-
+ {field ? (
+
+ ) : (
+
+ )}
|
{isCollapsible && (
)}
{displayUnderscoreWarning && }
+ {field ? null : {key}: }
void;
+ /**
+ * Counter how often data was fetched (used for testing)
+ */
+ fetchCounter: number;
+ /**
+ * Error in case of a failing document fetch
+ */
+ fetchError?: Error;
+ /**
+ * Statistics by fields calculated using the fetched documents
+ */
+ fieldCounts: Record ;
+ /**
+ * Histogram aggregation data
+ */
+ histogramData?: Chart;
+ /**
+ * Number of documents found by recent fetch
+ */
+ hits: number;
+ /**
+ * Current IndexPattern
+ */
+ indexPattern: IndexPattern;
+ /**
+ * Value needed for legacy "infinite" loading functionality
+ * Determins how much records are rendered using the legacy table
+ * Increased when scrolling down
+ */
+ minimumVisibleRows: number;
+ /**
+ * Function to add a column to state
+ */
+ onAddColumn: (column: string) => void;
+ /**
+ * Function to add a filter to state
+ */
+ onAddFilter: DocViewFilterFn;
+ /**
+ * Function to change the used time interval of the date histogram
+ */
+ onChangeInterval: (interval: string) => void;
+ /**
+ * Function to move a given column to a given index, used in legacy table
+ */
+ onMoveColumn: (columns: string, newIdx: number) => void;
+ /**
+ * Function to remove a given column from state
+ */
+ onRemoveColumn: (column: string) => void;
+ /**
+ * Function to replace columns in state
+ */
+ onSetColumns: (columns: string[]) => void;
+ /**
+ * Function to scroll down the legacy table to the bottom
+ */
+ onSkipBottomButtonClick: () => void;
+ /**
+ * Function to change sorting of the table, triggers a fetch
+ */
+ onSort: (sort: string[][]) => void;
+ opts: {
+ /**
+ * Date histogram aggregation config
+ */
+ chartAggConfigs?: AggConfigs;
+ /**
+ * Client of uiSettings
+ */
+ config: IUiSettingsClient;
+ /**
+ * Data plugin
+ */
+ data: DataPublicPluginStart;
+ /**
+ * Data plugin filter manager
+ */
+ filterManager: FilterManager;
+ /**
+ * List of available index patterns
+ */
+ indexPatternList: Array>;
+ /**
+ * The number of documents that can be displayed in the table/grid
+ */
+ sampleSize: number;
+ /**
+ * Current instance of SavedSearch
+ */
+ savedSearch: SavedSearch;
+ /**
+ * Function to set the header menu
+ */
+ setHeaderActionMenu: (menuMount: MountPoint | undefined) => void;
+ /**
+ * Timefield of the currently used index pattern
+ */
+ timefield: string;
+ /**
+ * Function to set the current state
+ */
+ setAppState: (state: Partial) => void;
+ };
+ /**
+ * Function to reset the current query
+ */
+ resetQuery: () => void;
+ /**
+ * Current state of the actual query, one of 'uninitialized', 'loading' ,'ready', 'none'
+ */
+ resultState: string;
+ /**
+ * Array of document of the recent successful search request
+ */
+ rows: ElasticSearchHit[];
+ /**
+ * Instance of SearchSource, the high level search API
+ */
+ searchSource: ISearchSource;
+ /**
+ * Function to change the current index pattern
+ */
+ setIndexPattern: (id: string) => void;
+ /**
+ * Current app state of URL
+ */
+ state: AppState;
+ /**
+ * Function to update the time filter
+ */
+ timefilterUpdateHandler: (ranges: { from: number; to: number }) => void;
+ /**
+ * Currently selected time range
+ */
+ timeRange?: { from: string; to: string };
+ /**
+ * Menu data of top navigation (New, save ...)
+ */
+ topNavMenu: TopNavMenuData[];
+ /**
+ * Function to update the actual query
+ */
+ updateQuery: (payload: { dateRange: TimeRange; query?: Query }, isUpdate?: boolean) => void;
+ /**
+ * Function to update the actual savedQuery id
+ */
+ updateSavedQueryId: (savedQueryId?: string) => void;
+}
diff --git a/src/plugins/discover/public/application/helpers/columns.test.ts b/src/plugins/discover/public/application/helpers/columns.test.ts
new file mode 100644
index 0000000000000..d455fd1f42c6d
--- /dev/null
+++ b/src/plugins/discover/public/application/helpers/columns.test.ts
@@ -0,0 +1,46 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * and the Server Side Public License, v 1; you may not use this file except in
+ * compliance with, at your election, the Elastic License or the Server Side
+ * Public License, v 1.
+ */
+
+import { getDisplayedColumns } from './columns';
+import { indexPatternWithTimefieldMock } from '../../__mocks__/index_pattern_with_timefield';
+import { indexPatternMock } from '../../__mocks__/index_pattern';
+
+describe('getDisplayedColumns', () => {
+ test('returns default columns given a index pattern without timefield', async () => {
+ const result = getDisplayedColumns([], indexPatternMock);
+ expect(result).toMatchInlineSnapshot(`
+ Array [
+ "_source",
+ ]
+ `);
+ });
+ test('returns default columns given a index pattern with timefield', async () => {
+ const result = getDisplayedColumns([], indexPatternWithTimefieldMock);
+ expect(result).toMatchInlineSnapshot(`
+ Array [
+ "_source",
+ ]
+ `);
+ });
+ test('returns default columns when just timefield is in state', async () => {
+ const result = getDisplayedColumns(['timestamp'], indexPatternWithTimefieldMock);
+ expect(result).toMatchInlineSnapshot(`
+ Array [
+ "_source",
+ ]
+ `);
+ });
+ test('returns columns given by argument, no fallback ', async () => {
+ const result = getDisplayedColumns(['test'], indexPatternWithTimefieldMock);
+ expect(result).toMatchInlineSnapshot(`
+ Array [
+ "test",
+ ]
+ `);
+ });
+});
diff --git a/src/plugins/discover/public/application/helpers/columns.ts b/src/plugins/discover/public/application/helpers/columns.ts
new file mode 100644
index 0000000000000..d2d47c932b7bd
--- /dev/null
+++ b/src/plugins/discover/public/application/helpers/columns.ts
@@ -0,0 +1,22 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * and the Server Side Public License, v 1; you may not use this file except in
+ * compliance with, at your election, the Elastic License or the Server Side
+ * Public License, v 1.
+ */
+import { IndexPattern } from '../../../../data/common';
+
+/**
+ * Function to provide fallback when
+ * 1) no columns are given
+ * 2) Just one column is given, which is the configured timefields
+ */
+export function getDisplayedColumns(stateColumns: string[] = [], indexPattern: IndexPattern) {
+ return stateColumns &&
+ stateColumns.length > 0 &&
+ // check if all columns where removed except the configured timeField (this can't be removed)
+ !(stateColumns.length === 1 && stateColumns[0] === indexPattern.timeFieldName)
+ ? stateColumns
+ : ['_source'];
+}
diff --git a/src/plugins/discover/public/get_inner_angular.ts b/src/plugins/discover/public/get_inner_angular.ts
index b27426a6c0621..4eda742d967f4 100644
--- a/src/plugins/discover/public/get_inner_angular.ts
+++ b/src/plugins/discover/public/get_inner_angular.ts
@@ -42,7 +42,6 @@ import {
} from '../../kibana_legacy/public';
import { DiscoverStartPlugins } from './plugin';
import { getScopedHistory } from './kibana_services';
-import { createDiscoverLegacyDirective } from './application/components/create_discover_legacy_directive';
import { createDiscoverDirective } from './application/components/create_discover_directive';
/**
@@ -124,7 +123,6 @@ export function initializeInnerAngularModule(
.config(watchMultiDecorator)
.run(registerListenEventListener)
.directive('renderComplete', createRenderCompleteDirective)
- .directive('discoverLegacy', createDiscoverLegacyDirective)
.directive('discover', createDiscoverDirective);
}
diff --git a/src/plugins/es_ui_shared/__packages_do_not_import__/errors/handle_es_error.ts b/src/plugins/es_ui_shared/__packages_do_not_import__/errors/handle_es_error.ts
index b7f7a5abb82b0..e2e1d7f05851c 100644
--- a/src/plugins/es_ui_shared/__packages_do_not_import__/errors/handle_es_error.ts
+++ b/src/plugins/es_ui_shared/__packages_do_not_import__/errors/handle_es_error.ts
@@ -13,14 +13,24 @@ import { IKibanaResponse, KibanaResponseFactory } from 'kibana/server';
interface EsErrorHandlerParams {
error: ApiError;
response: KibanaResponseFactory;
+ handleCustomError?: () => IKibanaResponse;
}
/*
* For errors returned by the new elasticsearch js client.
*/
-export const handleEsError = ({ error, response }: EsErrorHandlerParams): IKibanaResponse => {
+export const handleEsError = ({
+ error,
+ response,
+ handleCustomError,
+}: EsErrorHandlerParams): IKibanaResponse => {
// error.name is slightly better in terms of performance, since all errors now have name property
if (error.name === 'ResponseError') {
+ // The consumer may sometimes want to provide a custom response
+ if (typeof handleCustomError === 'function') {
+ return handleCustomError();
+ }
+
const { statusCode, body } = error as ResponseError;
return response.customError({
statusCode,
diff --git a/src/plugins/es_ui_shared/public/components/cron_editor/__snapshots__/cron_editor.test.tsx.snap b/src/plugins/es_ui_shared/public/components/cron_editor/__snapshots__/cron_editor.test.tsx.snap
index 9207c6467f6a9..151bd91750daa 100644
--- a/src/plugins/es_ui_shared/public/components/cron_editor/__snapshots__/cron_editor.test.tsx.snap
+++ b/src/plugins/es_ui_shared/public/components/cron_editor/__snapshots__/cron_editor.test.tsx.snap
@@ -170,6 +170,7 @@ exports[`CronEditor is rendered with a DAY frequency 1`] = `
@@ -914,6 +918,7 @@ exports[`CronEditor is rendered with a DAY frequency 1`] = `
@@ -1607,6 +1615,7 @@ exports[`CronEditor is rendered with a DAY frequency 1`] = `
@@ -1824,6 +1836,7 @@ exports[`CronEditor is rendered with a HOUR frequency 1`] = `
@@ -2816,6 +2832,7 @@ exports[`CronEditor is rendered with a HOUR frequency 1`] = `
@@ -3029,6 +3049,7 @@ exports[`CronEditor is rendered with a MINUTE frequency 1`] = `
@@ -3241,6 +3265,7 @@ exports[`CronEditor is rendered with a MONTH frequency 1`] = `
@@ -4173,6 +4201,7 @@ exports[`CronEditor is rendered with a MONTH frequency 1`] = `
@@ -4568,6 +4600,7 @@ exports[`CronEditor is rendered with a MONTH frequency 1`] = `
@@ -5261,6 +5297,7 @@ exports[`CronEditor is rendered with a MONTH frequency 1`] = `
@@ -5478,6 +5518,7 @@ exports[`CronEditor is rendered with a WEEK frequency 1`] = `
@@ -6074,6 +6118,7 @@ exports[`CronEditor is rendered with a WEEK frequency 1`] = `
@@ -6469,6 +6517,7 @@ exports[`CronEditor is rendered with a WEEK frequency 1`] = `
@@ -7162,6 +7214,7 @@ exports[`CronEditor is rendered with a WEEK frequency 1`] = `
@@ -7379,6 +7435,7 @@ exports[`CronEditor is rendered with a YEAR frequency 1`] = `
@@ -8174,6 +8234,7 @@ exports[`CronEditor is rendered with a YEAR frequency 1`] = `
@@ -8628,6 +8692,7 @@ exports[`CronEditor is rendered with a YEAR frequency 1`] = `
@@ -9023,6 +9091,7 @@ exports[`CronEditor is rendered with a YEAR frequency 1`] = `
@@ -9716,6 +9788,7 @@ exports[`CronEditor is rendered with a YEAR frequency 1`] = `
diff --git a/src/plugins/home/public/application/components/__snapshots__/sample_data_view_data_button.test.js.snap b/src/plugins/home/public/application/components/__snapshots__/sample_data_view_data_button.test.js.snap
index 1484ce6b1a81f..d38c77faab7f8 100644
--- a/src/plugins/home/public/application/components/__snapshots__/sample_data_view_data_button.test.js.snap
+++ b/src/plugins/home/public/application/components/__snapshots__/sample_data_view_data_button.test.js.snap
@@ -51,6 +51,7 @@ exports[`should render popover when appLinks is not empty 1`] = `
},
]
}
+ size="m"
/>
`;
diff --git a/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx b/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx
index ec9b5ee7e43da..4d82571995d58 100644
--- a/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx
+++ b/src/plugins/input_control_vis/public/components/editor/controls_tab.test.tsx
@@ -29,8 +29,6 @@ beforeEach(() => {
name: 'test',
title: 'test',
visualization: null,
- requestHandler: 'test',
- responseHandler: 'test',
stage: 'beta',
requiresSearch: false,
hidden: false,
diff --git a/src/plugins/input_control_vis/public/components/editor/controls_tab.tsx b/src/plugins/input_control_vis/public/components/editor/controls_tab.tsx
index a2ae1e6851a6b..5e432d81ebefb 100644
--- a/src/plugins/input_control_vis/public/components/editor/controls_tab.tsx
+++ b/src/plugins/input_control_vis/public/components/editor/controls_tab.tsx
@@ -19,7 +19,7 @@ import {
EuiSelect,
} from '@elastic/eui';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { IIndexPattern } from 'src/plugins/data/public';
import { ControlEditor } from './control_editor';
import {
@@ -40,7 +40,7 @@ interface ControlsTabUiState {
type: CONTROL_TYPES;
}
-export type ControlsTabProps = VisOptionsProps & {
+export type ControlsTabProps = VisEditorOptionsProps & {
deps: InputControlVisDependencies;
};
diff --git a/src/plugins/input_control_vis/public/components/editor/index.tsx b/src/plugins/input_control_vis/public/components/editor/index.tsx
index 15b1039a8cb3c..ee457a47a3b6d 100644
--- a/src/plugins/input_control_vis/public/components/editor/index.tsx
+++ b/src/plugins/input_control_vis/public/components/editor/index.tsx
@@ -7,7 +7,7 @@
*/
import React, { lazy } from 'react';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { InputControlVisDependencies } from '../../plugin';
import { InputControlVisParams } from '../../types';
@@ -15,9 +15,9 @@ const ControlsTab = lazy(() => import('./controls_tab'));
const OptionsTab = lazy(() => import('./options_tab'));
export const getControlsTab = (deps: InputControlVisDependencies) => (
- props: VisOptionsProps
+ props: VisEditorOptionsProps
) => ;
-export const OptionsTabLazy = (props: VisOptionsProps) => (
+export const OptionsTabLazy = (props: VisEditorOptionsProps) => (
);
diff --git a/src/plugins/input_control_vis/public/components/editor/options_tab.tsx b/src/plugins/input_control_vis/public/components/editor/options_tab.tsx
index fa995be0840ce..9a7eaa71c3324 100644
--- a/src/plugins/input_control_vis/public/components/editor/options_tab.tsx
+++ b/src/plugins/input_control_vis/public/components/editor/options_tab.tsx
@@ -12,10 +12,10 @@ import { EuiForm, EuiFormRow, EuiSwitch } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiSwitchEvent } from '@elastic/eui';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { InputControlVisParams } from '../../types';
-export type OptionsTabProps = VisOptionsProps;
+export type OptionsTabProps = VisEditorOptionsProps;
class OptionsTab extends PureComponent {
handleUpdateFiltersChange = (event: EuiSwitchEvent) => {
diff --git a/src/plugins/input_control_vis/public/input_control_vis_type.ts b/src/plugins/input_control_vis/public/input_control_vis_type.ts
index 8d8fdf2cfc568..00e680aa5d328 100644
--- a/src/plugins/input_control_vis/public/input_control_vis_type.ts
+++ b/src/plugins/input_control_vis/public/input_control_vis_type.ts
@@ -7,7 +7,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { VisGroups, BaseVisTypeOptions } from '../../visualizations/public';
+import { VisGroups, VisTypeDefinition } from '../../visualizations/public';
import { getControlsTab, OptionsTabLazy } from './components/editor';
import { InputControlVisDependencies } from './plugin';
import { toExpressionAst } from './to_ast';
@@ -15,7 +15,7 @@ import { InputControlVisParams } from './types';
export function createInputControlVisTypeDefinition(
deps: InputControlVisDependencies
-): BaseVisTypeOptions {
+): VisTypeDefinition {
const ControlsTab = getControlsTab(deps);
return {
@@ -56,7 +56,6 @@ export function createInputControlVisTypeDefinition(
],
},
inspectorAdapters: {},
- requestHandler: 'none',
toExpressionAst,
};
}
diff --git a/x-pack/plugins/xpack_legacy/common/eui_styled_components.tsx b/src/plugins/kibana_react/common/eui_styled_components.tsx
similarity index 86%
rename from x-pack/plugins/xpack_legacy/common/eui_styled_components.tsx
rename to src/plugins/kibana_react/common/eui_styled_components.tsx
index aab16f9d79c4b..fe002500309ad 100644
--- a/x-pack/plugins/xpack_legacy/common/eui_styled_components.tsx
+++ b/src/plugins/kibana_react/common/eui_styled_components.tsx
@@ -1,7 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * or more contributor license agreements. Licensed under the Elastic License
+ * and the Server Side Public License, v 1; you may not use this file except in
+ * compliance with, at your election, the Elastic License or the Server Side
+ * Public License, v 1.
*/
import React from 'react';
diff --git a/src/plugins/lens_oss/common/index.ts b/src/plugins/kibana_react/common/index.ts
similarity index 89%
rename from src/plugins/lens_oss/common/index.ts
rename to src/plugins/kibana_react/common/index.ts
index 7f60b8508dc27..0af8ed573699b 100644
--- a/src/plugins/lens_oss/common/index.ts
+++ b/src/plugins/kibana_react/common/index.ts
@@ -6,4 +6,4 @@
* Public License, v 1.
*/
-export * from './constants';
+export * from './eui_styled_components';
diff --git a/src/plugins/kibana_react/kibana.json b/src/plugins/kibana_react/kibana.json
index f2f0da53e6280..6bf7ff1d82070 100644
--- a/src/plugins/kibana_react/kibana.json
+++ b/src/plugins/kibana_react/kibana.json
@@ -2,5 +2,6 @@
"id": "kibanaReact",
"version": "kibana",
"ui": true,
- "server": false
+ "server": false,
+ "extraPublicDirs": ["common"]
}
diff --git a/src/plugins/kibana_react/public/index.ts b/src/plugins/kibana_react/public/index.ts
index c99da5e9b36b8..cbb60bba47861 100644
--- a/src/plugins/kibana_react/public/index.ts
+++ b/src/plugins/kibana_react/public/index.ts
@@ -15,6 +15,7 @@ export * from './ui_settings';
export * from './field_icon';
export * from './field_button';
export * from './table_list_view';
+export * from './toolbar_button';
export * from './split_panel';
export * from './react_router_navigate';
export { ValidatedDualRange, Value } from './validated_range';
diff --git a/src/plugins/kibana_react/public/toolbar_button/__snapshots__/toolbar_button.test.tsx.snap b/src/plugins/kibana_react/public/toolbar_button/__snapshots__/toolbar_button.test.tsx.snap
new file mode 100644
index 0000000000000..294be46398e8a
--- /dev/null
+++ b/src/plugins/kibana_react/public/toolbar_button/__snapshots__/toolbar_button.test.tsx.snap
@@ -0,0 +1,199 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`font weights bold is applied 1`] = `
+
+`;
+
+exports[`font weights normal is applied 1`] = `
+
+`;
+
+exports[`hasArrow is rendered 1`] = `
+
+`;
+
+exports[`positions center is applied 1`] = `
+
+`;
+
+exports[`positions left is applied 1`] = `
+
+`;
+
+exports[`positions none is applied 1`] = `
+
+`;
+
+exports[`positions right is applied 1`] = `
+
+`;
+
+exports[`sizes m is applied 1`] = `
+
+`;
+
+exports[`sizes s is applied 1`] = `
+
+`;
diff --git a/src/plugins/maps_oss/common/index.ts b/src/plugins/kibana_react/public/toolbar_button/index.ts
similarity index 91%
rename from src/plugins/maps_oss/common/index.ts
rename to src/plugins/kibana_react/public/toolbar_button/index.ts
index 7f60b8508dc27..f952741291b68 100644
--- a/src/plugins/maps_oss/common/index.ts
+++ b/src/plugins/kibana_react/public/toolbar_button/index.ts
@@ -6,4 +6,4 @@
* Public License, v 1.
*/
-export * from './constants';
+export * from './toolbar_button';
diff --git a/x-pack/plugins/lens/public/shared_components/toolbar_button.scss b/src/plugins/kibana_react/public/toolbar_button/toolbar_button.scss
similarity index 81%
rename from x-pack/plugins/lens/public/shared_components/toolbar_button.scss
rename to src/plugins/kibana_react/public/toolbar_button/toolbar_button.scss
index 61b02f47678c3..f290b3c7c5f89 100644
--- a/x-pack/plugins/lens/public/shared_components/toolbar_button.scss
+++ b/src/plugins/kibana_react/public/toolbar_button/toolbar_button.scss
@@ -1,4 +1,4 @@
-.lnsToolbarButton {
+.kbnToolbarButton {
line-height: $euiButtonHeight; // Keeps alignment of text and chart icon
background-color: $euiColorEmptyShade;
@@ -15,11 +15,11 @@
pointer-events: initial;
}
- .lnsToolbarButton__text > svg {
+ .kbnToolbarButton__text > svg {
margin-top: -1px; // Just some weird alignment issue when icon is the child not the `iconType`
}
- .lnsToolbarButton__text:empty {
+ .kbnToolbarButton__text:empty {
margin: 0;
}
@@ -27,34 +27,33 @@
&[class*='fullWidth'] {
text-align: left;
- .lnsToolbarButton__content {
+ .kbnToolbarButton__content {
justify-content: space-between;
}
}
-
}
-.lnsToolbarButton--groupLeft {
+.kbnToolbarButton--groupLeft {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
-.lnsToolbarButton--groupCenter {
+.kbnToolbarButton--groupCenter {
border-radius: 0;
border-left: none;
}
-.lnsToolbarButton--groupRight {
+.kbnToolbarButton--groupRight {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: none;
}
-.lnsToolbarButton--bold {
+.kbnToolbarButton--bold {
font-weight: $euiFontWeightBold;
}
-.lnsToolbarButton--s {
+.kbnToolbarButton--s {
box-shadow: none !important; // sass-lint:disable-line no-important
font-size: $euiFontSizeS;
}
diff --git a/src/plugins/kibana_react/public/toolbar_button/toolbar_button.test.tsx b/src/plugins/kibana_react/public/toolbar_button/toolbar_button.test.tsx
new file mode 100644
index 0000000000000..3d4ce29ffa5e9
--- /dev/null
+++ b/src/plugins/kibana_react/public/toolbar_button/toolbar_button.test.tsx
@@ -0,0 +1,47 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * and the Server Side Public License, v 1; you may not use this file except in
+ * compliance with, at your election, the Elastic License or the Server Side
+ * Public License, v 1.
+ */
+
+import React from 'react';
+import { shallow } from 'enzyme';
+import { ToolbarButton, POSITIONS, WEIGHTS, TOOLBAR_BUTTON_SIZES } from './toolbar_button';
+
+const noop = () => {};
+
+describe('sizes', () => {
+ TOOLBAR_BUTTON_SIZES.forEach((size) => {
+ test(`${size} is applied`, () => {
+ const component = shallow();
+ expect(component).toMatchSnapshot();
+ });
+ });
+});
+
+describe('positions', () => {
+ POSITIONS.forEach((position) => {
+ test(`${position} is applied`, () => {
+ const component = shallow();
+ expect(component).toMatchSnapshot();
+ });
+ });
+});
+
+describe('font weights', () => {
+ WEIGHTS.forEach((weight) => {
+ test(`${weight} is applied`, () => {
+ const component = shallow();
+ expect(component).toMatchSnapshot();
+ });
+ });
+});
+
+describe('hasArrow', () => {
+ it('is rendered', () => {
+ const component = shallow();
+ expect(component).toMatchSnapshot();
+ });
+});
diff --git a/x-pack/plugins/lens/public/shared_components/toolbar_button.tsx b/src/plugins/kibana_react/public/toolbar_button/toolbar_button.tsx
similarity index 61%
rename from x-pack/plugins/lens/public/shared_components/toolbar_button.tsx
rename to src/plugins/kibana_react/public/toolbar_button/toolbar_button.tsx
index 2ba227e6ff84f..388a11992268e 100644
--- a/x-pack/plugins/lens/public/shared_components/toolbar_button.tsx
+++ b/src/plugins/kibana_react/public/toolbar_button/toolbar_button.tsx
@@ -1,7 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License;
- * you may not use this file except in compliance with the Elastic License.
+ * or more contributor license agreements. Licensed under the Elastic License
+ * and the Server Side Public License, v 1; you may not use this file except in
+ * compliance with, at your election, the Elastic License or the Server Side
+ * Public License, v 1.
*/
import './toolbar_button.scss';
@@ -11,16 +13,24 @@ import { EuiButton, PropsOf, EuiButtonProps } from '@elastic/eui';
const groupPositionToClassMap = {
none: null,
- left: 'lnsToolbarButton--groupLeft',
- center: 'lnsToolbarButton--groupCenter',
- right: 'lnsToolbarButton--groupRight',
+ left: 'toolbarButton--groupLeft',
+ center: 'toolbarButton--groupCenter',
+ right: 'toolbarButton--groupRight',
};
+type ButtonPositions = keyof typeof groupPositionToClassMap;
+export const POSITIONS = Object.keys(groupPositionToClassMap) as ButtonPositions[];
+
+type Weights = 'normal' | 'bold';
+export const WEIGHTS = ['normal', 'bold'] as Weights[];
+
+export const TOOLBAR_BUTTON_SIZES: Array = ['s', 'm'];
+
export type ToolbarButtonProps = PropsOf & {
/**
* Determines prominence
*/
- fontWeight?: 'normal' | 'bold';
+ fontWeight?: Weights;
/**
* Smaller buttons also remove extra shadow for less prominence
*/
@@ -32,7 +42,7 @@ export type ToolbarButtonProps = PropsOf & {
/**
* Adjusts the borders for groupings
*/
- groupPosition?: 'none' | 'left' | 'center' | 'right';
+ groupPosition?: ButtonPositions;
dataTestSubj?: string;
};
@@ -47,9 +57,9 @@ export const ToolbarButton: React.FunctionComponent = ({
...rest
}) => {
const classes = classNames(
- 'lnsToolbarButton',
+ 'kbnToolbarButton',
groupPositionToClassMap[groupPosition],
- [`lnsToolbarButton--${fontWeight}`, `lnsToolbarButton--${size}`],
+ [`kbnToolbarButton--${fontWeight}`, `kbnToolbarButton--${size}`],
className
);
return (
@@ -60,10 +70,10 @@ export const ToolbarButton: React.FunctionComponent = ({
iconType={hasArrow ? 'arrowDown' : ''}
color="text"
contentProps={{
- className: 'lnsToolbarButton__content',
+ className: 'kbnToolbarButton__content',
}}
textProps={{
- className: 'lnsToolbarButton__text',
+ className: 'kbnToolbarButton__text',
}}
{...rest}
size={size}
diff --git a/src/plugins/kibana_react/tsconfig.json b/src/plugins/kibana_react/tsconfig.json
index 52899f868dbfb..eb9a24ca141f6 100644
--- a/src/plugins/kibana_react/tsconfig.json
+++ b/src/plugins/kibana_react/tsconfig.json
@@ -7,11 +7,6 @@
"declaration": true,
"declarationMap": true
},
- "include": [
- "public/**/*",
- "../../../typings/**/*"
- ],
- "references": [
- { "path": "../kibana_utils/tsconfig.json" }
- ]
+ "include": ["common/**/*", "public/**/*", "../../../typings/**/*"],
+ "references": [{ "path": "../kibana_utils/tsconfig.json" }]
}
diff --git a/src/plugins/kibana_usage_collection/README.md b/src/plugins/kibana_usage_collection/README.md
index 69711d30cdc74..85d362cf0a9b1 100644
--- a/src/plugins/kibana_usage_collection/README.md
+++ b/src/plugins/kibana_usage_collection/README.md
@@ -6,6 +6,6 @@ This plugin registers the basic usage collectors from Kibana:
- UI Metrics
- Ops stats
- Number of Saved Objects per type
-- Non-default UI Settings
+- [User-changed UI Settings](./server/collectors/management/README.md)
- CSP configuration
- Core Metrics
diff --git a/src/plugins/kibana_usage_collection/common/constants.ts b/src/plugins/kibana_usage_collection/common/constants.ts
index 4505c59e0f630..052367765a6ec 100644
--- a/src/plugins/kibana_usage_collection/common/constants.ts
+++ b/src/plugins/kibana_usage_collection/common/constants.ts
@@ -13,3 +13,7 @@ export const PLUGIN_NAME = 'kibana_usage_collection';
* The type name used to publish Kibana usage stats in the formatted as bulk.
*/
export const KIBANA_STATS_TYPE = 'kibana_stats';
+/**
+ * Redacted keyword; used as a value for sensitive ui settings
+ */
+export const REDACTED_KEYWORD = '[REDACTED]';
diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/README.md b/src/plugins/kibana_usage_collection/server/collectors/management/README.md
new file mode 100644
index 0000000000000..b539136d57b89
--- /dev/null
+++ b/src/plugins/kibana_usage_collection/server/collectors/management/README.md
@@ -0,0 +1,51 @@
+# User-changed UI Settings - Management Collector
+
+The Usage Collector `stack_management` reports user changed settings.
+All user changed UI Settings are automatically collected.
+
+After adding a new setting you will be required to do the following steps:
+
+1. Update the [schema](./schema.ts) to include the setting name and schema type.
+```
+export const stackManagementSchema: MakeSchemaFrom = {
+ 'MY_UI_SETTING': { type: 'keyword' },
+}
+```
+
+2. Update the [UsageStats interface](./types.ts) with the setting name and typescript type.
+```
+export interface UsageStats {
+ 'MY_UI_SETTING': string;
+}
+```
+3. Run the telemetry checker with `--fix` flag to automatically fix the mappings
+
+```
+node scripts/telemetry_check --fix
+```
+
+If you forget any of the steps our telemetry tools and tests will help you through the process!
+
+## Sensitive fields
+
+If the configured UI setting might contain user sensitive information simply add the property `sensitive: true` to the ui setting registration config.
+
+```
+uiSettings.register({
+ [NEWS_FEED_URL_SETTING]: {
+ name: i18n.translate('xpack.securitySolution.uiSettings.newsFeedUrl', {
+ defaultMessage: 'News feed URL',
+ }),
+ value: NEWS_FEED_URL_SETTING_DEFAULT,
+ sensitive: true,
+ description: i18n.translate('xpack.securitySolution.uiSettings.newsFeedUrlDescription', {
+ defaultMessage: 'News feed content will be retrieved from this URL ',
+ }),
+ category: [APP_ID],
+ requiresPageReload: true,
+ schema: schema.string(),
+ },
+}),
+```
+
+The value of any UI setting marked as `sensitive` will be reported as a keyword `[REDACTED]` instead of the actual value. This hides the actual sensitive information while giving us some intelligence over which fields the users are interactive with the most.
diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/__snapshots__/index.test.ts.snap b/src/plugins/kibana_usage_collection/server/collectors/management/__snapshots__/index.test.ts.snap
deleted file mode 100644
index def230dea8d70..0000000000000
--- a/src/plugins/kibana_usage_collection/server/collectors/management/__snapshots__/index.test.ts.snap
+++ /dev/null
@@ -1,7 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`telemetry_application_usage_collector fetch() 1`] = `
-Object {
- "my-key": "my-value",
-}
-`;
diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/index.test.ts b/src/plugins/kibana_usage_collection/server/collectors/management/index.test.ts
deleted file mode 100644
index 38baf02d6fe1b..0000000000000
--- a/src/plugins/kibana_usage_collection/server/collectors/management/index.test.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-import { loggingSystemMock, uiSettingsServiceMock } from '../../../../../core/server/mocks';
-import {
- Collector,
- createUsageCollectionSetupMock,
- createCollectorFetchContextMock,
-} from '../../../../usage_collection/server/usage_collection.mock';
-
-import { registerManagementUsageCollector } from './';
-
-const logger = loggingSystemMock.createLogger();
-
-describe('telemetry_application_usage_collector', () => {
- let collector: Collector;
-
- const usageCollectionMock = createUsageCollectionSetupMock();
- usageCollectionMock.makeUsageCollector.mockImplementation((config) => {
- collector = new Collector(logger, config);
- return createUsageCollectionSetupMock().makeUsageCollector(config);
- });
-
- const uiSettingsClient = uiSettingsServiceMock.createClient();
- const getUiSettingsClient = jest.fn(() => uiSettingsClient);
- const mockedFetchContext = createCollectorFetchContextMock();
-
- beforeAll(() => {
- registerManagementUsageCollector(usageCollectionMock, getUiSettingsClient);
- });
-
- test('registered collector is set', () => {
- expect(collector).not.toBeUndefined();
- });
-
- test('isReady() => false if no client', () => {
- getUiSettingsClient.mockImplementationOnce(() => undefined as any);
- expect(collector.isReady()).toBe(false);
- });
-
- test('isReady() => true', () => {
- expect(collector.isReady()).toBe(true);
- });
-
- test('fetch()', async () => {
- uiSettingsClient.getUserProvided.mockImplementationOnce(async () => ({
- 'my-key': { userValue: 'my-value' },
- }));
- await expect(collector.fetch(mockedFetchContext)).resolves.toMatchSnapshot();
- });
-
- test('fetch() should not fail if invoked when not ready', async () => {
- getUiSettingsClient.mockImplementationOnce(() => undefined as any);
- await expect(collector.fetch(mockedFetchContext)).resolves.toBe(undefined);
- });
-});
diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts
index d75b2981035f4..b644f282c1f36 100644
--- a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts
+++ b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts
@@ -7,18 +7,25 @@
*/
import { MakeSchemaFrom } from 'src/plugins/usage_collection/server';
-import { UsageStats } from './telemetry_management_collector';
+import { UsageStats } from './types';
-// Retrieved by changing all the current settings in Kibana (we'll need to revisit it in the future).
-// I would suggest we use flattened type for the mappings of this collector.
export const stackManagementSchema: MakeSchemaFrom = {
+ // sensitive
+ 'timelion:quandl.key': { type: 'keyword' },
+ 'securitySolution:defaultIndex': { type: 'keyword' },
+ 'securitySolution:newsFeedUrl': { type: 'keyword' },
+ 'xpackReporting:customPdfLogo': { type: 'keyword' },
+ 'notifications:banner': { type: 'keyword' },
+ 'timelion:graphite.url': { type: 'keyword' },
+ 'xpackDashboardMode:roles': { type: 'keyword' },
+ 'securitySolution:ipReputationLinks': { type: 'keyword' },
+ // non-sensitive
'visualize:enableLabs': { type: 'boolean' },
'visualization:heatmap:maxBuckets': { type: 'long' },
'visualization:colorMapping': { type: 'text' },
'visualization:regionmap:showWarnings': { type: 'boolean' },
'visualization:dimmingOpacity': { type: 'float' },
'visualization:tileMap:maxPrecision': { type: 'long' },
- 'securitySolution:ipReputationLinks': { type: 'text' },
'csv:separator': { type: 'keyword' },
'visualization:tileMap:WMSdefaults': { type: 'text' },
'timelion:target_buckets': { type: 'long' },
@@ -27,14 +34,11 @@ export const stackManagementSchema: MakeSchemaFrom = {
'timelion:min_interval': { type: 'keyword' },
'timelion:default_rows': { type: 'long' },
'timelion:default_columns': { type: 'long' },
- 'timelion:quandl.key': { type: 'keyword' },
'timelion:es.default_index': { type: 'keyword' },
'timelion:showTutorial': { type: 'boolean' },
'securitySolution:timeDefaults': { type: 'keyword' },
'securitySolution:defaultAnomalyScore': { type: 'long' },
- 'securitySolution:defaultIndex': { type: 'keyword' }, // it's an array
'securitySolution:refreshIntervalDefaults': { type: 'keyword' },
- 'securitySolution:newsFeedUrl': { type: 'keyword' },
'securitySolution:enableNewsFeed': { type: 'boolean' },
'search:includeFrozen': { type: 'boolean' },
'courier:maxConcurrentShardRequests': { type: 'long' },
@@ -43,21 +47,29 @@ export const stackManagementSchema: MakeSchemaFrom = {
'courier:customRequestPreference': { type: 'keyword' },
'courier:ignoreFilterIfFieldNotInIndex': { type: 'boolean' },
'rollups:enableIndexPatterns': { type: 'boolean' },
- 'xpackReporting:customPdfLogo': { type: 'text' },
'notifications:lifetime:warning': { type: 'long' },
'notifications:lifetime:banner': { type: 'long' },
'notifications:lifetime:info': { type: 'long' },
- 'notifications:banner': { type: 'text' },
'notifications:lifetime:error': { type: 'long' },
'doc_table:highlight': { type: 'boolean' },
'discover:searchOnPageLoad': { type: 'boolean' },
// eslint-disable-next-line @typescript-eslint/naming-convention
'doc_table:hideTimeColumn': { type: 'boolean' },
'discover:sampleSize': { type: 'long' },
- defaultColumns: { type: 'keyword' }, // it's an array
+ defaultColumns: {
+ type: 'array',
+ items: {
+ type: 'keyword',
+ },
+ },
'context:defaultSize': { type: 'long' },
'discover:aggs:terms:size': { type: 'long' },
- 'context:tieBreakerFields': { type: 'keyword' }, // it's an array
+ 'context:tieBreakerFields': {
+ type: 'array',
+ items: {
+ type: 'keyword',
+ },
+ },
'discover:sort:defaultOrder': { type: 'keyword' },
'context:step': { type: 'long' },
'accessibility:disableAnimations': { type: 'boolean' },
@@ -77,10 +89,14 @@ export const stackManagementSchema: MakeSchemaFrom = {
'sort:options': { type: 'keyword' },
'savedObjects:listingLimit': { type: 'long' },
'query:queryString:options': { type: 'keyword' },
- pageNavigation: { type: 'keyword' },
'metrics:max_buckets': { type: 'long' },
'query:allowLeadingWildcards': { type: 'boolean' },
- metaFields: { type: 'keyword' }, // it's an array
+ metaFields: {
+ type: 'array',
+ items: {
+ type: 'keyword',
+ },
+ },
'indexPattern:placeholder': { type: 'keyword' },
'histogram:barTarget': { type: 'long' },
'histogram:maxBars': { type: 'long' },
@@ -102,4 +118,14 @@ export const stackManagementSchema: MakeSchemaFrom = {
'csv:quoteValues': { type: 'boolean' },
'dateFormat:dow': { type: 'keyword' },
dateFormat: { type: 'keyword' },
+ 'autocomplete:useTimeRange': { type: 'boolean' },
+ 'search:timeout': { type: 'long' },
+ 'visualization:visualize:legacyChartsLibrary': { type: 'boolean' },
+ 'doc_table:legacy': { type: 'boolean' },
+ 'discover:modifyColumnsOnSwitch': { type: 'boolean' },
+ 'discover:searchFieldsFromSource': { type: 'boolean' },
+ 'securitySolution:rulesTableRefresh': { type: 'text' },
+ 'apm:enableSignificantTerms': { type: 'boolean' },
+ 'apm:enableServiceOverview': { type: 'boolean' },
+ 'apm:enableCorrelations': { type: 'boolean' },
};
diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.test.ts b/src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.test.ts
new file mode 100644
index 0000000000000..4bcd98f894e2a
--- /dev/null
+++ b/src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.test.ts
@@ -0,0 +1,140 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * and the Server Side Public License, v 1; you may not use this file except in
+ * compliance with, at your election, the Elastic License or the Server Side
+ * Public License, v 1.
+ */
+
+import { loggingSystemMock, uiSettingsServiceMock } from '../../../../../core/server/mocks';
+import {
+ Collector,
+ createUsageCollectionSetupMock,
+ createCollectorFetchContextMock,
+} from '../../../../usage_collection/server/usage_collection.mock';
+
+import {
+ registerManagementUsageCollector,
+ createCollectorFetch,
+} from './telemetry_management_collector';
+
+const logger = loggingSystemMock.createLogger();
+
+describe('telemetry_application_usage_collector', () => {
+ let collector: Collector;
+
+ const usageCollectionMock = createUsageCollectionSetupMock();
+ usageCollectionMock.makeUsageCollector.mockImplementation((config) => {
+ collector = new Collector(logger, config);
+ return createUsageCollectionSetupMock().makeUsageCollector(config);
+ });
+
+ const uiSettingsClient = uiSettingsServiceMock.createClient();
+ const getUiSettingsClient = jest.fn(() => uiSettingsClient);
+ const mockedFetchContext = createCollectorFetchContextMock();
+
+ beforeAll(() => {
+ registerManagementUsageCollector(usageCollectionMock, getUiSettingsClient);
+ });
+
+ test('registered collector is set', () => {
+ expect(collector).not.toBeUndefined();
+ });
+
+ test('isReady() => false if no client', () => {
+ getUiSettingsClient.mockImplementationOnce(() => undefined as any);
+ expect(collector.isReady()).toBe(false);
+ });
+
+ test('isReady() => true', () => {
+ expect(collector.isReady()).toBe(true);
+ });
+
+ test('fetch()', async () => {
+ uiSettingsClient.getUserProvided.mockImplementationOnce(async () => ({
+ 'visualization:colorMapping': { userValue: 'red' },
+ }));
+ await expect(collector.fetch(mockedFetchContext)).resolves.toEqual({
+ 'visualization:colorMapping': 'red',
+ });
+ });
+
+ test('fetch() should not fail if invoked when not ready', async () => {
+ getUiSettingsClient.mockImplementationOnce(() => undefined as any);
+ await expect(collector.fetch(mockedFetchContext)).resolves.toBe(undefined);
+ });
+});
+
+describe('createCollectorFetch', () => {
+ const mockUserSettings = {
+ item1: { userValue: 'test' },
+ item2: { userValue: 123 },
+ item3: { userValue: false },
+ };
+
+ const mockIsSensitive = (key: string) => {
+ switch (key) {
+ case 'item1':
+ case 'item2':
+ return false;
+ case 'item3':
+ return true;
+ default:
+ throw new Error(`Unexpected ui setting: ${key}`);
+ }
+ };
+
+ it('returns #fetchUsageStats function', () => {
+ const getUiSettingsClient = jest.fn(() => undefined);
+ const fetchFunction = createCollectorFetch(getUiSettingsClient);
+ expect(typeof fetchFunction).toBe('function');
+ });
+
+ describe('#fetchUsageStats', () => {
+ it('returns undefined if no uiSettingsClient returned from getUiSettingsClient', async () => {
+ const getUiSettingsClient = jest.fn(() => undefined);
+ const fetchFunction = createCollectorFetch(getUiSettingsClient);
+ const result = await fetchFunction();
+ expect(result).toBe(undefined);
+ expect(getUiSettingsClient).toBeCalledTimes(1);
+ });
+
+ it('returns all user changed settings', async () => {
+ const uiSettingsClient = uiSettingsServiceMock.createClient();
+ const getUiSettingsClient = jest.fn(() => uiSettingsClient);
+ uiSettingsClient.getUserProvided.mockResolvedValue(mockUserSettings);
+ uiSettingsClient.isSensitive.mockImplementation(mockIsSensitive);
+ const fetchFunction = createCollectorFetch(getUiSettingsClient);
+ const result = await fetchFunction();
+ expect(typeof result).toBe('object');
+ expect(Object.keys(result!)).toEqual(Object.keys(mockUserSettings));
+ });
+
+ it('returns the actual values of non-sensitive settings', async () => {
+ const uiSettingsClient = uiSettingsServiceMock.createClient();
+ const getUiSettingsClient = jest.fn(() => uiSettingsClient);
+ uiSettingsClient.getUserProvided.mockResolvedValue(mockUserSettings);
+ uiSettingsClient.isSensitive.mockImplementation(mockIsSensitive);
+ const fetchFunction = createCollectorFetch(getUiSettingsClient);
+ const result = await fetchFunction();
+ expect(typeof result).toBe('object');
+ expect(result!).toMatchObject({
+ item1: 'test',
+ item2: 123,
+ });
+ });
+
+ it('returns [REDACTED] as a value for sensitive settings', async () => {
+ const uiSettingsClient = uiSettingsServiceMock.createClient();
+ const getUiSettingsClient = jest.fn(() => uiSettingsClient);
+ uiSettingsClient.getUserProvided.mockResolvedValue(mockUserSettings);
+ uiSettingsClient.isSensitive.mockImplementation(mockIsSensitive);
+ const fetchFunction = createCollectorFetch(getUiSettingsClient);
+ const result = await fetchFunction();
+ expect(typeof result).toBe('object');
+ expect(result!).toMatchObject({
+ item3: '[REDACTED]',
+ });
+ });
+ });
+});
diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.ts b/src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.ts
index c45f3d6139d95..651fbbd5a897a 100644
--- a/src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.ts
+++ b/src/plugins/kibana_usage_collection/server/collectors/management/telemetry_management_collector.ts
@@ -9,12 +9,8 @@
import { IUiSettingsClient } from 'kibana/server';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { stackManagementSchema } from './schema';
-
-export interface UsageStats extends Record {
- // We don't support `type` yet. Only interfaces. So I added at least 1 known key to the generic
- // Record extension to avoid eslint reverting it back to a `type`
- 'visualize:enableLabs': boolean;
-}
+import { UsageStats } from './types';
+import { REDACTED_KEYWORD } from '../../../common/constants';
export function createCollectorFetch(getUiSettingsClient: () => IUiSettingsClient | undefined) {
return async function fetchUsageStats(): Promise {
@@ -23,11 +19,12 @@ export function createCollectorFetch(getUiSettingsClient: () => IUiSettingsClien
return;
}
- const user = await uiSettingsClient.getUserProvided();
- const modifiedEntries = Object.keys(user)
- .filter((key: string) => key !== 'buildNum')
- .reduce((obj: any, key: string) => {
- obj[key] = user[key].userValue;
+ const userProvided = await uiSettingsClient.getUserProvided();
+ const modifiedEntries = Object.entries(userProvided)
+ .filter(([key]) => key !== 'buildNum')
+ .reduce((obj: any, [key, { userValue }]) => {
+ const sensitive = uiSettingsClient.isSensitive(key);
+ obj[key] = sensitive ? REDACTED_KEYWORD : userValue;
return obj;
}, {});
diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts
new file mode 100644
index 0000000000000..417841ee89569
--- /dev/null
+++ b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts
@@ -0,0 +1,117 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * and the Server Side Public License, v 1; you may not use this file except in
+ * compliance with, at your election, the Elastic License or the Server Side
+ * Public License, v 1.
+ */
+
+export interface UsageStats {
+ /**
+ * sensitive settings
+ */
+ 'timelion:quandl.key': string;
+ 'securitySolution:defaultIndex': string;
+ 'securitySolution:newsFeedUrl': string;
+ 'xpackReporting:customPdfLogo': string;
+ 'notifications:banner': string;
+ 'timelion:graphite.url': string;
+ 'xpackDashboardMode:roles': string;
+ 'securitySolution:ipReputationLinks': string;
+ /**
+ * non-sensitive settings
+ */
+ 'autocomplete:useTimeRange': boolean;
+ 'search:timeout': number;
+ 'visualization:visualize:legacyChartsLibrary': boolean;
+ 'doc_table:legacy': boolean;
+ 'discover:modifyColumnsOnSwitch': boolean;
+ 'discover:searchFieldsFromSource': boolean;
+ 'securitySolution:rulesTableRefresh': string;
+ 'apm:enableSignificantTerms': boolean;
+ 'apm:enableServiceOverview': boolean;
+ 'apm:enableCorrelations': boolean;
+ 'visualize:enableLabs': boolean;
+ 'visualization:heatmap:maxBuckets': number;
+ 'visualization:colorMapping': string;
+ 'visualization:regionmap:showWarnings': boolean;
+ 'visualization:dimmingOpacity': number;
+ 'visualization:tileMap:maxPrecision': number;
+ 'csv:separator': string;
+ 'visualization:tileMap:WMSdefaults': string;
+ 'timelion:target_buckets': number;
+ 'timelion:max_buckets': number;
+ 'timelion:es.timefield': string;
+ 'timelion:min_interval': string;
+ 'timelion:default_rows': number;
+ 'timelion:default_columns': number;
+ 'timelion:es.default_index': string;
+ 'timelion:showTutorial': boolean;
+ 'securitySolution:timeDefaults': string;
+ 'securitySolution:defaultAnomalyScore': number;
+ 'securitySolution:refreshIntervalDefaults': string;
+ 'securitySolution:enableNewsFeed': boolean;
+ 'search:includeFrozen': boolean;
+ 'courier:maxConcurrentShardRequests': number;
+ 'courier:batchSearches': boolean;
+ 'courier:setRequestPreference': string;
+ 'courier:customRequestPreference': string;
+ 'courier:ignoreFilterIfFieldNotInIndex': boolean;
+ 'rollups:enableIndexPatterns': boolean;
+ 'notifications:lifetime:warning': number;
+ 'notifications:lifetime:banner': number;
+ 'notifications:lifetime:info': number;
+ 'notifications:lifetime:error': number;
+ 'doc_table:highlight': boolean;
+ 'discover:searchOnPageLoad': boolean;
+ // eslint-disable-next-line @typescript-eslint/naming-convention
+ 'doc_table:hideTimeColumn': boolean;
+ 'discover:sampleSize': number;
+ defaultColumns: string[];
+ 'context:defaultSize': number;
+ 'discover:aggs:terms:size': number;
+ 'context:tieBreakerFields': string[];
+ 'discover:sort:defaultOrder': string;
+ 'context:step': number;
+ 'accessibility:disableAnimations': boolean;
+ 'ml:fileDataVisualizerMaxFileSize': string;
+ 'ml:anomalyDetection:results:enableTimeDefaults': boolean;
+ 'ml:anomalyDetection:results:timeDefaults': string;
+ 'truncate:maxHeight': number;
+ 'timepicker:timeDefaults': string;
+ 'timepicker:refreshIntervalDefaults': string;
+ 'timepicker:quickRanges': string;
+ 'theme:version': string;
+ 'theme:darkMode': boolean;
+ 'state:storeInSessionStorage': boolean;
+ 'savedObjects:perPage': number;
+ 'search:queryLanguage': string;
+ 'shortDots:enable': boolean;
+ 'sort:options': string;
+ 'savedObjects:listingLimit': number;
+ 'query:queryString:options': string;
+ 'metrics:max_buckets': number;
+ 'query:allowLeadingWildcards': boolean;
+ metaFields: string[];
+ 'indexPattern:placeholder': string;
+ 'histogram:barTarget': number;
+ 'histogram:maxBars': number;
+ 'format:number:defaultLocale': string;
+ 'format:percent:defaultPattern': string;
+ 'format:number:defaultPattern': string;
+ 'history:limit': number;
+ 'format:defaultTypeMap': string;
+ 'format:currency:defaultPattern': string;
+ defaultIndex: string;
+ 'format:bytes:defaultPattern': string;
+ 'filters:pinnedByDefault': boolean;
+ 'filterEditor:suggestValues': boolean;
+ 'fields:popularLimit': number;
+ dateNanosFormat: string;
+ defaultRoute: string;
+ 'dateFormat:tz': string;
+ 'dateFormat:scaled': string;
+ 'csv:quoteValues': boolean;
+ 'dateFormat:dow': string;
+ dateFormat: string;
+}
diff --git a/src/plugins/lens_oss/README.md b/src/plugins/lens_oss/README.md
deleted file mode 100644
index 187da2497026e..0000000000000
--- a/src/plugins/lens_oss/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# lens_oss
-
-The lens_oss plugin registers the lens visualization on OSS.
-It is registered as disabled. The x-pack plugin should unregister this.
-
-`visualizations.unregisterAlias('lensOss')`
\ No newline at end of file
diff --git a/src/plugins/lens_oss/common/constants.ts b/src/plugins/lens_oss/common/constants.ts
deleted file mode 100644
index 0ff5cdd78bb1b..0000000000000
--- a/src/plugins/lens_oss/common/constants.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-export const APP_NAME = 'lens';
-export const PLUGIN_ID_OSS = 'lensOss';
-export const APP_PATH = '#/';
-export const APP_ICON = 'lensApp';
diff --git a/src/plugins/lens_oss/kibana.json b/src/plugins/lens_oss/kibana.json
deleted file mode 100644
index 3e3d3585f37fb..0000000000000
--- a/src/plugins/lens_oss/kibana.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "id": "lensOss",
- "version": "kibana",
- "ui": true,
- "server": true,
- "requiredPlugins": [
- "visualizations"
- ],
- "extraPublicDirs": ["common/constants"]
-}
diff --git a/src/plugins/lens_oss/public/plugin.ts b/src/plugins/lens_oss/public/plugin.ts
deleted file mode 100644
index 5a441614b7e24..0000000000000
--- a/src/plugins/lens_oss/public/plugin.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-import { DocLinksStart, CoreSetup } from 'src/core/public';
-import { VisualizationsSetup } from '../../visualizations/public';
-import { getLensAliasConfig } from './vis_type_alias';
-
-export interface LensPluginSetupDependencies {
- visualizations: VisualizationsSetup;
-}
-
-export interface LensPluginStartDependencies {
- docLinks: DocLinksStart;
-}
-
-export class LensOSSPlugin {
- setup(
- core: CoreSetup,
- { visualizations }: LensPluginSetupDependencies
- ) {
- core.getStartServices().then(([coreStart]) => {
- visualizations.registerAlias(getLensAliasConfig(coreStart.docLinks));
- });
- }
-
- start() {}
-}
diff --git a/src/plugins/lens_oss/public/vis_type_alias.ts b/src/plugins/lens_oss/public/vis_type_alias.ts
deleted file mode 100644
index b9806bbf3b4e5..0000000000000
--- a/src/plugins/lens_oss/public/vis_type_alias.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-import { i18n } from '@kbn/i18n';
-import { VisTypeAlias } from 'src/plugins/visualizations/public';
-import { DocLinksStart } from 'src/core/public';
-import { APP_NAME, PLUGIN_ID_OSS, APP_PATH, APP_ICON } from '../common';
-
-export const getLensAliasConfig = ({ links }: DocLinksStart): VisTypeAlias => ({
- aliasPath: APP_PATH,
- aliasApp: APP_NAME,
- name: PLUGIN_ID_OSS,
- title: i18n.translate('lensOss.visTypeAlias.title', {
- defaultMessage: 'Lens',
- }),
- description: i18n.translate('lensOss.visTypeAlias.description', {
- defaultMessage:
- 'Create visualizations with our drag-and-drop editor. Switch between visualization types at any time. Best for most visualizations.',
- }),
- icon: APP_ICON,
- stage: 'production',
- disabled: true,
- note: i18n.translate('lensOss.visTypeAlias.note', {
- defaultMessage: 'Recommended for most users.',
- }),
- promoTooltip: {
- description: i18n.translate('lensOss.visTypeAlias.promoTooltip.description', {
- defaultMessage: 'Try Lens for free with Elastic. Learn more.',
- }),
- link: `${links.visualize.lens}?blade=kibanaossvizwizard`,
- },
-});
diff --git a/src/plugins/lens_oss/server/index.ts b/src/plugins/lens_oss/server/index.ts
deleted file mode 100644
index d13a9b2caaeb2..0000000000000
--- a/src/plugins/lens_oss/server/index.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-import { PluginConfigDescriptor } from 'kibana/server';
-import { copyFromRoot } from '@kbn/config';
-import { configSchema, ConfigSchema } from '../config';
-
-export const config: PluginConfigDescriptor = {
- schema: configSchema,
- deprecations: () => [copyFromRoot('xpack.lens.enabled', 'lens_oss.enabled')],
-};
-
-export const plugin = () => ({
- setup() {},
- start() {},
-});
diff --git a/src/plugins/maps_legacy/public/index.ts b/src/plugins/maps_legacy/public/index.ts
index 95550fab1ba17..9268f14995f44 100644
--- a/src/plugins/maps_legacy/public/index.ts
+++ b/src/plugins/maps_legacy/public/index.ts
@@ -8,9 +8,7 @@
import { PluginInitializerContext } from 'kibana/public';
import { MapsLegacyPlugin } from './plugin';
-// @ts-ignore
import * as colorUtil from './map/color_util';
-// @ts-ignore
import { KibanaMapLayer } from './map/kibana_map_layer';
import {
VectorLayer,
@@ -19,7 +17,6 @@ import {
TmsLayer,
IServiceSettings,
} from './map/service_settings_types';
-// @ts-ignore
import { mapTooltipProvider } from './tooltip_provider';
import './map/index.scss';
diff --git a/src/plugins/maps_oss/public/index.ts b/src/plugins/maps_legacy/public/map/color_util.d.ts
similarity index 69%
rename from src/plugins/maps_oss/public/index.ts
rename to src/plugins/maps_legacy/public/map/color_util.d.ts
index 1d27dc4b6d996..9ec6b3c1fb007 100644
--- a/src/plugins/maps_oss/public/index.ts
+++ b/src/plugins/maps_legacy/public/map/color_util.d.ts
@@ -6,6 +6,6 @@
* Public License, v 1.
*/
-import { MapsOSSPlugin } from './plugin';
+export function getLegendColors(colorRamp: unknown, numLegendColors?: number): string[];
-export const plugin = () => new MapsOSSPlugin();
+export function getColor(colorRamp: unknown, i: number): string;
diff --git a/src/plugins/lens_oss/config.ts b/src/plugins/maps_legacy/public/map/kibana_map_layer.d.ts
similarity index 54%
rename from src/plugins/lens_oss/config.ts
rename to src/plugins/maps_legacy/public/map/kibana_map_layer.d.ts
index 58c50f0104f46..222cb6b215f9a 100644
--- a/src/plugins/lens_oss/config.ts
+++ b/src/plugins/maps_legacy/public/map/kibana_map_layer.d.ts
@@ -6,10 +6,20 @@
* Public License, v 1.
*/
-import { schema, TypeOf } from '@kbn/config-schema';
+export class KibanaMapLayer {
+ constructor();
-export const configSchema = schema.object({
- enabled: schema.boolean({ defaultValue: true }),
-});
+ getBounds(): Promise;
-export type ConfigSchema = TypeOf;
+ addToLeafletMap(leafletMap: unknown): void;
+
+ removeFromLeafletMap(leafletMap: unknown): void;
+
+ appendLegendContents(): void;
+
+ updateExtent(): void;
+
+ movePointer(): void;
+
+ getAttributions(): unknown;
+}
diff --git a/typings/@elastic/eui/lib/services.d.ts b/src/plugins/maps_legacy/public/tooltip_provider.d.ts
similarity index 79%
rename from typings/@elastic/eui/lib/services.d.ts
rename to src/plugins/maps_legacy/public/tooltip_provider.d.ts
index a667d111ceb72..4082a6ef83c4d 100644
--- a/typings/@elastic/eui/lib/services.d.ts
+++ b/src/plugins/maps_legacy/public/tooltip_provider.d.ts
@@ -6,4 +6,4 @@
* Public License, v 1.
*/
-export const RIGHT_ALIGNMENT: any;
+export function mapTooltipProvider(element: unknown, formatter: unknown): () => unknown;
diff --git a/src/plugins/lens_oss/tsconfig.json b/src/plugins/maps_legacy/tsconfig.json
similarity index 56%
rename from src/plugins/lens_oss/tsconfig.json
rename to src/plugins/maps_legacy/tsconfig.json
index d7bbc593fa87b..e7ea06706b64f 100644
--- a/src/plugins/lens_oss/tsconfig.json
+++ b/src/plugins/maps_legacy/tsconfig.json
@@ -7,14 +7,8 @@
"declaration": true,
"declarationMap": true
},
- "include": [
- "common/**/*",
- "public/**/*",
- "server/**/*",
- "*.ts"
- ],
+ "include": ["common/**/*", "public/**/*", "server/**/*", "config.ts"],
"references": [
- { "path": "../../core/tsconfig.json" },
- { "path": "../visualizations/tsconfig.json" }
+ { "path": "../vis_default_editor/tsconfig.json" },
]
}
diff --git a/src/plugins/maps_oss/README.md b/src/plugins/maps_oss/README.md
deleted file mode 100644
index ed91de500fbfb..0000000000000
--- a/src/plugins/maps_oss/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# maps_oss
-
-The maps_oss plugin registers the maps visualization on OSS.
-It is registered as disabled. The x-pack plugin should unregister this.
-
-`visualizations.unregisterAlias('mapsOss')`
\ No newline at end of file
diff --git a/src/plugins/maps_oss/common/constants.ts b/src/plugins/maps_oss/common/constants.ts
deleted file mode 100644
index db29f541a03df..0000000000000
--- a/src/plugins/maps_oss/common/constants.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-export const APP_NAME = 'maps';
-export const PLUGIN_ID_OSS = 'mapsOss';
-export const APP_PATH = '/map';
-export const APP_ICON = 'gisApp';
diff --git a/src/plugins/maps_oss/config.ts b/src/plugins/maps_oss/config.ts
deleted file mode 100644
index 58c50f0104f46..0000000000000
--- a/src/plugins/maps_oss/config.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-import { schema, TypeOf } from '@kbn/config-schema';
-
-export const configSchema = schema.object({
- enabled: schema.boolean({ defaultValue: true }),
-});
-
-export type ConfigSchema = TypeOf;
diff --git a/src/plugins/maps_oss/kibana.json b/src/plugins/maps_oss/kibana.json
deleted file mode 100644
index 19770dcffaadd..0000000000000
--- a/src/plugins/maps_oss/kibana.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "id": "mapsOss",
- "version": "kibana",
- "ui": true,
- "server": true,
- "requiredPlugins": [
- "visualizations"
- ],
- "extraPublicDirs": ["common/constants"]
-}
diff --git a/src/plugins/maps_oss/public/plugin.ts b/src/plugins/maps_oss/public/plugin.ts
deleted file mode 100644
index 5e27ae34257bf..0000000000000
--- a/src/plugins/maps_oss/public/plugin.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-import { DocLinksStart, CoreSetup } from 'src/core/public';
-import { VisualizationsSetup } from '../../visualizations/public';
-import { getMapsAliasConfig } from './vis_type_alias';
-
-export interface MapsPluginSetupDependencies {
- visualizations: VisualizationsSetup;
-}
-
-export interface MapsPluginStartDependencies {
- docLinks: DocLinksStart;
-}
-
-export class MapsOSSPlugin {
- setup(
- core: CoreSetup,
- { visualizations }: MapsPluginSetupDependencies
- ) {
- core.getStartServices().then(([coreStart]) => {
- visualizations.registerAlias(getMapsAliasConfig(coreStart.docLinks));
- });
- }
-
- start() {}
-}
diff --git a/src/plugins/maps_oss/public/vis_type_alias.ts b/src/plugins/maps_oss/public/vis_type_alias.ts
deleted file mode 100644
index a27c628755cf6..0000000000000
--- a/src/plugins/maps_oss/public/vis_type_alias.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-import { i18n } from '@kbn/i18n';
-import { VisTypeAlias } from 'src/plugins/visualizations/public';
-import { DocLinksStart } from 'src/core/public';
-import { APP_NAME, PLUGIN_ID_OSS, APP_PATH, APP_ICON } from '../common';
-
-export const getMapsAliasConfig = ({ links }: DocLinksStart): VisTypeAlias => ({
- aliasPath: APP_PATH,
- aliasApp: APP_NAME,
- name: PLUGIN_ID_OSS,
- title: i18n.translate('mapsOss.visTypeAlias.title', {
- defaultMessage: 'Maps',
- }),
- description: i18n.translate('mapsOss.visTypeAlias.description', {
- defaultMessage: 'Plot and style your geo data in a multi layer map.',
- }),
- icon: APP_ICON,
- stage: 'production',
- disabled: true,
- promoTooltip: {
- description: i18n.translate('mapsOss.visTypeAlias.promoTooltip.description', {
- defaultMessage: 'Try maps for free with Elastic. Learn more.',
- }),
- link: `${links.visualize.maps}?blade=kibanaossvizwizard`,
- },
-});
diff --git a/src/plugins/maps_oss/server/index.ts b/src/plugins/maps_oss/server/index.ts
deleted file mode 100644
index 8f07beee705a6..0000000000000
--- a/src/plugins/maps_oss/server/index.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-import { PluginConfigDescriptor } from 'kibana/server';
-import { copyFromRoot } from '@kbn/config';
-import { configSchema, ConfigSchema } from '../config';
-
-export const config: PluginConfigDescriptor = {
- schema: configSchema,
- deprecations: () => [copyFromRoot('xpack.maps.enabled', 'maps_oss.enabled')],
-};
-
-export const plugin = () => ({
- setup() {},
- start() {},
-});
diff --git a/src/plugins/maps_oss/tsconfig.json b/src/plugins/maps_oss/tsconfig.json
new file mode 100644
index 0000000000000..03c30c3c49fd3
--- /dev/null
+++ b/src/plugins/maps_oss/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "extends": "../../../tsconfig.base.json",
+ "compilerOptions": {
+ "composite": true,
+ "outDir": "./target/types",
+ "emitDeclarationOnly": true,
+ "declaration": true,
+ "declarationMap": true
+ },
+ "include": ["common/**/*", "public/**/*", "server/**/*", "config.ts"],
+ "references": [
+ { "path": "../visualizations/tsconfig.json" },
+ ]
+}
diff --git a/src/plugins/region_map/public/components/index.tsx b/src/plugins/region_map/public/components/index.tsx
index 2ad3c0ffec3f4..187c36f9cc46d 100644
--- a/src/plugins/region_map/public/components/index.tsx
+++ b/src/plugins/region_map/public/components/index.tsx
@@ -8,11 +8,11 @@
import React, { lazy } from 'react';
import { IServiceSettings } from 'src/plugins/maps_legacy/public';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { RegionMapVisParams } from '../region_map_types';
const RegionMapOptions = lazy(() => import('./region_map_options'));
export const createRegionMapOptions = (getServiceSettings: () => Promise) => (
- props: VisOptionsProps
+ props: VisEditorOptionsProps
) => ;
diff --git a/src/plugins/region_map/public/components/region_map_options.tsx b/src/plugins/region_map/public/components/region_map_options.tsx
index 0b11e1c5164d3..43bb15a547435 100644
--- a/src/plugins/region_map/public/components/region_map_options.tsx
+++ b/src/plugins/region_map/public/components/region_map_options.tsx
@@ -10,7 +10,7 @@ import React, { useCallback, useMemo } from 'react';
import { EuiIcon, EuiLink, EuiPanel, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { FileLayerField, VectorLayer, IServiceSettings } from '../../../maps_legacy/public';
import { SelectOption, SwitchOption, NumberInputOption } from '../../../vis_default_editor/public';
import { WmsOptions } from '../../../maps_legacy/public';
@@ -28,7 +28,7 @@ const mapFieldForOption = ({ description, name }: FileLayerField) => ({
export type RegionMapOptionsProps = {
getServiceSettings: () => Promise;
-} & VisOptionsProps;
+} & VisEditorOptionsProps;
function RegionMapOptions(props: RegionMapOptionsProps) {
const { getServiceSettings, stateParams, vis, setValue } = props;
diff --git a/src/plugins/region_map/public/region_map_type.ts b/src/plugins/region_map/public/region_map_type.ts
index bda478389faa1..c1d46cd603f0b 100644
--- a/src/plugins/region_map/public/region_map_type.ts
+++ b/src/plugins/region_map/public/region_map_type.ts
@@ -8,7 +8,7 @@
import { i18n } from '@kbn/i18n';
-import { BaseVisTypeOptions } from '../../visualizations/public';
+import { VisTypeDefinition } from '../../visualizations/public';
import { truncatedColorSchemas } from '../../charts/public';
import { ORIGIN } from '../../maps_legacy/public';
@@ -23,7 +23,7 @@ export function createRegionMapTypeDefinition({
uiSettings,
regionmapsConfig,
getServiceSettings,
-}: RegionMapVisualizationDependencies): BaseVisTypeOptions {
+}: RegionMapVisualizationDependencies): VisTypeDefinition {
return {
name: 'region_map',
getInfoMessage: getDeprecationMessage,
@@ -139,5 +139,6 @@ provided base maps, or add your own. Darker colors represent higher values.',
return vis;
},
+ requiresSearch: true,
};
}
diff --git a/src/plugins/region_map/public/to_ast.ts b/src/plugins/region_map/public/to_ast.ts
index 7c81b8fa9ecbb..77aaf18f0f697 100644
--- a/src/plugins/region_map/public/to_ast.ts
+++ b/src/plugins/region_map/public/to_ast.ts
@@ -11,11 +11,11 @@ import {
IndexPatternLoadExpressionFunctionDefinition,
} from '../../data/public';
import { buildExpression, buildExpressionFunction } from '../../expressions/public';
-import { getVisSchemas, Vis, BuildPipelineParams } from '../../visualizations/public';
+import { getVisSchemas, VisToExpressionAst } from '../../visualizations/public';
import { RegionMapExpressionFunctionDefinition } from './region_map_fn';
import { RegionMapVisConfig, RegionMapVisParams } from './region_map_types';
-export const toExpressionAst = (vis: Vis, params: BuildPipelineParams) => {
+export const toExpressionAst: VisToExpressionAst = (vis, params) => {
const esaggs = buildExpressionFunction('esaggs', {
index: buildExpression([
buildExpressionFunction('indexPatternLoad', {
diff --git a/src/plugins/region_map/tsconfig.json b/src/plugins/region_map/tsconfig.json
new file mode 100644
index 0000000000000..40f76ece2a6ff
--- /dev/null
+++ b/src/plugins/region_map/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "extends": "../../../tsconfig.base.json",
+ "compilerOptions": {
+ "composite": true,
+ "outDir": "./target/types",
+ "emitDeclarationOnly": true,
+ "declaration": true,
+ "declarationMap": true
+ },
+ "include": ["public/**/*", "server/**/*"],
+ "references": [
+ { "path": "../maps_legacy/tsconfig.json" },
+ { "path": "../vis_default_editor/tsconfig.json" },
+ ]
+}
diff --git a/src/plugins/share/public/components/__snapshots__/share_context_menu.test.tsx.snap b/src/plugins/share/public/components/__snapshots__/share_context_menu.test.tsx.snap
index fc3fa3e72b9c0..95d3026f66d37 100644
--- a/src/plugins/share/public/components/__snapshots__/share_context_menu.test.tsx.snap
+++ b/src/plugins/share/public/components/__snapshots__/share_context_menu.test.tsx.snap
@@ -55,6 +55,7 @@ exports[`shareContextMenuExtensions should sort ascending on sort order first an
},
]
}
+ size="m"
/>
`;
@@ -78,6 +79,7 @@ exports[`should only render permalink panel when there are no other panels 1`] =
},
]
}
+ size="m"
/>
`;
@@ -130,6 +132,7 @@ exports[`should render context menu panel when there are more than one panel 1`]
},
]
}
+ size="m"
/>
`;
diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json
index 27d9b5ce83203..950fdf9405b75 100644
--- a/src/plugins/telemetry/schema/oss_plugins.json
+++ b/src/plugins/telemetry/schema/oss_plugins.json
@@ -4076,6 +4076,27 @@
},
"stack_management": {
"properties": {
+ "timelion:quandl.key": {
+ "type": "keyword"
+ },
+ "securitySolution:defaultIndex": {
+ "type": "keyword"
+ },
+ "securitySolution:newsFeedUrl": {
+ "type": "keyword"
+ },
+ "xpackReporting:customPdfLogo": {
+ "type": "keyword"
+ },
+ "notifications:banner": {
+ "type": "keyword"
+ },
+ "timelion:graphite.url": {
+ "type": "keyword"
+ },
+ "xpackDashboardMode:roles": {
+ "type": "keyword"
+ },
"visualize:enableLabs": {
"type": "boolean"
},
@@ -4095,7 +4116,7 @@
"type": "long"
},
"securitySolution:ipReputationLinks": {
- "type": "text"
+ "type": "keyword"
},
"csv:separator": {
"type": "keyword"
@@ -4121,9 +4142,6 @@
"timelion:default_columns": {
"type": "long"
},
- "timelion:quandl.key": {
- "type": "keyword"
- },
"timelion:es.default_index": {
"type": "keyword"
},
@@ -4136,15 +4154,9 @@
"securitySolution:defaultAnomalyScore": {
"type": "long"
},
- "securitySolution:defaultIndex": {
- "type": "keyword"
- },
"securitySolution:refreshIntervalDefaults": {
"type": "keyword"
},
- "securitySolution:newsFeedUrl": {
- "type": "keyword"
- },
"securitySolution:enableNewsFeed": {
"type": "boolean"
},
@@ -4169,9 +4181,6 @@
"rollups:enableIndexPatterns": {
"type": "boolean"
},
- "xpackReporting:customPdfLogo": {
- "type": "text"
- },
"notifications:lifetime:warning": {
"type": "long"
},
@@ -4181,9 +4190,6 @@
"notifications:lifetime:info": {
"type": "long"
},
- "notifications:banner": {
- "type": "text"
- },
"notifications:lifetime:error": {
"type": "long"
},
@@ -4200,7 +4206,10 @@
"type": "long"
},
"defaultColumns": {
- "type": "keyword"
+ "type": "array",
+ "items": {
+ "type": "keyword"
+ }
},
"context:defaultSize": {
"type": "long"
@@ -4209,7 +4218,10 @@
"type": "long"
},
"context:tieBreakerFields": {
- "type": "keyword"
+ "type": "array",
+ "items": {
+ "type": "keyword"
+ }
},
"discover:sort:defaultOrder": {
"type": "keyword"
@@ -4268,9 +4280,6 @@
"query:queryString:options": {
"type": "keyword"
},
- "pageNavigation": {
- "type": "keyword"
- },
"metrics:max_buckets": {
"type": "long"
},
@@ -4278,7 +4287,10 @@
"type": "boolean"
},
"metaFields": {
- "type": "keyword"
+ "type": "array",
+ "items": {
+ "type": "keyword"
+ }
},
"indexPattern:placeholder": {
"type": "keyword"
@@ -4342,6 +4354,36 @@
},
"dateFormat": {
"type": "keyword"
+ },
+ "autocomplete:useTimeRange": {
+ "type": "boolean"
+ },
+ "search:timeout": {
+ "type": "long"
+ },
+ "visualization:visualize:legacyChartsLibrary": {
+ "type": "boolean"
+ },
+ "doc_table:legacy": {
+ "type": "boolean"
+ },
+ "discover:modifyColumnsOnSwitch": {
+ "type": "boolean"
+ },
+ "discover:searchFieldsFromSource": {
+ "type": "boolean"
+ },
+ "securitySolution:rulesTableRefresh": {
+ "type": "text"
+ },
+ "apm:enableSignificantTerms": {
+ "type": "boolean"
+ },
+ "apm:enableServiceOverview": {
+ "type": "boolean"
+ },
+ "apm:enableCorrelations": {
+ "type": "boolean"
}
}
},
diff --git a/src/plugins/tile_map/public/components/tile_map_options.tsx b/src/plugins/tile_map/public/components/tile_map_options.tsx
index c30d314d166bb..d6155dbfec877 100644
--- a/src/plugins/tile_map/public/components/tile_map_options.tsx
+++ b/src/plugins/tile_map/public/components/tile_map_options.tsx
@@ -10,8 +10,8 @@ import React, { useEffect } from 'react';
import { EuiPanel, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import {
- VisOptionsProps,
BasicOptions,
SelectOption,
SwitchOption,
@@ -21,7 +21,7 @@ import { WmsOptions } from '../../../maps_legacy/public';
import { TileMapVisParams } from '../types';
import { MapTypes } from '../utils/map_types';
-export type TileMapOptionsProps = VisOptionsProps;
+export type TileMapOptionsProps = VisEditorOptionsProps;
function TileMapOptions(props: TileMapOptionsProps) {
const { stateParams, setValue, vis } = props;
diff --git a/src/plugins/tile_map/public/tile_map_type.ts b/src/plugins/tile_map/public/tile_map_type.ts
index 7356da0cf8bcb..ceb9c138f043c 100644
--- a/src/plugins/tile_map/public/tile_map_type.ts
+++ b/src/plugins/tile_map/public/tile_map_type.ts
@@ -7,7 +7,7 @@
*/
import { i18n } from '@kbn/i18n';
-import { BaseVisTypeOptions } from 'src/plugins/visualizations/public';
+import { VisTypeDefinition } from 'src/plugins/visualizations/public';
import { truncatedColorSchemas } from '../../charts/public';
// @ts-expect-error
@@ -21,7 +21,7 @@ import { MapTypes } from './utils/map_types';
export function createTileMapTypeDefinition(
dependencies: TileMapVisualizationDependencies
-): BaseVisTypeOptions {
+): VisTypeDefinition {
const { uiSettings, getServiceSettings } = dependencies;
return {
@@ -147,5 +147,6 @@ export function createTileMapTypeDefinition(
}
return vis;
},
+ requiresSearch: true,
};
}
diff --git a/src/plugins/tile_map/public/to_ast.ts b/src/plugins/tile_map/public/to_ast.ts
index f5a964d257431..8130b7df25276 100644
--- a/src/plugins/tile_map/public/to_ast.ts
+++ b/src/plugins/tile_map/public/to_ast.ts
@@ -11,11 +11,11 @@ import {
IndexPatternLoadExpressionFunctionDefinition,
} from '../../data/public';
import { buildExpression, buildExpressionFunction } from '../../expressions/public';
-import { getVisSchemas, Vis, BuildPipelineParams } from '../../visualizations/public';
+import { getVisSchemas, VisToExpressionAst } from '../../visualizations/public';
import { TileMapExpressionFunctionDefinition } from './tile_map_fn';
import { TileMapVisConfig, TileMapVisParams } from './types';
-export const toExpressionAst = (vis: Vis, params: BuildPipelineParams) => {
+export const toExpressionAst: VisToExpressionAst = (vis, params) => {
const esaggs = buildExpressionFunction('esaggs', {
index: buildExpression([
buildExpressionFunction('indexPatternLoad', {
diff --git a/src/plugins/tile_map/tsconfig.json b/src/plugins/tile_map/tsconfig.json
new file mode 100644
index 0000000000000..40f76ece2a6ff
--- /dev/null
+++ b/src/plugins/tile_map/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "extends": "../../../tsconfig.base.json",
+ "compilerOptions": {
+ "composite": true,
+ "outDir": "./target/types",
+ "emitDeclarationOnly": true,
+ "declaration": true,
+ "declarationMap": true
+ },
+ "include": ["public/**/*", "server/**/*"],
+ "references": [
+ { "path": "../maps_legacy/tsconfig.json" },
+ { "path": "../vis_default_editor/tsconfig.json" },
+ ]
+}
diff --git a/src/plugins/usage_collection/server/collector/collector.ts b/src/plugins/usage_collection/server/collector/collector.ts
index ccc17ea1c5967..8e8a74902d479 100644
--- a/src/plugins/usage_collection/server/collector/collector.ts
+++ b/src/plugins/usage_collection/server/collector/collector.ts
@@ -14,17 +14,38 @@ import {
KibanaRequest,
} from 'src/core/server';
-export type AllowedSchemaNumberTypes = 'long' | 'integer' | 'short' | 'byte' | 'double' | 'float';
+export type AllowedSchemaNumberTypes =
+ | 'long'
+ | 'integer'
+ | 'short'
+ | 'byte'
+ | 'double'
+ | 'float'
+ | 'date';
+export type AllowedSchemaStringTypes = 'keyword' | 'text' | 'date';
+export type AllowedSchemaBooleanTypes = 'boolean';
-export type AllowedSchemaTypes = AllowedSchemaNumberTypes | 'keyword' | 'text' | 'boolean' | 'date';
+export type AllowedSchemaTypes =
+ | AllowedSchemaNumberTypes
+ | AllowedSchemaStringTypes
+ | AllowedSchemaBooleanTypes;
export interface SchemaField {
type: string;
}
+export type PossibleSchemaTypes = U extends string
+ ? AllowedSchemaStringTypes
+ : U extends number
+ ? AllowedSchemaNumberTypes
+ : U extends boolean
+ ? AllowedSchemaBooleanTypes
+ : // allow any schema type from the union if typescript is unable to resolve the exact U type
+ AllowedSchemaTypes;
+
export type RecursiveMakeSchemaFrom = U extends object
? MakeSchemaFrom
- : { type: AllowedSchemaTypes };
+ : { type: PossibleSchemaTypes };
// Using Required to enforce all optional keys in the object
export type MakeSchemaFrom = {
diff --git a/src/plugins/vis_default_editor/public/components/agg_group_helper.test.ts b/src/plugins/vis_default_editor/public/components/agg_group_helper.test.ts
index 131edb4601546..fb41d610d2175 100644
--- a/src/plugins/vis_default_editor/public/components/agg_group_helper.test.ts
+++ b/src/plugins/vis_default_editor/public/components/agg_group_helper.test.ts
@@ -50,7 +50,6 @@ describe('DefaultEditorGroup helpers', () => {
min: 0,
max: 3,
aggFilter: [],
- editor: false,
params: [],
defaults: null,
mustBeFirst: true,
@@ -62,7 +61,6 @@ describe('DefaultEditorGroup helpers', () => {
min: 2,
max: 3,
aggFilter: [],
- editor: false,
params: [],
defaults: null,
},
diff --git a/src/plugins/vis_default_editor/public/components/options/basic_options.tsx b/src/plugins/vis_default_editor/public/components/options/basic_options.tsx
index 4edfd9982ffbd..85a94e1228a3e 100644
--- a/src/plugins/vis_default_editor/public/components/options/basic_options.tsx
+++ b/src/plugins/vis_default_editor/public/components/options/basic_options.tsx
@@ -10,7 +10,7 @@ import React from 'react';
import { i18n } from '@kbn/i18n';
-import { VisOptionsProps } from '../../vis_options_props';
+import { VisEditorOptionsProps } from '../../../../visualizations/public';
import { SwitchOption } from './switch';
import { SelectOption } from './select';
@@ -23,7 +23,7 @@ function BasicOptions({
stateParams,
setValue,
vis,
-}: VisOptionsProps) {
+}: VisEditorOptionsProps) {
return (
<>
(
interface ColorSchemaOptionsProps extends ColorSchemaParams {
disabled?: boolean;
colorSchemas: ColorSchema[];
- uiState: VisOptionsProps['uiState'];
+ uiState: VisEditorOptionsProps['uiState'];
setValue: SetColorSchemaOptionsValue;
showHelpText?: boolean;
}
diff --git a/src/plugins/vis_default_editor/public/components/sidebar/use_option_tabs.ts b/src/plugins/vis_default_editor/public/components/sidebar/use_option_tabs.ts
index fbec23fd199f5..be0e4dd9a8c20 100644
--- a/src/plugins/vis_default_editor/public/components/sidebar/use_option_tabs.ts
+++ b/src/plugins/vis_default_editor/public/components/sidebar/use_option_tabs.ts
@@ -9,13 +9,12 @@
import { useCallback, useState } from 'react';
import { i18n } from '@kbn/i18n';
-import { Vis } from '../../../../visualizations/public';
+import { Vis, VisEditorOptionsProps } from '../../../../visualizations/public';
-import { VisOptionsProps } from '../../vis_options_props';
import { DefaultEditorDataTab, DefaultEditorDataTabProps } from './data_tab';
export interface OptionTab {
- editor: React.ComponentType;
+ editor: React.ComponentType;
name: string;
title: string;
isSelected?: boolean;
diff --git a/src/plugins/vis_default_editor/public/index.ts b/src/plugins/vis_default_editor/public/index.ts
index a4c94dd664968..9d315f1a94ce7 100644
--- a/src/plugins/vis_default_editor/public/index.ts
+++ b/src/plugins/vis_default_editor/public/index.ts
@@ -16,7 +16,6 @@ export { PalettePicker } from './components/controls/palette_picker';
export * from './components/options';
export { RangesParamEditor, RangeValues } from './components/controls/ranges';
export * from './editor_size';
-export * from './vis_options_props';
export * from './utils';
export const plugin = (context: PluginInitializerContext) => {
diff --git a/src/plugins/vis_default_editor/public/vis_options_props.tsx b/src/plugins/vis_default_editor/public/vis_options_props.tsx
deleted file mode 100644
index 6180686b6996d..0000000000000
--- a/src/plugins/vis_default_editor/public/vis_options_props.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * and the Server Side Public License, v 1; you may not use this file except in
- * compliance with, at your election, the Elastic License or the Server Side
- * Public License, v 1.
- */
-
-import { Vis, PersistedState } from 'src/plugins/visualizations/public';
-import { IAggConfigs } from 'src/plugins/data/public';
-
-export interface VisOptionsProps {
- aggs: IAggConfigs;
- hasHistogramAgg: boolean;
- isTabSelected: boolean;
- stateParams: VisParamType;
- vis: Vis;
- uiState: PersistedState;
- setValue(paramName: T, value: VisParamType[T]): void;
- setValidity(isValid: boolean): void;
- setTouched(isTouched: boolean): void;
-}
diff --git a/src/plugins/vis_type_markdown/public/markdown_options.test.tsx b/src/plugins/vis_type_markdown/public/markdown_options.test.tsx
index cf27118ac71e4..9d464cf9e2063 100644
--- a/src/plugins/vis_type_markdown/public/markdown_options.test.tsx
+++ b/src/plugins/vis_type_markdown/public/markdown_options.test.tsx
@@ -9,7 +9,7 @@
import React from 'react';
import { shallow } from 'enzyme';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { MarkdownVisParams } from './types';
import { MarkdownOptions } from './markdown_options';
@@ -21,7 +21,7 @@ describe('MarkdownOptions', () => {
openLinksInNewTab: false,
},
setValue: jest.fn(),
- } as unknown) as VisOptionsProps;
+ } as unknown) as VisEditorOptionsProps;
it('should match snapshot', () => {
const comp = shallow();
diff --git a/src/plugins/vis_type_markdown/public/markdown_options.tsx b/src/plugins/vis_type_markdown/public/markdown_options.tsx
index 72e4aaf8758b2..79d850b8c1fd8 100644
--- a/src/plugins/vis_type_markdown/public/markdown_options.tsx
+++ b/src/plugins/vis_type_markdown/public/markdown_options.tsx
@@ -18,10 +18,10 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { MarkdownVisParams } from './types';
-function MarkdownOptions({ stateParams, setValue }: VisOptionsProps) {
+function MarkdownOptions({ stateParams, setValue }: VisEditorOptionsProps) {
const onMarkdownUpdate = useCallback(
({ target: { value } }: React.ChangeEvent) => setValue('markdown', value),
[setValue]
diff --git a/src/plugins/vis_type_markdown/public/markdown_vis.ts b/src/plugins/vis_type_markdown/public/markdown_vis.ts
index e698316dc8e70..adfdb811cc28c 100644
--- a/src/plugins/vis_type_markdown/public/markdown_vis.ts
+++ b/src/plugins/vis_type_markdown/public/markdown_vis.ts
@@ -11,10 +11,11 @@ import { i18n } from '@kbn/i18n';
import { MarkdownOptions } from './markdown_options';
import { SettingsOptions } from './settings_options_lazy';
import { DefaultEditorSize } from '../../vis_default_editor/public';
-import { VisGroups } from '../../visualizations/public';
+import { VisGroups, VisTypeDefinition } from '../../visualizations/public';
import { toExpressionAst } from './to_ast';
+import { MarkdownVisParams } from './types';
-export const markdownVisDefinition = {
+export const markdownVisDefinition: VisTypeDefinition = {
name: 'markdown',
title: 'Markdown',
isAccessible: true,
@@ -58,7 +59,5 @@ export const markdownVisDefinition = {
showTimePicker: false,
showFilterBar: false,
},
- requestHandler: 'none',
- responseHandler: 'none',
inspectorAdapters: {},
};
diff --git a/src/plugins/vis_type_markdown/public/settings_options.tsx b/src/plugins/vis_type_markdown/public/settings_options.tsx
index 4ebcc88a8c04f..c18f1305d778a 100644
--- a/src/plugins/vis_type_markdown/public/settings_options.tsx
+++ b/src/plugins/vis_type_markdown/public/settings_options.tsx
@@ -10,10 +10,11 @@ import React from 'react';
import { EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import { VisOptionsProps, SwitchOption, RangeOption } from '../../vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
+import { SwitchOption, RangeOption } from '../../vis_default_editor/public';
import { MarkdownVisParams } from './types';
-function SettingsOptions({ stateParams, setValue }: VisOptionsProps) {
+function SettingsOptions({ stateParams, setValue }: VisEditorOptionsProps) {
return (
{
+export const toExpressionAst: VisToExpressionAst = (vis) => {
const { markdown, fontSize, openLinksInNewTab } = vis.params;
const markdownVis = buildExpressionFunction(
diff --git a/src/plugins/vis_type_metric/public/__snapshots__/metric_vis_fn.test.ts.snap b/src/plugins/vis_type_metric/public/__snapshots__/metric_vis_fn.test.ts.snap
index fd8f3a712d8ae..a212cec2d8827 100644
--- a/src/plugins/vis_type_metric/public/__snapshots__/metric_vis_fn.test.ts.snap
+++ b/src/plugins/vis_type_metric/public/__snapshots__/metric_vis_fn.test.ts.snap
@@ -5,9 +5,6 @@ Object {
"as": "metric_vis",
"type": "render",
"value": Object {
- "params": Object {
- "listenOnChange": true,
- },
"visConfig": Object {
"dimensions": Object {
"metrics": undefined,
diff --git a/src/plugins/vis_type_metric/public/__snapshots__/to_ast.test.ts.snap b/src/plugins/vis_type_metric/public/__snapshots__/to_ast.test.ts.snap
index a89f41737d7bc..46e86c4c25de1 100644
--- a/src/plugins/vis_type_metric/public/__snapshots__/to_ast.test.ts.snap
+++ b/src/plugins/vis_type_metric/public/__snapshots__/to_ast.test.ts.snap
@@ -37,6 +37,9 @@ Object {
"percentageMode": Array [
true,
],
+ "showLabels": Array [
+ false,
+ ],
},
"function": "metricVis",
"type": "function",
@@ -79,7 +82,11 @@ Object {
"type": "function",
},
Object {
- "arguments": Object {},
+ "arguments": Object {
+ "showLabels": Array [
+ false,
+ ],
+ },
"function": "metricVis",
"type": "function",
},
diff --git a/src/plugins/vis_type_metric/public/components/metric_vis_options.tsx b/src/plugins/vis_type_metric/public/components/metric_vis_options.tsx
index c8448ae68c074..069690b58e2a0 100644
--- a/src/plugins/vis_type_metric/public/components/metric_vis_options.tsx
+++ b/src/plugins/vis_type_metric/public/components/metric_vis_options.tsx
@@ -18,10 +18,10 @@ import {
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import {
ColorRanges,
SetColorRangeValue,
- VisOptionsProps,
SwitchOption,
SetColorSchemaOptionsValue,
ColorSchemaOptions,
@@ -37,7 +37,7 @@ function MetricVisOptions({
setTouched,
vis,
uiState,
-}: VisOptionsProps) {
+}: VisEditorOptionsProps) {
const setMetricValue: (
paramName: T,
value: MetricVisParam[T]
diff --git a/src/plugins/vis_type_metric/public/metric_vis_fn.ts b/src/plugins/vis_type_metric/public/metric_vis_fn.ts
index 892523493fb78..083d0413161b2 100644
--- a/src/plugins/vis_type_metric/public/metric_vis_fn.ts
+++ b/src/plugins/vis_type_metric/public/metric_vis_fn.ts
@@ -39,7 +39,6 @@ export interface MetricVisRenderValue {
visType: typeof visType;
visData: Input;
visConfig: Pick;
- params: any;
}
export type MetricVisExpressionFunctionDefinition = ExpressionFunctionDefinition<
@@ -194,9 +193,6 @@ export const createMetricVisFn = (): MetricVisExpressionFunctionDefinition => ({
},
dimensions,
},
- params: {
- listenOnChange: true,
- },
},
};
},
diff --git a/src/plugins/vis_type_metric/public/metric_vis_type.ts b/src/plugins/vis_type_metric/public/metric_vis_type.ts
index cd4357574950d..e81d8f071c4f0 100644
--- a/src/plugins/vis_type_metric/public/metric_vis_type.ts
+++ b/src/plugins/vis_type_metric/public/metric_vis_type.ts
@@ -9,11 +9,12 @@
import { i18n } from '@kbn/i18n';
import { MetricVisOptions } from './components/metric_vis_options';
import { ColorSchemas, colorSchemas, ColorMode } from '../../charts/public';
-import { BaseVisTypeOptions } from '../../visualizations/public';
+import { VisTypeDefinition } from '../../visualizations/public';
import { AggGroupNames } from '../../data/public';
import { toExpressionAst } from './to_ast';
+import { VisParams } from './types';
-export const createMetricVisTypeDefinition = (): BaseVisTypeOptions => ({
+export const createMetricVisTypeDefinition = (): VisTypeDefinition => ({
name: 'metric',
title: i18n.translate('visTypeMetric.metricTitle', { defaultMessage: 'Metric' }),
icon: 'visMetric',
@@ -110,4 +111,5 @@ export const createMetricVisTypeDefinition = (): BaseVisTypeOptions => ({
},
],
},
+ requiresSearch: true,
});
diff --git a/src/plugins/vis_type_metric/public/to_ast.test.ts b/src/plugins/vis_type_metric/public/to_ast.test.ts
index fb90b27391c83..871b2ca0dc379 100644
--- a/src/plugins/vis_type_metric/public/to_ast.test.ts
+++ b/src/plugins/vis_type_metric/public/to_ast.test.ts
@@ -6,14 +6,17 @@
* Public License, v 1.
*/
+import { TimefilterContract } from 'src/plugins/data/public';
+import { Vis } from 'src/plugins/visualizations/public';
+
import { toExpressionAst } from './to_ast';
-import { Vis } from '../../visualizations/public';
+import { VisParams } from './types';
describe('metric vis toExpressionAst function', () => {
- let vis: Vis;
+ let vis: Vis;
beforeEach(() => {
- vis = {
+ vis = ({
isHierarchical: () => false,
type: {},
params: {
@@ -26,18 +29,22 @@ describe('metric vis toExpressionAst function', () => {
aggs: [],
} as any,
},
- } as any;
+ } as unknown) as Vis;
});
it('without params', () => {
- vis.params = { metric: {} };
- const actual = toExpressionAst(vis, {});
+ vis.params = { metric: {} } as VisParams;
+ const actual = toExpressionAst(vis, {
+ timefilter: {} as TimefilterContract,
+ });
expect(actual).toMatchSnapshot();
});
it('with percentage mode should have percentage format', () => {
- vis.params = { metric: { percentageMode: true } };
- const actual = toExpressionAst(vis, {});
+ vis.params = { metric: { percentageMode: true } } as VisParams;
+ const actual = toExpressionAst(vis, {
+ timefilter: {} as TimefilterContract,
+ });
expect(actual).toMatchSnapshot();
});
});
diff --git a/src/plugins/vis_type_metric/public/to_ast.ts b/src/plugins/vis_type_metric/public/to_ast.ts
index 3b95b0c841016..3addce7610f2e 100644
--- a/src/plugins/vis_type_metric/public/to_ast.ts
+++ b/src/plugins/vis_type_metric/public/to_ast.ts
@@ -7,13 +7,14 @@
*/
import { get } from 'lodash';
-import { getVisSchemas, SchemaConfig, Vis } from '../../visualizations/public';
+import { getVisSchemas, SchemaConfig, VisToExpressionAst } from '../../visualizations/public';
import { buildExpression, buildExpressionFunction } from '../../expressions/public';
import { MetricVisExpressionFunctionDefinition } from './metric_vis_fn';
import {
EsaggsExpressionFunctionDefinition,
IndexPatternLoadExpressionFunctionDefinition,
} from '../../data/public';
+import { VisParams } from './types';
const prepareDimension = (params: SchemaConfig) => {
const visdimension = buildExpressionFunction('visdimension', { accessor: params.accessor });
@@ -26,7 +27,7 @@ const prepareDimension = (params: SchemaConfig) => {
return buildExpression([visdimension]);
};
-export const toExpressionAst = (vis: Vis, params: any) => {
+export const toExpressionAst: VisToExpressionAst = (vis, params) => {
const esaggs = buildExpressionFunction('esaggs', {
index: buildExpression([
buildExpressionFunction('indexPatternLoad', {
@@ -34,7 +35,7 @@ export const toExpressionAst = (vis: Vis, params: any) => {
}),
]),
metricsAtAllLevels: vis.isHierarchical(),
- partialRows: vis.params.showPartialRows || false,
+ partialRows: false,
aggs: vis.data.aggs!.aggs.map((agg) => buildExpression(agg.toExpressionAst())),
});
@@ -65,7 +66,7 @@ export const toExpressionAst = (vis: Vis, params: any) => {
colorMode: metricColorMode,
useRanges,
invertColors,
- showLabels: labels && labels.show,
+ showLabels: labels?.show ?? false,
});
if (style) {
diff --git a/src/plugins/vis_type_table/public/components/table_vis_options.tsx b/src/plugins/vis_type_table/public/components/table_vis_options.tsx
index a70ecb43f1be7..163dae7ddc1c6 100644
--- a/src/plugins/vis_type_table/public/components/table_vis_options.tsx
+++ b/src/plugins/vis_type_table/public/components/table_vis_options.tsx
@@ -12,13 +12,9 @@ import { EuiIconTip, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { search } from '../../../data/public';
-import {
- SwitchOption,
- SelectOption,
- NumberInputOption,
- VisOptionsProps,
-} from '../../../vis_default_editor/public';
+import { SwitchOption, SelectOption, NumberInputOption } from '../../../vis_default_editor/public';
import { TableVisParams } from '../../common';
import { totalAggregations } from './utils';
@@ -29,7 +25,7 @@ function TableOptions({
stateParams,
setValidity,
setValue,
-}: VisOptionsProps) {
+}: VisEditorOptionsProps) {
const percentageColumns = useMemo(
() => [
{
diff --git a/src/plugins/vis_type_table/public/components/table_vis_options_lazy.tsx b/src/plugins/vis_type_table/public/components/table_vis_options_lazy.tsx
index 716b77e9c91d2..2f7369996634a 100644
--- a/src/plugins/vis_type_table/public/components/table_vis_options_lazy.tsx
+++ b/src/plugins/vis_type_table/public/components/table_vis_options_lazy.tsx
@@ -8,12 +8,13 @@
import React, { lazy, Suspense } from 'react';
import { EuiLoadingSpinner } from '@elastic/eui';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { TableVisParams } from '../../common';
const TableOptionsComponent = lazy(() => import('./table_vis_options'));
-export const TableOptions = (props: VisOptionsProps) => (
+export const TableOptions = (props: VisEditorOptionsProps) => (
}>
diff --git a/src/plugins/vis_type_table/public/legacy/table_vis_legacy_type.ts b/src/plugins/vis_type_table/public/legacy/table_vis_legacy_type.ts
index 3e1140275593d..53ad67ab4dd94 100644
--- a/src/plugins/vis_type_table/public/legacy/table_vis_legacy_type.ts
+++ b/src/plugins/vis_type_table/public/legacy/table_vis_legacy_type.ts
@@ -8,14 +8,14 @@
import { i18n } from '@kbn/i18n';
import { AggGroupNames } from '../../../data/public';
-import { BaseVisTypeOptions } from '../../../visualizations/public';
+import { VisTypeDefinition } from '../../../visualizations/public';
import { TableOptions } from '../components/table_vis_options_lazy';
import { VIS_EVENT_TO_TRIGGER } from '../../../visualizations/public';
import { TableVisParams, VIS_TYPE_TABLE } from '../../common';
import { toExpressionAst } from '../to_ast';
-export const tableVisLegacyTypeDefinition: BaseVisTypeOptions = {
+export const tableVisLegacyTypeDefinition: VisTypeDefinition = {
name: VIS_TYPE_TABLE,
title: i18n.translate('visTypeTable.tableVisTitle', {
defaultMessage: 'Data table',
@@ -81,4 +81,5 @@ export const tableVisLegacyTypeDefinition: BaseVisTypeOptions =
},
toExpressionAst,
hierarchicalData: (vis) => vis.params.showPartialRows || vis.params.showMetricsAtAllLevels,
+ requiresSearch: true,
};
diff --git a/src/plugins/vis_type_table/public/table_vis_type.ts b/src/plugins/vis_type_table/public/table_vis_type.ts
index ef6d85db103b3..92148a5f085b0 100644
--- a/src/plugins/vis_type_table/public/table_vis_type.ts
+++ b/src/plugins/vis_type_table/public/table_vis_type.ts
@@ -7,15 +7,14 @@
*/
import { i18n } from '@kbn/i18n';
-import { AggGroupNames } from '../../data/public';
-import { BaseVisTypeOptions } from '../../visualizations/public';
+import { AggGroupNames } from '../../data/public';
+import { VIS_EVENT_TO_TRIGGER, VisTypeDefinition } from '../../visualizations/public';
import { TableVisParams, VIS_TYPE_TABLE } from '../common';
import { TableOptions } from './components/table_vis_options_lazy';
-import { VIS_EVENT_TO_TRIGGER } from '../../../plugins/visualizations/public';
import { toExpressionAst } from './to_ast';
-export const tableVisTypeDefinition: BaseVisTypeOptions = {
+export const tableVisTypeDefinition: VisTypeDefinition = {
name: VIS_TYPE_TABLE,
title: i18n.translate('visTypeTable.tableVisTitle', {
defaultMessage: 'Data table',
@@ -78,4 +77,5 @@ export const tableVisTypeDefinition: BaseVisTypeOptions = {
},
toExpressionAst,
hierarchicalData: (vis) => vis.params.showPartialRows || vis.params.showMetricsAtAllLevels,
+ requiresSearch: true,
};
diff --git a/src/plugins/vis_type_table/public/to_ast.ts b/src/plugins/vis_type_table/public/to_ast.ts
index 1cbe9832e4c98..ba79d82947d06 100644
--- a/src/plugins/vis_type_table/public/to_ast.ts
+++ b/src/plugins/vis_type_table/public/to_ast.ts
@@ -11,7 +11,7 @@ import {
IndexPatternLoadExpressionFunctionDefinition,
} from '../../data/public';
import { buildExpression, buildExpressionFunction } from '../../expressions/public';
-import { getVisSchemas, Vis, BuildPipelineParams } from '../../visualizations/public';
+import { getVisSchemas, VisToExpressionAst } from '../../visualizations/public';
import { TableVisParams } from '../common';
import { TableExpressionFunctionDefinition } from './table_vis_fn';
import { TableVisConfig } from './types';
@@ -41,7 +41,7 @@ const buildTableVisConfig = (
return visConfig;
};
-export const toExpressionAst = (vis: Vis, params: BuildPipelineParams) => {
+export const toExpressionAst: VisToExpressionAst = (vis, params) => {
const esaggs = buildExpressionFunction('esaggs', {
index: buildExpression([
buildExpressionFunction('indexPatternLoad', {
diff --git a/src/plugins/vis_type_tagcloud/public/components/tag_cloud_options.tsx b/src/plugins/vis_type_tagcloud/public/components/tag_cloud_options.tsx
index 2bcae41fae566..d15772b3fdb18 100644
--- a/src/plugins/vis_type_tagcloud/public/components/tag_cloud_options.tsx
+++ b/src/plugins/vis_type_tagcloud/public/components/tag_cloud_options.tsx
@@ -9,11 +9,12 @@
import React from 'react';
import { EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import { VisOptionsProps, SelectOption, SwitchOption } from '../../../vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
+import { SelectOption, SwitchOption } from '../../../vis_default_editor/public';
import { ValidatedDualRange } from '../../../kibana_react/public';
import { TagCloudVisParams } from '../types';
-function TagCloudOptions({ stateParams, setValue, vis }: VisOptionsProps) {
+function TagCloudOptions({ stateParams, setValue, vis }: VisEditorOptionsProps) {
const handleFontSizeChange = ([minFontSize, maxFontSize]: [string | number, string | number]) => {
setValue('minFontSize', Number(minFontSize));
setValue('maxFontSize', Number(maxFontSize));
diff --git a/src/plugins/vis_type_tagcloud/public/tag_cloud_type.ts b/src/plugins/vis_type_tagcloud/public/tag_cloud_type.ts
index 8159192b3491a..ebfa8db41944c 100644
--- a/src/plugins/vis_type_tagcloud/public/tag_cloud_type.ts
+++ b/src/plugins/vis_type_tagcloud/public/tag_cloud_type.ts
@@ -7,6 +7,7 @@
*/
import { i18n } from '@kbn/i18n';
+import { AggGroupNames } from '../../data/public';
import { VIS_EVENT_TO_TRIGGER } from '../../visualizations/public';
import { TagCloudOptions } from './components/tag_cloud_options';
@@ -78,7 +79,7 @@ export const tagCloudVisTypeDefinition = {
optionsTemplate: TagCloudOptions,
schemas: [
{
- group: 'metrics',
+ group: AggGroupNames.Metrics,
name: 'metric',
title: i18n.translate('visTypeTagCloud.vis.schemas.metricTitle', {
defaultMessage: 'Tag size',
@@ -96,7 +97,7 @@ export const tagCloudVisTypeDefinition = {
defaults: [{ schema: 'metric', type: 'count' }],
},
{
- group: 'buckets',
+ group: AggGroupNames.Buckets,
name: 'segment',
title: i18n.translate('visTypeTagCloud.vis.schemas.segmentTitle', {
defaultMessage: 'Tags',
@@ -107,4 +108,5 @@ export const tagCloudVisTypeDefinition = {
},
],
},
+ requiresSearch: true,
};
diff --git a/src/plugins/vis_type_tagcloud/public/to_ast.ts b/src/plugins/vis_type_tagcloud/public/to_ast.ts
index adde82dd0dda9..1d9b24235b7ff 100644
--- a/src/plugins/vis_type_tagcloud/public/to_ast.ts
+++ b/src/plugins/vis_type_tagcloud/public/to_ast.ts
@@ -11,7 +11,7 @@ import {
IndexPatternLoadExpressionFunctionDefinition,
} from '../../data/public';
import { buildExpression, buildExpressionFunction } from '../../expressions/public';
-import { getVisSchemas, SchemaConfig, Vis, BuildPipelineParams } from '../../visualizations/public';
+import { getVisSchemas, SchemaConfig, VisToExpressionAst } from '../../visualizations/public';
import { TagcloudExpressionFunctionDefinition } from './tag_cloud_fn';
import { TagCloudVisParams } from './types';
@@ -26,7 +26,7 @@ const prepareDimension = (params: SchemaConfig) => {
return buildExpression([visdimension]);
};
-export const toExpressionAst = (vis: Vis, params: BuildPipelineParams) => {
+export const toExpressionAst: VisToExpressionAst = (vis, params) => {
const esaggs = buildExpressionFunction('esaggs', {
index: buildExpression([
buildExpressionFunction('indexPatternLoad', {
diff --git a/src/plugins/vis_type_timelion/public/timelion_options.tsx b/src/plugins/vis_type_timelion/public/timelion_options.tsx
index 4627a5d5c8657..e366ec98f4be0 100644
--- a/src/plugins/vis_type_timelion/public/timelion_options.tsx
+++ b/src/plugins/vis_type_timelion/public/timelion_options.tsx
@@ -9,7 +9,7 @@
import React, { useCallback } from 'react';
import { EuiPanel } from '@elastic/eui';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { KibanaContextProvider } from '../../kibana_react/public';
import { TimelionVisParams } from './timelion_vis_fn';
@@ -18,7 +18,7 @@ import { TimelionVisDependencies } from './plugin';
import './timelion_options.scss';
-export type TimelionOptionsProps = VisOptionsProps;
+export type TimelionOptionsProps = VisEditorOptionsProps;
function TimelionOptions({
services,
diff --git a/src/plugins/vis_type_timelion/public/timelion_vis_type.tsx b/src/plugins/vis_type_timelion/public/timelion_vis_type.tsx
index 21344fc794c98..c9780ec6bcd1c 100644
--- a/src/plugins/vis_type_timelion/public/timelion_vis_type.tsx
+++ b/src/plugins/vis_type_timelion/public/timelion_vis_type.tsx
@@ -10,7 +10,6 @@ import React, { lazy } from 'react';
import { i18n } from '@kbn/i18n';
import { DefaultEditorSize } from '../../vis_default_editor/public';
-import { getTimelionRequestHandler } from './helpers/timelion_request_handler';
import { TimelionOptionsProps } from './timelion_options';
import { TimelionVisDependencies } from './plugin';
import { toExpressionAst } from './to_ast';
@@ -22,8 +21,6 @@ const TimelionOptions = lazy(() => import('./timelion_options'));
export const TIMELION_VIS_NAME = 'timelion';
export function getTimelionVisDefinition(dependencies: TimelionVisDependencies) {
- const timelionRequestHandler = getTimelionRequestHandler(dependencies);
-
// return the visType object, which kibana will use to display and configure new
// Vis object of this type.
return {
@@ -45,9 +42,7 @@ export function getTimelionVisDefinition(dependencies: TimelionVisDependencies)
),
defaultSize: DefaultEditorSize.MEDIUM,
},
- requestHandler: timelionRequestHandler,
toExpressionAst,
- responseHandler: 'none',
inspectorAdapters: {},
getSupportedTriggers: () => {
return [VIS_EVENT_TO_TRIGGER.applyFilter];
@@ -57,5 +52,6 @@ export function getTimelionVisDefinition(dependencies: TimelionVisDependencies)
showQueryBar: false,
showFilterBar: false,
},
+ requiresSearch: true,
};
}
diff --git a/src/plugins/vis_type_timelion/server/plugin.ts b/src/plugins/vis_type_timelion/server/plugin.ts
index f999c1dfc773a..fca557efc01e3 100644
--- a/src/plugins/vis_type_timelion/server/plugin.ts
+++ b/src/plugins/vis_type_timelion/server/plugin.ts
@@ -173,6 +173,7 @@ export class Plugin {
defaultMessage: '{experimentalLabel} Your API key from www.quandl.com',
values: { experimentalLabel: `[${experimentalLabel}]` },
}),
+ sensitive: true,
category: ['timelion'],
schema: schema.string(),
},
diff --git a/src/plugins/vis_type_vega/public/components/vega_vis_editor.tsx b/src/plugins/vis_type_vega/public/components/vega_vis_editor.tsx
index 7afc01adec385..0a54a74b6b68c 100644
--- a/src/plugins/vis_type_vega/public/components/vega_vis_editor.tsx
+++ b/src/plugins/vis_type_vega/public/components/vega_vis_editor.tsx
@@ -13,7 +13,7 @@ import hjson from 'hjson';
import 'brace/mode/hjson';
import { i18n } from '@kbn/i18n';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { getNotifications } from '../services';
import { VisParams } from '../vega_fn';
import { VegaHelpMenu } from './vega_help_menu';
@@ -55,7 +55,7 @@ function format(
}
}
-function VegaVisEditor({ stateParams, setValue }: VisOptionsProps) {
+function VegaVisEditor({ stateParams, setValue }: VisEditorOptionsProps) {
const onChange = useCallback(
(value: string) => {
setValue('spec', value);
diff --git a/src/plugins/vis_type_vega/public/components/vega_vis_editor_lazy.tsx b/src/plugins/vis_type_vega/public/components/vega_vis_editor_lazy.tsx
index 875f13453cf6d..bd26424552038 100644
--- a/src/plugins/vis_type_vega/public/components/vega_vis_editor_lazy.tsx
+++ b/src/plugins/vis_type_vega/public/components/vega_vis_editor_lazy.tsx
@@ -8,11 +8,11 @@
import React, { lazy } from 'react';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { VisParams } from '../vega_fn';
const VegaVisEditor = lazy(() => import('./vega_vis_editor'));
-export const VegaVisEditorComponent = (props: VisOptionsProps) => (
+export const VegaVisEditorComponent = (props: VisEditorOptionsProps) => (
);
diff --git a/src/plugins/vis_type_vega/public/plugin.ts b/src/plugins/vis_type_vega/public/plugin.ts
index b74b686500e6d..376ef84de23c3 100644
--- a/src/plugins/vis_type_vega/public/plugin.ts
+++ b/src/plugins/vis_type_vega/public/plugin.ts
@@ -84,7 +84,7 @@ export class VegaPlugin implements Plugin, void> {
expressions.registerFunction(() => createVegaFn(visualizationDependencies));
expressions.registerRenderer(getVegaVisRenderer(visualizationDependencies));
- visualizations.createBaseVisualization(createVegaTypeDefinition(visualizationDependencies));
+ visualizations.createBaseVisualization(createVegaTypeDefinition());
}
public start(core: CoreStart, { data }: VegaPluginStartDependencies) {
diff --git a/src/plugins/vis_type_vega/public/vega_type.ts b/src/plugins/vis_type_vega/public/vega_type.ts
index 66e4b8b98056f..4b2ec65850030 100644
--- a/src/plugins/vis_type_vega/public/vega_type.ts
+++ b/src/plugins/vis_type_vega/public/vega_type.ts
@@ -8,16 +8,13 @@
import { i18n } from '@kbn/i18n';
import { parse } from 'hjson';
-import type { BaseVisTypeOptions } from 'src/plugins/visualizations/public';
import { DefaultEditorSize } from '../../vis_default_editor/public';
-import type { VegaVisualizationDependencies } from './plugin';
+import { VIS_EVENT_TO_TRIGGER, VisGroups, VisTypeDefinition } from '../../visualizations/public';
-import { createVegaRequestHandler } from './vega_request_handler';
import { getDefaultSpec } from './default_spec';
import { extractIndexPatternsFromSpec } from './lib/extract_index_pattern';
import { createInspectorAdapters } from './vega_inspector';
-import { VIS_EVENT_TO_TRIGGER, VisGroups } from '../../visualizations/public';
import { toExpressionAst } from './to_ast';
import { getInfoMessage } from './components/experimental_map_vis_info';
import { VegaVisEditorComponent } from './components/vega_vis_editor_lazy';
@@ -25,11 +22,7 @@ import { VegaVisEditorComponent } from './components/vega_vis_editor_lazy';
import type { VegaSpec } from './data_model/types';
import type { VisParams } from './vega_fn';
-export const createVegaTypeDefinition = (
- dependencies: VegaVisualizationDependencies
-): BaseVisTypeOptions => {
- const requestHandler = createVegaRequestHandler(dependencies);
-
+export const createVegaTypeDefinition = (): VisTypeDefinition => {
return {
name: 'vega',
title: 'Vega',
@@ -52,7 +45,6 @@ export const createVegaTypeDefinition = (
enableAutoApply: true,
defaultSize: DefaultEditorSize.MEDIUM,
},
- requestHandler,
toExpressionAst,
options: {
showIndexSelection: false,
@@ -73,5 +65,9 @@ export const createVegaTypeDefinition = (
return [];
},
inspectorAdapters: createInspectorAdapters,
+ /**
+ * This is necessary for showing actions bar in top of vega editor
+ */
+ requiresSearch: true,
};
};
diff --git a/src/plugins/vis_type_vislib/public/area.ts b/src/plugins/vis_type_vislib/public/area.ts
index 7458d0a44ecae..cbb705f4cce5d 100644
--- a/src/plugins/vis_type_vislib/public/area.ts
+++ b/src/plugins/vis_type_vislib/public/area.ts
@@ -7,13 +7,12 @@
*/
import { xyVisTypes } from '../../vis_type_xy/public';
-import { BaseVisTypeOptions } from '../../visualizations/public';
+import { VisTypeDefinition } from '../../visualizations/public';
import { toExpressionAst } from './to_ast';
import { BasicVislibParams } from './types';
-export const areaVisTypeDefinition: BaseVisTypeOptions = {
- ...(xyVisTypes.area() as BaseVisTypeOptions),
+export const areaVisTypeDefinition = {
+ ...xyVisTypes.area(),
toExpressionAst,
- visualization: undefined,
-};
+} as VisTypeDefinition;
diff --git a/src/plugins/vis_type_vislib/public/editor/components/gauge/index.tsx b/src/plugins/vis_type_vislib/public/editor/components/gauge/index.tsx
index fa0091b2082b7..e9651954ed302 100644
--- a/src/plugins/vis_type_vislib/public/editor/components/gauge/index.tsx
+++ b/src/plugins/vis_type_vislib/public/editor/components/gauge/index.tsx
@@ -9,20 +9,20 @@
import React, { useCallback } from 'react';
import { EuiSpacer } from '@elastic/eui';
-import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { GaugeVisParams } from '../../../gauge';
import { RangesPanel } from './ranges_panel';
import { StylePanel } from './style_panel';
import { LabelsPanel } from './labels_panel';
-export type GaugeOptionsInternalProps = VisOptionsProps & {
+export type GaugeOptionsInternalProps = VisEditorOptionsProps & {
setGaugeValue: (
paramName: T,
value: GaugeVisParams['gauge'][T]
) => void;
};
-function GaugeOptions(props: VisOptionsProps) {
+function GaugeOptions(props: VisEditorOptionsProps) {
const { stateParams, setValue } = props;
const setGaugeValue: GaugeOptionsInternalProps['setGaugeValue'] = useCallback(
diff --git a/src/plugins/vis_type_vislib/public/editor/components/heatmap/index.tsx b/src/plugins/vis_type_vislib/public/editor/components/heatmap/index.tsx
index 7092615d9fcaf..2dd4b06a52288 100644
--- a/src/plugins/vis_type_vislib/public/editor/components/heatmap/index.tsx
+++ b/src/plugins/vis_type_vislib/public/editor/components/heatmap/index.tsx
@@ -12,9 +12,9 @@ import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { ValueAxis } from '../../../../../vis_type_xy/public';
import {
- VisOptionsProps,
BasicOptions,
SelectOption,
SwitchOption,
@@ -28,7 +28,7 @@ import {
import { HeatmapVisParams } from '../../../heatmap';
import { LabelsPanel } from './labels_panel';
-function HeatmapOptions(props: VisOptionsProps) {
+function HeatmapOptions(props: VisEditorOptionsProps) {
const { stateParams, vis, uiState, setValue, setValidity, setTouched } = props;
const [valueAxis] = stateParams.valueAxes;
const isColorsNumberInvalid = stateParams.colorsNumber < 2 || stateParams.colorsNumber > 10;
diff --git a/src/plugins/vis_type_vislib/public/editor/components/heatmap/labels_panel.tsx b/src/plugins/vis_type_vislib/public/editor/components/heatmap/labels_panel.tsx
index cc224f8e1c6aa..ff98a494ad906 100644
--- a/src/plugins/vis_type_vislib/public/editor/components/heatmap/labels_panel.tsx
+++ b/src/plugins/vis_type_vislib/public/editor/components/heatmap/labels_panel.tsx
@@ -12,7 +12,8 @@ import { EuiColorPicker, EuiFormRow, EuiPanel, EuiSpacer, EuiTitle } from '@elas
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
-import { VisOptionsProps, SwitchOption } from '../../../../../vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
+import { SwitchOption } from '../../../../../vis_default_editor/public';
import { ValueAxis } from '../../../../../vis_type_xy/public';
import { HeatmapVisParams } from '../../../heatmap';
@@ -21,7 +22,7 @@ const VERTICAL_ROTATION = 270;
interface LabelsPanelProps {
valueAxis: ValueAxis;
- setValue: VisOptionsProps['setValue'];
+ setValue: VisEditorOptionsProps['setValue'];
}
function LabelsPanel({ valueAxis, setValue }: LabelsPanelProps) {
diff --git a/src/plugins/vis_type_vislib/public/editor/components/index.tsx b/src/plugins/vis_type_vislib/public/editor/components/index.tsx
index 264c3066f13fe..6c6181246d6db 100644
--- a/src/plugins/vis_type_vislib/public/editor/components/index.tsx
+++ b/src/plugins/vis_type_vislib/public/editor/components/index.tsx
@@ -8,8 +8,7 @@
import React, { lazy } from 'react';
-import { VisOptionsProps } from '../../../../vis_default_editor/public';
-
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
import { GaugeVisParams } from '../../gauge';
import { PieVisParams } from '../../pie';
import { HeatmapVisParams } from '../../heatmap';
@@ -18,12 +17,14 @@ const GaugeOptionsLazy = lazy(() => import('./gauge'));
const PieOptionsLazy = lazy(() => import('./pie'));
const HeatmapOptionsLazy = lazy(() => import('./heatmap'));
-export const GaugeOptions = (props: VisOptionsProps) => (
+export const GaugeOptions = (props: VisEditorOptionsProps) => (
);
-export const PieOptions = (props: VisOptionsProps) => ;
+export const PieOptions = (props: VisEditorOptionsProps) => (
+
+);
-export const HeatmapOptions = (props: VisOptionsProps) => (
+export const HeatmapOptions = (props: VisEditorOptionsProps) => (
);
diff --git a/src/plugins/vis_type_vislib/public/editor/components/pie.tsx b/src/plugins/vis_type_vislib/public/editor/components/pie.tsx
index 863b11c6a3fcf..e0ea1fcee4881 100644
--- a/src/plugins/vis_type_vislib/public/editor/components/pie.tsx
+++ b/src/plugins/vis_type_vislib/public/editor/components/pie.tsx
@@ -12,12 +12,13 @@ import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
-import { BasicOptions, SwitchOption, VisOptionsProps } from '../../../../vis_default_editor/public';
+import { VisEditorOptionsProps } from 'src/plugins/visualizations/public';
+import { BasicOptions, SwitchOption } from '../../../../vis_default_editor/public';
import { TruncateLabelsOption } from '../../../../vis_type_xy/public';
import { PieVisParams } from '../../pie';
-function PieOptions(props: VisOptionsProps) {
+function PieOptions(props: VisEditorOptionsProps) {
const { stateParams, setValue } = props;
const setLabels = (
paramName: T,
diff --git a/src/plugins/vis_type_vislib/public/gauge.ts b/src/plugins/vis_type_vislib/public/gauge.ts
index 5dc59f62edffd..e0c63fd15e3d7 100644
--- a/src/plugins/vis_type_vislib/public/gauge.ts
+++ b/src/plugins/vis_type_vislib/public/gauge.ts
@@ -11,9 +11,9 @@ import { i18n } from '@kbn/i18n';
import { ColorMode, ColorSchemas, ColorSchemaParams, Labels, Style } from '../../charts/public';
import { RangeValues } from '../../vis_default_editor/public';
import { AggGroupNames } from '../../data/public';
-import { BaseVisTypeOptions, VIS_EVENT_TO_TRIGGER } from '../../visualizations/public';
+import { VisTypeDefinition, VIS_EVENT_TO_TRIGGER } from '../../visualizations/public';
-import { Alignment, GaugeType, BasicVislibParams, VislibChartType } from './types';
+import { Alignment, GaugeType, VislibChartType } from './types';
import { getGaugeCollections } from './editor';
import { toExpressionAst } from './to_ast';
import { GaugeOptions } from './editor/components';
@@ -46,7 +46,7 @@ export interface GaugeVisParams {
gauge: Gauge;
}
-export const gaugeVisTypeDefinition: BaseVisTypeOptions = {
+export const gaugeVisTypeDefinition: VisTypeDefinition = {
name: 'gauge',
title: i18n.translate('visTypeVislib.gauge.gaugeTitle', { defaultMessage: 'Gauge' }),
icon: 'visGauge',
@@ -135,5 +135,5 @@ export const gaugeVisTypeDefinition: BaseVisTypeOptions = {
},
],
},
- useCustomNoDataScreen: true,
+ requiresSearch: true,
};
diff --git a/src/plugins/vis_type_vislib/public/goal.ts b/src/plugins/vis_type_vislib/public/goal.ts
index 55a9f83daa4ab..6565ae53f3104 100644
--- a/src/plugins/vis_type_vislib/public/goal.ts
+++ b/src/plugins/vis_type_vislib/public/goal.ts
@@ -10,13 +10,14 @@ import { i18n } from '@kbn/i18n';
import { AggGroupNames } from '../../data/public';
import { ColorMode, ColorSchemas } from '../../charts/public';
-import { BaseVisTypeOptions } from '../../visualizations/public';
+import { VisTypeDefinition } from '../../visualizations/public';
import { getGaugeCollections, GaugeOptions } from './editor';
import { toExpressionAst } from './to_ast';
-import { GaugeType, BasicVislibParams } from './types';
+import { GaugeType } from './types';
+import { GaugeVisParams } from './gauge';
-export const goalVisTypeDefinition: BaseVisTypeOptions = {
+export const goalVisTypeDefinition: VisTypeDefinition = {
name: 'goal',
title: i18n.translate('visTypeVislib.goal.goalTitle', { defaultMessage: 'Goal' }),
icon: 'visGoal',
@@ -98,5 +99,5 @@ export const goalVisTypeDefinition: BaseVisTypeOptions = {
},
],
},
- useCustomNoDataScreen: true,
+ requiresSearch: true,
};
diff --git a/src/plugins/vis_type_vislib/public/heatmap.ts b/src/plugins/vis_type_vislib/public/heatmap.ts
index 8f891263e354a..1b1f4c6530fef 100644
--- a/src/plugins/vis_type_vislib/public/heatmap.ts
+++ b/src/plugins/vis_type_vislib/public/heatmap.ts
@@ -12,12 +12,12 @@ import { Position } from '@elastic/charts';
import { RangeValues } from '../../vis_default_editor/public';
import { AggGroupNames } from '../../data/public';
import { ColorSchemas, ColorSchemaParams } from '../../charts/public';
-import { VIS_EVENT_TO_TRIGGER, BaseVisTypeOptions } from '../../visualizations/public';
+import { VIS_EVENT_TO_TRIGGER, VisTypeDefinition } from '../../visualizations/public';
import { ValueAxis, ScaleType, AxisType } from '../../vis_type_xy/public';
import { HeatmapOptions, getHeatmapCollections } from './editor';
import { TimeMarker } from './vislib/visualizations/time_marker';
-import { CommonVislibParams, BasicVislibParams, VislibChartType } from './types';
+import { CommonVislibParams, VislibChartType } from './types';
import { toExpressionAst } from './to_ast';
export interface HeatmapVisParams extends CommonVislibParams, ColorSchemaParams {
@@ -32,7 +32,7 @@ export interface HeatmapVisParams extends CommonVislibParams, ColorSchemaParams
times: TimeMarker[];
}
-export const heatmapVisTypeDefinition: BaseVisTypeOptions = {
+export const heatmapVisTypeDefinition: VisTypeDefinition = {
name: 'heatmap',
title: i18n.translate('visTypeVislib.heatmap.heatmapTitle', { defaultMessage: 'Heat map' }),
icon: 'heatmap',
@@ -127,4 +127,5 @@ export const heatmapVisTypeDefinition: BaseVisTypeOptions = {
},
],
},
+ requiresSearch: true,
};
diff --git a/src/plugins/vis_type_vislib/public/histogram.ts b/src/plugins/vis_type_vislib/public/histogram.ts
index 8116b40e9522e..5162df2e6d985 100644
--- a/src/plugins/vis_type_vislib/public/histogram.ts
+++ b/src/plugins/vis_type_vislib/public/histogram.ts
@@ -7,13 +7,12 @@
*/
import { xyVisTypes } from '../../vis_type_xy/public';
-import { BaseVisTypeOptions } from '../../visualizations/public';
+import { VisTypeDefinition } from '../../visualizations/public';
import { toExpressionAst } from './to_ast';
import { BasicVislibParams } from './types';
-export const histogramVisTypeDefinition: BaseVisTypeOptions = {
- ...(xyVisTypes.histogram() as BaseVisTypeOptions),
+export const histogramVisTypeDefinition = {
+ ...xyVisTypes.histogram(),
toExpressionAst,
- visualization: undefined,
-};
+} as VisTypeDefinition |