From 156fb3d33c83bb7c455e0cbfa0ada5217612fa1b Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Wed, 13 Jan 2021 07:30:21 -0400 Subject: [PATCH 01/22] [Fleet] Only display logs UI for agent >= 7.11 (#87926) --- .../components/agent_logs/agent_logs.tsx | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx index 95c630e3b3686..7326d2efb8565 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_logs/agent_logs.tsx @@ -15,6 +15,8 @@ import { EuiFilterGroup, EuiPanel, EuiButtonEmpty, + EuiCallOut, + EuiLink, } from '@elastic/eui'; import useMeasure from 'react-use/lib/useMeasure'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -184,7 +186,7 @@ export const AgentLogsUI: React.FunctionComponent = memo(({ agen const [logsPanelRef, { height: logPanelHeight }] = useMeasure(); const agentVersion = agent.local_metadata?.elastic?.agent?.version; - const isLogLevelSelectionAvailable = useMemo(() => { + const isLogFeatureAvailable = useMemo(() => { if (!agentVersion) { return false; } @@ -195,6 +197,31 @@ export const AgentLogsUI: React.FunctionComponent = memo(({ agen return semverGte(agentVersionWithPrerelease, '7.11.0'); }, [agentVersion]); + if (!isLogFeatureAvailable) { + return ( + + + + ), + }} + /> + } + /> + ); + } + return ( @@ -271,11 +298,9 @@ export const AgentLogsUI: React.FunctionComponent = memo(({ agen /> - {isLogLevelSelectionAvailable && ( - - - - )} + + + ); }); From cea39d90b7dceb95b8bf510144a30ad1bd874f9a Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 13 Jan 2021 13:31:24 +0100 Subject: [PATCH 02/22] close popover on repeated button click (#87834) --- .../operations/definitions/terms/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx index 625084000fa93..fae086506f015 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx @@ -259,7 +259,7 @@ export const termsOperation: OperationDefinition { - setPopoverOpen(true); + setPopoverOpen(!popoverOpen); }} > {i18n.translate('xpack.lens.indexPattern.terms.advancedSettings', { From ed9479738de169cedca589bafc81d89e2cbf843d Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 13 Jan 2021 13:32:14 +0100 Subject: [PATCH 03/22] make sure filter object is persistable (#87828) --- .../public/persistence/filter_references.test.ts | 12 ++++++++++++ .../lens/public/persistence/filter_references.ts | 8 ++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/lens/public/persistence/filter_references.test.ts b/x-pack/plugins/lens/public/persistence/filter_references.test.ts index 23c0cd1d11f1b..02b99c1b63ee5 100644 --- a/x-pack/plugins/lens/public/persistence/filter_references.test.ts +++ b/x-pack/plugins/lens/public/persistence/filter_references.test.ts @@ -56,6 +56,18 @@ describe('filter saved object references', () => { `); }); + it('should remove index and value from persistable filter', () => { + const { persistableFilters } = extractFilterReferences([ + { ...filters[0], meta: { ...filters[0].meta, value: 'CN' } }, + { ...filters[1], meta: { ...filters[1].meta, value: 'US' } }, + ]); + expect(persistableFilters.length).toBe(2); + persistableFilters.forEach((filter) => { + expect(filter.meta.hasOwnProperty('index')).toBe(false); + expect(filter.meta.hasOwnProperty('value')).toBe(false); + }); + }); + it('should restore the same filter after extracting and injecting', () => { const { persistableFilters, references } = extractFilterReferences(filters); expect(injectFilterReferences(persistableFilters, references)).toEqual(filters); diff --git a/x-pack/plugins/lens/public/persistence/filter_references.ts b/x-pack/plugins/lens/public/persistence/filter_references.ts index 47564e510ce9c..0dca0941662c7 100644 --- a/x-pack/plugins/lens/public/persistence/filter_references.ts +++ b/x-pack/plugins/lens/public/persistence/filter_references.ts @@ -22,14 +22,18 @@ export function extractFilterReferences( type: 'index-pattern', id: filterRow.meta.index, }); - return { + const newFilter = { ...filterRow, meta: { ...filterRow.meta, indexRefName: refName, - index: undefined, }, }; + // remove index because it's specified by indexRefName + delete newFilter.meta.index; + // remove value because it can't be persisted + delete newFilter.meta.value; + return newFilter; }); return { persistableFilters, references }; From c0ab3200851f1195330e982afdb0f3ee556a1168 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 13 Jan 2021 13:57:49 +0100 Subject: [PATCH 04/22] [Console] Add functional test to check for basic autocomplete functionality (#87331) * added first pass at functional test * refactor console autocomplete test to be more robust * remove unused variable * refactored test to use data-test-subj where possible * remove unused value Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../editor/legacy/console_editor/editor.tsx | 3 +- test/functional/apps/console/_console.ts | 11 ++++-- test/functional/page_objects/console_page.ts | 34 +++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx index abef8afcc3985..4abc37a455d05 100644 --- a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx +++ b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.tsx @@ -97,6 +97,7 @@ function EditorUI({ initialTextValue }: EditorProps) { if (textareaElement) { textareaElement.setAttribute('id', inputId); + textareaElement.setAttribute('data-test-subj', 'console-textarea'); } const readQueryParams = () => { @@ -204,7 +205,7 @@ function EditorUI({ initialTextValue }: EditorProps) { }, [sendCurrentRequestToES, openDocumentation]); return ( -
+
    { - const editor = await find.byCssSelector('.conApp'); + const editor = await PageObjects.console.getEditor(); await browser.setWindowSize(1300, 1100); const initialSize = await editor.getSize(); await browser.setWindowSize(1000, 1100); const afterSize = await editor.getSize(); expect(initialSize.width).to.be.greaterThan(afterSize.width); }); + + it('should provide basic auto-complete functionality', async () => { + // Ensure that the text area can be interacted with + await PageObjects.console.dismissTutorial(); + expect(await PageObjects.console.hasAutocompleter()).to.be(false); + await PageObjects.console.promptAutocomplete(); + retry.waitFor('autocomplete to be visible', () => PageObjects.console.hasAutocompleter()); + }); }); } diff --git a/test/functional/page_objects/console_page.ts b/test/functional/page_objects/console_page.ts index f67a2722da367..5b0fcd0d331b5 100644 --- a/test/functional/page_objects/console_page.ts +++ b/test/functional/page_objects/console_page.ts @@ -17,12 +17,14 @@ * under the License. */ +import { Key } from 'selenium-webdriver'; import { FtrProviderContext } from '../ftr_provider_context'; import { WebElementWrapper } from '../services/lib/web_element_wrapper'; export function ConsolePageProvider({ getService }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const retry = getService('retry'); + const find = getService('find'); class ConsolePage { public async getVisibleTextFromAceEditor(editor: WebElementWrapper) { @@ -79,6 +81,38 @@ export function ConsolePageProvider({ getService }: FtrProviderContext) { public async getRequestFontSize() { return await this.getFontSize(await this.getRequestEditor()); } + + public async getEditor() { + return testSubjects.find('console-application'); + } + + public async dismissTutorial() { + try { + const closeButton = await testSubjects.find('help-close-button'); + await closeButton.click(); + } catch (e) { + // Ignore because it is probably not there. + } + } + + public async promptAutocomplete() { + // This focusses the cursor on the bottom of the text area + const editor = await this.getEditor(); + const content = await editor.findByCssSelector('.ace_content'); + await content.click(); + const textArea = await testSubjects.find('console-textarea'); + // There should be autocomplete for this on all license levels + await textArea.pressKeys('\nGET s'); + await textArea.pressKeys([Key.CONTROL, Key.SPACE]); + } + + public async hasAutocompleter(): Promise { + try { + return Boolean(await find.byCssSelector('.ace_autocomplete')); + } catch (e) { + return false; + } + } } return new ConsolePage(); From 2c8b518f6921061f6f646f26e17275bf976dd15f Mon Sep 17 00:00:00 2001 From: ymao1 Date: Wed, 13 Jan 2021 08:01:08 -0500 Subject: [PATCH 05/22] =?UTF-8?q?Fixes=20Failing=20test:=20Chrome=20X-Pack?= =?UTF-8?q?=20UI=20Functional=20Tests.x-pack/test/functional=5Fwith=5Fes?= =?UTF-8?q?=5Fssl/apps/triggers=5Factions=5Fui/alerts=5Flist=C2=B7ts=20-?= =?UTF-8?q?=20Actions=20and=20Triggers=20app=20alerts=20list=20should=20di?= =?UTF-8?q?splay=20total=20alerts=20by=20status=20and=20error=20banner=20o?= =?UTF-8?q?nly=20when=20exists=20alerts=20with=20status=20error=20(#88119)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Unskipping test * Adding refresh before checking status --- .../apps/triggers_actions_ui/alerts_list.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts index 36812d0cd9eef..ca753e9253bde 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/alerts_list.ts @@ -53,8 +53,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await testSubjects.click('alertsTab'); } - // Failing: See https://github.com/elastic/kibana/issues/87105 - describe.skip('alerts list', function () { + describe('alerts list', function () { before(async () => { await pageObjects.common.navigateToApp('triggersActions'); await testSubjects.click('alertsTab'); @@ -407,6 +406,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { ).to.equal('Error found in 1 alert.'); }); + await refreshAlertsList(); expect(await testSubjects.getVisibleText('totalAlertsCount')).to.be( 'Showing: 2 of 2 alerts.' ); From 5167e731df37d0e7805bfe6e4e1f9cd56d169a8b Mon Sep 17 00:00:00 2001 From: Diana Derevyankina <54894989+DziyanaDzeraviankina@users.noreply.github.com> Date: Wed, 13 Jan 2021 16:08:02 +0300 Subject: [PATCH 06/22] Advanced input does not work for visualizations (#88154) * Advanced input does not work for visualizations * Remove unnecessary imports and update tests --- .../search/aggs/buckets/date_histogram_fn.test.ts | 8 +------- .../common/search/aggs/buckets/date_histogram_fn.ts | 1 - .../common/search/aggs/buckets/date_range_fn.test.ts | 9 +-------- .../data/common/search/aggs/buckets/date_range_fn.ts | 1 - .../data/common/search/aggs/buckets/filter_fn.test.ts | 8 +------- .../data/common/search/aggs/buckets/filter_fn.ts | 1 - .../data/common/search/aggs/buckets/filters_fn.test.ts | 8 +------- .../data/common/search/aggs/buckets/filters_fn.ts | 1 - .../common/search/aggs/buckets/geo_hash_fn.test.ts | 9 +-------- .../data/common/search/aggs/buckets/geo_hash_fn.ts | 1 - .../common/search/aggs/buckets/geo_tile_fn.test.ts | 9 +-------- .../data/common/search/aggs/buckets/geo_tile_fn.ts | 2 -- .../common/search/aggs/buckets/histogram_fn.test.ts | 10 +--------- .../data/common/search/aggs/buckets/histogram_fn.ts | 1 - .../common/search/aggs/buckets/ip_range_fn.test.ts | 10 +--------- .../data/common/search/aggs/buckets/ip_range_fn.ts | 1 - .../data/common/search/aggs/buckets/range_fn.test.ts | 9 +-------- .../data/common/search/aggs/buckets/range_fn.ts | 1 - .../common/search/aggs/buckets/shard_delay_fn.test.ts | 9 +-------- .../data/common/search/aggs/buckets/shard_delay_fn.ts | 2 -- .../search/aggs/buckets/significant_terms_fn.test.ts | 8 +------- .../common/search/aggs/buckets/significant_terms_fn.ts | 2 -- .../data/common/search/aggs/buckets/terms_fn.test.ts | 10 +--------- .../data/common/search/aggs/buckets/terms_fn.ts | 2 -- .../data/common/search/aggs/metrics/avg_fn.test.ts | 8 +------- src/plugins/data/common/search/aggs/metrics/avg_fn.ts | 2 -- .../common/search/aggs/metrics/bucket_avg_fn.test.ts | 7 +------ .../data/common/search/aggs/metrics/bucket_avg_fn.ts | 2 -- .../common/search/aggs/metrics/bucket_max_fn.test.ts | 7 +------ .../data/common/search/aggs/metrics/bucket_max_fn.ts | 2 -- .../common/search/aggs/metrics/bucket_min_fn.test.ts | 7 +------ .../data/common/search/aggs/metrics/bucket_min_fn.ts | 2 -- .../common/search/aggs/metrics/bucket_sum_fn.test.ts | 7 +------ .../data/common/search/aggs/metrics/bucket_sum_fn.ts | 2 -- .../common/search/aggs/metrics/cardinality_fn.test.ts | 8 +------- .../data/common/search/aggs/metrics/cardinality_fn.ts | 2 -- .../search/aggs/metrics/cumulative_sum_fn.test.ts | 8 +------- .../common/search/aggs/metrics/cumulative_sum_fn.ts | 2 -- .../common/search/aggs/metrics/derivative_fn.test.ts | 8 +------- .../data/common/search/aggs/metrics/derivative_fn.ts | 2 -- .../common/search/aggs/metrics/geo_bounds_fn.test.ts | 8 +------- .../data/common/search/aggs/metrics/geo_bounds_fn.ts | 2 -- .../common/search/aggs/metrics/geo_centroid_fn.test.ts | 8 +------- .../data/common/search/aggs/metrics/geo_centroid_fn.ts | 2 -- .../data/common/search/aggs/metrics/max_fn.test.ts | 8 +------- src/plugins/data/common/search/aggs/metrics/max_fn.ts | 2 -- .../data/common/search/aggs/metrics/median_fn.test.ts | 8 +------- .../data/common/search/aggs/metrics/median_fn.ts | 2 -- .../data/common/search/aggs/metrics/min_fn.test.ts | 8 +------- src/plugins/data/common/search/aggs/metrics/min_fn.ts | 2 -- .../common/search/aggs/metrics/moving_avg_fn.test.ts | 8 +------- .../data/common/search/aggs/metrics/moving_avg_fn.ts | 2 -- .../search/aggs/metrics/percentile_ranks_fn.test.ts | 8 +------- .../common/search/aggs/metrics/percentile_ranks_fn.ts | 2 -- .../common/search/aggs/metrics/percentiles_fn.test.ts | 8 +------- .../data/common/search/aggs/metrics/percentiles_fn.ts | 2 -- .../common/search/aggs/metrics/serial_diff_fn.test.ts | 8 +------- .../data/common/search/aggs/metrics/serial_diff_fn.ts | 2 -- .../search/aggs/metrics/std_deviation_fn.test.ts | 8 +------- .../common/search/aggs/metrics/std_deviation_fn.ts | 2 -- .../data/common/search/aggs/metrics/sum_fn.test.ts | 8 +------- src/plugins/data/common/search/aggs/metrics/sum_fn.ts | 2 -- .../data/common/search/aggs/metrics/top_hit_fn.test.ts | 9 +-------- .../data/common/search/aggs/metrics/top_hit_fn.ts | 2 -- 64 files changed, 32 insertions(+), 288 deletions(-) diff --git a/src/plugins/data/common/search/aggs/buckets/date_histogram_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/date_histogram_fn.test.ts index bd3c4f8dd58cf..5edbf6fc4eac2 100644 --- a/src/plugins/data/common/search/aggs/buckets/date_histogram_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/date_histogram_fn.test.ts @@ -108,13 +108,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/date_histogram_fn.ts b/src/plugins/data/common/search/aggs/buckets/date_histogram_fn.ts index 3e3895b7b50db..55a43864879c4 100644 --- a/src/plugins/data/common/search/aggs/buckets/date_histogram_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/date_histogram_fn.ts @@ -152,7 +152,6 @@ export const aggDateHistogram = (): FunctionDefinition => ({ ...rest, timeRange: getParsedValue(args, 'timeRange'), extended_bounds: getParsedValue(args, 'extended_bounds'), - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/buckets/date_range_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/date_range_fn.test.ts index 93bb791874e67..2aa6a3a1f6fab 100644 --- a/src/plugins/data/common/search/aggs/buckets/date_range_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/date_range_fn.test.ts @@ -88,14 +88,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - field: 'date_field', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/date_range_fn.ts b/src/plugins/data/common/search/aggs/buckets/date_range_fn.ts index 0dc66be5b84f2..c09c87b8b9afd 100644 --- a/src/plugins/data/common/search/aggs/buckets/date_range_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/date_range_fn.ts @@ -107,7 +107,6 @@ export const aggDateRange = (): FunctionDefinition => ({ type: BUCKET_TYPES.DATE_RANGE, params: { ...rest, - json: getParsedValue(args, 'json'), ranges: getParsedValue(args, 'ranges'), }, }, diff --git a/src/plugins/data/common/search/aggs/buckets/filter_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/filter_fn.test.ts index c820a73b0a894..1d85b7dba8bd1 100644 --- a/src/plugins/data/common/search/aggs/buckets/filter_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/filter_fn.test.ts @@ -73,13 +73,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/filter_fn.ts b/src/plugins/data/common/search/aggs/buckets/filter_fn.ts index 8c8c0f430184a..07ed11e2249b1 100644 --- a/src/plugins/data/common/search/aggs/buckets/filter_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/filter_fn.ts @@ -95,7 +95,6 @@ export const aggFilter = (): FunctionDefinition => ({ type: BUCKET_TYPES.FILTER, params: { ...rest, - json: getParsedValue(args, 'json'), geo_bounding_box: getParsedValue(args, 'geo_bounding_box'), }, }, diff --git a/src/plugins/data/common/search/aggs/buckets/filters_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/filters_fn.test.ts index 99c4f7d8c2b65..da29afec1e1e6 100644 --- a/src/plugins/data/common/search/aggs/buckets/filters_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/filters_fn.test.ts @@ -79,13 +79,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/filters_fn.ts b/src/plugins/data/common/search/aggs/buckets/filters_fn.ts index 194feb67d3366..ccf9232d14d3f 100644 --- a/src/plugins/data/common/search/aggs/buckets/filters_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/filters_fn.ts @@ -90,7 +90,6 @@ export const aggFilters = (): FunctionDefinition => ({ params: { ...rest, filters: getParsedValue(args, 'filters'), - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/buckets/geo_hash_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/geo_hash_fn.test.ts index 07ab8e66f1def..1fbb69d7dd182 100644 --- a/src/plugins/data/common/search/aggs/buckets/geo_hash_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/geo_hash_fn.test.ts @@ -99,14 +99,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - field: 'geo_field', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/geo_hash_fn.ts b/src/plugins/data/common/search/aggs/buckets/geo_hash_fn.ts index aa5f473f73f9d..cbd901a438eb4 100644 --- a/src/plugins/data/common/search/aggs/buckets/geo_hash_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/geo_hash_fn.ts @@ -126,7 +126,6 @@ export const aggGeoHash = (): FunctionDefinition => ({ params: { ...rest, boundingBox: getParsedValue(args, 'boundingBox'), - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/buckets/geo_tile_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/geo_tile_fn.test.ts index bfaf47ede8734..78bf16e8f067c 100644 --- a/src/plugins/data/common/search/aggs/buckets/geo_tile_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/geo_tile_fn.test.ts @@ -78,14 +78,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - field: 'geo_field', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/geo_tile_fn.ts b/src/plugins/data/common/search/aggs/buckets/geo_tile_fn.ts index 346c70bba31fd..1e7258ea7da53 100644 --- a/src/plugins/data/common/search/aggs/buckets/geo_tile_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/geo_tile_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, BUCKET_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggGeoTileFnName = 'aggGeoTile'; @@ -105,7 +104,6 @@ export const aggGeoTile = (): FunctionDefinition => ({ type: BUCKET_TYPES.GEOTILE_GRID, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/buckets/histogram_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/histogram_fn.test.ts index 354946f99a2f5..4a8e785da2974 100644 --- a/src/plugins/data/common/search/aggs/buckets/histogram_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/histogram_fn.test.ts @@ -98,15 +98,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - field: 'field', - interval: '10', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/histogram_fn.ts b/src/plugins/data/common/search/aggs/buckets/histogram_fn.ts index 62dbc7ca8ca45..6b5e2d02b271b 100644 --- a/src/plugins/data/common/search/aggs/buckets/histogram_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/histogram_fn.ts @@ -135,7 +135,6 @@ export const aggHistogram = (): FunctionDefinition => ({ params: { ...rest, extended_bounds: getParsedValue(args, 'extended_bounds'), - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/buckets/ip_range_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/ip_range_fn.test.ts index 5940345b25890..462672cf5dffe 100644 --- a/src/plugins/data/common/search/aggs/buckets/ip_range_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/ip_range_fn.test.ts @@ -88,15 +88,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - field: 'ip_field', - ipRangeType: IP_RANGE_TYPES.FROM_TO, - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/ip_range_fn.ts b/src/plugins/data/common/search/aggs/buckets/ip_range_fn.ts index 7ad61a9c27d86..92eedc35ce61b 100644 --- a/src/plugins/data/common/search/aggs/buckets/ip_range_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/ip_range_fn.ts @@ -110,7 +110,6 @@ export const aggIpRange = (): FunctionDefinition => ({ type: BUCKET_TYPES.IP_RANGE, params: { ...rest, - json: getParsedValue(args, 'json'), ranges: getParsedValue(args, 'ranges'), }, }, diff --git a/src/plugins/data/common/search/aggs/buckets/range_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/range_fn.test.ts index 93ae4490196a8..1a08cc1adaa28 100644 --- a/src/plugins/data/common/search/aggs/buckets/range_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/range_fn.test.ts @@ -87,14 +87,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - field: 'number_field', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/range_fn.ts b/src/plugins/data/common/search/aggs/buckets/range_fn.ts index a52b2427b9845..f3d662ced8fcf 100644 --- a/src/plugins/data/common/search/aggs/buckets/range_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/range_fn.ts @@ -102,7 +102,6 @@ export const aggRange = (): FunctionDefinition => ({ type: BUCKET_TYPES.RANGE, params: { ...rest, - json: getParsedValue(args, 'json'), ranges: getParsedValue(args, 'ranges'), }, }, diff --git a/src/plugins/data/common/search/aggs/buckets/shard_delay_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/shard_delay_fn.test.ts index 89281490167b3..d2c1fc77d0514 100644 --- a/src/plugins/data/common/search/aggs/buckets/shard_delay_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/shard_delay_fn.test.ts @@ -52,14 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - - expect(() => { - fn({ - delay: '1000ms', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/shard_delay_fn.ts b/src/plugins/data/common/search/aggs/buckets/shard_delay_fn.ts index 87f80192ca3cd..d13138ad43dad 100644 --- a/src/plugins/data/common/search/aggs/buckets/shard_delay_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/shard_delay_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggConfigSerialized } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; import { AggParamsShardDelay, SHARD_DELAY_AGG_NAME } from './shard_delay'; export const aggShardDelayFnName = 'aggShardDelay'; @@ -93,7 +92,6 @@ export const aggShardDelay = (): FunctionDefinition => ({ type: SHARD_DELAY_AGG_NAME, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/buckets/significant_terms_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/significant_terms_fn.test.ts index 71be4e9cfa9ac..9e94654821913 100644 --- a/src/plugins/data/common/search/aggs/buckets/significant_terms_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/significant_terms_fn.test.ts @@ -84,13 +84,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/significant_terms_fn.ts b/src/plugins/data/common/search/aggs/buckets/significant_terms_fn.ts index a1a7500678fd6..2998200ccae76 100644 --- a/src/plugins/data/common/search/aggs/buckets/significant_terms_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/significant_terms_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, BUCKET_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggSignificantTermsFnName = 'aggSignificantTerms'; @@ -113,7 +112,6 @@ export const aggSignificantTerms = (): FunctionDefinition => ({ type: BUCKET_TYPES.SIGNIFICANT_TERMS, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/buckets/terms_fn.test.ts b/src/plugins/data/common/search/aggs/buckets/terms_fn.test.ts index 1384a9f17e4b6..9374497ddb664 100644 --- a/src/plugins/data/common/search/aggs/buckets/terms_fn.test.ts +++ b/src/plugins/data/common/search/aggs/buckets/terms_fn.test.ts @@ -154,15 +154,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - order: 'asc', - orderBy: '1', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/buckets/terms_fn.ts b/src/plugins/data/common/search/aggs/buckets/terms_fn.ts index 7737cb1e1c952..a0b491b4cb398 100644 --- a/src/plugins/data/common/search/aggs/buckets/terms_fn.ts +++ b/src/plugins/data/common/search/aggs/buckets/terms_fn.ts @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, BUCKET_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggTermsFnName = 'aggTerms'; @@ -160,7 +159,6 @@ export const aggTerms = (): FunctionDefinition => ({ params: { ...rest, orderAgg: args.orderAgg?.value, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/avg_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/avg_fn.test.ts index 0e2ee00df49dd..8162b6e7554f0 100644 --- a/src/plugins/data/common/search/aggs/metrics/avg_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/avg_fn.test.ts @@ -52,13 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/avg_fn.ts b/src/plugins/data/common/search/aggs/metrics/avg_fn.ts index 57dd3dae70fba..d28bd88095191 100644 --- a/src/plugins/data/common/search/aggs/metrics/avg_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/avg_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggAvgFnName = 'aggAvg'; @@ -87,7 +86,6 @@ export const aggAvg = (): FunctionDefinition => ({ type: METRIC_TYPES.AVG, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/bucket_avg_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/bucket_avg_fn.test.ts index 7e08bc9954510..7329ea57ade83 100644 --- a/src/plugins/data/common/search/aggs/metrics/bucket_avg_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/bucket_avg_fn.test.ts @@ -67,12 +67,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/bucket_avg_fn.ts b/src/plugins/data/common/search/aggs/metrics/bucket_avg_fn.ts index 595d49647d9c2..cfed0205f1b61 100644 --- a/src/plugins/data/common/search/aggs/metrics/bucket_avg_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/bucket_avg_fn.ts @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggBucketAvgFnName = 'aggBucketAvg'; @@ -104,7 +103,6 @@ export const aggBucketAvg = (): FunctionDefinition => ({ ...rest, customBucket: args.customBucket?.value, customMetric: args.customMetric?.value, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/bucket_max_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/bucket_max_fn.test.ts index b789bdf51ebd5..9e890331a848f 100644 --- a/src/plugins/data/common/search/aggs/metrics/bucket_max_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/bucket_max_fn.test.ts @@ -67,12 +67,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/bucket_max_fn.ts b/src/plugins/data/common/search/aggs/metrics/bucket_max_fn.ts index 482c73e7d3005..90a494f8cbc77 100644 --- a/src/plugins/data/common/search/aggs/metrics/bucket_max_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/bucket_max_fn.ts @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggBucketMaxFnName = 'aggBucketMax'; @@ -104,7 +103,6 @@ export const aggBucketMax = (): FunctionDefinition => ({ ...rest, customBucket: args.customBucket?.value, customMetric: args.customMetric?.value, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/bucket_min_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/bucket_min_fn.test.ts index 6ebc83417813b..8a03849769a9a 100644 --- a/src/plugins/data/common/search/aggs/metrics/bucket_min_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/bucket_min_fn.test.ts @@ -67,12 +67,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/bucket_min_fn.ts b/src/plugins/data/common/search/aggs/metrics/bucket_min_fn.ts index 68beffbf05660..8f48166887f25 100644 --- a/src/plugins/data/common/search/aggs/metrics/bucket_min_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/bucket_min_fn.ts @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggBucketMinFnName = 'aggBucketMin'; @@ -104,7 +103,6 @@ export const aggBucketMin = (): FunctionDefinition => ({ ...rest, customBucket: args.customBucket?.value, customMetric: args.customMetric?.value, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/bucket_sum_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/bucket_sum_fn.test.ts index 71549f41b1d15..ea26f58dd2f15 100644 --- a/src/plugins/data/common/search/aggs/metrics/bucket_sum_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/bucket_sum_fn.test.ts @@ -67,12 +67,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/bucket_sum_fn.ts b/src/plugins/data/common/search/aggs/metrics/bucket_sum_fn.ts index 7994bb85be2a7..d26f22b106c2f 100644 --- a/src/plugins/data/common/search/aggs/metrics/bucket_sum_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/bucket_sum_fn.ts @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggBucketSumFnName = 'aggBucketSum'; @@ -104,7 +103,6 @@ export const aggBucketSum = (): FunctionDefinition => ({ ...rest, customBucket: args.customBucket?.value, customMetric: args.customMetric?.value, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/cardinality_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/cardinality_fn.test.ts index 4008819018ee5..5045fccf921a3 100644 --- a/src/plugins/data/common/search/aggs/metrics/cardinality_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/cardinality_fn.test.ts @@ -52,13 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/cardinality_fn.ts b/src/plugins/data/common/search/aggs/metrics/cardinality_fn.ts index 6e78a42fea90f..e5599ab8599f7 100644 --- a/src/plugins/data/common/search/aggs/metrics/cardinality_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/cardinality_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggCardinalityFnName = 'aggCardinality'; @@ -92,7 +91,6 @@ export const aggCardinality = (): FunctionDefinition => ({ type: METRIC_TYPES.CARDINALITY, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/cumulative_sum_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/cumulative_sum_fn.test.ts index 3cf53e3da153e..48120f9bdc338 100644 --- a/src/plugins/data/common/search/aggs/metrics/cumulative_sum_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/cumulative_sum_fn.test.ts @@ -108,13 +108,7 @@ describe('agg_expression_functions', () => { buckets_path: 'the_sum', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - buckets_path: 'the_sum', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/cumulative_sum_fn.ts b/src/plugins/data/common/search/aggs/metrics/cumulative_sum_fn.ts index 040e26125079f..b20d03f06c854 100644 --- a/src/plugins/data/common/search/aggs/metrics/cumulative_sum_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/cumulative_sum_fn.ts @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggCumulativeSumFnName = 'aggCumulativeSum'; @@ -107,7 +106,6 @@ export const aggCumulativeSum = (): FunctionDefinition => ({ params: { ...rest, customMetric: args.customMetric?.value, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/derivative_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/derivative_fn.test.ts index 79ea7292104ee..602ef8e1de48b 100644 --- a/src/plugins/data/common/search/aggs/metrics/derivative_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/derivative_fn.test.ts @@ -108,13 +108,7 @@ describe('agg_expression_functions', () => { buckets_path: 'the_sum', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - buckets_path: 'the_sum', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/derivative_fn.ts b/src/plugins/data/common/search/aggs/metrics/derivative_fn.ts index 93ef0286a0c7e..b3fb448446c44 100644 --- a/src/plugins/data/common/search/aggs/metrics/derivative_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/derivative_fn.ts @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggDerivativeFnName = 'aggDerivative'; @@ -107,7 +106,6 @@ export const aggDerivative = (): FunctionDefinition => ({ params: { ...rest, customMetric: args.customMetric?.value, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/geo_bounds_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/geo_bounds_fn.test.ts index 96bd31916784a..3f85a874b0dd5 100644 --- a/src/plugins/data/common/search/aggs/metrics/geo_bounds_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/geo_bounds_fn.test.ts @@ -52,13 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/geo_bounds_fn.ts b/src/plugins/data/common/search/aggs/metrics/geo_bounds_fn.ts index af5ea3c80506c..1403d95371c1d 100644 --- a/src/plugins/data/common/search/aggs/metrics/geo_bounds_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/geo_bounds_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggGeoBoundsFnName = 'aggGeoBounds'; @@ -92,7 +91,6 @@ export const aggGeoBounds = (): FunctionDefinition => ({ type: METRIC_TYPES.GEO_BOUNDS, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/geo_centroid_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/geo_centroid_fn.test.ts index bf9a4548bafbf..aea6ee1f2c332 100644 --- a/src/plugins/data/common/search/aggs/metrics/geo_centroid_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/geo_centroid_fn.test.ts @@ -52,13 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/geo_centroid_fn.ts b/src/plugins/data/common/search/aggs/metrics/geo_centroid_fn.ts index 2c2d60711def3..9e36e07cbaf58 100644 --- a/src/plugins/data/common/search/aggs/metrics/geo_centroid_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/geo_centroid_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggGeoCentroidFnName = 'aggGeoCentroid'; @@ -92,7 +91,6 @@ export const aggGeoCentroid = (): FunctionDefinition => ({ type: METRIC_TYPES.GEO_CENTROID, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/max_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/max_fn.test.ts index 156b51ca54af5..b042b82a048c2 100644 --- a/src/plugins/data/common/search/aggs/metrics/max_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/max_fn.test.ts @@ -52,13 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/max_fn.ts b/src/plugins/data/common/search/aggs/metrics/max_fn.ts index 9624cd3012398..7f1e3b9ad9d69 100644 --- a/src/plugins/data/common/search/aggs/metrics/max_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/max_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggMaxFnName = 'aggMax'; @@ -87,7 +86,6 @@ export const aggMax = (): FunctionDefinition => ({ type: METRIC_TYPES.MAX, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/median_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/median_fn.test.ts index 69200c35426c8..def9197bc3444 100644 --- a/src/plugins/data/common/search/aggs/metrics/median_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/median_fn.test.ts @@ -52,13 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/median_fn.ts b/src/plugins/data/common/search/aggs/metrics/median_fn.ts index e2ea8ae0fe2e7..2323fa969c245 100644 --- a/src/plugins/data/common/search/aggs/metrics/median_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/median_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggMedianFnName = 'aggMedian'; @@ -92,7 +91,6 @@ export const aggMedian = (): FunctionDefinition => ({ type: METRIC_TYPES.MEDIAN, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/min_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/min_fn.test.ts index ef32d086e41f7..44d0f0f4f4607 100644 --- a/src/plugins/data/common/search/aggs/metrics/min_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/min_fn.test.ts @@ -52,13 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/min_fn.ts b/src/plugins/data/common/search/aggs/metrics/min_fn.ts index b880937eea2d7..40b2085a97e97 100644 --- a/src/plugins/data/common/search/aggs/metrics/min_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/min_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggMinFnName = 'aggMin'; @@ -87,7 +86,6 @@ export const aggMin = (): FunctionDefinition => ({ type: METRIC_TYPES.MIN, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/moving_avg_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/moving_avg_fn.test.ts index d6c0e6b2cbd6e..a9334480ec602 100644 --- a/src/plugins/data/common/search/aggs/metrics/moving_avg_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/moving_avg_fn.test.ts @@ -118,13 +118,7 @@ describe('agg_expression_functions', () => { buckets_path: 'the_sum', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - buckets_path: 'the_sum', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/moving_avg_fn.ts b/src/plugins/data/common/search/aggs/metrics/moving_avg_fn.ts index 85b7e536e66fc..5f30e088954c9 100644 --- a/src/plugins/data/common/search/aggs/metrics/moving_avg_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/moving_avg_fn.ts @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggMovingAvgFnName = 'aggMovingAvg'; @@ -120,7 +119,6 @@ export const aggMovingAvg = (): FunctionDefinition => ({ params: { ...rest, customMetric: args.customMetric?.value, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/percentile_ranks_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/percentile_ranks_fn.test.ts index e3ce91bafd40a..c9393f68ce404 100644 --- a/src/plugins/data/common/search/aggs/metrics/percentile_ranks_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/percentile_ranks_fn.test.ts @@ -81,13 +81,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/percentile_ranks_fn.ts b/src/plugins/data/common/search/aggs/metrics/percentile_ranks_fn.ts index 9bf35c4dba9ff..bd4c83c1bdbbb 100644 --- a/src/plugins/data/common/search/aggs/metrics/percentile_ranks_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/percentile_ranks_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggPercentileRanksFnName = 'aggPercentileRanks'; @@ -99,7 +98,6 @@ export const aggPercentileRanks = (): FunctionDefinition => ({ type: METRIC_TYPES.PERCENTILE_RANKS, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/percentiles_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/percentiles_fn.test.ts index 2074cc1d89527..4b8424b79b33a 100644 --- a/src/plugins/data/common/search/aggs/metrics/percentiles_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/percentiles_fn.test.ts @@ -81,13 +81,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/percentiles_fn.ts b/src/plugins/data/common/search/aggs/metrics/percentiles_fn.ts index d7bcefc23f711..0b5f5d4c1a890 100644 --- a/src/plugins/data/common/search/aggs/metrics/percentiles_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/percentiles_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggPercentilesFnName = 'aggPercentiles'; @@ -99,7 +98,6 @@ export const aggPercentiles = (): FunctionDefinition => ({ type: METRIC_TYPES.PERCENTILES, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/serial_diff_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/serial_diff_fn.test.ts index 1bb859ad4bad8..a3410401a38cf 100644 --- a/src/plugins/data/common/search/aggs/metrics/serial_diff_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/serial_diff_fn.test.ts @@ -108,13 +108,7 @@ describe('agg_expression_functions', () => { buckets_path: 'the_sum', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - json: '/// intentionally malformed json ///', - buckets_path: 'the_sum', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/serial_diff_fn.ts b/src/plugins/data/common/search/aggs/metrics/serial_diff_fn.ts index f3602f5519d5e..f2c5b152e2f2f 100644 --- a/src/plugins/data/common/search/aggs/metrics/serial_diff_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/serial_diff_fn.ts @@ -21,7 +21,6 @@ import { i18n } from '@kbn/i18n'; import { Assign } from '@kbn/utility-types'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggSerialDiffFnName = 'aggSerialDiff'; @@ -107,7 +106,6 @@ export const aggSerialDiff = (): FunctionDefinition => ({ params: { ...rest, customMetric: args.customMetric?.value, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/std_deviation_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/std_deviation_fn.test.ts index bfa6aa7cc4122..bbaa1d3eef3fc 100644 --- a/src/plugins/data/common/search/aggs/metrics/std_deviation_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/std_deviation_fn.test.ts @@ -52,13 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/std_deviation_fn.ts b/src/plugins/data/common/search/aggs/metrics/std_deviation_fn.ts index 2a3c1bd33e17d..d0dadf7e0078e 100644 --- a/src/plugins/data/common/search/aggs/metrics/std_deviation_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/std_deviation_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggStdDeviationFnName = 'aggStdDeviation'; @@ -92,7 +91,6 @@ export const aggStdDeviation = (): FunctionDefinition => ({ type: METRIC_TYPES.STD_DEV, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/sum_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/sum_fn.test.ts index 6e57632ba84cc..fed56246e087a 100644 --- a/src/plugins/data/common/search/aggs/metrics/sum_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/sum_fn.test.ts @@ -52,13 +52,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/sum_fn.ts b/src/plugins/data/common/search/aggs/metrics/sum_fn.ts index a42510dc594ad..d58231f732c9d 100644 --- a/src/plugins/data/common/search/aggs/metrics/sum_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/sum_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggSumFnName = 'aggSum'; @@ -87,7 +86,6 @@ export const aggSum = (): FunctionDefinition => ({ type: METRIC_TYPES.SUM, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; diff --git a/src/plugins/data/common/search/aggs/metrics/top_hit_fn.test.ts b/src/plugins/data/common/search/aggs/metrics/top_hit_fn.test.ts index d0e9788f85025..7251909e44c81 100644 --- a/src/plugins/data/common/search/aggs/metrics/top_hit_fn.test.ts +++ b/src/plugins/data/common/search/aggs/metrics/top_hit_fn.test.ts @@ -89,14 +89,7 @@ describe('agg_expression_functions', () => { json: '{ "foo": true }', }); - expect(actual.value.params.json).toEqual({ foo: true }); - expect(() => { - fn({ - field: 'machine.os.keyword', - aggregate: 'min', - json: '/// intentionally malformed json ///', - }); - }).toThrowErrorMatchingInlineSnapshot(`"Unable to parse json argument string"`); + expect(actual.value.params.json).toEqual('{ "foo": true }'); }); }); }); diff --git a/src/plugins/data/common/search/aggs/metrics/top_hit_fn.ts b/src/plugins/data/common/search/aggs/metrics/top_hit_fn.ts index 38a3bc6a59bfc..2636e9865df18 100644 --- a/src/plugins/data/common/search/aggs/metrics/top_hit_fn.ts +++ b/src/plugins/data/common/search/aggs/metrics/top_hit_fn.ts @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; import { AggExpressionType, AggExpressionFunctionArgs, METRIC_TYPES } from '../'; -import { getParsedValue } from '../utils/get_parsed_value'; export const aggTopHitFnName = 'aggTopHit'; @@ -119,7 +118,6 @@ export const aggTopHit = (): FunctionDefinition => ({ type: METRIC_TYPES.TOP_HITS, params: { ...rest, - json: getParsedValue(args, 'json'), }, }, }; From 7334b965164ac523297e652be6423d7924ec32e7 Mon Sep 17 00:00:00 2001 From: ymao1 Date: Wed, 13 Jan 2021 08:12:58 -0500 Subject: [PATCH 07/22] CSS fix for connector list (#87831) --- .../components/actions_connectors_list.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.scss b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.scss index 70ad1cae6c1d1..476c971cfbbff 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.scss +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/actions_connectors_list.scss @@ -5,7 +5,7 @@ color: $euiColorDarkShade; } - .euiLink + .euiIcon { + .euiLink + .euiToolTipAnchor { margin-left: $euiSizeXS; } } From 633495ef43752868bac52e1b03a30a634d7831cb Mon Sep 17 00:00:00 2001 From: Stratoula Kalafateli Date: Wed, 13 Jan 2021 15:56:28 +0200 Subject: [PATCH 08/22] [XY axis] Implement new palette service (#86876) * [XY Axis] New Palette service * Calculate all Series to map the colors correctly * remove commented out code * syncColors on XY plugin * Reset to false when no embeddable * Add unit test for getAllSeries function * Measure the usage of the selected palette * Minor adjustments * Update documentation for isSyncColorsEnabled method * Fix bug on changing palette on charts with no split series * Fix coloring for multiple y axis visualizations * Call getPalettes function from the renderer * Fullwidth palette picker * Fetch palette registry on the component and not on the renderer Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- ...ic.executioncontext.issynccolorsenabled.md | 13 ++ ...ins-expressions-public.executioncontext.md | 1 + ...er.executioncontext.issynccolorsenabled.md | 13 ++ ...ins-expressions-server.executioncontext.md | 1 + .../expressions/common/execution/execution.ts | 1 + .../expressions/common/execution/types.ts | 5 + .../common/service/expressions_services.ts | 2 + src/plugins/expressions/public/loader.ts | 2 + src/plugins/expressions/public/public.api.md | 1 + src/plugins/expressions/server/server.api.md | 1 + .../controls/palette_picker.test.tsx | 59 ++++++ .../components/controls/palette_picker.tsx | 75 +++++++ .../vis_default_editor/public/index.ts | 1 + .../point_series/elastic_charts_options.tsx | 34 ++- src/plugins/vis_type_xy/public/plugin.ts | 5 +- src/plugins/vis_type_xy/public/services.ts | 6 +- src/plugins/vis_type_xy/public/types/param.ts | 3 +- .../public/utils/get_all_series.test.ts | 193 ++++++++++++++++++ .../public/utils/get_all_series.ts | 62 ++++++ .../vis_type_xy/public/utils/index.tsx | 1 + .../vis_type_xy/public/vis_component.tsx | 71 +++++-- .../vis_type_xy/public/vis_renderer.tsx | 5 +- .../vis_type_xy/public/vis_types/area.tsx | 4 + .../public/vis_types/histogram.tsx | 4 + .../public/vis_types/horizontal_bar.tsx | 4 + .../vis_type_xy/public/vis_types/line.tsx | 4 + src/plugins/vis_type_xy/public/xy_vis_fn.ts | 2 + .../public/embeddable/visualize_embeddable.ts | 8 + .../visualization_migrations.test.ts | 7 + .../saved_objects/visualization_migrations.ts | 4 + 30 files changed, 567 insertions(+), 25 deletions(-) create mode 100644 docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.issynccolorsenabled.md create mode 100644 docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.issynccolorsenabled.md create mode 100644 src/plugins/vis_default_editor/public/components/controls/palette_picker.test.tsx create mode 100644 src/plugins/vis_default_editor/public/components/controls/palette_picker.tsx create mode 100644 src/plugins/vis_type_xy/public/utils/get_all_series.test.ts create mode 100644 src/plugins/vis_type_xy/public/utils/get_all_series.ts diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.issynccolorsenabled.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.issynccolorsenabled.md new file mode 100644 index 0000000000000..4a439a1e91316 --- /dev/null +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.issynccolorsenabled.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) > [ExecutionContext](./kibana-plugin-plugins-expressions-public.executioncontext.md) > [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-public.executioncontext.issynccolorsenabled.md) + +## ExecutionContext.isSyncColorsEnabled property + +Returns the state (true\|false) of the sync colors across panels switch. + +Signature: + +```typescript +isSyncColorsEnabled?: () => boolean; +``` diff --git a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.md b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.md index 1c0d10a382abf..901b46f0888d4 100644 --- a/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.md +++ b/docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.executioncontext.md @@ -22,6 +22,7 @@ export interface ExecutionContext() => ExecutionContextSearch | Get search context of the expression. | | [getSearchSessionId](./kibana-plugin-plugins-expressions-public.executioncontext.getsearchsessionid.md) | () => string | undefined | Search context in which expression should operate. | | [inspectorAdapters](./kibana-plugin-plugins-expressions-public.executioncontext.inspectoradapters.md) | InspectorAdapters | Adapters for inspector plugin. | +| [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-public.executioncontext.issynccolorsenabled.md) | () => boolean | Returns the state (true\|false) of the sync colors across panels switch. | | [types](./kibana-plugin-plugins-expressions-public.executioncontext.types.md) | Record<string, ExpressionType> | A map of available expression types. | | [variables](./kibana-plugin-plugins-expressions-public.executioncontext.variables.md) | Record<string, unknown> | Context variables that can be consumed using var and var_set functions. | diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.issynccolorsenabled.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.issynccolorsenabled.md new file mode 100644 index 0000000000000..24f7bb618deb8 --- /dev/null +++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.issynccolorsenabled.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) > [ExecutionContext](./kibana-plugin-plugins-expressions-server.executioncontext.md) > [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-server.executioncontext.issynccolorsenabled.md) + +## ExecutionContext.isSyncColorsEnabled property + +Returns the state (true\|false) of the sync colors across panels switch. + +Signature: + +```typescript +isSyncColorsEnabled?: () => boolean; +``` diff --git a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md index fbf9dc634d563..39018599a2c92 100644 --- a/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md +++ b/docs/development/plugins/expressions/server/kibana-plugin-plugins-expressions-server.executioncontext.md @@ -22,6 +22,7 @@ export interface ExecutionContext() => ExecutionContextSearch | Get search context of the expression. | | [getSearchSessionId](./kibana-plugin-plugins-expressions-server.executioncontext.getsearchsessionid.md) | () => string | undefined | Search context in which expression should operate. | | [inspectorAdapters](./kibana-plugin-plugins-expressions-server.executioncontext.inspectoradapters.md) | InspectorAdapters | Adapters for inspector plugin. | +| [isSyncColorsEnabled](./kibana-plugin-plugins-expressions-server.executioncontext.issynccolorsenabled.md) | () => boolean | Returns the state (true\|false) of the sync colors across panels switch. | | [types](./kibana-plugin-plugins-expressions-server.executioncontext.types.md) | Record<string, ExpressionType> | A map of available expression types. | | [variables](./kibana-plugin-plugins-expressions-server.executioncontext.variables.md) | Record<string, unknown> | Context variables that can be consumed using var and var_set functions. | diff --git a/src/plugins/expressions/common/execution/execution.ts b/src/plugins/expressions/common/execution/execution.ts index 609022f8a55c0..a1841d8fa3743 100644 --- a/src/plugins/expressions/common/execution/execution.ts +++ b/src/plugins/expressions/common/execution/execution.ts @@ -183,6 +183,7 @@ export class Execution< logDatatable: (name: string, datatable: Datatable) => { inspectorAdapters.tables[name] = datatable; }, + isSyncColorsEnabled: () => execution.params.syncColors, ...(execution.params as any).extraContext, }; } diff --git a/src/plugins/expressions/common/execution/types.ts b/src/plugins/expressions/common/execution/types.ts index a1b25c3802f4b..bac9cda128697 100644 --- a/src/plugins/expressions/common/execution/types.ts +++ b/src/plugins/expressions/common/execution/types.ts @@ -83,6 +83,11 @@ export interface ExecutionContext< type: string, id: string ) => Promise>; + + /** + * Returns the state (true|false) of the sync colors across panels switch. + */ + isSyncColorsEnabled?: () => boolean; } /** diff --git a/src/plugins/expressions/common/service/expressions_services.ts b/src/plugins/expressions/common/service/expressions_services.ts index ec1fffe64f102..3adf452ef8bd3 100644 --- a/src/plugins/expressions/common/service/expressions_services.ts +++ b/src/plugins/expressions/common/service/expressions_services.ts @@ -70,6 +70,8 @@ export interface ExpressionExecutionParams { searchSessionId?: string; + syncColors?: boolean; + inspectorAdapters?: Adapters; } diff --git a/src/plugins/expressions/public/loader.ts b/src/plugins/expressions/public/loader.ts index 1cf499ce2635a..4db070f88a17f 100644 --- a/src/plugins/expressions/public/loader.ts +++ b/src/plugins/expressions/public/loader.ts @@ -154,6 +154,7 @@ export class ExpressionLoader { inspectorAdapters: params.inspectorAdapters, searchSessionId: params.searchSessionId, debug: params.debug, + syncColors: params.syncColors, }); const prevDataHandler = this.execution; @@ -189,6 +190,7 @@ export class ExpressionLoader { if (params.searchSessionId && this.params) { this.params.searchSessionId = params.searchSessionId; } + this.params.syncColors = params.syncColors; this.params.debug = Boolean(params.debug); this.params.inspectorAdapters = (params.inspectorAdapters || diff --git a/src/plugins/expressions/public/public.api.md b/src/plugins/expressions/public/public.api.md index 5c018adc0131b..df24882f6eb58 100644 --- a/src/plugins/expressions/public/public.api.md +++ b/src/plugins/expressions/public/public.api.md @@ -143,6 +143,7 @@ export interface ExecutionContext ExecutionContextSearch; getSearchSessionId: () => string | undefined; inspectorAdapters: InspectorAdapters; + isSyncColorsEnabled?: () => boolean; types: Record; variables: Record; } diff --git a/src/plugins/expressions/server/server.api.md b/src/plugins/expressions/server/server.api.md index 71199560ee0c7..0f5c3c8ae8736 100644 --- a/src/plugins/expressions/server/server.api.md +++ b/src/plugins/expressions/server/server.api.md @@ -141,6 +141,7 @@ export interface ExecutionContext ExecutionContextSearch; getSearchSessionId: () => string | undefined; inspectorAdapters: InspectorAdapters; + isSyncColorsEnabled?: () => boolean; types: Record; variables: Record; } diff --git a/src/plugins/vis_default_editor/public/components/controls/palette_picker.test.tsx b/src/plugins/vis_default_editor/public/components/controls/palette_picker.test.tsx new file mode 100644 index 0000000000000..1b4d7e060296a --- /dev/null +++ b/src/plugins/vis_default_editor/public/components/controls/palette_picker.test.tsx @@ -0,0 +1,59 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { mountWithIntl } from '@kbn/test/jest'; +import { ReactWrapper } from 'enzyme'; +import { PalettePicker, PalettePickerProps } from './palette_picker'; +import { chartPluginMock } from '../../../../charts/public/mocks'; +import { EuiColorPalettePicker } from '@elastic/eui'; + +describe('PalettePicker', function () { + let props: PalettePickerProps<'palette'>; + let component: ReactWrapper>; + + beforeAll(() => { + props = { + palettes: chartPluginMock.createPaletteRegistry(), + paramName: 'palette', + activePalette: { + type: 'palette', + name: 'kibana_palette', + }, + setPalette: jest.fn(), + }; + }); + + it('renders the EuiPalettePicker', () => { + component = mountWithIntl(); + expect(component.find(EuiColorPalettePicker).length).toBe(1); + }); + + it('renders the default palette if not activePalette is given', function () { + const { activePalette, ...newProps } = props; + component = mountWithIntl(); + const palettePicker = component.find(EuiColorPalettePicker); + expect(palettePicker.props().valueOfSelected).toBe('default'); + }); + + it('renders the activePalette palette if given', function () { + component = mountWithIntl(); + const palettePicker = component.find(EuiColorPalettePicker); + expect(palettePicker.props().valueOfSelected).toBe('kibana_palette'); + }); +}); diff --git a/src/plugins/vis_default_editor/public/components/controls/palette_picker.tsx b/src/plugins/vis_default_editor/public/components/controls/palette_picker.tsx new file mode 100644 index 0000000000000..8985ded413d46 --- /dev/null +++ b/src/plugins/vis_default_editor/public/components/controls/palette_picker.tsx @@ -0,0 +1,75 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; +import { PaletteOutput, PaletteRegistry } from 'src/plugins/charts/public'; +import { EuiColorPalettePicker } from '@elastic/eui'; +import { EuiFormRow } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +export interface PalettePickerProps { + activePalette?: PaletteOutput; + palettes: PaletteRegistry; + paramName: ParamName; + setPalette: (paramName: ParamName, value: PaletteOutput) => void; +} + +export function PalettePicker({ + activePalette, + palettes, + paramName, + setPalette, +}: PalettePickerProps) { + return ( + + !internal) + .map(({ id, title, getColors }) => { + return { + value: id, + title, + type: 'fixed', + palette: getColors( + 10, + id === activePalette?.name ? activePalette?.params : undefined + ), + }; + })} + onChange={(newPalette) => { + setPalette(paramName, { + type: 'palette', + name: newPalette, + }); + }} + valueOfSelected={activePalette?.name || 'default'} + selectionDisplay={'palette'} + /> + + ); +} diff --git a/src/plugins/vis_default_editor/public/index.ts b/src/plugins/vis_default_editor/public/index.ts index 06834ab19c876..bd907095baeeb 100644 --- a/src/plugins/vis_default_editor/public/index.ts +++ b/src/plugins/vis_default_editor/public/index.ts @@ -23,6 +23,7 @@ import { VisDefaultEditorPlugin } from './plugin'; export { DefaultEditorController }; export { useValidation } from './components/controls/utils'; +export { PalettePicker } from './components/controls/palette_picker'; export * from './components/options'; export { RangesParamEditor, RangeValues } from './components/controls/ranges'; export * from './editor_size'; diff --git a/src/plugins/vis_type_xy/public/editor/components/options/point_series/elastic_charts_options.tsx b/src/plugins/vis_type_xy/public/editor/components/options/point_series/elastic_charts_options.tsx index a3e573741644c..08fd0155b0d4b 100644 --- a/src/plugins/vis_type_xy/public/editor/components/options/point_series/elastic_charts_options.tsx +++ b/src/plugins/vis_type_xy/public/editor/components/options/point_series/elastic_charts_options.tsx @@ -17,20 +17,26 @@ * under the License. */ -import React from 'react'; +import React, { useState, useEffect } from 'react'; import { i18n } from '@kbn/i18n'; import { METRIC_TYPE } from '@kbn/analytics'; -import { SelectOption, SwitchOption } from '../../../../../../vis_default_editor/public'; +import { + SelectOption, + SwitchOption, + PalettePicker, +} from '../../../../../../vis_default_editor/public'; +import { PaletteRegistry } from '../../../../../../charts/public'; import { ChartType } from '../../../../../common'; import { VisParams } from '../../../../types'; import { ValidationVisOptionsProps } from '../../common'; -import { getTrackUiMetric } from '../../../../services'; +import { getPalettesService, getTrackUiMetric } from '../../../../services'; export function ElasticChartsOptions(props: ValidationVisOptionsProps) { const trackUiMetric = getTrackUiMetric(); + const [palettesRegistry, setPalettesRegistry] = useState(null); const { stateParams, setValue, vis, aggs } = props; const hasLineChart = stateParams.seriesParams.some( @@ -39,6 +45,14 @@ export function ElasticChartsOptions(props: ValidationVisOptionsProps aggs.aggs.find(({ id }) => id === paramId)?.enabled ); + useEffect(() => { + const fetchPalettes = async () => { + const palettes = await getPalettesService().getPalettes(); + setPalettesRegistry(palettes); + }; + fetchPalettes(); + }, []); + return ( <> }} /> )} + + {palettesRegistry && ( + { + if (trackUiMetric) { + trackUiMetric(METRIC_TYPE.CLICK, 'palette_selected'); + } + setValue(paramName, value); + }} + /> + )} ); } diff --git a/src/plugins/vis_type_xy/public/plugin.ts b/src/plugins/vis_type_xy/public/plugin.ts index ab22ae57ebbdf..cdacc1bfaca6a 100644 --- a/src/plugins/vis_type_xy/public/plugin.ts +++ b/src/plugins/vis_type_xy/public/plugin.ts @@ -29,10 +29,10 @@ import { setDataActions, setFormatService, setThemeService, - setColorsService, setTimefilter, setUISettings, setDocLinks, + setPalettesService, setTrackUiMetric, } from './services'; import { visTypesDefinitions } from './vis_types'; @@ -77,8 +77,7 @@ export class VisTypeXyPlugin if (!core.uiSettings.get(LEGACY_CHARTS_LIBRARY, false)) { setUISettings(core.uiSettings); setThemeService(charts.theme); - setColorsService(charts.legacyColors); - + setPalettesService(charts.palettes); [createVisTypeXyVisFn].forEach(expressions.registerFunction); expressions.registerRenderer(xyVisRenderer); visTypesDefinitions.forEach(visualizations.createBaseVisualization); diff --git a/src/plugins/vis_type_xy/public/services.ts b/src/plugins/vis_type_xy/public/services.ts index 086cab8fb217a..67d38d6647a98 100644 --- a/src/plugins/vis_type_xy/public/services.ts +++ b/src/plugins/vis_type_xy/public/services.ts @@ -43,9 +43,9 @@ export const [getThemeService, setThemeService] = createGetterSetter('xy charts.color'); +export const [getPalettesService, setPalettesService] = createGetterSetter< + ChartsPluginSetup['palettes'] +>('xy charts.palette'); export const [getDocLinks, setDocLinks] = createGetterSetter('DocLinks'); diff --git a/src/plugins/vis_type_xy/public/types/param.ts b/src/plugins/vis_type_xy/public/types/param.ts index c8cd020dec03c..69b5fe6158bd7 100644 --- a/src/plugins/vis_type_xy/public/types/param.ts +++ b/src/plugins/vis_type_xy/public/types/param.ts @@ -18,7 +18,7 @@ */ import { Fit, Position } from '@elastic/charts'; -import { Style, Labels } from '../../../charts/public'; +import { Style, Labels, PaletteOutput } from '../../../charts/public'; import { SchemaConfig } from '../../../visualizations/public'; import { ChartType } from '../../common'; @@ -156,5 +156,6 @@ export interface VisParams { * Add for detailed tooltip option */ detailedTooltip?: boolean; + palette: PaletteOutput; fittingFunction?: Exclude; } diff --git a/src/plugins/vis_type_xy/public/utils/get_all_series.test.ts b/src/plugins/vis_type_xy/public/utils/get_all_series.test.ts new file mode 100644 index 0000000000000..0f4f8fd297343 --- /dev/null +++ b/src/plugins/vis_type_xy/public/utils/get_all_series.test.ts @@ -0,0 +1,193 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { getAllSeries } from './get_all_series'; + +const rowsNoSplitSeries = [ + { + 'col-0-4': 'Kibana Airlines', + 'col-1-1': 85, + }, + { + 'col-0-4': 'ES-Air', + 'col-1-1': 84, + }, + { + 'col-0-4': 'Logstash Airways', + 'col-1-1': 82, + }, + { + 'col-0-4': 'JetBeats', + 'col-1-1': 81, + }, +]; + +const rowsWithSplitSeries = [ + { + 'col-0-4': 'ES-Air', + 'col-1-5': 0, + 'col-2-1': 71, + }, + { + 'col-0-4': 'ES-Air', + 'col-1-5': 1, + 'col-2-1': 14, + }, + { + 'col-0-4': 'Kibana Airlines', + 'col-1-5': 0, + 'col-2-1': 71, + }, + { + 'col-0-4': 'Kibana Airlines', + 'col-1-5': 1, + 'col-2-1': 13, + }, + { + 'col-0-4': 'JetBeats', + 'col-1-5': 0, + 'col-2-1': 72, + }, + { + 'col-0-4': 'JetBeats', + 'col-1-5': 1, + 'col-2-1': 9, + }, + { + 'col-0-4': 'Logstash Airways', + 'col-1-5': 0, + 'col-2-1': 71, + }, + { + 'col-0-4': 'Logstash Airways', + 'col-1-5': 1, + 'col-2-1': 10, + }, +]; + +const yAspects = [ + { + accessor: 'col-2-1', + column: 2, + title: 'Count', + format: { + id: 'number', + }, + aggType: 'count', + aggId: '1', + params: {}, + }, +]; + +const myltipleYAspects = [ + { + accessor: 'col-2-1', + column: 2, + title: 'Count', + format: { + id: 'number', + }, + aggType: 'count', + aggId: '1', + params: {}, + }, + { + accessor: 'col-3-4', + column: 3, + title: 'Average AvgTicketPrice', + format: { + id: 'number', + params: { + pattern: '$0,0.[00]', + }, + }, + aggType: 'avg', + aggId: '4', + params: {}, + }, +]; + +describe('getFilterClickData', () => { + it('returns empty array if splitAccessors is undefined', () => { + const splitAccessors = undefined; + const series = getAllSeries(rowsNoSplitSeries, splitAccessors, yAspects); + expect(series).toStrictEqual([]); + }); + + it('returns an array of series names if splitAccessors is an array', () => { + const splitAccessors = [ + { + accessor: 'col-1-5', + }, + ]; + const series = getAllSeries(rowsWithSplitSeries, splitAccessors, yAspects); + expect(series).toStrictEqual([0, 1]); + }); + + it('returns the correct array of series names for two splitAccessors without duplicates', () => { + const splitAccessors = [ + { + accessor: 'col-0-4', + }, + { + accessor: 'col-1-5', + }, + ]; + const series = getAllSeries(rowsWithSplitSeries, splitAccessors, yAspects); + expect(series).toStrictEqual([ + 'ES-Air - 0', + 'ES-Air - 1', + 'Kibana Airlines - 0', + 'Kibana Airlines - 1', + 'JetBeats - 0', + 'JetBeats - 1', + 'Logstash Airways - 0', + 'Logstash Airways - 1', + ]); + }); + + it('returns the correct array of series names for two splitAccessors and two y axis', () => { + const splitAccessors = [ + { + accessor: 'col-0-4', + }, + { + accessor: 'col-1-5', + }, + ]; + const series = getAllSeries(rowsWithSplitSeries, splitAccessors, myltipleYAspects); + expect(series).toStrictEqual([ + 'ES-Air - 0: Count', + 'ES-Air - 0: Average AvgTicketPrice', + 'ES-Air - 1: Count', + 'ES-Air - 1: Average AvgTicketPrice', + 'Kibana Airlines - 0: Count', + 'Kibana Airlines - 0: Average AvgTicketPrice', + 'Kibana Airlines - 1: Count', + 'Kibana Airlines - 1: Average AvgTicketPrice', + 'JetBeats - 0: Count', + 'JetBeats - 0: Average AvgTicketPrice', + 'JetBeats - 1: Count', + 'JetBeats - 1: Average AvgTicketPrice', + 'Logstash Airways - 0: Count', + 'Logstash Airways - 0: Average AvgTicketPrice', + 'Logstash Airways - 1: Count', + 'Logstash Airways - 1: Average AvgTicketPrice', + ]); + }); +}); diff --git a/src/plugins/vis_type_xy/public/utils/get_all_series.ts b/src/plugins/vis_type_xy/public/utils/get_all_series.ts new file mode 100644 index 0000000000000..8ffc59846c1fc --- /dev/null +++ b/src/plugins/vis_type_xy/public/utils/get_all_series.ts @@ -0,0 +1,62 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { TickFormatter } from '@elastic/charts'; +import { DatatableRow } from '../../../expressions/public'; +import { Column, Aspect } from '../types'; + +interface SplitAccessors { + accessor: Column['id']; + formatter?: TickFormatter; +} + +export const getAllSeries = ( + rows: DatatableRow[], + splitAccessors: SplitAccessors[] | undefined, + yAspects: Aspect[] +) => { + const allSeries: string[] = []; + if (!splitAccessors) return []; + + rows.forEach((row) => { + let seriesName = ''; + splitAccessors?.forEach(({ accessor, formatter }) => { + if (!accessor) return; + const name = formatter ? formatter(row[accessor]) : row[accessor]; + if (seriesName) { + seriesName += ` - ${name}`; + } else { + seriesName = name; + } + }); + + // multiple y axis + if (yAspects.length > 1) { + yAspects.forEach((aspect) => { + if (!allSeries.includes(`${seriesName}: ${aspect.title}`)) { + allSeries.push(`${seriesName}: ${aspect.title}`); + } + }); + } else { + if (!allSeries.includes(seriesName)) { + allSeries.push(seriesName); + } + } + }); + return allSeries; +}; diff --git a/src/plugins/vis_type_xy/public/utils/index.tsx b/src/plugins/vis_type_xy/public/utils/index.tsx index 20b5d7a3c8881..9143a57454d13 100644 --- a/src/plugins/vis_type_xy/public/utils/index.tsx +++ b/src/plugins/vis_type_xy/public/utils/index.tsx @@ -24,3 +24,4 @@ export { getSeriesNameFn } from './get_series_name_fn'; export { getXDomain, getAdjustedDomain } from './domain'; export { useColorPicker } from './use_color_picker'; export { getXAccessor } from './accessors'; +export { getAllSeries } from './get_all_series'; diff --git a/src/plugins/vis_type_xy/public/vis_component.tsx b/src/plugins/vis_type_xy/public/vis_component.tsx index dcf9f69cc291d..8d27d0161785a 100644 --- a/src/plugins/vis_type_xy/public/vis_component.tsx +++ b/src/plugins/vis_type_xy/public/vis_component.tsx @@ -48,6 +48,7 @@ import { LegendToggle, getBrushFromChartBrushEventFn, ClickTriggerEvent, + PaletteRegistry, } from '../../charts/public'; import { Datatable, IInterpreterRenderHandlers } from '../../expressions/public'; import type { PersistedState } from '../../visualizations/public'; @@ -62,10 +63,11 @@ import { getLegendActions, useColorPicker, getXAccessor, + getAllSeries, } from './utils'; import { XYAxis, XYEndzones, XYCurrentTime, XYSettings, XYThresholdLine } from './components'; import { getConfig } from './config'; -import { getThemeService, getColorsService, getDataActions } from './services'; +import { getThemeService, getDataActions, getPalettesService } from './services'; import { ChartType } from '../common'; import './_chart.scss'; @@ -81,22 +83,19 @@ export interface VisComponentProps { uiState: PersistedState; fireEvent: IInterpreterRenderHandlers['event']; renderComplete: IInterpreterRenderHandlers['done']; + syncColors: boolean; } export type VisComponentType = typeof VisComponent; const VisComponent = (props: VisComponentProps) => { - /** - * Stores all series labels to replicate vislib color map lookup - */ - const allSeries: Array = useMemo(() => [], []); const [showLegend, setShowLegend] = useState(() => { // TODO: Check when this bwc can safely be removed const bwcLegendStateDefault = props.visParams.addLegend == null ? true : props.visParams.addLegend; return props.uiState?.get('vis.legendOpen', bwcLegendStateDefault) as boolean; }); - + const [palettesRegistry, setPalettesRegistry] = useState(null); useEffect(() => { const fn = () => { props?.uiState?.emit?.('reload'); @@ -117,6 +116,14 @@ const VisComponent = (props: VisComponentProps) => { [props] ); + useEffect(() => { + const fetchPalettes = async () => { + const palettes = await getPalettesService().getPalettes(); + setPalettesRegistry(palettes); + }; + fetchPalettes(); + }, []); + const handleFilterClick = useCallback( ( visData: Datatable, @@ -225,7 +232,8 @@ const VisComponent = (props: VisComponentProps) => { [props.uiState] ); - const { visData, visParams } = props; + const { visData, visParams, syncColors } = props; + const config = getConfig(visData, visParams); const timeZone = getTimeZone(); const xDomain = @@ -245,21 +253,58 @@ const VisComponent = (props: VisComponentProps) => { const isDarkMode = getThemeService().useDarkMode(); const getSeriesName = getSeriesNameFn(config.aspects, config.aspects.y.length > 1); + const splitAccessors = config.aspects.series?.map(({ accessor, formatter }) => { + return { accessor, formatter }; + }); + + const allSeries = useMemo(() => getAllSeries(visData.rows, splitAccessors, config.aspects.y), [ + config.aspects.y, + splitAccessors, + visData.rows, + ]); + const getSeriesColor = useCallback( (series: XYChartSeriesIdentifier) => { - const seriesName = getSeriesName(series); + const seriesName = getSeriesName(series) as string; if (!seriesName) { - return; + return null; } - const overwriteColors: Record = props.uiState?.get ? props.uiState.get('vis.colors', {}) : {}; - allSeries.push(seriesName); - return getColorsService().createColorLookupFunction(allSeries, overwriteColors)(seriesName); + if (Object.keys(overwriteColors).includes(seriesName)) { + return overwriteColors[seriesName]; + } + const outputColor = palettesRegistry?.get(visParams.palette.name).getColor( + [ + { + name: seriesName, + rankAtDepth: splitAccessors + ? allSeries.findIndex((name) => name === seriesName) + : config.aspects.y.findIndex((aspect) => aspect.accessor === series.yAccessor), + totalSeriesAtDepth: splitAccessors ? allSeries.length : config.aspects.y.length, + }, + ], + { + maxDepth: 1, + totalSeries: splitAccessors ? allSeries.length : config.aspects.y.length, + behindText: false, + syncColors, + } + ); + return outputColor || null; }, - [allSeries, getSeriesName, props.uiState] + [ + allSeries, + config.aspects.y, + getSeriesName, + props.uiState, + splitAccessors, + syncColors, + visParams.palette.name, + palettesRegistry, + ] ); const xAccessor = getXAccessor(config.aspects.x); const splitSeriesAccessors = config.aspects.series diff --git a/src/plugins/vis_type_xy/public/vis_renderer.tsx b/src/plugins/vis_type_xy/public/vis_renderer.tsx index 16463abb07631..ee0c9983435e9 100644 --- a/src/plugins/vis_type_xy/public/vis_renderer.tsx +++ b/src/plugins/vis_type_xy/public/vis_renderer.tsx @@ -45,9 +45,9 @@ export const xyVisRenderer: ExpressionRenderDefinition = { name: visName, displayName: 'XY visualization', reuseDomNode: true, - render: (domNode, { visData, visConfig, visType }, handlers) => { + render: async (domNode, { visData, visConfig, visType, syncColors }, handlers) => { const showNoResult = shouldShowNoResultsMessage(visData, visType); - const isSplitChart = Boolean(visConfig.dimensions.splitRow || visConfig.dimensions.splitRow); + const isSplitChart = Boolean(visConfig.dimensions.splitRow); handlers.onDestroy(() => unmountComponentAtNode(domNode)); render( @@ -61,6 +61,7 @@ export const xyVisRenderer: ExpressionRenderDefinition = { renderComplete={handlers.done} fireEvent={handlers.event} uiState={handlers.uiState as PersistedState} + syncColors={syncColors} /> diff --git a/src/plugins/vis_type_xy/public/vis_types/area.tsx b/src/plugins/vis_type_xy/public/vis_types/area.tsx index 58423d2f619fa..f04105470e01d 100644 --- a/src/plugins/vis_type_xy/public/vis_types/area.tsx +++ b/src/plugins/vis_type_xy/public/vis_types/area.tsx @@ -119,6 +119,10 @@ export const getAreaVisTypeDefinition = ( ], addTooltip: true, detailedTooltip: true, + palette: { + type: 'palette', + name: 'default', + }, addLegend: true, legendPosition: Position.Right, fittingFunction: Fit.Linear, diff --git a/src/plugins/vis_type_xy/public/vis_types/histogram.tsx b/src/plugins/vis_type_xy/public/vis_types/histogram.tsx index 5bc5f1b49e5da..9e032b34c98de 100644 --- a/src/plugins/vis_type_xy/public/vis_types/histogram.tsx +++ b/src/plugins/vis_type_xy/public/vis_types/histogram.tsx @@ -122,6 +122,10 @@ export const getHistogramVisTypeDefinition = ( radiusRatio: 0, addTooltip: true, detailedTooltip: true, + palette: { + type: 'palette', + name: 'default', + }, addLegend: true, legendPosition: Position.Right, times: [], diff --git a/src/plugins/vis_type_xy/public/vis_types/horizontal_bar.tsx b/src/plugins/vis_type_xy/public/vis_types/horizontal_bar.tsx index 3029b3dcd6765..4b1e95368d9fc 100644 --- a/src/plugins/vis_type_xy/public/vis_types/horizontal_bar.tsx +++ b/src/plugins/vis_type_xy/public/vis_types/horizontal_bar.tsx @@ -122,6 +122,10 @@ export const getHorizontalBarVisTypeDefinition = ( ], addTooltip: true, detailedTooltip: true, + palette: { + type: 'palette', + name: 'default', + }, addLegend: true, legendPosition: Position.Right, times: [], diff --git a/src/plugins/vis_type_xy/public/vis_types/line.tsx b/src/plugins/vis_type_xy/public/vis_types/line.tsx index e0f83ce649d23..e146b91a6141b 100644 --- a/src/plugins/vis_type_xy/public/vis_types/line.tsx +++ b/src/plugins/vis_type_xy/public/vis_types/line.tsx @@ -119,6 +119,10 @@ export const getLineVisTypeDefinition = ( ], addTooltip: true, detailedTooltip: true, + palette: { + type: 'palette', + name: 'default', + }, addLegend: true, legendPosition: Position.Right, fittingFunction: Fit.Linear, diff --git a/src/plugins/vis_type_xy/public/xy_vis_fn.ts b/src/plugins/vis_type_xy/public/xy_vis_fn.ts index 47c4caf243b36..f24b7391c1391 100644 --- a/src/plugins/vis_type_xy/public/xy_vis_fn.ts +++ b/src/plugins/vis_type_xy/public/xy_vis_fn.ts @@ -34,6 +34,7 @@ export interface RenderValue { visData: Datatable; visType: ChartType; visConfig: VisParams; + syncColors: boolean; } export type VisTypeXyExpressionFunctionDefinition = ExpressionFunctionDefinition< @@ -80,6 +81,7 @@ export const createVisTypeXyVisFn = (): VisTypeXyExpressionFunctionDefinition => visType, visConfig, visData: context, + syncColors: handlers?.isSyncColorsEnabled?.() ?? false, }, }; }, diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts index 590b65e1af13d..4eaf70c98a26e 100644 --- a/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts @@ -102,6 +102,7 @@ export class VisualizeEmbeddable private query?: Query; private filters?: Filter[]; private searchSessionId?: string; + private syncColors?: boolean; private visCustomizations?: Pick; private subscriptions: Subscription[] = []; private expression: string = ''; @@ -145,6 +146,7 @@ export class VisualizeEmbeddable ); this.deps = deps; this.timefilter = timefilter; + this.syncColors = this.input.syncColors; this.vis = vis; this.vis.uiState.on('change', this.uiStateChangeHandler); this.vis.uiState.on('reload', this.reload); @@ -248,6 +250,11 @@ export class VisualizeEmbeddable dirty = true; } + if (this.syncColors !== this.input.syncColors) { + this.syncColors = this.input.syncColors; + dirty = true; + } + if (this.vis.description && this.domNode) { this.domNode.setAttribute('data-description', this.vis.description); } @@ -377,6 +384,7 @@ export class VisualizeEmbeddable filters: this.input.filters, }, searchSessionId: this.input.searchSessionId, + syncColors: this.input.syncColors, uiState: this.vis.uiState, inspectorAdapters: this.inspectorAdapters, }; diff --git a/src/plugins/visualizations/server/saved_objects/visualization_migrations.test.ts b/src/plugins/visualizations/server/saved_objects/visualization_migrations.test.ts index d3fc5de93c366..4f1b7b3a163be 100644 --- a/src/plugins/visualizations/server/saved_objects/visualization_migrations.test.ts +++ b/src/plugins/visualizations/server/saved_objects/visualization_migrations.test.ts @@ -1720,6 +1720,13 @@ describe('migration visualization', () => { expect(isVislibVis).toEqual(true); }); + it('should decorate existing docs with the kibana legacy palette', () => { + const migratedTestDoc = migrate(getTestDoc()); + const { palette } = JSON.parse(migratedTestDoc.attributes.visState).params; + + expect(palette.name).toEqual('kibana_palette'); + }); + describe('labels.filter', () => { it('should keep existing categoryAxes labels.filter value', () => { const migratedTestDoc = migrate(getTestDoc('area', [{ labels: { filter: false } }])); diff --git a/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts b/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts index c625662ab7fe3..20d93d73fe190 100644 --- a/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts +++ b/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts @@ -832,6 +832,10 @@ const migrateVislibAreaLineBarTypes: SavedObjectMigrationFn = (doc) => ...visState, params: { ...visState.params, + palette: { + type: 'palette', + name: 'kibana_palette', + }, categoryAxes: visState.params.categoryAxes && decorateAxes(visState.params.categoryAxes, !isHorizontalBar), From 4c5d8be8dae324dbfa5b380f5bcf2f6e73abea3c Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Wed, 13 Jan 2021 10:00:26 -0400 Subject: [PATCH 09/22] [Fleet] Remove misleading information from enrollment token revoke modal (#88094) --- .../components/confirm_delete_modal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/confirm_delete_modal.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/confirm_delete_modal.tsx index 45fd380a06f34..a87dd0c6d35eb 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/confirm_delete_modal.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/enrollment_token_list_page/components/confirm_delete_modal.tsx @@ -37,7 +37,7 @@ export const ConfirmEnrollmentTokenDelete = (props: Props) => { Date: Wed, 13 Jan 2021 15:04:38 +0100 Subject: [PATCH 10/22] [ML] Functional tests - stabilize AD job delete test (#88148) This PR stabilizes the AD job delete tests by waiting for the job to not exist anymore before checking the job list. --- .../apps/ml/anomaly_detection/categorization_job.ts | 1 + .../apps/ml/anomaly_detection/single_metric_job.ts | 1 + x-pack/test/functional/services/ml/api.ts | 8 ++++---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts index d3de41689244b..3ac85fbeff36e 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts @@ -343,6 +343,7 @@ export default function ({ getService }: FtrProviderContext) { await ml.testExecution.logTestStep('job deletion confirms the delete modal'); await ml.jobTable.confirmDeleteJobModal(); + await ml.api.waitForAnomalyDetectionJobNotToExist(jobIdClone, 30 * 1000); await ml.testExecution.logTestStep( 'job deletion does not display the deleted job in the job list any more' diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts index dd6310b67d844..e20b5e8b41bdf 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/single_metric_job.ts @@ -326,6 +326,7 @@ export default function ({ getService }: FtrProviderContext) { await ml.testExecution.logTestStep('job deletion confirms the delete modal'); await ml.jobTable.confirmDeleteJobModal(); + await ml.api.waitForAnomalyDetectionJobNotToExist(jobIdClone, 30 * 1000); await ml.testExecution.logTestStep( 'job deletion does not display the deleted job in the job list any more' diff --git a/x-pack/test/functional/services/ml/api.ts b/x-pack/test/functional/services/ml/api.ts index 0a0a80e52de79..e50fb1818273d 100644 --- a/x-pack/test/functional/services/ml/api.ts +++ b/x-pack/test/functional/services/ml/api.ts @@ -454,8 +454,8 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { return await esSupertest.get(`/_ml/anomaly_detectors/${jobId}`).expect(200); }, - async waitForAnomalyDetectionJobToExist(jobId: string) { - await retry.waitForWithTimeout(`'${jobId}' to exist`, 5 * 1000, async () => { + async waitForAnomalyDetectionJobToExist(jobId: string, timeout: number = 5 * 1000) { + await retry.waitForWithTimeout(`'${jobId}' to exist`, timeout, async () => { if (await this.getAnomalyDetectionJob(jobId)) { return true; } else { @@ -464,8 +464,8 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { }); }, - async waitForAnomalyDetectionJobNotToExist(jobId: string) { - await retry.waitForWithTimeout(`'${jobId}' to not exist`, 5 * 1000, async () => { + async waitForAnomalyDetectionJobNotToExist(jobId: string, timeout: number = 5 * 1000) { + await retry.waitForWithTimeout(`'${jobId}' to not exist`, timeout, async () => { if (await esSupertest.get(`/_ml/anomaly_detectors/${jobId}`).expect(404)) { return true; } else { From 2eca6aa11e4133e03f6a70cc1480983f1fb11122 Mon Sep 17 00:00:00 2001 From: "Christiane (Tina) Heiligers" Date: Wed, 13 Jan 2021 07:09:32 -0700 Subject: [PATCH 11/22] Converts Telemetry Management Section to TS project refs (#88073) --- .../tsconfig.json | 28 +++++++++++++++++++ test/tsconfig.json | 1 + tsconfig.json | 2 ++ tsconfig.refs.json | 1 + x-pack/test/tsconfig.json | 1 + x-pack/tsconfig.json | 1 + 6 files changed, 34 insertions(+) create mode 100644 src/plugins/telemetry_management_section/tsconfig.json diff --git a/src/plugins/telemetry_management_section/tsconfig.json b/src/plugins/telemetry_management_section/tsconfig.json new file mode 100644 index 0000000000000..48e40814b8570 --- /dev/null +++ b/src/plugins/telemetry_management_section/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "public/**/*", + "../../../typings/**/*" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../usage_collection/tsconfig.json" }, + { "path": "../telemetry/tsconfig.json" }, + { "path": "../kibana_legacy/tsconfig.json"}, + { "path": "../ui_actions/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../home/tsconfig.json" }, + { "path": "../bfetch/tsconfig.json"}, + { "path": "../data/tsconfig.json"}, + { "path": "../advanced_settings/tsconfig.json" }, + { "path": "../management/tsconfig.json"} + ] +} diff --git a/test/tsconfig.json b/test/tsconfig.json index f1d5115bf35fb..11508ad8ce105 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -8,6 +8,7 @@ "exclude": ["plugin_functional/plugins/**/*", "interpreter_functional/plugins/**/*"], "references": [ { "path": "../src/core/tsconfig.json" }, + { "path": "../src/plugins/telemetry_management_section/tsconfig.json" }, { "path": "../src/plugins/advanced_settings/tsconfig.json" }, { "path": "../src/plugins/management/tsconfig.json" }, { "path": "../src/plugins/bfetch/tsconfig.json" }, diff --git a/tsconfig.json b/tsconfig.json index 1d8c61d515fdf..88d2183dd7bcb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,7 @@ "exclude": [ "src/**/__fixtures__/**/*", "src/core/**/*", + "src/plugins/telemetry_management_section/**/*", "src/plugins/advanced_settings/**/*", "src/plugins/apm_oss/**/*", "src/plugins/bfetch/**/*", @@ -45,6 +46,7 @@ ], "references": [ { "path": "./src/core/tsconfig.json" }, + { "path": "./src/plugins/telemetry_management_section/tsconfig.json" }, { "path": "./src/plugins/advanced_settings/tsconfig.json" }, { "path": "./src/plugins/apm_oss/tsconfig.json" }, { "path": "./src/plugins/bfetch/tsconfig.json" }, diff --git a/tsconfig.refs.json b/tsconfig.refs.json index d6e87da6ac19d..1a7f0282c921a 100644 --- a/tsconfig.refs.json +++ b/tsconfig.refs.json @@ -2,6 +2,7 @@ "include": [], "references": [ { "path": "./src/core/tsconfig.json" }, + { "path": "./src/plugins/telemetry_management_section/tsconfig.json" }, { "path": "./src/plugins/advanced_settings/tsconfig.json" }, { "path": "./src/plugins/apm_oss/tsconfig.json" }, { "path": "./src/plugins/bfetch/tsconfig.json" }, diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index 2584cedd01523..696649c17f910 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -9,6 +9,7 @@ "exclude": ["../typings/jest.d.ts"], "references": [ { "path": "../../src/core/tsconfig.json" }, + { "path": "../../src/plugins/telemetry_management_section/tsconfig.json" }, { "path": "../../src/plugins/management/tsconfig.json" }, { "path": "../../src/plugins/bfetch/tsconfig.json" }, { "path": "../../src/plugins/charts/tsconfig.json" }, diff --git a/x-pack/tsconfig.json b/x-pack/tsconfig.json index 0780251e42f22..08f5f78c95acc 100644 --- a/x-pack/tsconfig.json +++ b/x-pack/tsconfig.json @@ -24,6 +24,7 @@ }, "references": [ { "path": "../src/core/tsconfig.json" }, + { "path": "../src/plugins/telemetry_management_section/tsconfig.json" }, { "path": "../src/plugins/management/tsconfig.json" }, { "path": "../src/plugins/bfetch/tsconfig.json" }, { "path": "../src/plugins/charts/tsconfig.json" }, From 109bed0768945fbd04625d13e19638e62a25b199 Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Wed, 13 Jan 2021 08:34:30 -0600 Subject: [PATCH 12/22] revert runtime fields editor plugin (#88132) --- docs/developer/plugin-list.asciidoc | 8 ++--- packages/kbn-optimizer/limits.yml | 3 +- src/plugins/runtime_fields/README.mdx | 4 --- .../runtime_fields/common/constants.ts | 20 ------------- src/plugins/runtime_fields/common/index.ts | 21 -------------- src/plugins/runtime_fields/common/types.ts | 29 ------------------- src/plugins/runtime_fields/kibana.json | 6 ---- src/plugins/runtime_fields/public/index.ts | 28 ------------------ x-pack/.i18nrc.json | 2 +- x-pack/plugins/index_management/kibana.json | 2 +- .../mappings_editor/shared_imports.ts | 2 +- .../README.md | 4 +-- .../jest.config.js | 2 +- .../kibana.json | 2 +- .../public/__jest__/setup_environment.tsx | 0 .../public/components/index.ts | 0 .../components/runtime_field_editor/index.ts | 0 .../runtime_field_editor.test.tsx | 0 .../runtime_field_editor.tsx | 0 .../index.ts | 0 ...ntime_field_editor_flyout_content.test.tsx | 0 .../runtime_field_editor_flyout_content.tsx | 0 .../components/runtime_field_form/index.ts | 0 .../runtime_field_form.test.tsx | 0 .../runtime_field_form/runtime_field_form.tsx | 0 .../components/runtime_field_form/schema.ts | 0 .../public/constants.ts | 6 +++- .../public/index.ts | 0 .../public/lib/documentation.ts | 0 .../public/lib/index.ts | 0 .../public/load_editor.tsx | 0 .../public/plugin.test.ts | 0 .../public/plugin.ts | 0 .../public/shared_imports.ts | 0 .../public/test_utils.ts | 0 .../public/types.ts | 16 ++++++---- 36 files changed, 26 insertions(+), 129 deletions(-) delete mode 100644 src/plugins/runtime_fields/README.mdx delete mode 100644 src/plugins/runtime_fields/common/constants.ts delete mode 100644 src/plugins/runtime_fields/common/index.ts delete mode 100644 src/plugins/runtime_fields/common/types.ts delete mode 100644 src/plugins/runtime_fields/kibana.json delete mode 100644 src/plugins/runtime_fields/public/index.ts rename x-pack/plugins/{runtime_field_editor => runtime_fields}/README.md (98%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/jest.config.js (83%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/kibana.json (88%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/__jest__/setup_environment.tsx (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/index.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_editor/index.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_editor/runtime_field_editor.test.tsx (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_editor/runtime_field_editor.tsx (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_editor_flyout_content/index.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.test.tsx (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.tsx (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_form/index.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_form/runtime_field_form.test.tsx (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_form/runtime_field_form.tsx (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/components/runtime_field_form/schema.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/constants.ts (75%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/index.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/lib/documentation.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/lib/index.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/load_editor.tsx (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/plugin.test.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/plugin.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/shared_imports.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/test_utils.ts (100%) rename x-pack/plugins/{runtime_field_editor => runtime_fields}/public/types.ts (80%) diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index ba2ea98cad5e6..642713e48e833 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -168,10 +168,6 @@ Content is fetched from the remote (https://feeds.elastic.co and https://feeds-s |Create choropleth maps. Display the results of a term-aggregation as e.g. countries, zip-codes, states. -|{kib-repo}blob/{branch}/src/plugins/runtime_fields/README.mdx[runtimeFields] -|The runtime fields plugin provides types and constants for OSS and xpack runtime field related code. - - |{kib-repo}blob/{branch}/src/plugins/saved_objects/README.md[savedObjects] |The savedObjects plugin exposes utilities to manipulate saved objects on the client side. @@ -491,8 +487,8 @@ Elastic. |Welcome to the Kibana rollup plugin! This plugin provides Kibana support for Elasticsearch's rollup feature. Please refer to the Elasticsearch documentation to understand rollup indices and how to create rollup jobs. -|{kib-repo}blob/{branch}/x-pack/plugins/runtime_field_editor/README.md[runtimeFieldEditor] -|Welcome to the home of the runtime field editor! +|{kib-repo}blob/{branch}/x-pack/plugins/runtime_fields/README.md[runtimeFields] +|Welcome to the home of the runtime field editor and everything related to runtime fields! |{kib-repo}blob/{branch}/x-pack/plugins/saved_objects_tagging/README.md[savedObjectsTagging] diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 485481e2a7f14..44cc4fdabb25e 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -102,8 +102,7 @@ pageLoadAssetSize: visualizations: 295025 visualize: 57431 watcher: 43598 - runtimeFields: 10000 + runtimeFields: 41752 stackAlerts: 29684 presentationUtil: 28545 - runtimeFieldEditor: 46986 spacesOss: 18817 diff --git a/src/plugins/runtime_fields/README.mdx b/src/plugins/runtime_fields/README.mdx deleted file mode 100644 index 15985b07caf96..0000000000000 --- a/src/plugins/runtime_fields/README.mdx +++ /dev/null @@ -1,4 +0,0 @@ - -# Runtime Fields - -The runtime fields plugin provides types and constants for OSS and xpack runtime field related code. diff --git a/src/plugins/runtime_fields/common/constants.ts b/src/plugins/runtime_fields/common/constants.ts deleted file mode 100644 index 568003508f4bd..0000000000000 --- a/src/plugins/runtime_fields/common/constants.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export const RUNTIME_FIELD_TYPES = ['keyword', 'long', 'double', 'date', 'ip', 'boolean'] as const; diff --git a/src/plugins/runtime_fields/common/index.ts b/src/plugins/runtime_fields/common/index.ts deleted file mode 100644 index b08ac661a4bd6..0000000000000 --- a/src/plugins/runtime_fields/common/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export * from './constants'; -export * from './types'; diff --git a/src/plugins/runtime_fields/common/types.ts b/src/plugins/runtime_fields/common/types.ts deleted file mode 100644 index f16d3d75d6ecf..0000000000000 --- a/src/plugins/runtime_fields/common/types.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { RUNTIME_FIELD_TYPES } from './constants'; - -export type RuntimeType = typeof RUNTIME_FIELD_TYPES[number]; -export interface RuntimeField { - name: string; - type: RuntimeType; - script: { - source: string; - }; -} diff --git a/src/plugins/runtime_fields/kibana.json b/src/plugins/runtime_fields/kibana.json deleted file mode 100644 index e71116f81532e..0000000000000 --- a/src/plugins/runtime_fields/kibana.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "id": "runtimeFields", - "version": "kibana", - "server": false, - "ui": true -} diff --git a/src/plugins/runtime_fields/public/index.ts b/src/plugins/runtime_fields/public/index.ts deleted file mode 100644 index a7a94b07ac6e8..0000000000000 --- a/src/plugins/runtime_fields/public/index.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export * from '../common'; - -export function plugin() { - return { - setup() {}, - start() {}, - stop() {}, - }; -} diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 7380d25930bc0..6937862d20536 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -42,7 +42,7 @@ "xpack.remoteClusters": "plugins/remote_clusters", "xpack.reporting": ["plugins/reporting"], "xpack.rollupJobs": ["plugins/rollup"], - "xpack.runtimeFields": "plugins/runtime_field_editor", + "xpack.runtimeFields": "plugins/runtime_fields", "xpack.searchProfiler": "plugins/searchprofiler", "xpack.security": "plugins/security", "xpack.server": "legacy/server", diff --git a/x-pack/plugins/index_management/kibana.json b/x-pack/plugins/index_management/kibana.json index af3d61c8808ef..5dcff0ba942e1 100644 --- a/x-pack/plugins/index_management/kibana.json +++ b/x-pack/plugins/index_management/kibana.json @@ -9,6 +9,6 @@ "requiredBundles": [ "kibanaReact", "esUiShared", - "runtimeFieldEditor" + "runtimeFields" ] } diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts index 652925a977fa0..36f7fecbcff21 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts @@ -58,7 +58,7 @@ export { RuntimeField, RuntimeFieldEditorFlyoutContent, RuntimeFieldEditorFlyoutContentProps, -} from '../../../../../runtime_field_editor/public'; +} from '../../../../../runtime_fields/public'; export { createKibanaReactContext } from '../../../../../../../src/plugins/kibana_react/public'; diff --git a/x-pack/plugins/runtime_field_editor/README.md b/x-pack/plugins/runtime_fields/README.md similarity index 98% rename from x-pack/plugins/runtime_field_editor/README.md rename to x-pack/plugins/runtime_fields/README.md index 1eddfd75a39f3..eb7b31e6e1154 100644 --- a/x-pack/plugins/runtime_field_editor/README.md +++ b/x-pack/plugins/runtime_fields/README.md @@ -1,6 +1,6 @@ -# Runtime fields editor +# Runtime fields -Welcome to the home of the runtime field editor! +Welcome to the home of the runtime field editor and everything related to runtime fields! ## The runtime field editor diff --git a/x-pack/plugins/runtime_field_editor/jest.config.js b/x-pack/plugins/runtime_fields/jest.config.js similarity index 83% rename from x-pack/plugins/runtime_field_editor/jest.config.js rename to x-pack/plugins/runtime_fields/jest.config.js index f5a9e988fd867..9c4ec56593c8b 100644 --- a/x-pack/plugins/runtime_field_editor/jest.config.js +++ b/x-pack/plugins/runtime_fields/jest.config.js @@ -7,5 +7,5 @@ module.exports = { preset: '@kbn/test', rootDir: '../../..', - roots: ['/x-pack/plugins/runtime_field_editor'], + roots: ['/x-pack/plugins/runtime_fields'], }; diff --git a/x-pack/plugins/runtime_field_editor/kibana.json b/x-pack/plugins/runtime_fields/kibana.json similarity index 88% rename from x-pack/plugins/runtime_field_editor/kibana.json rename to x-pack/plugins/runtime_fields/kibana.json index 3270ada544ba4..65932c723c474 100644 --- a/x-pack/plugins/runtime_field_editor/kibana.json +++ b/x-pack/plugins/runtime_fields/kibana.json @@ -1,5 +1,5 @@ { - "id": "runtimeFieldEditor", + "id": "runtimeFields", "version": "kibana", "server": false, "ui": true, diff --git a/x-pack/plugins/runtime_field_editor/public/__jest__/setup_environment.tsx b/x-pack/plugins/runtime_fields/public/__jest__/setup_environment.tsx similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/__jest__/setup_environment.tsx rename to x-pack/plugins/runtime_fields/public/__jest__/setup_environment.tsx diff --git a/x-pack/plugins/runtime_field_editor/public/components/index.ts b/x-pack/plugins/runtime_fields/public/components/index.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/index.ts rename to x-pack/plugins/runtime_fields/public/components/index.ts diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor/index.ts b/x-pack/plugins/runtime_fields/public/components/runtime_field_editor/index.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor/index.ts rename to x-pack/plugins/runtime_fields/public/components/runtime_field_editor/index.ts diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor/runtime_field_editor.test.tsx b/x-pack/plugins/runtime_fields/public/components/runtime_field_editor/runtime_field_editor.test.tsx similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor/runtime_field_editor.test.tsx rename to x-pack/plugins/runtime_fields/public/components/runtime_field_editor/runtime_field_editor.test.tsx diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor/runtime_field_editor.tsx b/x-pack/plugins/runtime_fields/public/components/runtime_field_editor/runtime_field_editor.tsx similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor/runtime_field_editor.tsx rename to x-pack/plugins/runtime_fields/public/components/runtime_field_editor/runtime_field_editor.tsx diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor_flyout_content/index.ts b/x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/index.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor_flyout_content/index.ts rename to x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/index.ts diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.test.tsx b/x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.test.tsx similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.test.tsx rename to x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.test.tsx diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.tsx b/x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.tsx similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.tsx rename to x-pack/plugins/runtime_fields/public/components/runtime_field_editor_flyout_content/runtime_field_editor_flyout_content.tsx diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_form/index.ts b/x-pack/plugins/runtime_fields/public/components/runtime_field_form/index.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_form/index.ts rename to x-pack/plugins/runtime_fields/public/components/runtime_field_form/index.ts diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_form/runtime_field_form.test.tsx b/x-pack/plugins/runtime_fields/public/components/runtime_field_form/runtime_field_form.test.tsx similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_form/runtime_field_form.test.tsx rename to x-pack/plugins/runtime_fields/public/components/runtime_field_form/runtime_field_form.test.tsx diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_form/runtime_field_form.tsx b/x-pack/plugins/runtime_fields/public/components/runtime_field_form/runtime_field_form.tsx similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_form/runtime_field_form.tsx rename to x-pack/plugins/runtime_fields/public/components/runtime_field_form/runtime_field_form.tsx diff --git a/x-pack/plugins/runtime_field_editor/public/components/runtime_field_form/schema.ts b/x-pack/plugins/runtime_fields/public/components/runtime_field_form/schema.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/components/runtime_field_form/schema.ts rename to x-pack/plugins/runtime_fields/public/components/runtime_field_form/schema.ts diff --git a/x-pack/plugins/runtime_field_editor/public/constants.ts b/x-pack/plugins/runtime_fields/public/constants.ts similarity index 75% rename from x-pack/plugins/runtime_field_editor/public/constants.ts rename to x-pack/plugins/runtime_fields/public/constants.ts index eebc3007d79d5..017b58c246afe 100644 --- a/x-pack/plugins/runtime_field_editor/public/constants.ts +++ b/x-pack/plugins/runtime_fields/public/constants.ts @@ -3,7 +3,11 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { ComboBoxOption, RuntimeType } from './types'; +import { ComboBoxOption } from './types'; + +export const RUNTIME_FIELD_TYPES = ['keyword', 'long', 'double', 'date', 'ip', 'boolean'] as const; + +type RuntimeType = typeof RUNTIME_FIELD_TYPES[number]; export const RUNTIME_FIELD_OPTIONS: Array> = [ { diff --git a/x-pack/plugins/runtime_field_editor/public/index.ts b/x-pack/plugins/runtime_fields/public/index.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/index.ts rename to x-pack/plugins/runtime_fields/public/index.ts diff --git a/x-pack/plugins/runtime_field_editor/public/lib/documentation.ts b/x-pack/plugins/runtime_fields/public/lib/documentation.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/lib/documentation.ts rename to x-pack/plugins/runtime_fields/public/lib/documentation.ts diff --git a/x-pack/plugins/runtime_field_editor/public/lib/index.ts b/x-pack/plugins/runtime_fields/public/lib/index.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/lib/index.ts rename to x-pack/plugins/runtime_fields/public/lib/index.ts diff --git a/x-pack/plugins/runtime_field_editor/public/load_editor.tsx b/x-pack/plugins/runtime_fields/public/load_editor.tsx similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/load_editor.tsx rename to x-pack/plugins/runtime_fields/public/load_editor.tsx diff --git a/x-pack/plugins/runtime_field_editor/public/plugin.test.ts b/x-pack/plugins/runtime_fields/public/plugin.test.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/plugin.test.ts rename to x-pack/plugins/runtime_fields/public/plugin.test.ts diff --git a/x-pack/plugins/runtime_field_editor/public/plugin.ts b/x-pack/plugins/runtime_fields/public/plugin.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/plugin.ts rename to x-pack/plugins/runtime_fields/public/plugin.ts diff --git a/x-pack/plugins/runtime_field_editor/public/shared_imports.ts b/x-pack/plugins/runtime_fields/public/shared_imports.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/shared_imports.ts rename to x-pack/plugins/runtime_fields/public/shared_imports.ts diff --git a/x-pack/plugins/runtime_field_editor/public/test_utils.ts b/x-pack/plugins/runtime_fields/public/test_utils.ts similarity index 100% rename from x-pack/plugins/runtime_field_editor/public/test_utils.ts rename to x-pack/plugins/runtime_fields/public/test_utils.ts diff --git a/x-pack/plugins/runtime_field_editor/public/types.ts b/x-pack/plugins/runtime_fields/public/types.ts similarity index 80% rename from x-pack/plugins/runtime_field_editor/public/types.ts rename to x-pack/plugins/runtime_fields/public/types.ts index 984d6ab9f8655..b1bbb06d79655 100644 --- a/x-pack/plugins/runtime_field_editor/public/types.ts +++ b/x-pack/plugins/runtime_fields/public/types.ts @@ -4,12 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ import { DataPublicPluginStart } from 'src/plugins/data/public'; -export type { - RuntimeField, - RuntimeType, - RUNTIME_FIELD_TYPES, -} from 'src/plugins/runtime_fields/common'; +import { RUNTIME_FIELD_TYPES } from './constants'; import { OpenRuntimeFieldEditorProps } from './load_editor'; export interface LoadEditorResponse { @@ -30,6 +26,16 @@ export interface StartPlugins { data: DataPublicPluginStart; } +export type RuntimeType = typeof RUNTIME_FIELD_TYPES[number]; + +export interface RuntimeField { + name: string; + type: RuntimeType; + script: { + source: string; + }; +} + export interface ComboBoxOption { label: string; value?: T; From 40b65630bef42db9f1d97cbf46d63274d8cd43e0 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 13 Jan 2021 16:05:52 +0100 Subject: [PATCH 13/22] set aria-pressed for function buttons (#87825) --- .../indexpattern_datasource/dimension_panel/dimension_editor.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx index 1144a1043c5b1..fd62b8ca962ab 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx @@ -220,6 +220,7 @@ export function DimensionEditor(props: DimensionEditorProps) { 'data-test-subj': `lns-indexPatternDimension-${operationType}${ compatibleWithCurrentField ? '' : ' incompatible' }`, + [`aria-pressed`]: isActive, onClick() { if ( operationDefinitionMap[operationType].input === 'none' || From 8eb3865af02ea3655dfc2b014d5204fecdb4945c Mon Sep 17 00:00:00 2001 From: Devon Thomson Date: Wed, 13 Jan 2021 10:26:04 -0500 Subject: [PATCH 14/22] [Dashboard] Fix Blank Screen when Expanded Embeddable Not Found (#87925) * Fixed blank screen when expanded embeddable id is changed --- .../application/dashboard_state.test.ts | 37 +++++++++++++++++-- .../application/dashboard_state_manager.ts | 10 ++++- .../embeddable/grid/dashboard_grid.tsx | 24 ++++++------ 3 files changed, 53 insertions(+), 18 deletions(-) diff --git a/src/plugins/dashboard/public/application/dashboard_state.test.ts b/src/plugins/dashboard/public/application/dashboard_state.test.ts index f31ed30f8eb80..ddfca1eddcc19 100644 --- a/src/plugins/dashboard/public/application/dashboard_state.test.ts +++ b/src/plugins/dashboard/public/application/dashboard_state.test.ts @@ -19,11 +19,11 @@ import { createBrowserHistory } from 'history'; import { getSavedDashboardMock } from './test_helpers'; -import { DashboardContainer, DashboardContainerInput } from '.'; +import { DashboardContainer, DashboardContainerInput, DashboardPanelState } from '.'; import { DashboardStateManager } from './dashboard_state_manager'; import { DashboardContainerServices } from './embeddable/dashboard_container'; -import { ViewMode } from '../services/embeddable'; +import { EmbeddableInput, ViewMode } from '../services/embeddable'; import { createKbnUrlStateStorage } from '../services/kibana_utils'; import { InputTimeRange, TimefilterContract, TimeRange } from '../services/data'; @@ -134,6 +134,11 @@ describe('DashboardState', function () { const dashboardContainer = initDashboardContainer({ expandedPanelId: 'theCoolestPanelOnThisDashboard', + panels: { + theCoolestPanelOnThisDashboard: { + explicitInput: { id: 'theCoolestPanelOnThisDashboard' }, + } as DashboardPanelState, + }, }); dashboardState.handleDashboardContainerChanges(dashboardContainer); @@ -149,15 +154,39 @@ describe('DashboardState', function () { const dashboardContainer = initDashboardContainer({ expandedPanelId: 'theCoolestPanelOnThisDashboard', + panels: { + theCoolestPanelOnThisDashboard: { + explicitInput: { id: 'theCoolestPanelOnThisDashboard' }, + } as DashboardPanelState, + }, }); dashboardState.handleDashboardContainerChanges(dashboardContainer); dashboardState.handleDashboardContainerChanges(dashboardContainer); expect(dashboardState.setExpandedPanelId).toHaveBeenCalledTimes(1); + }); + + test('expandedPanelId is set to undefined if panel does not exist in input', () => { + dashboardState.setExpandedPanelId = jest + .fn() + .mockImplementation(dashboardState.setExpandedPanelId); + const dashboardContainer = initDashboardContainer({ + expandedPanelId: 'theCoolestPanelOnThisDashboard', + panels: { + theCoolestPanelOnThisDashboard: { + explicitInput: { id: 'theCoolestPanelOnThisDashboard' }, + } as DashboardPanelState, + }, + }); + + dashboardState.handleDashboardContainerChanges(dashboardContainer); + expect(dashboardState.setExpandedPanelId).toHaveBeenCalledWith( + 'theCoolestPanelOnThisDashboard' + ); - dashboardContainer.updateInput({ expandedPanelId: 'woah it changed' }); + dashboardContainer.updateInput({ expandedPanelId: 'theLeastCoolPanelOnThisDashboard' }); dashboardState.handleDashboardContainerChanges(dashboardContainer); - expect(dashboardState.setExpandedPanelId).toHaveBeenCalledTimes(2); + expect(dashboardState.setExpandedPanelId).toHaveBeenCalledWith(undefined); }); }); diff --git a/src/plugins/dashboard/public/application/dashboard_state_manager.ts b/src/plugins/dashboard/public/application/dashboard_state_manager.ts index dfcbfcafd3db1..891add08547db 100644 --- a/src/plugins/dashboard/public/application/dashboard_state_manager.ts +++ b/src/plugins/dashboard/public/application/dashboard_state_manager.ts @@ -223,6 +223,7 @@ export class DashboardStateManager { const savedDashboardPanelMap: { [key: string]: SavedDashboardPanel } = {}; const input = dashboardContainer.getInput(); + this.getPanels().forEach((savedDashboardPanel) => { if (input.panels[savedDashboardPanel.panelIndex] !== undefined) { savedDashboardPanelMap[savedDashboardPanel.panelIndex] = savedDashboardPanel; @@ -234,11 +235,16 @@ export class DashboardStateManager { const convertedPanelStateMap: { [key: string]: SavedDashboardPanel } = {}; + let expandedPanelValid = false; Object.values(input.panels).forEach((panelState) => { if (savedDashboardPanelMap[panelState.explicitInput.id] === undefined) { dirty = true; } + if (panelState.explicitInput.id === input.expandedPanelId) { + expandedPanelValid = true; + } + convertedPanelStateMap[panelState.explicitInput.id] = convertPanelStateToSavedDashboardPanel( panelState, this.kibanaVersion @@ -272,8 +278,10 @@ export class DashboardStateManager { this.setFullScreenMode(input.isFullScreenMode); } - if (input.expandedPanelId !== this.getExpandedPanelId()) { + if (expandedPanelValid && input.expandedPanelId !== this.getExpandedPanelId()) { this.setExpandedPanelId(input.expandedPanelId); + } else if (!expandedPanelValid && this.getExpandedPanelId()) { + this.setExpandedPanelId(undefined); } if (!_.isEqual(input.query, this.getQuery())) { diff --git a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx index c5929c5d85dbb..3d7b9312a5127 100644 --- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx +++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx @@ -34,7 +34,6 @@ import { ViewMode, EmbeddableChildPanel } from '../../../services/embeddable'; import { DASHBOARD_GRID_COLUMN_COUNT, DASHBOARD_GRID_HEIGHT } from '../dashboard_constants'; import { DashboardPanelState } from '../types'; import { withKibana } from '../../../services/kibana_react'; -import { DashboardContainerInput } from '../dashboard_container'; import { DashboardContainer, DashboardReactContextValue } from '../dashboard_container'; let lastValidGridSize = 0; @@ -177,18 +176,17 @@ class DashboardGridUi extends React.Component { isLayoutInvalid, }); - this.subscription = this.props.container - .getInput$() - .subscribe((input: DashboardContainerInput) => { - if (this.mounted) { - this.setState({ - panels: input.panels, - viewMode: input.viewMode, - useMargins: input.useMargins, - expandedPanelId: input.expandedPanelId, - }); - } - }); + this.subscription = this.props.container.getInput$().subscribe(() => { + const { panels, viewMode, useMargins, expandedPanelId } = this.props.container.getInput(); + if (this.mounted) { + this.setState({ + panels, + viewMode, + useMargins, + expandedPanelId, + }); + } + }); } public componentWillUnmount() { From 6a55d46b2e42f6b24472a37c9e85fed3da0a43a6 Mon Sep 17 00:00:00 2001 From: Sonja Krause-Harder Date: Wed, 13 Jan 2021 16:32:55 +0100 Subject: [PATCH 15/22] [EPM] Include both kibana and elasticsearch assets in package information (#88036) * Return both kibana and elasticsearch assets. * Fix type complaints. --- .../common/services/package_to_package_policy.test.ts | 8 ++++++++ x-pack/plugins/fleet/common/types/models/epm.ts | 4 ++-- .../public/applications/fleet/sections/epm/constants.tsx | 3 ++- .../plugins/fleet/server/services/epm/registry/index.ts | 7 +++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts b/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts index 36972270de011..3523c73ee64e1 100644 --- a/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts +++ b/x-pack/plugins/fleet/common/services/package_to_package_policy.test.ts @@ -27,6 +27,14 @@ describe('Fleet - packageToPackagePolicy', () => { index_pattern: [], map: [], }, + elasticsearch: { + ingest_pipeline: [], + component_template: [], + index_template: [], + transform: [], + ilm_policy: [], + data_stream_ilm_policy: [], + }, }, status: 'not_installed', release: 'experimental', diff --git a/x-pack/plugins/fleet/common/types/models/epm.ts b/x-pack/plugins/fleet/common/types/models/epm.ts index 08f92f406b90f..6724863557411 100644 --- a/x-pack/plugins/fleet/common/types/models/epm.ts +++ b/x-pack/plugins/fleet/common/types/models/epm.ts @@ -187,8 +187,8 @@ export type AssetTypeToParts = KibanaAssetTypeToParts & ElasticsearchAssetTypeTo export type AssetsGroupedByServiceByType = Record< Extract, KibanaAssetTypeToParts ->; -// & Record, ElasticsearchAssetTypeToParts>; +> & + Record, ElasticsearchAssetTypeToParts>; export type KibanaAssetParts = AssetParts & { service: Extract; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx index 26e36621802fd..533026aa93f78 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/epm/constants.tsx @@ -30,8 +30,9 @@ export const AssetTitleMap: Record = { data_stream_ilm_policy: 'Data Stream ILM Policy', }; -export const ServiceTitleMap: Record, string> = { +export const ServiceTitleMap: Record = { kibana: 'Kibana', + elasticsearch: 'Elasticsearch', }; export const AssetIcons: Record = { diff --git a/x-pack/plugins/fleet/server/services/epm/registry/index.ts b/x-pack/plugins/fleet/server/services/epm/registry/index.ts index dc4f02c94acde..61bbb4cddd085 100644 --- a/x-pack/plugins/fleet/server/services/epm/registry/index.ts +++ b/x-pack/plugins/fleet/server/services/epm/registry/index.ts @@ -208,7 +208,10 @@ export function groupPathsByService(paths: string[]): AssetsGroupedByServiceByTy // ASK: best way, if any, to avoid `any`? const assets = paths.reduce((map: any, path) => { const parts = getPathParts(path.replace(/^\/package\//, '')); - if (parts.service === 'kibana' && kibanaAssetTypes.includes(parts.type)) { + if ( + (parts.service === 'kibana' && kibanaAssetTypes.includes(parts.type)) || + parts.service === 'elasticsearch' + ) { if (!map[parts.service]) map[parts.service] = {}; if (!map[parts.service][parts.type]) map[parts.service][parts.type] = []; map[parts.service][parts.type].push(parts); @@ -219,6 +222,6 @@ export function groupPathsByService(paths: string[]): AssetsGroupedByServiceByTy return { kibana: assets.kibana, - // elasticsearch: assets.elasticsearch, + elasticsearch: assets.elasticsearch, }; } From 3953f9647e218ed12d51f18d42c5dc809166fd5e Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 13 Jan 2021 08:38:41 -0700 Subject: [PATCH 16/22] skip flaky suite (#88177) --- x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts b/x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts index ff4ab65a310ed..04cf8bef1a16c 100644 --- a/x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts +++ b/x-pack/test/functional_with_es_ssl/apps/uptime/alert_flyout.ts @@ -8,7 +8,8 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default ({ getPageObjects, getService }: FtrProviderContext) => { - describe('uptime alerts', () => { + // FLAKY: https://github.com/elastic/kibana/issues/88177 + describe.skip('uptime alerts', () => { const pageObjects = getPageObjects(['common', 'uptime']); const supertest = getService('supertest'); const retry = getService('retry'); From 74e408f91dcb66db9a0a5e2df8799a15c6476c00 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Wed, 13 Jan 2021 09:50:51 -0600 Subject: [PATCH 17/22] [build] Migrate grunt license:csv_report to script (#86001) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- scripts/licenses_csv_report.js | 21 +++++ src/dev/run_licenses_csv_report.js | 128 +++++++++++++++++++++++++++++ tasks/licenses_csv_report.js | 116 -------------------------- 3 files changed, 149 insertions(+), 116 deletions(-) create mode 100644 scripts/licenses_csv_report.js create mode 100644 src/dev/run_licenses_csv_report.js delete mode 100644 tasks/licenses_csv_report.js diff --git a/scripts/licenses_csv_report.js b/scripts/licenses_csv_report.js new file mode 100644 index 0000000000000..6fe813a472745 --- /dev/null +++ b/scripts/licenses_csv_report.js @@ -0,0 +1,21 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +require('../src/setup_node_env'); +require('../src/dev/run_licenses_csv_report'); diff --git a/src/dev/run_licenses_csv_report.js b/src/dev/run_licenses_csv_report.js new file mode 100644 index 0000000000000..791f296085deb --- /dev/null +++ b/src/dev/run_licenses_csv_report.js @@ -0,0 +1,128 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { writeFileSync } from 'fs'; +import { resolve } from 'path'; +import { isNull, isUndefined } from 'lodash'; + +import { run } from '@kbn/dev-utils'; + +import { getInstalledPackages } from './npm'; +import { engines } from '../../package'; +import { LICENSE_OVERRIDES } from './license_checker'; + +const allDoubleQuoteRE = /"/g; + +function escapeValue(value) { + if (isNull(value)) { + return; + } + + return `"${value.replace(allDoubleQuoteRE, '""')}"`; +} + +function formatCsvValues(fields, values) { + return fields + .map((field) => { + const value = values[field]; + + if (isNull(value) || isUndefined(value)) { + return null; + } + + return value.toString(); + }) + .map(escapeValue) + .join(','); +} + +run( + async ({ log, flags }) => { + const fields = ['name', 'version', 'url', 'license', 'sourceURL']; + + const file = flags.csv; + const directory = flags.directory; + const dev = flags.dev; + + const root = resolve(__dirname, '..', '..'); + const packages = await getInstalledPackages({ + directory: directory ? resolve(directory) : root, + licenseOverrides: LICENSE_OVERRIDES, + dev, + }); + + packages.unshift( + { + name: 'Node.js', + version: engines.node, + repository: 'https://nodejs.org', + licenses: ['MIT'], + }, + { + name: 'Red Hat Universal Base Image minimal', + version: '8', + repository: + 'https://catalog.redhat.com/software/containers/ubi8/ubi-minimal/5c359a62bed8bd75a2c3fba8', + licenses: [ + 'Custom;https://www.redhat.com/licenses/EULA_Red_Hat_Universal_Base_Image_English_20190422.pdf', + ], + sourceURL: 'https://oss-dependencies.elastic.co/redhat/ubi/ubi-minimal-8-source.tar.gz', + } + ); + + const csv = packages + .map((pkg) => { + const data = { + name: pkg.name, + version: pkg.version, + url: pkg.repository || `https://www.npmjs.com/package/${pkg.name}`, + license: pkg.licenses.join(','), + sourceURL: pkg.sourceURL, + }; + + return formatCsvValues(fields, data); + }) + .join('\n'); + + if (file) { + writeFileSync(file, `${fields.join(',')}\n${csv}`); + log.success(`wrote to ${file}`); + } else { + log.success(csv); + log.debug('\nspecify "--csv [filepath]" to write the data to a specific file'); + } + }, + { + description: ` + Report of 3rd party dependencies + `, + flags: { + boolean: ['dev'], + string: ['csv', 'directory'], + default: { + dev: false, + }, + help: ` + --dev Include development dependencies + --csv Write csv report to file + --directory Directory to check for licenses + `, + }, + } +); diff --git a/tasks/licenses_csv_report.js b/tasks/licenses_csv_report.js deleted file mode 100644 index f504cbcaa5fc8..0000000000000 --- a/tasks/licenses_csv_report.js +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { writeFileSync } from 'fs'; -import { resolve } from 'path'; -import { getInstalledPackages } from '../src/dev/npm'; -import { engines } from '../package'; -import { LICENSE_OVERRIDES } from '../src/dev/license_checker'; - -import { isNull, isUndefined } from 'lodash'; - -const allDoubleQuoteRE = /"/g; - -function escapeValue(value) { - if (isNull(value)) { - return; - } - - return `"${value.replace(allDoubleQuoteRE, '""')}"`; -} - -function formatCsvValues(fields, values) { - return fields - .map((field) => { - const value = values[field]; - - if (isNull(value) || isUndefined(value)) { - return null; - } - - return value.toString(); - }) - .map(escapeValue) - .join(','); -} - -export default function licensesCSVReport(grunt) { - grunt.registerTask('licenses:csv_report', 'Report of 3rd party dependencies', async function () { - const fields = ['name', 'version', 'url', 'license', 'sourceURL']; - const done = this.async(); - - try { - const file = grunt.option('csv'); - const directory = grunt.option('directory'); - const dev = Boolean(grunt.option('dev')); - - const packages = await getInstalledPackages({ - directory: directory ? resolve(directory) : grunt.config.get('root'), - licenseOverrides: LICENSE_OVERRIDES, - dev, - }); - - packages.unshift( - { - name: 'Node.js', - version: engines.node, - repository: 'https://nodejs.org', - licenses: ['MIT'], - }, - { - name: 'Red Hat Universal Base Image minimal', - version: '8', - repository: - 'https://catalog.redhat.com/software/containers/ubi8/ubi-minimal/5c359a62bed8bd75a2c3fba8', - licenses: [ - 'Custom;https://www.redhat.com/licenses/EULA_Red_Hat_Universal_Base_Image_English_20190422.pdf', - ], - sourceURL: 'https://oss-dependencies.elastic.co/redhat/ubi/ubi-minimal-8-source.tar.gz', - } - ); - - const csv = packages - .map((pkg) => { - const data = { - name: pkg.name, - version: pkg.version, - url: pkg.repository || `https://www.npmjs.com/package/${pkg.name}`, - license: pkg.licenses.join(','), - sourceURL: pkg.sourceURL, - }; - - return formatCsvValues(fields, data); - }) - .join('\n'); - - if (file) { - writeFileSync(file, `${fields.join(',')}\n${csv}`); - grunt.log.writeln(`wrote to ${file}`); - } else { - grunt.log.writeln(csv); - grunt.log.writeln('\nspecify "--csv [filepath]" to write the data to a specific file'); - } - - done(); - } catch (err) { - grunt.fail.fatal(err); - done(err); - } - }); -} From 05f5192d1d58b0fb685819acc80a47817f49330f Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 13 Jan 2021 08:51:30 -0700 Subject: [PATCH 18/22] skipping flaky suite (#87988) --- .../test/case_api_integration/basic/tests/cases/patch_cases.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/test/case_api_integration/basic/tests/cases/patch_cases.ts b/x-pack/test/case_api_integration/basic/tests/cases/patch_cases.ts index a0c5941d984cd..5b12ba4bf613f 100644 --- a/x-pack/test/case_api_integration/basic/tests/cases/patch_cases.ts +++ b/x-pack/test/case_api_integration/basic/tests/cases/patch_cases.ts @@ -36,6 +36,7 @@ export default ({ getService }: FtrProviderContext): void => { const es = getService('es'); // Failing: See https://github.com/elastic/kibana/issues/88130 + // FLAKY: https://github.com/elastic/kibana/issues/87988 describe.skip('patch_cases', () => { afterEach(async () => { await deleteCases(es); From 1670d48229264b7f445801bfc008d73aea7de854 Mon Sep 17 00:00:00 2001 From: Nick Partridge Date: Wed, 13 Jan 2021 10:00:20 -0600 Subject: [PATCH 19/22] [Visualize] Fix color picker close on blur (#88067) --- .../public/utils/use_color_picker.tsx | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/plugins/vis_type_xy/public/utils/use_color_picker.tsx b/src/plugins/vis_type_xy/public/utils/use_color_picker.tsx index 05de38b7700a9..666dcee29fc9d 100644 --- a/src/plugins/vis_type_xy/public/utils/use_color_picker.tsx +++ b/src/plugins/vis_type_xy/public/utils/use_color_picker.tsx @@ -17,10 +17,10 @@ * under the License. */ -import React, { BaseSyntheticEvent, useMemo } from 'react'; +import React, { BaseSyntheticEvent, useCallback, useMemo } from 'react'; import { LegendColorPicker, Position, XYChartSeriesIdentifier, SeriesName } from '@elastic/charts'; -import { PopoverAnchorPosition, EuiWrappingPopover } from '@elastic/eui'; +import { PopoverAnchorPosition, EuiWrappingPopover, EuiOutsideClickDetector } from '@elastic/eui'; import { ColorPicker } from '../../../charts/public'; @@ -61,18 +61,26 @@ export const useColorPicker = ( onClose(); }; + // rule doesn't know this is inside a functional component + // eslint-disable-next-line react-hooks/rules-of-hooks + const handleOutsideClick = useCallback(() => { + onClose?.(); + }, [onClose]); + return ( - - - + + + + + ); }, [getSeriesName, legendPosition, setColor] From f4a348f7624e7c4b0b5021e03382bef40d06d20a Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 13 Jan 2021 09:14:39 -0700 Subject: [PATCH 20/22] skip flaky test (#75106) --- .../app/Settings/CustomizeUI/CustomLink/index.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx index 4477ee5a99be3..63dd486544124 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/CustomizeUI/CustomLink/index.test.tsx @@ -219,7 +219,8 @@ describe('CustomLink', () => { expect(saveCustomLinkSpy).toHaveBeenCalledTimes(1); }); - it('deletes a custom link', async () => { + // FLAKY: https://github.com/elastic/kibana/issues/75106 + it.skip('deletes a custom link', async () => { const mockContext = getMockAPMContext({ canSave: true }); const component = render( From 94ca8ab1c3b22285d9520d34703af737082f00dc Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 13 Jan 2021 17:15:41 +0100 Subject: [PATCH 21/22] Migrate most kibana app plugins to TS projects (#87636) --- src/plugins/lens_oss/tsconfig.json | 20 +++++++++++ .../timelion/public/services/_saved_sheet.ts | 2 +- src/plugins/timelion/tsconfig.json | 23 +++++++++++++ src/plugins/vis_default_editor/tsconfig.json | 20 +++++++++++ src/plugins/vis_type_markdown/tsconfig.json | 22 ++++++++++++ src/plugins/vis_type_metric/tsconfig.json | 20 +++++++++++ .../public/legacy/vis_controller.ts | 4 +-- src/plugins/vis_type_table/tsconfig.json | 27 +++++++++++++++ src/plugins/vis_type_tagcloud/tsconfig.json | 25 ++++++++++++++ src/plugins/vis_type_timelion/common/types.ts | 2 +- .../public/timelion_vis_fn.ts | 12 +++---- src/plugins/vis_type_timelion/tsconfig.json | 25 ++++++++++++++ .../lib/vis_data/helpers/unit_to_seconds.ts | 2 +- src/plugins/vis_type_timeseries/tsconfig.json | 27 +++++++++++++++ .../vis_type_vislib/public/to_ast.test.ts | 2 +- .../vis_type_vislib/public/to_ast_pie.test.ts | 2 +- .../vis_type_vislib/public/vis_controller.tsx | 4 +-- src/plugins/vis_type_vislib/tsconfig.json | 26 ++++++++++++++ .../public/sample_vis.test.mocks.ts | 0 src/plugins/vis_type_xy/public/to_ast.test.ts | 2 +- .../vis_type_xy/public/utils/domain.ts | 2 +- src/plugins/vis_type_xy/tsconfig.json | 25 ++++++++++++++ .../public/legacy/vis_update_state.d.ts | 24 +++++++++++++ .../saved_objects/visualization_migrations.ts | 10 ++++-- src/plugins/visualizations/tsconfig.json | 29 ++++++++++++++++ src/plugins/visualize/tsconfig.json | 34 +++++++++++++++++++ tsconfig.json | 30 ++++++++++++++-- tsconfig.refs.json | 14 +++++++- .../plugins/discover_enhanced/tsconfig.json | 24 +++++++++++++ .../tsconfig.json | 15 ++++++++ x-pack/tsconfig.json | 6 +++- x-pack/tsconfig.refs.json | 4 ++- 32 files changed, 458 insertions(+), 26 deletions(-) create mode 100644 src/plugins/lens_oss/tsconfig.json create mode 100644 src/plugins/timelion/tsconfig.json create mode 100644 src/plugins/vis_default_editor/tsconfig.json create mode 100644 src/plugins/vis_type_markdown/tsconfig.json create mode 100644 src/plugins/vis_type_metric/tsconfig.json create mode 100644 src/plugins/vis_type_table/tsconfig.json create mode 100644 src/plugins/vis_type_tagcloud/tsconfig.json create mode 100644 src/plugins/vis_type_timelion/tsconfig.json create mode 100644 src/plugins/vis_type_timeseries/tsconfig.json create mode 100644 src/plugins/vis_type_vislib/tsconfig.json rename src/plugins/{vis_type_vislib => vis_type_xy}/public/sample_vis.test.mocks.ts (100%) create mode 100644 src/plugins/vis_type_xy/tsconfig.json create mode 100644 src/plugins/visualizations/public/legacy/vis_update_state.d.ts create mode 100644 src/plugins/visualizations/tsconfig.json create mode 100644 src/plugins/visualize/tsconfig.json create mode 100644 x-pack/plugins/discover_enhanced/tsconfig.json create mode 100644 x-pack/plugins/vis_type_timeseries_enhanced/tsconfig.json diff --git a/src/plugins/lens_oss/tsconfig.json b/src/plugins/lens_oss/tsconfig.json new file mode 100644 index 0000000000000..d7bbc593fa87b --- /dev/null +++ b/src/plugins/lens_oss/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*", + "*.ts" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" } + ] +} diff --git a/src/plugins/timelion/public/services/_saved_sheet.ts b/src/plugins/timelion/public/services/_saved_sheet.ts index 3fe66fabebe73..eafc8068fbfd1 100644 --- a/src/plugins/timelion/public/services/_saved_sheet.ts +++ b/src/plugins/timelion/public/services/_saved_sheet.ts @@ -69,5 +69,5 @@ export function createSavedSheetClass(savedObjects: SavedObjectsStart, config: I } } - return SavedSheet; + return SavedSheet as unknown; } diff --git a/src/plugins/timelion/tsconfig.json b/src/plugins/timelion/tsconfig.json new file mode 100644 index 0000000000000..5b96d69a878ea --- /dev/null +++ b/src/plugins/timelion/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "public/**/*", + "server/**/*" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../navigation/tsconfig.json" }, + { "path": "../vis_type_timelion/tsconfig.json" }, + { "path": "../saved_objects/tsconfig.json" }, + { "path": "../kibana_legacy/tsconfig.json" }, + ] +} diff --git a/src/plugins/vis_default_editor/tsconfig.json b/src/plugins/vis_default_editor/tsconfig.json new file mode 100644 index 0000000000000..27bb775c2d0e8 --- /dev/null +++ b/src/plugins/vis_default_editor/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "public/**/*" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../visualize/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../kibana_react/tsconfig.json" }, + ] +} diff --git a/src/plugins/vis_type_markdown/tsconfig.json b/src/plugins/vis_type_markdown/tsconfig.json new file mode 100644 index 0000000000000..d5ab89b98081b --- /dev/null +++ b/src/plugins/vis_type_markdown/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "public/**/*", + "server/**/*", + "*.ts" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../kibana_react/tsconfig.json" }, + { "path": "../vis_default_editor/tsconfig.json" }, + ] +} diff --git a/src/plugins/vis_type_metric/tsconfig.json b/src/plugins/vis_type_metric/tsconfig.json new file mode 100644 index 0000000000000..7441848d5a430 --- /dev/null +++ b/src/plugins/vis_type_metric/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["public/**/*", "server/**/*", "*.ts"], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../charts/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../vis_default_editor/tsconfig.json" } + ] +} diff --git a/src/plugins/vis_type_table/public/legacy/vis_controller.ts b/src/plugins/vis_type_table/public/legacy/vis_controller.ts index eff8e34f3e778..7584397e78dc6 100644 --- a/src/plugins/vis_type_table/public/legacy/vis_controller.ts +++ b/src/plugins/vis_type_table/public/legacy/vis_controller.ts @@ -42,8 +42,8 @@ export function getTableVisualizationControllerClass( context: PluginInitializerContext ) { return class TableVisualizationController { - private tableVisModule: IModule | undefined; - private injector: auto.IInjectorService | undefined; + tableVisModule: IModule | undefined; + injector: auto.IInjectorService | undefined; el: JQuery; $rootScope: IRootScopeService | null = null; $scope: (IScope & { [key: string]: any }) | undefined; diff --git a/src/plugins/vis_type_table/tsconfig.json b/src/plugins/vis_type_table/tsconfig.json new file mode 100644 index 0000000000000..bda86d06c0ff7 --- /dev/null +++ b/src/plugins/vis_type_table/tsconfig.json @@ -0,0 +1,27 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "public/**/*", + "server/**/*", + "*.ts" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../share/tsconfig.json" }, + { "path": "../usage_collection/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../kibana_legacy/tsconfig.json" }, + { "path": "../kibana_react/tsconfig.json" }, + { "path": "../vis_default_editor/tsconfig.json" }, + ] +} diff --git a/src/plugins/vis_type_tagcloud/tsconfig.json b/src/plugins/vis_type_tagcloud/tsconfig.json new file mode 100644 index 0000000000000..18bbad2257466 --- /dev/null +++ b/src/plugins/vis_type_tagcloud/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "public/**/*", + "server/**/*", + "*.ts" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../charts/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../kibana_react/tsconfig.json" }, + { "path": "../vis_default_editor/tsconfig.json" }, + ] +} diff --git a/src/plugins/vis_type_timelion/common/types.ts b/src/plugins/vis_type_timelion/common/types.ts index f7084948a14f7..fed380130b26d 100644 --- a/src/plugins/vis_type_timelion/common/types.ts +++ b/src/plugins/vis_type_timelion/common/types.ts @@ -19,7 +19,7 @@ type TimelionFunctionArgsTypes = 'seriesList' | 'number' | 'string' | 'boolean' | 'null'; -interface TimelionFunctionArgsSuggestion { +export interface TimelionFunctionArgsSuggestion { name: string; help: string; } diff --git a/src/plugins/vis_type_timelion/public/timelion_vis_fn.ts b/src/plugins/vis_type_timelion/public/timelion_vis_fn.ts index 2e8878b11e915..dad3a04ddd387 100644 --- a/src/plugins/vis_type_timelion/public/timelion_vis_fn.ts +++ b/src/plugins/vis_type_timelion/public/timelion_vis_fn.ts @@ -30,23 +30,21 @@ import { KibanaContext, Filter, Query, TimeRange } from '../../data/public'; type Input = KibanaContext | null; type Output = Promise>; -interface Arguments { - expression: string; - interval: string; -} - export interface TimelionRenderValue { visData: TimelionSuccessResponse; visType: 'timelion'; visParams: TimelionVisParams; } -export type TimelionVisParams = Arguments; +export interface TimelionVisParams { + expression: string; + interval: string; +} export type TimelionExpressionFunctionDefinition = ExpressionFunctionDefinition< 'timelion_vis', Input, - Arguments, + TimelionVisParams, Output >; diff --git a/src/plugins/vis_type_timelion/tsconfig.json b/src/plugins/vis_type_timelion/tsconfig.json new file mode 100644 index 0000000000000..77f97de28366d --- /dev/null +++ b/src/plugins/vis_type_timelion/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*", + "*.ts" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../kibana_react/tsconfig.json" }, + { "path": "../vis_default_editor/tsconfig.json" }, + ] +} diff --git a/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.ts b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.ts index 8950e05c85d4f..22dfc590245ac 100644 --- a/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.ts +++ b/src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/unit_to_seconds.ts @@ -37,7 +37,7 @@ const units: Record = { const sortedUnits = sortBy(Object.keys(units), (key: Unit) => units[key]); -interface ParsedInterval { +export interface ParsedInterval { value: number; unit: Unit; } diff --git a/src/plugins/vis_type_timeseries/tsconfig.json b/src/plugins/vis_type_timeseries/tsconfig.json new file mode 100644 index 0000000000000..7b2dd4b608c1c --- /dev/null +++ b/src/plugins/vis_type_timeseries/tsconfig.json @@ -0,0 +1,27 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*", + "*.ts" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../charts/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../visualize/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../kibana_react/tsconfig.json" }, + { "path": "../usage_collection/tsconfig.json" }, + ] +} diff --git a/src/plugins/vis_type_vislib/public/to_ast.test.ts b/src/plugins/vis_type_vislib/public/to_ast.test.ts index 48d3dfe254d0b..28049be291723 100644 --- a/src/plugins/vis_type_vislib/public/to_ast.test.ts +++ b/src/plugins/vis_type_vislib/public/to_ast.test.ts @@ -22,7 +22,7 @@ import { buildExpression } from '../../expressions/public'; import { BasicVislibParams } from './types'; import { toExpressionAst } from './to_ast'; -import { sampleAreaVis } from './sample_vis.test.mocks'; +import { sampleAreaVis } from '../../vis_type_xy/public/sample_vis.test.mocks'; jest.mock('../../expressions/public', () => ({ ...(jest.requireActual('../../expressions/public') as any), diff --git a/src/plugins/vis_type_vislib/public/to_ast_pie.test.ts b/src/plugins/vis_type_vislib/public/to_ast_pie.test.ts index 36a9a17341bc5..08a74a37f380c 100644 --- a/src/plugins/vis_type_vislib/public/to_ast_pie.test.ts +++ b/src/plugins/vis_type_vislib/public/to_ast_pie.test.ts @@ -21,7 +21,7 @@ import { Vis } from '../../visualizations/public'; import { buildExpression } from '../../expressions/public'; import { PieVisParams } from './pie'; -import { samplePieVis } from './sample_vis.test.mocks'; +import { samplePieVis } from '../../vis_type_xy/public/sample_vis.test.mocks'; import { toExpressionAst } from './to_ast_pie'; jest.mock('../../expressions/public', () => ({ diff --git a/src/plugins/vis_type_vislib/public/vis_controller.tsx b/src/plugins/vis_type_vislib/public/vis_controller.tsx index 2a32d19874c22..a536ac4b207ea 100644 --- a/src/plugins/vis_type_vislib/public/vis_controller.tsx +++ b/src/plugins/vis_type_vislib/public/vis_controller.tsx @@ -44,8 +44,8 @@ export const createVislibVisController = ( charts: ChartsPluginSetup ) => { return class VislibVisController { - private removeListeners?: () => void; - private unmountLegend?: () => void; + removeListeners?: () => void; + unmountLegend?: () => void; legendRef: RefObject; container: HTMLDivElement; diff --git a/src/plugins/vis_type_vislib/tsconfig.json b/src/plugins/vis_type_vislib/tsconfig.json new file mode 100644 index 0000000000000..74bc1440d9dbc --- /dev/null +++ b/src/plugins/vis_type_vislib/tsconfig.json @@ -0,0 +1,26 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../charts/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../kibana_legacy/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../vis_default_editor/tsconfig.json" }, + { "path": "../vis_type_xy/tsconfig.json" }, + ] +} diff --git a/src/plugins/vis_type_vislib/public/sample_vis.test.mocks.ts b/src/plugins/vis_type_xy/public/sample_vis.test.mocks.ts similarity index 100% rename from src/plugins/vis_type_vislib/public/sample_vis.test.mocks.ts rename to src/plugins/vis_type_xy/public/sample_vis.test.mocks.ts diff --git a/src/plugins/vis_type_xy/public/to_ast.test.ts b/src/plugins/vis_type_xy/public/to_ast.test.ts index 678a9faaec585..b6dedd694eb95 100644 --- a/src/plugins/vis_type_xy/public/to_ast.test.ts +++ b/src/plugins/vis_type_xy/public/to_ast.test.ts @@ -19,7 +19,7 @@ import { Vis } from '../../visualizations/public'; import { buildExpression } from '../../expressions/public'; -import { sampleAreaVis } from '../../vis_type_vislib/public/sample_vis.test.mocks'; +import { sampleAreaVis } from './sample_vis.test.mocks'; import { toExpressionAst } from './to_ast'; import { VisParams } from './types'; diff --git a/src/plugins/vis_type_xy/public/utils/domain.ts b/src/plugins/vis_type_xy/public/utils/domain.ts index 132c8df71428b..b5e3c15a42c43 100644 --- a/src/plugins/vis_type_xy/public/utils/domain.ts +++ b/src/plugins/vis_type_xy/public/utils/domain.ts @@ -52,7 +52,7 @@ export const getAdjustedDomain = ( data: Datatable['rows'], { accessor, params }: Aspect, timeZone: string, - domain?: DomainRange, + domain: DomainRange | undefined, hasBars?: boolean ): DomainRange => { if ( diff --git a/src/plugins/vis_type_xy/tsconfig.json b/src/plugins/vis_type_xy/tsconfig.json new file mode 100644 index 0000000000000..5cb0bc8d0bc8e --- /dev/null +++ b/src/plugins/vis_type_xy/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../charts/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../usage_collection/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../vis_default_editor/tsconfig.json" }, + ] +} diff --git a/src/plugins/visualizations/public/legacy/vis_update_state.d.ts b/src/plugins/visualizations/public/legacy/vis_update_state.d.ts new file mode 100644 index 0000000000000..a400ac3d1500f --- /dev/null +++ b/src/plugins/visualizations/public/legacy/vis_update_state.d.ts @@ -0,0 +1,24 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { SavedVisState } from '../types'; + +declare function updateOldState(oldState: unknown): SavedVisState; + +export { updateOldState }; diff --git a/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts b/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts index 20d93d73fe190..8317536f4b28a 100644 --- a/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts +++ b/src/plugins/visualizations/server/saved_objects/visualization_migrations.ts @@ -21,7 +21,6 @@ import { cloneDeep, get, omit, has, flow } from 'lodash'; import { SavedObjectMigrationFn } from 'kibana/server'; -import { ChartType } from '../../../vis_type_xy/common'; import { DEFAULT_QUERY_LANGUAGE } from '../../../data/common'; const migrateIndexPattern: SavedObjectMigrationFn = (doc) => { @@ -804,6 +803,11 @@ const decorateAxes = ( }, })); +// Inlined from vis_type_xy +const CHART_TYPE_AREA = 'area'; +const CHART_TYPE_LINE = 'line'; +const CHART_TYPE_HISTOGRAM = 'histogram'; + /** * Migrate vislib bar, line and area charts to use new vis_type_xy plugin */ @@ -819,11 +823,11 @@ const migrateVislibAreaLineBarTypes: SavedObjectMigrationFn = (doc) => } if ( visState && - [ChartType.Area, ChartType.Line, ChartType.Histogram].includes(visState?.params?.type) + [CHART_TYPE_AREA, CHART_TYPE_LINE, CHART_TYPE_HISTOGRAM].includes(visState?.params?.type) ) { const isHorizontalBar = visState.type === 'horizontal_bar'; const isLineOrArea = - visState?.params?.type === ChartType.Area || visState?.params?.type === ChartType.Line; + visState?.params?.type === CHART_TYPE_AREA || visState?.params?.type === CHART_TYPE_LINE; return { ...doc, attributes: { diff --git a/src/plugins/visualizations/tsconfig.json b/src/plugins/visualizations/tsconfig.json new file mode 100644 index 0000000000000..d7c5e6a4b4366 --- /dev/null +++ b/src/plugins/visualizations/tsconfig.json @@ -0,0 +1,29 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../dashboard/tsconfig.json" }, + { "path": "../expressions/tsconfig.json" }, + { "path": "../ui_actions/tsconfig.json" }, + { "path": "../embeddable/tsconfig.json" }, + { "path": "../inspector/tsconfig.json" }, + { "path": "../saved_objects/tsconfig.json" }, + { "path": "../saved_objects_tagging_oss/tsconfig.json" }, + { "path": "../usage_collection/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../discover/tsconfig.json" }, + ] +} diff --git a/src/plugins/visualize/tsconfig.json b/src/plugins/visualize/tsconfig.json new file mode 100644 index 0000000000000..bc0891f391746 --- /dev/null +++ b/src/plugins/visualize/tsconfig.json @@ -0,0 +1,34 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "common/**/*", + "public/**/*", + "server/**/*" + ], + "references": [ + { "path": "../../core/tsconfig.json" }, + { "path": "../data/tsconfig.json" }, + { "path": "../url_forwarding/tsconfig.json" }, + { "path": "../navigation/tsconfig.json" }, + { "path": "../saved_objects/tsconfig.json" }, + { "path": "../visualizations/tsconfig.json" }, + { "path": "../embeddable/tsconfig.json" }, + { "path": "../dashboard/tsconfig.json" }, + { "path": "../ui_actions/tsconfig.json" }, + { "path": "../home/tsconfig.json" }, + { "path": "../share/tsconfig.json" }, + { "path": "../saved_objects_tagging_oss/tsconfig.json" }, + { "path": "../kibana_utils/tsconfig.json" }, + { "path": "../kibana_react/tsconfig.json" }, + { "path": "../home/tsconfig.json" }, + { "path": "../presentation_util/tsconfig.json" }, + { "path": "../discover/tsconfig.json" }, + ] +} diff --git a/tsconfig.json b/tsconfig.json index 88d2183dd7bcb..d0596f1cdf3d4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,6 +24,7 @@ "src/plugins/kibana_react/**/*", "src/plugins/kibana_usage_collection/**/*", "src/plugins/kibana_utils/**/*", + "src/plugins/lens_oss/**/*", "src/plugins/management/**/*", "src/plugins/navigation/**/*", "src/plugins/newsfeed/**/*", @@ -34,10 +35,22 @@ "src/plugins/spaces_oss/**/*", "src/plugins/telemetry/**/*", "src/plugins/telemetry_collection_manager/**/*", + "src/plugins/timelion/**/*", "src/plugins/ui_actions/**/*", "src/plugins/url_forwarding/**/*", "src/plugins/usage_collection/**/*", - "src/plugins/presentation_util/**/*" + "src/plugins/presentation_util/**/*", + "src/plugins/vis_default_editor/**/*", + "src/plugins/vis_type_markdown/**/*", + "src/plugins/vis_type_metric/**/*", + "src/plugins/vis_type_table/**/*", + "src/plugins/vis_type_tagcloud/**/*", + "src/plugins/vis_type_timelion/**/*", + "src/plugins/vis_type_timeseries/**/*", + "src/plugins/vis_type_vislib/**/*", + "src/plugins/vis_type_xy/**/*", + "src/plugins/visualizations/**/*", + "src/plugins/visualize/**/*", // In the build we actually exclude **/public/**/* from this config so that // we can run the TSC on both this and the .browser version of this config // file, but if we did it during development IDEs would not be able to find @@ -63,6 +76,7 @@ { "path": "./src/plugins/kibana_react/tsconfig.json" }, { "path": "./src/plugins/kibana_usage_collection/tsconfig.json" }, { "path": "./src/plugins/kibana_utils/tsconfig.json" }, + { "path": "./src/plugins/lens_oss/tsconfig.json" }, { "path": "./src/plugins/management/tsconfig.json" }, { "path": "./src/plugins/navigation/tsconfig.json" }, { "path": "./src/plugins/newsfeed/tsconfig.json" }, @@ -73,8 +87,20 @@ { "path": "./src/plugins/spaces_oss/tsconfig.json" }, { "path": "./src/plugins/telemetry/tsconfig.json" }, { "path": "./src/plugins/telemetry_collection_manager/tsconfig.json" }, + { "path": "./src/plugins/timelion/tsconfig.json" }, { "path": "./src/plugins/ui_actions/tsconfig.json" }, { "path": "./src/plugins/url_forwarding/tsconfig.json" }, - { "path": "./src/plugins/usage_collection/tsconfig.json" } + { "path": "./src/plugins/usage_collection/tsconfig.json" }, + { "path": "./src/plugins/vis_default_editor/tsconfig.json" }, + { "path": "./src/plugins/vis_type_markdown/tsconfig.json" }, + { "path": "./src/plugins/vis_type_metric/tsconfig.json" }, + { "path": "./src/plugins/vis_type_table/tsconfig.json" }, + { "path": "./src/plugins/vis_type_tagcloud/tsconfig.json" }, + { "path": "./src/plugins/vis_type_timelion/tsconfig.json" }, + { "path": "./src/plugins/vis_type_timeseries/tsconfig.json" }, + { "path": "./src/plugins/vis_type_vislib/tsconfig.json" }, + { "path": "./src/plugins/vis_type_xy/tsconfig.json" }, + { "path": "./src/plugins/visualizations/tsconfig.json" }, + { "path": "./src/plugins/visualize/tsconfig.json" }, ] } diff --git a/tsconfig.refs.json b/tsconfig.refs.json index 1a7f0282c921a..5520960444bd9 100644 --- a/tsconfig.refs.json +++ b/tsconfig.refs.json @@ -20,6 +20,7 @@ { "path": "./src/plugins/kibana_react/tsconfig.json" }, { "path": "./src/plugins/kibana_usage_collection/tsconfig.json" }, { "path": "./src/plugins/kibana_utils/tsconfig.json" }, + { "path": "./src/plugins/lens_oss/tsconfig.json" }, { "path": "./src/plugins/management/tsconfig.json" }, { "path": "./src/plugins/navigation/tsconfig.json" }, { "path": "./src/plugins/newsfeed/tsconfig.json" }, @@ -31,9 +32,20 @@ { "path": "./src/plugins/spaces_oss/tsconfig.json" }, { "path": "./src/plugins/telemetry/tsconfig.json" }, { "path": "./src/plugins/telemetry_collection_manager/tsconfig.json" }, + { "path": "./src/plugins/timelion/tsconfig.json" }, { "path": "./src/plugins/ui_actions/tsconfig.json" }, { "path": "./src/plugins/url_forwarding/tsconfig.json" }, { "path": "./src/plugins/usage_collection/tsconfig.json" }, - { "path": "./src/plugins/management/tsconfig.json" }, + { "path": "./src/plugins/vis_default_editor/tsconfig.json" }, + { "path": "./src/plugins/vis_type_markdown/tsconfig.json" }, + { "path": "./src/plugins/vis_type_metric/tsconfig.json" }, + { "path": "./src/plugins/vis_type_table/tsconfig.json" }, + { "path": "./src/plugins/vis_type_tagcloud/tsconfig.json" }, + { "path": "./src/plugins/vis_type_timelion/tsconfig.json" }, + { "path": "./src/plugins/vis_type_timeseries/tsconfig.json" }, + { "path": "./src/plugins/vis_type_vislib/tsconfig.json" }, + { "path": "./src/plugins/vis_type_xy/tsconfig.json" }, + { "path": "./src/plugins/visualizations/tsconfig.json" }, + { "path": "./src/plugins/visualize/tsconfig.json" }, ] } diff --git a/x-pack/plugins/discover_enhanced/tsconfig.json b/x-pack/plugins/discover_enhanced/tsconfig.json new file mode 100644 index 0000000000000..38a55e557909b --- /dev/null +++ b/x-pack/plugins/discover_enhanced/tsconfig.json @@ -0,0 +1,24 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["*.ts", "common/**/*", "public/**/*", "server/**/*"], + "references": [ + { "path": "../../../src/core/tsconfig.json" }, + { "path": "../../../src/plugins/data/tsconfig.json" }, + { "path": "../../../src/plugins/discover/tsconfig.json" }, + { "path": "../../../src/plugins/share/tsconfig.json" }, + { "path": "../../../src/plugins/kibana_legacy/tsconfig.json" }, + { "path": "../../../src/plugins/kibana_utils/tsconfig.json" }, + { "path": "../../../src/plugins/url_forwarding/tsconfig.json" }, + { "path": "../../../src/plugins/usage_collection/tsconfig.json" }, + { "path": "../../../src/plugins/embeddable/tsconfig.json" }, + { "path": "../../../src/plugins/visualizations/tsconfig.json" }, + { "path": "../../../src/plugins/ui_actions/tsconfig.json" } + ] +} diff --git a/x-pack/plugins/vis_type_timeseries_enhanced/tsconfig.json b/x-pack/plugins/vis_type_timeseries_enhanced/tsconfig.json new file mode 100644 index 0000000000000..c5ec5571917bd --- /dev/null +++ b/x-pack/plugins/vis_type_timeseries_enhanced/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./target/types", + "emitDeclarationOnly": true, + "declaration": true, + "declarationMap": true + }, + "include": ["*.ts", "server/**/*"], + "references": [ + { "path": "../../../src/core/tsconfig.json" }, + { "path": "../../../src/plugins/vis_type_timeseries/tsconfig.json" } + ] +} diff --git a/x-pack/tsconfig.json b/x-pack/tsconfig.json index 08f5f78c95acc..d08920fa52020 100644 --- a/x-pack/tsconfig.json +++ b/x-pack/tsconfig.json @@ -5,6 +5,7 @@ "plugins/apm/e2e/cypress/**/*", "plugins/apm/scripts/**/*", "plugins/data_enhanced/**/*", + "plugins/discover_enhanced/**/*", "plugins/dashboard_enhanced/**/*", "plugins/global_search/**/*", "plugins/graph/**/*", @@ -16,6 +17,7 @@ "plugins/telemetry_collection_xpack/**/*", "plugins/translations/**/*", "plugins/ui_actions_enhanced/**/*", + "plugins/vis_type_timeseries_enhanced/**/*", "test/**/*" ], "compilerOptions": { @@ -55,6 +57,7 @@ { "path": "../src/plugins/usage_collection/tsconfig.json" }, { "path": "./plugins/data_enhanced/tsconfig.json" }, + { "path": "./plugins/discover_enhanced/tsconfig.json" }, { "path": "./plugins/global_search/tsconfig.json" }, { "path": "./plugins/features/tsconfig.json" }, { "path": "./plugins/graph/tsconfig.json" }, @@ -62,7 +65,8 @@ { "path": "./plugins/licensing/tsconfig.json" }, { "path": "./plugins/task_manager/tsconfig.json" }, { "path": "./plugins/telemetry_collection_xpack/tsconfig.json" }, + { "path": "./plugins/ui_actions_enhanced/tsconfig.json" }, + { "path": "./plugins/vis_type_timeseries_enhanced/tsconfig.json" }, { "path": "./plugins/translations/tsconfig.json" }, - { "path": "./plugins/ui_actions_enhanced/tsconfig.json" } ] } diff --git a/x-pack/tsconfig.refs.json b/x-pack/tsconfig.refs.json index 28f77a82f415e..49863f9e1aaee 100644 --- a/x-pack/tsconfig.refs.json +++ b/x-pack/tsconfig.refs.json @@ -3,6 +3,7 @@ "references": [ { "path": "./plugins/dashboard_enhanced/tsconfig.json" }, { "path": "./plugins/licensing/tsconfig.json" }, + { "path": "./plugins/discover_enhanced/tsconfig.json" }, { "path": "./plugins/data_enhanced/tsconfig.json" }, { "path": "./plugins/global_search/tsconfig.json" }, { "path": "./plugins/features/tsconfig.json" }, @@ -10,7 +11,8 @@ { "path": "./plugins/embeddable_enhanced/tsconfig.json" }, { "path": "./plugins/task_manager/tsconfig.json" }, { "path": "./plugins/telemetry_collection_xpack/tsconfig.json" }, + { "path": "./plugins/ui_actions_enhanced/tsconfig.json" }, + { "path": "./plugins/vis_type_timeseries_enhanced/tsconfig.json" }, { "path": "./plugins/translations/tsconfig.json" }, - { "path": "./plugins/ui_actions_enhanced/tsconfig.json" } ] } From 64275cd11af05c25d55dc3a8278305cc32543d2c Mon Sep 17 00:00:00 2001 From: Constance Date: Wed, 13 Jan 2021 08:23:56 -0800 Subject: [PATCH 22/22] [App Search] Minor log retention refactors (#88140) * Move reused log retention components to own folder - e.g., logic file, helpers used by other views & not just settings * Update settings-specific views to reference top-level folder - I'm leaving the panel and the confirmation modal within settings as that isn't used anywhere outside the settings page, but we can revisit this if needed or if people think it makes more sense to keep everything log related together * [bug] Fix nested

    error in log retention confirmation modal --- .../app_search/components/log_retention/index.ts | 9 +++++++++ .../log_retention/log_retention_logic.test.ts | 10 +++++----- .../log_retention/log_retention_logic.ts | 5 +++-- .../log_retention/messaging/constants.ts | 0 .../messaging/determine_tooltip_content.test.ts | 0 .../messaging/determine_tooltip_content.ts | 0 .../log_retention/messaging/index.test.tsx | 4 ++-- .../{settings => }/log_retention/messaging/index.tsx | 2 +- .../{settings => }/log_retention/messaging/types.ts | 0 .../components/{settings => }/log_retention/types.ts | 0 .../log_retention/utils/convert_log_retention.test.ts | 1 + .../log_retention/utils/convert_log_retention.ts | 0 .../log_retention/generic_confirmation_modal.tsx | 2 +- .../components/settings/log_retention/index.ts | 8 ++++++++ .../log_retention_confirmation_modal.test.tsx | 4 ++-- .../log_retention/log_retention_confirmation_modal.tsx | 4 +--- .../log_retention/log_retention_panel.test.tsx | 2 +- .../settings/log_retention/log_retention_panel.tsx | 9 ++++++--- .../app_search/components/settings/settings.tsx | 3 +-- 19 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/index.ts rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/log_retention_logic.test.ts (97%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/log_retention_logic.ts (96%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/messaging/constants.ts (100%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/messaging/determine_tooltip_content.test.ts (100%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/messaging/determine_tooltip_content.ts (100%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/messaging/index.test.tsx (95%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/messaging/index.tsx (96%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/messaging/types.ts (100%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/types.ts (100%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/utils/convert_log_retention.test.ts (99%) rename x-pack/plugins/enterprise_search/public/applications/app_search/components/{settings => }/log_retention/utils/convert_log_retention.ts (100%) create mode 100644 x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/index.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/index.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/index.ts new file mode 100644 index 0000000000000..0e007f5d8d1d1 --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/index.ts @@ -0,0 +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. + */ + +export { LogRetentionLogic } from './log_retention_logic'; +export * from './types'; +export * from './messaging'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts similarity index 97% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_logic.test.ts rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts index 8310e2abe045b..801a8d36cc403 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.test.ts @@ -4,18 +4,18 @@ * you may not use this file except in compliance with the Elastic License. */ -import { LogicMounter } from '../../../../__mocks__/kea.mock'; +import { LogicMounter } from '../../../__mocks__/kea.mock'; -import { mockHttpValues } from '../../../../__mocks__'; -jest.mock('../../../../shared/http', () => ({ +import { mockHttpValues } from '../../../__mocks__'; +jest.mock('../../../shared/http', () => ({ HttpLogic: { values: mockHttpValues }, })); const { http } = mockHttpValues; -jest.mock('../../../../shared/flash_messages', () => ({ +jest.mock('../../../shared/flash_messages', () => ({ flashAPIErrors: jest.fn(), })); -import { flashAPIErrors } from '../../../../shared/flash_messages'; +import { flashAPIErrors } from '../../../shared/flash_messages'; import { LogRetentionOptions } from './types'; import { LogRetentionLogic } from './log_retention_logic'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_logic.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.ts similarity index 96% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_logic.ts rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.ts index 31fc41213492d..46c91e5c3c45a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/log_retention_logic.ts @@ -6,9 +6,10 @@ import { kea, MakeLogicType } from 'kea'; +import { HttpLogic } from '../../../shared/http'; +import { flashAPIErrors } from '../../../shared/flash_messages'; + import { LogRetentionOptions, LogRetention, LogRetentionServer } from './types'; -import { HttpLogic } from '../../../../shared/http'; -import { flashAPIErrors } from '../../../../shared/flash_messages'; import { convertLogRetentionFromServerToClient } from './utils/convert_log_retention'; interface LogRetentionActions { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/constants.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/constants.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/constants.ts rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/constants.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/determine_tooltip_content.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/determine_tooltip_content.test.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/determine_tooltip_content.test.ts rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/determine_tooltip_content.test.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/determine_tooltip_content.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/determine_tooltip_content.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/determine_tooltip_content.ts rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/determine_tooltip_content.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/index.test.tsx similarity index 95% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/index.test.tsx rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/index.test.tsx index b65ffc04ad700..13692bb3e415d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/index.test.tsx @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import '../../../../../__mocks__/kea.mock'; -import { setMockValues } from '../../../../../__mocks__'; +import '../../../../__mocks__/kea.mock'; +import { setMockValues } from '../../../../__mocks__'; import React from 'react'; import { shallow } from 'enzyme'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/index.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/index.tsx similarity index 96% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/index.tsx rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/index.tsx index 21267738f61ad..3b0761950ee3d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/index.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { useValues } from 'kea'; import moment from 'moment'; -import { AppLogic } from '../../../../app_logic'; +import { AppLogic } from '../../../app_logic'; import { LogRetentionLogic } from '../log_retention_logic'; import { LogRetentionOptions } from '../types'; diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/types.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/types.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/messaging/types.ts rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/messaging/types.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/types.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/types.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/types.ts rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/types.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/utils/convert_log_retention.test.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/utils/convert_log_retention.test.ts similarity index 99% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/utils/convert_log_retention.test.ts rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/utils/convert_log_retention.test.ts index b49b2afe50831..88090dbb5ea1f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/utils/convert_log_retention.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/utils/convert_log_retention.test.ts @@ -3,6 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ + import { convertLogRetentionFromServerToClient } from './convert_log_retention'; describe('convertLogRetentionFromServerToClient', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/utils/convert_log_retention.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/utils/convert_log_retention.ts similarity index 100% rename from x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/utils/convert_log_retention.ts rename to x-pack/plugins/enterprise_search/public/applications/app_search/components/log_retention/utils/convert_log_retention.ts diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/generic_confirmation_modal.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/generic_confirmation_modal.tsx index 6d802b0c5cfaf..5b2e439436b55 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/generic_confirmation_modal.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/generic_confirmation_modal.tsx @@ -55,7 +55,7 @@ export const GenericConfirmationModal: React.FC =

    {subheading}

    -

    {description}

    + {description} ', () => { const actions = { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_confirmation_modal.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_confirmation_modal.tsx index 67421bb78fa71..25f90df4e541b 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_confirmation_modal.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_confirmation_modal.tsx @@ -10,10 +10,8 @@ import { i18n } from '@kbn/i18n'; import { EuiTextColor, EuiOverlayMask } from '@elastic/eui'; import { useActions, useValues } from 'kea'; +import { LogRetentionLogic, LogRetentionOptions } from '../../log_retention'; import { GenericConfirmationModal } from './generic_confirmation_modal'; -import { LogRetentionLogic } from './log_retention_logic'; - -import { LogRetentionOptions } from './types'; export const LogRetentionConfirmationModal: React.FC = () => { const CANNOT_BE_RECOVERED_TEXT = i18n.translate( diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx index c44418a1eb5a2..9140704ece3f8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.test.tsx @@ -12,8 +12,8 @@ import { setMockActions, setMockValues } from '../../../../__mocks__'; import React from 'react'; import { shallow } from 'enzyme'; +import { LogRetention } from '../../log_retention/types'; import { LogRetentionPanel } from './log_retention_panel'; -import { LogRetention } from './types'; describe('', () => { const actions = { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.tsx index 3297f0df4d7bd..a3aa463ad069a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/log_retention/log_retention_panel.tsx @@ -12,9 +12,12 @@ import { useActions, useValues } from 'kea'; import { DOCS_PREFIX } from '../../../routes'; -import { LogRetentionLogic } from './log_retention_logic'; -import { AnalyticsLogRetentionMessage, ApiLogRetentionMessage } from './messaging'; -import { LogRetentionOptions } from './types'; +import { + LogRetentionLogic, + LogRetentionOptions, + AnalyticsLogRetentionMessage, + ApiLogRetentionMessage, +} from '../../log_retention'; export const LogRetentionPanel: React.FC = () => { const { toggleLogRetention, fetchLogRetention } = useActions(LogRetentionLogic); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/settings.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/settings.tsx index dbd6627a3b9ce..993da9e563185 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/settings.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/settings/settings.tsx @@ -16,9 +16,8 @@ import { import { SetAppSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome'; import { FlashMessages } from '../../../shared/flash_messages'; -import { LogRetentionPanel } from './log_retention/log_retention_panel'; -import { LogRetentionConfirmationModal } from './log_retention/log_retention_confirmation_modal'; +import { LogRetentionPanel, LogRetentionConfirmationModal } from './log_retention'; import { SETTINGS_TITLE } from './'; export const Settings: React.FC = () => {