-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into rollup-jobs/migrate-to-new-es-client
- Loading branch information
Showing
160 changed files
with
5,235 additions
and
1,751 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const UNIFIED_TOOLBAR = 'labs:presentation:unifiedToolbar'; | ||
|
||
export const projectIDs = [UNIFIED_TOOLBAR] as const; | ||
export const environmentNames = ['kibana', 'browser', 'session'] as const; | ||
export const solutionNames = ['canvas', 'dashboard', 'presentation'] as const; | ||
|
||
/** | ||
* This is a list of active Labs Projects for the Presentation Team. It is the "source of truth" for all projects | ||
* provided to users of our solutions in Kibana. | ||
*/ | ||
export const projects: { [ID in ProjectID]: ProjectConfig & { id: ID } } = { | ||
[UNIFIED_TOOLBAR]: { | ||
id: UNIFIED_TOOLBAR, | ||
isActive: false, | ||
environments: ['kibana', 'browser', 'session'], | ||
name: i18n.translate('presentationUtil.labs.enableUnifiedToolbarProjectName', { | ||
defaultMessage: 'Unified Toolbar', | ||
}), | ||
description: i18n.translate('presentationUtil.labs.enableUnifiedToolbarProjectDescription', { | ||
defaultMessage: 'Enable the new unified toolbar design for Presentation solutions', | ||
}), | ||
solutions: ['dashboard', 'canvas'], | ||
}, | ||
}; | ||
|
||
export type ProjectID = typeof projectIDs[number]; | ||
export type EnvironmentName = typeof environmentNames[number]; | ||
export type SolutionName = typeof solutionNames[number]; | ||
|
||
export type EnvironmentStatus = { | ||
[env in EnvironmentName]?: boolean; | ||
}; | ||
|
||
export type ProjectStatus = { | ||
defaultValue: boolean; | ||
isEnabled: boolean; | ||
isOverride: boolean; | ||
} & EnvironmentStatus; | ||
|
||
export interface ProjectConfig { | ||
id: ProjectID; | ||
name: string; | ||
isActive: boolean; | ||
environments: EnvironmentName[]; | ||
description: string; | ||
solutions: SolutionName[]; | ||
} | ||
|
||
export type Project = ProjectConfig & { status: ProjectStatus }; | ||
|
||
export const getProjectIDs = () => projectIDs; | ||
|
||
export const isProjectEnabledByStatus = (active: boolean, status: EnvironmentStatus): boolean => { | ||
// If the project is enabled by default, then any false flag will flip the switch, and vice-versa. | ||
return active | ||
? Object.values(status).every((value) => value === true) | ||
: Object.values(status).some((value) => value === true); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React, { Suspense, ComponentType, ReactElement } from 'react'; | ||
import { EuiLoadingSpinner, EuiErrorBoundary } from '@elastic/eui'; | ||
|
||
/** | ||
* A HOC which supplies React.Suspense with a fallback component, and a `EuiErrorBoundary` to contain errors. | ||
* @param Component A component deferred by `React.lazy` | ||
* @param fallback A fallback component to render while things load; default is `EuiLoadingSpinner` | ||
*/ | ||
export const withSuspense = <P extends {}>( | ||
Component: ComponentType<P>, | ||
fallback: ReactElement | null = <EuiLoadingSpinner /> | ||
) => (props: P) => ( | ||
<EuiErrorBoundary> | ||
<Suspense fallback={fallback}> | ||
<Component {...props} /> | ||
</Suspense> | ||
</EuiErrorBoundary> | ||
); | ||
|
||
export const LazyLabsBeakerButton = withSuspense( | ||
React.lazy(() => import('./labs/labs_beaker_button')) | ||
); | ||
|
||
export const LazyLabsFlyout = withSuspense(React.lazy(() => import('./labs/labs_flyout'))); | ||
|
||
export const LazyDashboardPicker = React.lazy(() => import('./dashboard_picker')); | ||
|
||
export const LazySavedObjectSaveModalDashboard = React.lazy( | ||
() => import('./saved_object_save_modal_dashboard') | ||
); |
Oops, something went wrong.