From 8525bd5e6ef32eedde4f8d957e59ee47cae32555 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 3 Mar 2021 12:07:21 +0100 Subject: [PATCH 1/6] remove portal for screenreader component (#93274) --- .../public/drag_drop/providers/providers.tsx | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/x-pack/plugins/lens/public/drag_drop/providers/providers.tsx b/x-pack/plugins/lens/public/drag_drop/providers/providers.tsx index 6a78bc1b46ddf..2c6b07ea11765 100644 --- a/x-pack/plugins/lens/public/drag_drop/providers/providers.tsx +++ b/x-pack/plugins/lens/public/drag_drop/providers/providers.tsx @@ -6,7 +6,7 @@ */ import React, { useState, useMemo } from 'react'; -import { EuiScreenReaderOnly, EuiPortal } from '@elastic/eui'; +import { EuiScreenReaderOnly } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { DropIdentifier, @@ -103,25 +103,23 @@ export function RootDragDropProvider({ children }: { children: React.ReactNode } > {children} - - -
-

- {a11yMessageState} -

-

- {i18n.translate('xpack.lens.dragDrop.keyboardInstructionsReorder', { - defaultMessage: `Press space or enter to start dragging. When dragging, use the up/down arrow keys to reorder items in the group and left/right arrow keys to choose drop targets outside of the group. Press space or enter again to finish.`, - })} -

-

- {i18n.translate('xpack.lens.dragDrop.keyboardInstructions', { - defaultMessage: `Press space or enter to start dragging. When dragging, use the left/right arrow keys to move between drop targets. Press space or enter again to finish.`, - })} -

-
-
-
+ +
+

+ {a11yMessageState} +

+

+ {i18n.translate('xpack.lens.dragDrop.keyboardInstructionsReorder', { + defaultMessage: `Press space or enter to start dragging. When dragging, use the up/down arrow keys to reorder items in the group and left/right arrow keys to choose drop targets outside of the group. Press space or enter again to finish.`, + })} +

+

+ {i18n.translate('xpack.lens.dragDrop.keyboardInstructions', { + defaultMessage: `Press space or enter to start dragging. When dragging, use the left/right arrow keys to move between drop targets. Press space or enter again to finish.`, + })} +

+
+
); } From be0b44487347dccc2cc539d384826c24d8bdb053 Mon Sep 17 00:00:00 2001 From: Pete Harverson Date: Wed, 3 Mar 2021 11:41:44 +0000 Subject: [PATCH 2/6] [ML] Transforms: Adds a11y tests for Transform plugin (#93197) --- .github/CODEOWNERS | 2 + x-pack/plugins/ml/readme.md | 2 +- x-pack/plugins/transform/readme.md | 9 + x-pack/test/accessibility/apps/ml.ts | 16 +- x-pack/test/accessibility/apps/transform.ts | 262 ++++++++++++++++++++ x-pack/test/accessibility/config.ts | 1 + 6 files changed, 279 insertions(+), 13 deletions(-) create mode 100644 x-pack/test/accessibility/apps/transform.ts diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 30de890d6967a..7a21d792e7270 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -117,10 +117,12 @@ /x-pack/plugins/ml/ @elastic/ml-ui /x-pack/test/functional/apps/ml/ @elastic/ml-ui /x-pack/test/functional/services/ml/ @elastic/ml-ui +/x-pack/test/accessibility/apps/ml.ts @elastic/ml-ui # ML team owns and maintains the transform plugin despite it living in the Elasticsearch management section. /x-pack/plugins/transform/ @elastic/ml-ui /x-pack/test/functional/apps/transform/ @elastic/ml-ui /x-pack/test/functional/services/transform/ @elastic/ml-ui +/x-pack/test/accessibility/apps/transform.ts @elastic/ml-ui /x-pack/test/api_integration_basic/apis/ml/ @elastic/ml-ui /x-pack/test/functional_basic/apps/ml/ @elastic/ml-ui diff --git a/x-pack/plugins/ml/readme.md b/x-pack/plugins/ml/readme.md index e6238a8339ff8..8425054d3f648 100644 --- a/x-pack/plugins/ml/readme.md +++ b/x-pack/plugins/ml/readme.md @@ -139,7 +139,7 @@ and Kibana instance that the tests will be run against. node scripts/functional_tests_server --config test/accessibility/config.ts node scripts/functional_test_runner.js --config test/accessibility/config.ts --grep=ml - ML accessibility tests are located in `x-pack/test/accessibility/app`. + ML accessibility tests are located in `x-pack/test/accessibility/apps`. ## Shared functions diff --git a/x-pack/plugins/transform/readme.md b/x-pack/plugins/transform/readme.md index a1005c43687e2..51a89f224fb29 100644 --- a/x-pack/plugins/transform/readme.md +++ b/x-pack/plugins/transform/readme.md @@ -131,3 +131,12 @@ and Kibana instance that the tests will be run against. node scripts/functional_test_runner.js --config test/api_integration_basic/config.ts --include-tag transform Transform API integration `Basic` license tests are located in `x-pack/test/api_integration_basic/apis/ml`. + +1. Accessibility tests: + + We maintain a suite of accessibility tests (you may see them referred to elsewhere as `a11y` tests). These tests render each of our pages and ensure that the inputs and other elements contain the attributes necessary to ensure all users are able to make use of Transforms (for example, users relying on screen readers). + + node scripts/functional_tests_server --config test/accessibility/config.ts + node scripts/functional_test_runner.js --config test/accessibility/config.ts --grep=transform + + Transform accessibility tests are located in `x-pack/test/accessibility/apps`. diff --git a/x-pack/test/accessibility/apps/ml.ts b/x-pack/test/accessibility/apps/ml.ts index 323fe5d783c70..bc7069c40db48 100644 --- a/x-pack/test/accessibility/apps/ml.ts +++ b/x-pack/test/accessibility/apps/ml.ts @@ -217,9 +217,7 @@ export default function ({ getService }: FtrProviderContext) { await a11y.testAppSnapshot(); }); - it.skip('anomaly detection Anomaly Explorer page', async () => { - // Skip test until the dots used in the Elastic chart legend no longer have duplicate ids - // see https://github.com/elastic/elastic-charts/issues/970 + it('anomaly detection Anomaly Explorer page', async () => { await ml.singleMetricViewer.openAnomalyExplorer(); await ml.commonUI.waitForMlLoadingIndicatorToDisappear(); await a11y.testAppSnapshot(); @@ -235,9 +233,7 @@ export default function ({ getService }: FtrProviderContext) { await ml.dataFrameAnalyticsResults.assertOutlierTablePanelExists(); await ml.dataFrameAnalyticsResults.assertResultsTableExists(); await ml.dataFrameAnalyticsResults.assertResultsTableNotEmpty(); - // EuiDataGrid does not have row roles - // https://github.com/elastic/eui/issues/4471 - // await a11y.testAppSnapshot(); + await a11y.testAppSnapshot(); }); it('data frame analytics create job select index pattern modal', async () => { @@ -253,9 +249,7 @@ export default function ({ getService }: FtrProviderContext) { ); await ml.jobSourceSelection.selectSourceForAnalyticsJob(ihpIndexPattern); await ml.dataFrameAnalyticsCreation.assertConfigurationStepActive(); - // EuiDataGrid does not have row roles - // https://github.com/elastic/eui/issues/4471 - // await a11y.testAppSnapshot(); + await a11y.testAppSnapshot(); }); it('data frame analytics create job configuration step for outlier job', async () => { @@ -268,9 +262,7 @@ export default function ({ getService }: FtrProviderContext) { await ml.dataFrameAnalyticsCreation.enableSourceDataPreviewHistogramCharts(true); await ml.testExecution.logTestStep('displays the include fields selection'); await ml.dataFrameAnalyticsCreation.assertIncludeFieldsSelectionExists(); - // EuiDataGrid does not have row roles - // https://github.com/elastic/eui/issues/4471 - // await a11y.testAppSnapshot(); + await a11y.testAppSnapshot(); }); it('data frame analytics create job additional options step for outlier job', async () => { diff --git a/x-pack/test/accessibility/apps/transform.ts b/x-pack/test/accessibility/apps/transform.ts new file mode 100644 index 0000000000000..4c0cae4174d36 --- /dev/null +++ b/x-pack/test/accessibility/apps/transform.ts @@ -0,0 +1,262 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../ftr_provider_context'; + +export default function ({ getService }: FtrProviderContext) { + const a11y = getService('a11y'); + const transform = getService('transform'); + + describe('transform', () => { + const esArchiver = getService('esArchiver'); + + before(async () => { + await transform.securityCommon.createTransformRoles(); + await transform.securityCommon.createTransformUsers(); + }); + + after(async () => { + await transform.securityCommon.cleanTransformUsers(); + await transform.securityCommon.cleanTransformRoles(); + }); + + describe('for user with full Transform access', function () { + before(async () => { + await transform.securityUI.loginAsTransformPowerUser(); + }); + + after(async () => { + await transform.securityUI.logout(); + }); + + describe('with no transforms created', function () { + it('Transform management page', async () => { + await transform.navigation.navigateTo(); + await a11y.testAppSnapshot(); + }); + }); + + describe('with data loaded', function () { + const ecIndexPattern = 'ft_ecommerce'; + + const pivotGroupByEntries = [ + { + identifier: 'terms(category.keyword)', + label: 'category.keyword', + }, + { + identifier: 'date_histogram(order_date)', + label: 'order_date', + intervalLabel: '1m', + }, + ]; + const pivotAggregationEntries = [ + { + identifier: 'avg(products.base_price)', + label: 'products.base_price.avg', + }, + { + identifier: 'avg(taxful_total_price)', + label: 'taxful_total_price.avg', + }, + ]; + const pivotTransformId = `ec_pivot_${Date.now()}`; + const pivotTransformDescription = 'ecommerce batch pivot transform'; + const pivotTransformDestinationIndex = `user-${pivotTransformId}`; + + const latestTransformUniqueKeys = [ + { + identifier: 'geoip.country_iso_code', + label: 'geoip.country_iso_code', + }, + ]; + const latestTransformSortField = { + identifier: 'order_date', + label: 'order_date', + }; + const latestTransformId = `ec_latest_${Date.now()}`; + const latestTransformDescription = 'ecommerce batch latest transform'; + const latestTransformDestinationIndex = `user-${latestTransformId}`; + + before(async () => { + await esArchiver.loadIfNeeded('ml/ecommerce'); + await transform.testResources.createIndexPatternIfNeeded(ecIndexPattern, 'order_date'); + await transform.testResources.setKibanaTimeZoneToUTC(); + }); + + after(async () => { + await transform.api.cleanTransformIndices(); + await transform.api.deleteIndices(pivotTransformDestinationIndex); + await transform.api.deleteIndices(latestTransformDestinationIndex); + await transform.testResources.deleteIndexPatternByTitle(pivotTransformDestinationIndex); + await transform.testResources.deleteIndexPatternByTitle(latestTransformDestinationIndex); + await transform.testResources.deleteIndexPatternByTitle(ecIndexPattern); + await esArchiver.unload('ml/ecommerce'); + await transform.testResources.resetKibanaTimeZone(); + }); + + it('create transform select index pattern modal', async () => { + await transform.navigation.navigateTo(); + await transform.management.startTransformCreation(); + await a11y.testAppSnapshot(); + }); + + it('create transform configuration step source preview', async () => { + await transform.testExecution.logTestStep( + 'transform creation selects the source data and loads the Transform wizard page' + ); + await transform.sourceSelection.selectSource(ecIndexPattern); + + await transform.testExecution.logTestStep('loads the index preview'); + await transform.wizard.assertIndexPreviewLoaded(); + await transform.testExecution.logTestStep('displays an empty transform preview'); + await transform.wizard.assertTransformPreviewEmpty(); + await a11y.testAppSnapshot(); + }); + + it('create pivot transform configuration step transform preview', async () => { + await transform.testExecution.logTestStep('adding pivot transform group by entries'); + for (const [index, entry] of pivotGroupByEntries.entries()) { + await transform.wizard.addGroupByEntry( + index, + entry.identifier, + entry.label, + entry.intervalLabel + ); + } + + await transform.testExecution.logTestStep('adds pivot transform aggregation entries'); + await transform.wizard.addAggregationEntries(pivotAggregationEntries); + await transform.wizard.assertPivotPreviewLoaded(); + await a11y.testAppSnapshot(); + }); + + it('create pivot transform configuration step JSON editor', async () => { + await transform.testExecution.logTestStep('displays the JSON pivot configuration'); + await transform.wizard.assertAdvancedPivotEditorSwitchExists(); + await transform.wizard.enableAdvancedPivotEditor(); + await a11y.testAppSnapshot(); + }); + + it('create pivot transform details step', async () => { + await transform.wizard.advanceToDetailsStep(); + await transform.testExecution.logTestStep('inputs the transform id'); + await transform.wizard.assertTransformIdInputExists(); + await transform.wizard.setTransformId(pivotTransformId); + + await transform.testExecution.logTestStep('inputs the transform description'); + await transform.wizard.assertTransformDescriptionInputExists(); + await transform.wizard.setTransformDescription(pivotTransformDescription); + + await transform.testExecution.logTestStep('inputs the destination index'); + await transform.wizard.assertDestinationIndexInputExists(); + await transform.wizard.setDestinationIndex(pivotTransformDestinationIndex); + + await a11y.testAppSnapshot(); + }); + + it('create pivot transform create step', async () => { + await transform.wizard.advanceToCreateStep(); + await transform.testExecution.logTestStep('displays the create and start button'); + await transform.wizard.assertCreateAndStartButtonExists(); + await a11y.testAppSnapshot(); + }); + + it('runs the pivot transform and displays management page', async () => { + await transform.testExecution.logTestStep('creates the transform'); + await transform.wizard.createTransform(); + + await transform.testExecution.logTestStep('starts the transform and finishes processing'); + await transform.wizard.startTransform(); + await transform.wizard.waitForProgressBarComplete(); + + await transform.testExecution.logTestStep('returns to the management page'); + await transform.wizard.returnToManagement(); + + await transform.testExecution.logTestStep('displays the transforms table'); + await transform.management.assertTransformsTableExists(); + + await a11y.testAppSnapshot(); + }); + + it('create latest transform configuration step source preview', async () => { + await transform.navigation.navigateTo(); + await transform.management.startTransformCreation(); + await transform.testExecution.logTestStep( + 'selects the source data and loads the Transform wizard page' + ); + await transform.sourceSelection.selectSource(ecIndexPattern); + await transform.wizard.assertIndexPreviewLoaded(); + await transform.wizard.assertTransformPreviewEmpty(); + + await transform.testExecution.logTestStep('sets latest transform method'); + await transform.wizard.selectTransformFunction('latest'); + await a11y.testAppSnapshot(); + }); + + it('create latest transform configuration step transform preview', async () => { + await transform.testExecution.logTestStep('adding latest transform unique keys'); + for (const { identifier, label } of latestTransformUniqueKeys) { + await transform.wizard.assertUniqueKeysInputExists(); + await transform.wizard.assertUniqueKeysInputValue([]); + await transform.wizard.addUniqueKeyEntry(identifier, label); + } + + await transform.testExecution.logTestStep('adds latest transform sort field'); + await transform.wizard.assertSortFieldInputExists(); + await transform.wizard.setSortFieldValue( + latestTransformSortField.identifier, + latestTransformSortField.label + ); + await transform.wizard.assertPivotPreviewLoaded(); + await a11y.testAppSnapshot(); + }); + + it('create latest transform details step', async () => { + await transform.wizard.advanceToDetailsStep(); + await transform.testExecution.logTestStep('inputs the transform id'); + await transform.wizard.assertTransformIdInputExists(); + await transform.wizard.setTransformId(latestTransformId); + + await transform.testExecution.logTestStep('inputs the transform description'); + await transform.wizard.assertTransformDescriptionInputExists(); + await transform.wizard.setTransformDescription(latestTransformDescription); + + await transform.testExecution.logTestStep('inputs the destination index'); + await transform.wizard.assertDestinationIndexInputExists(); + await transform.wizard.setDestinationIndex(latestTransformDestinationIndex); + + await a11y.testAppSnapshot(); + }); + + it('create latest transform create step', async () => { + await transform.wizard.advanceToCreateStep(); + await transform.testExecution.logTestStep('displays the create and start button'); + await transform.wizard.assertCreateAndStartButtonExists(); + await a11y.testAppSnapshot(); + }); + + it('runs the latest transform and displays management page', async () => { + await transform.testExecution.logTestStep('creates the transform'); + await transform.wizard.createTransform(); + + await transform.testExecution.logTestStep('starts the transform and finishes processing'); + await transform.wizard.startTransform(); + await transform.wizard.waitForProgressBarComplete(); + + await transform.testExecution.logTestStep('returns to the management page'); + await transform.wizard.returnToManagement(); + + await transform.testExecution.logTestStep('displays the transforms table'); + await transform.management.assertTransformsTableExists(); + + await a11y.testAppSnapshot(); + }); + }); + }); + }); +} diff --git a/x-pack/test/accessibility/config.ts b/x-pack/test/accessibility/config.ts index b014f672ed5a6..c6d85c8755a6b 100644 --- a/x-pack/test/accessibility/config.ts +++ b/x-pack/test/accessibility/config.ts @@ -30,6 +30,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { require.resolve('./apps/ingest_node_pipelines'), require.resolve('./apps/index_lifecycle_management'), require.resolve('./apps/ml'), + require.resolve('./apps/transform'), require.resolve('./apps/lens'), require.resolve('./apps/upgrade_assistant'), require.resolve('./apps/canvas'), From e42b0f983545e821e3a7fe931c4fd1a6295b4129 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 3 Mar 2021 13:50:45 +0100 Subject: [PATCH 3/6] Bump handlebars from 4.7.6 to 4.7.7 (#93396) --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d1d2bc5672427..6e5feac8a16a9 100644 --- a/package.json +++ b/package.json @@ -212,7 +212,7 @@ "graphql-fields": "^1.0.2", "graphql-tag": "^2.10.3", "graphql-tools": "^3.0.2", - "handlebars": "4.7.6", + "handlebars": "4.7.7", "history": "^4.9.0", "hjson": "3.2.1", "http-proxy-agent": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index f12071a9d1e95..bcf5c37f6f912 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15446,10 +15446,10 @@ handle-thing@^2.0.0: resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.0.tgz#0e039695ff50c93fc288557d696f3c1dc6776754" integrity sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ== -handlebars@4.7.6, handlebars@^4.7.6: - version "4.7.6" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.6.tgz#d4c05c1baf90e9945f77aa68a7a219aa4a7df74e" - integrity sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA== +handlebars@4.7.7, handlebars@^4.7.6: + version "4.7.7" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" + integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== dependencies: minimist "^1.2.5" neo-async "^2.6.0" From b8c8c66e1afbdb22210050cfd939d21fb5e54e2f Mon Sep 17 00:00:00 2001 From: Vadim Dalecky Date: Wed, 3 Mar 2021 14:33:29 +0100 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=F0=9F=90=9B=20do=20not=20send=20non?= =?UTF-8?q?-serializable=20fields=20over=20HTTP=20(#93207)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 do not send non-serializable fields over HTTP * fix: 🐛 dont set sessionId when .getSearchOptions() returns null * chore: 🤖 update api docs --- api_docs/data_search.json | 102 ++++++++++-------- src/plugins/data/common/search/types.ts | 9 ++ .../data/public/search/search_interceptor.ts | 26 +++-- .../data/server/search/routes/bsearch.ts | 4 +- 4 files changed, 91 insertions(+), 50 deletions(-) diff --git a/api_docs/data_search.json b/api_docs/data_search.json index d03bb23e9bc93..5e3c0b95d9789 100644 --- a/api_docs/data_search.json +++ b/api_docs/data_search.json @@ -34,8 +34,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 70, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L70" + "lineNumber": 75, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L75" } } ], @@ -43,8 +43,8 @@ "returnComment": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 70, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L70" + "lineNumber": 75, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L75" } }, { @@ -67,8 +67,8 @@ "returnComment": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 86, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L86" + "lineNumber": 91, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L91" } }, { @@ -128,8 +128,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 95, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L95" + "lineNumber": 100, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L100" } }, { @@ -142,8 +142,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 96, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L96" + "lineNumber": 101, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L101" } }, { @@ -163,8 +163,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 97, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L97" + "lineNumber": 102, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L102" } } ], @@ -172,8 +172,8 @@ "returnComment": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 94, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L94" + "lineNumber": 99, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L99" } }, { @@ -230,8 +230,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 233, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L233" + "lineNumber": 247, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L247" } }, { @@ -251,8 +251,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 234, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L234" + "lineNumber": 248, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L248" } } ], @@ -264,8 +264,8 @@ ], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 232, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L232" + "lineNumber": 246, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L246" } }, { @@ -287,8 +287,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 261, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L261" + "lineNumber": 275, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L275" } } ], @@ -296,15 +296,15 @@ "returnComment": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 261, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L261" + "lineNumber": 275, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L275" } } ], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 45, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L45" + "lineNumber": 50, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L50" }, "initialIsOpen": false }, @@ -990,8 +990,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 36, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L36" + "lineNumber": 41, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L41" }, "signature": [ { @@ -1011,8 +1011,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 37, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L37" + "lineNumber": 42, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L42" }, "signature": [ { @@ -1032,8 +1032,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 38, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L38" + "lineNumber": 43, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L43" }, "signature": [ { @@ -1053,8 +1053,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 39, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L39" + "lineNumber": 44, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L44" }, "signature": [ "Promise<[", @@ -1076,8 +1076,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 40, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L40" + "lineNumber": 45, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L45" }, "signature": [ "Pick<", @@ -1099,8 +1099,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 41, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L41" + "lineNumber": 46, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L46" }, "signature": [ { @@ -1121,8 +1121,8 @@ "description": [], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 42, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L42" + "lineNumber": 47, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L47" }, "signature": [ "Pick<", @@ -1139,8 +1139,8 @@ ], "source": { "path": "src/plugins/data/public/search/search_interceptor.ts", - "lineNumber": 35, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L35" + "lineNumber": 40, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/public/search/search_interceptor.ts#L40" }, "initialIsOpen": false }, @@ -19191,6 +19191,24 @@ " | undefined) => Promise" ], "initialIsOpen": false + }, + { + "id": "def-common.ISearchOptionsSerializable", + "type": "Type", + "label": "ISearchOptionsSerializable", + "tags": [], + "description": [ + "\nSame as `ISearchOptions`, but contains only serializable fields, which can\nbe sent over the network." + ], + "source": { + "path": "src/plugins/data/common/search/types.ts", + "lineNumber": 127, + "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/common/search/types.ts#L127" + }, + "signature": [ + "{ isStored?: boolean | undefined; isRestore?: boolean | undefined; sessionId?: string | undefined; strategy?: string | undefined; legacyHitsTotal?: boolean | undefined; }" + ], + "initialIsOpen": false } ], "objects": [ diff --git a/src/plugins/data/common/search/types.ts b/src/plugins/data/common/search/types.ts index 3ac4c33091f6b..d77a2ea62bb9a 100644 --- a/src/plugins/data/common/search/types.ts +++ b/src/plugins/data/common/search/types.ts @@ -119,3 +119,12 @@ export interface ISearchOptions { indexPattern?: IndexPattern; } + +/** + * Same as `ISearchOptions`, but contains only serializable fields, which can + * be sent over the network. + */ +export type ISearchOptionsSerializable = Pick< + ISearchOptions, + 'strategy' | 'legacyHitsTotal' | 'sessionId' | 'isStored' | 'isRestore' +>; diff --git a/src/plugins/data/public/search/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor.ts index ec4b628a6bd3a..f5a2dc0571fdc 100644 --- a/src/plugins/data/public/search/search_interceptor.ts +++ b/src/plugins/data/public/search/search_interceptor.ts @@ -13,7 +13,12 @@ import { PublicMethodsOf } from '@kbn/utility-types'; import { CoreStart, CoreSetup, ToastsSetup } from 'kibana/public'; import { i18n } from '@kbn/i18n'; import { BatchedFunc, BfetchPublicSetup } from 'src/plugins/bfetch/public'; -import { IKibanaSearchRequest, IKibanaSearchResponse, ISearchOptions } from '../../common'; +import { + IKibanaSearchRequest, + IKibanaSearchResponse, + ISearchOptions, + ISearchOptionsSerializable, +} from '../../common'; import { SearchUsageCollector } from './collectors'; import { SearchTimeoutError, @@ -60,7 +65,7 @@ export class SearchInterceptor { */ protected application!: CoreStart['application']; private batchedFetch!: BatchedFunc< - { request: IKibanaSearchRequest; options: ISearchOptions }, + { request: IKibanaSearchRequest; options: ISearchOptionsSerializable }, IKibanaSearchResponse >; @@ -127,14 +132,23 @@ export class SearchInterceptor { options?: ISearchOptions ): Promise { const { abortSignal, sessionId, ...requestOptions } = options || {}; + const combined = { + ...requestOptions, + ...this.deps.session.getSearchOptions(sessionId), + }; + const serializableOptions: ISearchOptionsSerializable = {}; + + if (combined.sessionId !== undefined) serializableOptions.sessionId = combined.sessionId; + if (combined.isRestore !== undefined) serializableOptions.isRestore = combined.isRestore; + if (combined.legacyHitsTotal !== undefined) + serializableOptions.legacyHitsTotal = combined.legacyHitsTotal; + if (combined.strategy !== undefined) serializableOptions.strategy = combined.strategy; + if (combined.isStored !== undefined) serializableOptions.isStored = combined.isStored; return this.batchedFetch( { request, - options: { - ...requestOptions, - ...this.deps.session.getSearchOptions(sessionId), - }, + options: serializableOptions, }, abortSignal ); diff --git a/src/plugins/data/server/search/routes/bsearch.ts b/src/plugins/data/server/search/routes/bsearch.ts index b0047d33fd2b1..49d469945ce29 100644 --- a/src/plugins/data/server/search/routes/bsearch.ts +++ b/src/plugins/data/server/search/routes/bsearch.ts @@ -11,7 +11,7 @@ import { BfetchServerSetup } from 'src/plugins/bfetch/server'; import { IKibanaSearchRequest, IKibanaSearchResponse, - ISearchOptions, + ISearchOptionsSerializable, } from '../../../common/search'; import { ISearchStart } from '../types'; @@ -20,7 +20,7 @@ export function registerBsearchRoute( getScoped: ISearchStart['asScoped'] ): void { bfetch.addBatchProcessingRoute< - { request: IKibanaSearchRequest; options?: ISearchOptions }, + { request: IKibanaSearchRequest; options?: ISearchOptionsSerializable }, IKibanaSearchResponse >('/internal/bsearch', (request) => { return { From 1c019025bc2d6f6c9da13a5ab51bc83daa035595 Mon Sep 17 00:00:00 2001 From: Christos Nasikas Date: Wed, 3 Mar 2021 15:36:00 +0200 Subject: [PATCH 5/6] [Security Solution][Case] Fix individual case deletion on case view (#93218) --- .../cases/components/all_cases/index.test.tsx | 15 +++++--- .../cases/components/all_cases/index.tsx | 30 +++++++--------- .../cases/components/bulk_actions/index.tsx | 17 ++++----- .../case_action_bar/actions.test.tsx | 2 +- .../components/case_action_bar/actions.tsx | 4 ++- .../cases/components/case_view/index.tsx | 36 ++++++++++--------- .../public/cases/containers/mock.ts | 31 ++++++++++++++++ .../public/cases/containers/types.ts | 2 +- .../containers/use_delete_cases.test.tsx | 8 ++++- 9 files changed, 93 insertions(+), 52 deletions(-) diff --git a/x-pack/plugins/security_solution/public/cases/components/all_cases/index.test.tsx b/x-pack/plugins/security_solution/public/cases/components/all_cases/index.test.tsx index 9654681ce8e32..90b1143ca750d 100644 --- a/x-pack/plugins/security_solution/public/cases/components/all_cases/index.test.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/all_cases/index.test.tsx @@ -11,7 +11,7 @@ import moment from 'moment-timezone'; import { waitFor } from '@testing-library/react'; import '../../../common/mock/match_media'; import { TestProviders } from '../../../common/mock'; -import { casesStatus, useGetCasesMockState } from '../../containers/mock'; +import { casesStatus, useGetCasesMockState, collectionCase } from '../../containers/mock'; import * as i18n from './translations'; import { CaseStatuses, CaseType } from '../../../../../case/common/api'; @@ -436,7 +436,7 @@ describe('AllCases', () => { useGetCasesMock.mockReturnValue({ ...defaultGetCases, filterOptions: { ...defaultGetCases.filterOptions, status: CaseStatuses.closed }, - selectedCases: useGetCasesMockState.data.cases, + selectedCases: [...useGetCasesMockState.data.cases, collectionCase], }); useDeleteCasesMock @@ -465,9 +465,14 @@ describe('AllCases', () => { ) .last() .simulate('click'); - expect(handleOnDeleteConfirm.mock.calls[0][0]).toStrictEqual( - useGetCasesMockState.data.cases.map(({ id }) => ({ id })) - ); + expect(handleOnDeleteConfirm.mock.calls[0][0]).toStrictEqual([ + ...useGetCasesMockState.data.cases.map(({ id, type, title }) => ({ id, type, title })), + { + id: collectionCase.id, + title: collectionCase.title, + type: collectionCase.type, + }, + ]); }); }); diff --git a/x-pack/plugins/security_solution/public/cases/components/all_cases/index.tsx b/x-pack/plugins/security_solution/public/cases/components/all_cases/index.tsx index 5f0e72564f60e..7b72a2e188903 100644 --- a/x-pack/plugins/security_solution/public/cases/components/all_cases/index.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/all_cases/index.tsx @@ -167,6 +167,7 @@ export const AllCases = React.memo( const [deleteThisCase, setDeleteThisCase] = useState({ title: '', id: '', + type: null, }); const [deleteBulk, setDeleteBulk] = useState([]); const filterRefetch = useRef<() => void>(); @@ -230,10 +231,10 @@ export const AllCases = React.memo( ); const toggleBulkDeleteModal = useCallback( - (caseIds: string[]) => { + (cases: Case[]) => { handleToggleModal(); - if (caseIds.length === 1) { - const singleCase = selectedCases.find((theCase) => theCase.id === caseIds[0]); + if (cases.length === 1) { + const singleCase = cases[0]; if (singleCase) { return setDeleteThisCase({ id: singleCase.id, @@ -242,10 +243,14 @@ export const AllCases = React.memo( }); } } - const convertToDeleteCases: DeleteCase[] = caseIds.map((id) => ({ id })); + const convertToDeleteCases: DeleteCase[] = cases.map(({ id, title, type }) => ({ + id, + title, + type, + })); setDeleteBulk(convertToDeleteCases); }, - [selectedCases, setDeleteBulk, handleToggleModal] + [setDeleteBulk, handleToggleModal] ); const handleUpdateCaseStatus = useCallback( @@ -255,11 +260,6 @@ export const AllCases = React.memo( [selectedCases, updateBulkStatus] ); - const selectedCaseIds = useMemo( - (): string[] => selectedCases.map((caseObj: Case) => caseObj.id), - [selectedCases] - ); - const getBulkItemsPopoverContent = useCallback( (closePopover: () => void) => ( ( caseStatus: filterOptions.status, closePopover, deleteCasesAction: toggleBulkDeleteModal, - selectedCaseIds, + selectedCases, updateCaseStatus: handleUpdateCaseStatus, includeCollections: isSelectedCasesIncludeCollections(selectedCases), })} /> ), - [ - selectedCases, - selectedCaseIds, - filterOptions.status, - toggleBulkDeleteModal, - handleUpdateCaseStatus, - ] + [selectedCases, filterOptions.status, toggleBulkDeleteModal, handleUpdateCaseStatus] ); const handleDispatchUpdate = useCallback( (args: Omit) => { diff --git a/x-pack/plugins/security_solution/public/cases/components/bulk_actions/index.tsx b/x-pack/plugins/security_solution/public/cases/components/bulk_actions/index.tsx index a6d5a0679df37..3d2f81f5e5931 100644 --- a/x-pack/plugins/security_solution/public/cases/components/bulk_actions/index.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/bulk_actions/index.tsx @@ -11,12 +11,13 @@ import { EuiContextMenuItem } from '@elastic/eui'; import { CaseStatuses } from '../../../../../case/common/api'; import { statuses, CaseStatusWithAllStatus } from '../status'; import * as i18n from './translations'; +import { Case } from '../../containers/types'; interface GetBulkItems { caseStatus: CaseStatusWithAllStatus; closePopover: () => void; - deleteCasesAction: (cases: string[]) => void; - selectedCaseIds: string[]; + deleteCasesAction: (cases: Case[]) => void; + selectedCases: Case[]; updateCaseStatus: (status: string) => void; includeCollections: boolean; } @@ -25,7 +26,7 @@ export const getBulkItems = ({ caseStatus, closePopover, deleteCasesAction, - selectedCaseIds, + selectedCases, updateCaseStatus, includeCollections, }: GetBulkItems) => { @@ -34,7 +35,7 @@ export const getBulkItems = ({ const openMenuItem = ( { @@ -49,7 +50,7 @@ export const getBulkItems = ({ const inProgressMenuItem = ( { @@ -64,7 +65,7 @@ export const getBulkItems = ({ const closeMenuItem = ( { @@ -99,10 +100,10 @@ export const getBulkItems = ({ data-test-subj="cases-bulk-delete-button" key={i18n.BULK_ACTION_DELETE_SELECTED} icon="trash" - disabled={selectedCaseIds.length === 0} + disabled={selectedCases.length === 0} onClick={() => { closePopover(); - deleteCasesAction(selectedCaseIds); + deleteCasesAction(selectedCases); }} > {i18n.BULK_ACTION_DELETE_SELECTED} diff --git a/x-pack/plugins/security_solution/public/cases/components/case_action_bar/actions.test.tsx b/x-pack/plugins/security_solution/public/cases/components/case_action_bar/actions.test.tsx index 58e0e60160c9c..ba0c725f99460 100644 --- a/x-pack/plugins/security_solution/public/cases/components/case_action_bar/actions.test.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/case_action_bar/actions.test.tsx @@ -74,7 +74,7 @@ describe('CaseView actions', () => { expect(wrapper.find('[data-test-subj="confirm-delete-case-modal"]').exists()).toBeTruthy(); wrapper.find('button[data-test-subj="confirmModalConfirmButton"]').simulate('click'); expect(handleOnDeleteConfirm.mock.calls[0][0]).toEqual([ - { id: basicCase.id, title: basicCase.title }, + { id: basicCase.id, title: basicCase.title, type: 'individual' }, ]); }); diff --git a/x-pack/plugins/security_solution/public/cases/components/case_action_bar/actions.tsx b/x-pack/plugins/security_solution/public/cases/components/case_action_bar/actions.tsx index 80047d7e573ba..74d2a40f1ceb9 100644 --- a/x-pack/plugins/security_solution/public/cases/components/case_action_bar/actions.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/case_action_bar/actions.tsx @@ -42,7 +42,9 @@ const ActionsComponent: React.FC = ({ isModalVisible={isDisplayConfirmDeleteModal} isPlural={false} onCancel={handleToggleModal} - onConfirm={handleOnDeleteConfirm.bind(null, [{ id: caseData.id, title: caseData.title }])} + onConfirm={handleOnDeleteConfirm.bind(null, [ + { id: caseData.id, title: caseData.title, type: caseData.type }, + ])} /> ), // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/x-pack/plugins/security_solution/public/cases/components/case_view/index.tsx b/x-pack/plugins/security_solution/public/cases/components/case_view/index.tsx index 83a0c4e7acd3d..9bbf2db3d83c5 100644 --- a/x-pack/plugins/security_solution/public/cases/components/case_view/index.tsx +++ b/x-pack/plugins/security_solution/public/cases/components/case_view/index.tsx @@ -397,27 +397,29 @@ export const CaseComponent = React.memo( userCanCrud={userCanCrud} /> {(caseData.type !== CaseType.collection || hasDataToPush) && ( - + <> - {caseData.type !== CaseType.collection && ( - - - - )} - {hasDataToPush && ( - - {pushButton} - - )} - + + {caseData.type !== CaseType.collection && ( + + + + )} + {hasDataToPush && ( + + {pushButton} + + )} + + )} )} diff --git a/x-pack/plugins/security_solution/public/cases/containers/mock.ts b/x-pack/plugins/security_solution/public/cases/containers/mock.ts index d8692da986cbe..719fe01579285 100644 --- a/x-pack/plugins/security_solution/public/cases/containers/mock.ts +++ b/x-pack/plugins/security_solution/public/cases/containers/mock.ts @@ -103,6 +103,37 @@ export const basicCase: Case = { subCaseIds: [], }; +export const collectionCase: Case = { + type: CaseType.collection, + closedAt: null, + closedBy: null, + id: 'collection-id', + comments: [basicComment], + createdAt: basicCreatedAt, + createdBy: elasticUser, + connector: { + id: '123', + name: 'My Connector', + type: ConnectorTypes.none, + fields: null, + }, + description: 'Security banana Issue', + externalService: null, + status: CaseStatuses.open, + tags, + title: 'Another horrible breach in a collection!!', + totalComment: 1, + totalAlerts: 0, + updatedAt: basicUpdatedAt, + updatedBy: elasticUser, + version: 'WzQ3LDFd', + settings: { + syncAlerts: true, + }, + subCases: [], + subCaseIds: [], +}; + export const basicCasePost: Case = { ...basicCase, updatedAt: null, diff --git a/x-pack/plugins/security_solution/public/cases/containers/types.ts b/x-pack/plugins/security_solution/public/cases/containers/types.ts index 09c911d93ea47..98e0ced2b6067 100644 --- a/x-pack/plugins/security_solution/public/cases/containers/types.ts +++ b/x-pack/plugins/security_solution/public/cases/containers/types.ts @@ -150,8 +150,8 @@ export interface ActionLicense { export interface DeleteCase { id: string; + type: CaseType | null; title?: string; - type?: CaseType; } export interface FieldMappings { diff --git a/x-pack/plugins/security_solution/public/cases/containers/use_delete_cases.test.tsx b/x-pack/plugins/security_solution/public/cases/containers/use_delete_cases.test.tsx index 1525f145f9030..422eb0c92cbd8 100644 --- a/x-pack/plugins/security_solution/public/cases/containers/use_delete_cases.test.tsx +++ b/x-pack/plugins/security_solution/public/cases/containers/use_delete_cases.test.tsx @@ -6,6 +6,8 @@ */ import { renderHook, act } from '@testing-library/react-hooks'; + +import { CaseType } from '../../../../case/common/api'; import { useDeleteCases, UseDeleteCase } from './use_delete_cases'; import * as api from './api'; @@ -13,7 +15,11 @@ jest.mock('./api'); describe('useDeleteCases', () => { const abortCtrl = new AbortController(); - const deleteObj = [{ id: '1' }, { id: '2' }, { id: '3' }]; + const deleteObj = [ + { id: '1', type: CaseType.individual }, + { id: '2', type: CaseType.individual }, + { id: '3', type: CaseType.individual }, + ]; const deleteArr = ['1', '2', '3']; it('init', async () => { await act(async () => { From e2fb4760a14988905c08ceb8d18ee19aa98f30a8 Mon Sep 17 00:00:00 2001 From: Liza Katz Date: Wed, 3 Mar 2021 16:02:13 +0200 Subject: [PATCH 6/6] master docs are broken (#93405) --- api_docs/data.json | 100 ------------------ .../common/es_query/filters/phrase_filter.ts | 2 + 2 files changed, 2 insertions(+), 100 deletions(-) diff --git a/api_docs/data.json b/api_docs/data.json index 74161a7c239c0..28274d7a87c9f 100644 --- a/api_docs/data.json +++ b/api_docs/data.json @@ -26207,106 +26207,6 @@ "returnComment": [], "initialIsOpen": false }, - { - "id": "def-common.getConvertedValueForField", - "type": "Function", - "children": [ - { - "type": "Object", - "label": "field", - "isRequired": true, - "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.IFieldType", - "text": "IFieldType" - } - ], - "description": [], - "source": { - "path": "src/plugins/data/common/es_query/filters/phrase_filter.ts", - "lineNumber": 107, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/common/es_query/filters/phrase_filter.ts#L107" - } - }, - { - "type": "Any", - "label": "value", - "isRequired": true, - "signature": [ - "any" - ], - "description": [], - "source": { - "path": "src/plugins/data/common/es_query/filters/phrase_filter.ts", - "lineNumber": 107, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/common/es_query/filters/phrase_filter.ts#L107" - } - } - ], - "signature": [ - "(field: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataIndexPatternsPluginApi", - "section": "def-common.IFieldType", - "text": "IFieldType" - }, - ", value: any) => any" - ], - "description": [ - "\nSee issues bellow for the reason behind this change.\nValues need to be converted to correct types for boolean \\ numeric fields.\nhttps://github.com/elastic/kibana/issues/74301\nhttps://github.com/elastic/kibana/issues/8677\nhttps://github.com/elastic/elasticsearch/issues/20941\nhttps://github.com/elastic/elasticsearch/pull/22201" - ], - "label": "getConvertedValueForField", - "source": { - "path": "src/plugins/data/common/es_query/filters/phrase_filter.ts", - "lineNumber": 107, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/common/es_query/filters/phrase_filter.ts#L107" - }, - "tags": [], - "returnComment": [], - "initialIsOpen": false - }, - { - "id": "def-common.buildInlineScriptForPhraseFilter", - "type": "Function", - "children": [ - { - "type": "Any", - "label": "scriptedField", - "isRequired": true, - "signature": [ - "any" - ], - "description": [], - "source": { - "path": "src/plugins/data/common/es_query/filters/phrase_filter.ts", - "lineNumber": 132, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/common/es_query/filters/phrase_filter.ts#L132" - } - } - ], - "signature": [ - "(scriptedField: any) => string" - ], - "description": [ - "\nTakes a scripted field and returns an inline script appropriate for use in a script query.\nHandles lucene expression and Painless scripts. Other langs aren't guaranteed to generate valid\nscripts.\n" - ], - "label": "buildInlineScriptForPhraseFilter", - "source": { - "path": "src/plugins/data/common/es_query/filters/phrase_filter.ts", - "lineNumber": 132, - "link": "https://github.com/elastic/kibana/tree/mastersrc/plugins/data/common/es_query/filters/phrase_filter.ts#L132" - }, - "tags": [], - "returnComment": [ - "The inline script string" - ], - "initialIsOpen": false - }, { "id": "def-common.isPhrasesFilter", "type": "Function", diff --git a/src/plugins/data/common/es_query/filters/phrase_filter.ts b/src/plugins/data/common/es_query/filters/phrase_filter.ts index 364e8dc1b035f..2a7f2458a27de 100644 --- a/src/plugins/data/common/es_query/filters/phrase_filter.ts +++ b/src/plugins/data/common/es_query/filters/phrase_filter.ts @@ -97,6 +97,7 @@ export const getPhraseScript = (field: IFieldType, value: string) => { }; /** + * @internal * See issues bellow for the reason behind this change. * Values need to be converted to correct types for boolean \ numeric fields. * https://github.com/elastic/kibana/issues/74301 @@ -122,6 +123,7 @@ export const getConvertedValueForField = (field: IFieldType, value: any) => { }; /** + * @internal * Takes a scripted field and returns an inline script appropriate for use in a script query. * Handles lucene expression and Painless scripts. Other langs aren't guaranteed to generate valid * scripts.