Skip to content

Commit

Permalink
Merge branch 'master' into rollup-jobs/migrate-to-new-es-client
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Apr 7, 2021
2 parents c2f29aa + 532f38f commit ab07eef
Show file tree
Hide file tree
Showing 160 changed files with 5,235 additions and 1,751 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"dependencies": {
"@elastic/apm-rum": "^5.6.1",
"@elastic/apm-rum-react": "^1.2.5",
"@elastic/charts": "27.0.0",
"@elastic/charts": "28.0.0",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath/npm_module",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.4",
"@elastic/ems-client": "7.12.0",
Expand Down Expand Up @@ -444,7 +444,7 @@
"@bazel/ibazel": "^0.14.0",
"@bazel/typescript": "^3.2.3",
"@cypress/snapshot": "^2.1.7",
"@cypress/webpack-preprocessor": "^5.5.0",
"@cypress/webpack-preprocessor": "^5.6.0",
"@elastic/apm-rum": "^5.6.1",
"@elastic/apm-rum-react": "^1.2.5",
"@elastic/eslint-config-kibana": "link:packages/elastic-eslint-config-kibana",
Expand Down Expand Up @@ -682,7 +682,7 @@
"copy-webpack-plugin": "^6.0.2",
"cpy": "^8.1.1",
"css-loader": "^3.4.2",
"cypress": "^6.2.1",
"cypress": "^6.8.0",
"cypress-cucumber-preprocessor": "^2.5.2",
"cypress-multi-reporters": "^1.4.0",
"cypress-pipe": "^2.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pageLoadAssetSize:
lens: 96624
licenseManagement: 41817
licensing: 29004
lists: 202261
lists: 228500
logstash: 53548
management: 46112
maps: 80000
Expand All @@ -68,7 +68,7 @@ pageLoadAssetSize:
searchprofiler: 67080
security: 189428
securityOss: 30806
securitySolution: 283440
securitySolution: 235402
share: 99061
snapshotRestore: 79032
spaces: 387915
Expand Down
5 changes: 5 additions & 0 deletions src/core/server/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ export async function bootstrap({ configs, cliArgs, applyConfigOverrides }: Boot
try {
await root.setup();
await root.start();

// notify parent process know when we are ready for dev mode.
if (process.send) {
process.send(['SERVER_LISTENING']);
}
} catch (err) {
await shutdown(err);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ describe(`enumeratePatterns`, () => {
'src/plugins/charts/public/static/color_maps/color_maps.ts kibana-app'
);
});
it(`should resolve x-pack/plugins/security_solution/public/common/components/exceptions/builder/translations.ts to kibana-security`, () => {
it(`should resolve x-pack/plugins/security_solution/public/common/components/exceptions/edit_exception_modal/translations.ts to kibana-security`, () => {
const short = 'x-pack/plugins/security_solution';
const actual = enumeratePatterns(REPO_ROOT)(log)(new Map([[short, ['kibana-security']]]));

expect(
actual[0].includes(
`${short}/public/common/components/exceptions/builder/translations.ts kibana-security`
`${short}/public/common/components/exceptions/edit_exception_modal/translations.ts kibana-security`
)
).toBe(true);
});
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/charts/public/static/components/current_time.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import moment, { Moment } from 'moment';
import React, { FC } from 'react';

import { LineAnnotation, AnnotationDomainTypes, LineAnnotationStyle } from '@elastic/charts';
import { LineAnnotation, AnnotationDomainType, LineAnnotationStyle } from '@elastic/charts';
import lightEuiTheme from '@elastic/eui/dist/eui_theme_light.json';
import darkEuiTheme from '@elastic/eui/dist/eui_theme_dark.json';

Expand Down Expand Up @@ -46,7 +46,7 @@ export const CurrentTime: FC<CurrentTimeProps> = ({ isDarkMode, domainEnd }) =>
<LineAnnotation
id="__current-time__"
hideTooltips
domainType={AnnotationDomainTypes.XDomain}
domainType={AnnotationDomainType.XDomain}
dataValues={lineAnnotationData}
style={lineAnnotationStyle}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
EuiOutsideClickDetector,
} from '@elastic/eui';
import { DashboardCopyToCapabilities } from './copy_to_dashboard_action';
import { DashboardPicker } from '../../services/presentation_util';
import { LazyDashboardPicker, withSuspense } from '../../services/presentation_util';
import { dashboardCopyToDashboardAction } from '../../dashboard_strings';
import { EmbeddableStateTransfer, IEmbeddable } from '../../services/embeddable';
import { createDashboardEditUrl, DashboardConstants } from '../..';
Expand All @@ -37,6 +37,8 @@ interface CopyToDashboardModalProps {
closeModal: () => void;
}

const DashboardPicker = withSuspense(LazyDashboardPicker);

export function CopyToDashboardModal({
PresentationUtilContext,
stateTransfer,
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/dashboard/public/services/presentation_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
* Side Public License, v 1.
*/

export { PresentationUtilPluginStart, DashboardPicker } from '../../../presentation_util/public';
export {
PresentationUtilPluginStart,
LazyDashboardPicker,
withSuspense,
} from '../../../presentation_util/public';
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ const geti18nTexts = (fieldsToDelete?: string[]) => {
typeConfirm: i18n.translate(
'indexPatternFieldEditor.deleteRuntimeField.confirmModal.typeConfirm',
{
defaultMessage: "Type 'REMOVE' to confirm",
defaultMessage: 'Enter REMOVE to confirm',
}
),
warningRemovingFields: i18n.translate(
'indexPatternFieldEditor.deleteRuntimeField.confirmModal.warningRemovingFields',
{
defaultMessage:
'Warning: Removing fields may break searches or visualizations that rely on this field.',
'Removing fields can break searches and visualizations that rely on this field.',
}
),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,29 @@ const geti18nTexts = (field?: Field) => {
confirmButtonText: i18n.translate(
'indexPatternFieldEditor.deleteRuntimeField.confirmationModal.saveButtonLabel',
{
defaultMessage: 'Save',
defaultMessage: 'Save changes',
}
),
warningChangingFields: i18n.translate(
'indexPatternFieldEditor.deleteRuntimeField.confirmModal.warningChangingFields',
{
defaultMessage:
'Warning: Changing name or type may break searches or visualizations that rely on this field.',
'Changing name or type can break searches and visualizations that rely on this field.',
}
),
typeConfirm: i18n.translate(
'indexPatternFieldEditor.saveRuntimeField.confirmModal.typeConfirm',
{
defaultMessage: "Type 'CHANGE' to continue:",
defaultMessage: 'Enter CHANGE to continue',
}
),
titleConfirmChanges: i18n.translate(
'indexPatternFieldEditor.saveRuntimeField.confirmModal.title',
{
defaultMessage: `Save changes to '{name}'`,
values: {
name: field?.name,
},
}
),
};
Expand Down Expand Up @@ -211,7 +220,7 @@ const FieldEditorFlyoutContentComponent = ({

const modal = isModalVisible ? (
<EuiConfirmModal
title={`Confirm changes to '${field?.name}'`}
title={i18nTexts.titleConfirmChanges}
data-test-subj="runtimeFieldSaveConfirmModal"
cancelButtonText={i18nTexts.cancelButtonText}
confirmButtonText={i18nTexts.confirmButtonText}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableInspectEsQueries': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'banners:placement': {
type: 'keyword',
_meta: { description: 'Non-default value of setting.' },
Expand All @@ -428,7 +432,7 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableInspectEsQueries': {
'labs:presentation:unifiedToolbar': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,5 @@ export interface UsageStats {
'banners:placement': string;
'banners:textColor': string;
'banners:backgroundColor': string;
'labs:presentation:unifiedToolbar': boolean;
}
2 changes: 2 additions & 0 deletions src/plugins/presentation_util/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@

export const PLUGIN_ID = 'presentationUtil';
export const PLUGIN_NAME = 'presentationUtil';

export * from './labs';
68 changes: 68 additions & 0 deletions src/plugins/presentation_util/common/labs.ts
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);
};
6 changes: 4 additions & 2 deletions src/plugins/presentation_util/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"id": "presentationUtil",
"version": "1.0.0",
"kibanaVersion": "kibana",
"server": false,
"server": true,
"ui": true,
"requiredPlugins": ["savedObjects"],
"requiredPlugins": [
"savedObjects"
],
"optionalPlugins": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ export function DashboardPicker(props: DashboardPickerProps) {
/>
);
}

// required for dynamic import using React.lazy()
// eslint-disable-next-line import/no-default-export
export default DashboardPicker;
38 changes: 38 additions & 0 deletions src/plugins/presentation_util/public/components/index.tsx
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')
);
Loading

0 comments on commit ab07eef

Please sign in to comment.