diff --git a/.buildkite/scripts/build_kibana.sh b/.buildkite/scripts/build_kibana.sh index 90f9da8ac8de..2757c956920f 100755 --- a/.buildkite/scripts/build_kibana.sh +++ b/.buildkite/scripts/build_kibana.sh @@ -10,6 +10,7 @@ echo "--- Build Kibana Distribution" BUILD_ARGS="" is_pr_with_label "ci:build-all-platforms" && BUILD_ARGS="--all-platforms" +is_pr_with_label "ci:build-example-plugins" && BUILD_ARGS="$BUILD_ARGS --example-plugins" is_pr_with_label "ci:build-docker-cross-compile" && BUILD_ARG="$BUILD_ARGS --docker-cross-compile" is_pr_with_label "ci:build-os-packages" || BUILD_ARGS="$BUILD_ARGS --skip-os-packages" is_pr_with_label "ci:build-canvas-shareable-runtime" || BUILD_ARGS="$BUILD_ARGS --skip-canvas-shareable-runtime" diff --git a/.buildkite/scripts/download_build_artifacts.sh b/.buildkite/scripts/download_build_artifacts.sh index dd0ae660543a..1e793346da33 100755 --- a/.buildkite/scripts/download_build_artifacts.sh +++ b/.buildkite/scripts/download_build_artifacts.sh @@ -15,6 +15,13 @@ if [[ ! -d "$KIBANA_BUILD_LOCATION/bin" ]]; then mkdir -p "$KIBANA_BUILD_LOCATION" tar -xzf kibana-default.tar.gz -C "$KIBANA_BUILD_LOCATION" --strip=1 + if is_pr_with_label "ci:build-example-plugins"; then + # Testing against an example plugin distribution is not supported, + # mostly due to snapshot failures when testing UI element lists + rm -rf "$KIBANA_BUILD_LOCATION/plugins" + mkdir "$KIBANA_BUILD_LOCATION/plugins" + fi + cd "$KIBANA_DIR" tar -xzf ../kibana-default-plugins.tar.gz diff --git a/.buildkite/scripts/steps/demo_env/Dockerfile b/.buildkite/scripts/steps/demo_env/Dockerfile index a0b1c3311dc8..4e841c04bbf4 100644 --- a/.buildkite/scripts/steps/demo_env/Dockerfile +++ b/.buildkite/scripts/steps/demo_env/Dockerfile @@ -1,4 +1,2 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} -COPY ./* /var/lib/example_plugins -RUN find /var/lib/example_plugins/ -type f -name '*.zip' | xargs -I % /usr/share/kibana/bin/kibana-plugin install 'file://%' diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0a1fcc60d55b..b7d588bc8926 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -784,6 +784,7 @@ packages/core/notifications/core-notifications-browser-mocks @elastic/kibana-cor packages/core/overlays/core-overlays-browser @elastic/kibana-core packages/core/overlays/core-overlays-browser-internal @elastic/kibana-core packages/core/overlays/core-overlays-browser-mocks @elastic/kibana-core +packages/core/plugins/core-plugins-base-server-internal @elastic/kibana-core packages/core/plugins/core-plugins-browser @elastic/kibana-core packages/core/plugins/core-plugins-browser-internal @elastic/kibana-core packages/core/plugins/core-plugins-browser-mocks @elastic/kibana-core @@ -792,6 +793,8 @@ packages/core/preboot/core-preboot-server-internal @elastic/kibana-core packages/core/preboot/core-preboot-server-mocks @elastic/kibana-core packages/core/rendering/core-rendering-browser-internal @elastic/kibana-core packages/core/rendering/core-rendering-browser-mocks @elastic/kibana-core +packages/core/rendering/core-rendering-server-internal @elastic/kibana-core +packages/core/rendering/core-rendering-server-mocks @elastic/kibana-core packages/core/root/core-root-browser-internal @elastic/kibana-core packages/core/saved-objects/core-saved-objects-api-browser @elastic/kibana-core packages/core/saved-objects/core-saved-objects-api-server @elastic/kibana-core diff --git a/.gitignore b/.gitignore index 98b294dbd6dc..82a13e661a5b 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ __tmp__ # Ignore example plugin builds /examples/*/build +/x-pack/examples/*/build # Ignore certain functional test runner artifacts /test/*/failure_debug diff --git a/api_docs/actions.mdx b/api_docs/actions.mdx index 929e069b2bf5..8c70634191ac 100644 --- a/api_docs/actions.mdx +++ b/api_docs/actions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/actions title: "actions" image: https://source.unsplash.com/400x175/?github description: API docs for the actions plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'actions'] --- import actionsObj from './actions.devdocs.json'; diff --git a/api_docs/advanced_settings.mdx b/api_docs/advanced_settings.mdx index 43856104f328..5f708b7bd5b2 100644 --- a/api_docs/advanced_settings.mdx +++ b/api_docs/advanced_settings.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/advancedSettings title: "advancedSettings" image: https://source.unsplash.com/400x175/?github description: API docs for the advancedSettings plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'advancedSettings'] --- import advancedSettingsObj from './advanced_settings.devdocs.json'; diff --git a/api_docs/aiops.mdx b/api_docs/aiops.mdx index 7694fbde6190..affc8c08a679 100644 --- a/api_docs/aiops.mdx +++ b/api_docs/aiops.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/aiops title: "aiops" image: https://source.unsplash.com/400x175/?github description: API docs for the aiops plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiops'] --- import aiopsObj from './aiops.devdocs.json'; diff --git a/api_docs/alerting.mdx b/api_docs/alerting.mdx index fd1ed97c10f2..dba2b5b8a03f 100644 --- a/api_docs/alerting.mdx +++ b/api_docs/alerting.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/alerting title: "alerting" image: https://source.unsplash.com/400x175/?github description: API docs for the alerting plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'alerting'] --- import alertingObj from './alerting.devdocs.json'; diff --git a/api_docs/apm.mdx b/api_docs/apm.mdx index 934ffbbd3380..e327d3d9ef26 100644 --- a/api_docs/apm.mdx +++ b/api_docs/apm.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/apm title: "apm" image: https://source.unsplash.com/400x175/?github description: API docs for the apm plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'apm'] --- import apmObj from './apm.devdocs.json'; diff --git a/api_docs/banners.mdx b/api_docs/banners.mdx index 12a25911e2da..8465fcc62bbb 100644 --- a/api_docs/banners.mdx +++ b/api_docs/banners.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/banners title: "banners" image: https://source.unsplash.com/400x175/?github description: API docs for the banners plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'banners'] --- import bannersObj from './banners.devdocs.json'; diff --git a/api_docs/bfetch.mdx b/api_docs/bfetch.mdx index c4055d656405..b4d39167b8af 100644 --- a/api_docs/bfetch.mdx +++ b/api_docs/bfetch.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/bfetch title: "bfetch" image: https://source.unsplash.com/400x175/?github description: API docs for the bfetch plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'bfetch'] --- import bfetchObj from './bfetch.devdocs.json'; diff --git a/api_docs/canvas.mdx b/api_docs/canvas.mdx index 4ef1b1b03a0e..964d7c080f50 100644 --- a/api_docs/canvas.mdx +++ b/api_docs/canvas.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/canvas title: "canvas" image: https://source.unsplash.com/400x175/?github description: API docs for the canvas plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'canvas'] --- import canvasObj from './canvas.devdocs.json'; diff --git a/api_docs/cases.mdx b/api_docs/cases.mdx index 6df29978541a..1b56bb9f2bb5 100644 --- a/api_docs/cases.mdx +++ b/api_docs/cases.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cases title: "cases" image: https://source.unsplash.com/400x175/?github description: API docs for the cases plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cases'] --- import casesObj from './cases.devdocs.json'; diff --git a/api_docs/charts.mdx b/api_docs/charts.mdx index 718e93231dff..5971c6140b9d 100644 --- a/api_docs/charts.mdx +++ b/api_docs/charts.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/charts title: "charts" image: https://source.unsplash.com/400x175/?github description: API docs for the charts plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'charts'] --- import chartsObj from './charts.devdocs.json'; diff --git a/api_docs/cloud.mdx b/api_docs/cloud.mdx index 74692e016ccf..07a722e9fc63 100644 --- a/api_docs/cloud.mdx +++ b/api_docs/cloud.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloud title: "cloud" image: https://source.unsplash.com/400x175/?github description: API docs for the cloud plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloud'] --- import cloudObj from './cloud.devdocs.json'; diff --git a/api_docs/cloud_experiments.mdx b/api_docs/cloud_experiments.mdx index 9b5efb2aa51f..8cb19bfe8beb 100644 --- a/api_docs/cloud_experiments.mdx +++ b/api_docs/cloud_experiments.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudExperiments title: "cloudExperiments" image: https://source.unsplash.com/400x175/?github description: API docs for the cloudExperiments plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudExperiments'] --- import cloudExperimentsObj from './cloud_experiments.devdocs.json'; diff --git a/api_docs/cloud_security_posture.mdx b/api_docs/cloud_security_posture.mdx index 1ccfb42f61d0..6c3113198141 100644 --- a/api_docs/cloud_security_posture.mdx +++ b/api_docs/cloud_security_posture.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/cloudSecurityPosture title: "cloudSecurityPosture" image: https://source.unsplash.com/400x175/?github description: API docs for the cloudSecurityPosture plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'cloudSecurityPosture'] --- import cloudSecurityPostureObj from './cloud_security_posture.devdocs.json'; diff --git a/api_docs/console.mdx b/api_docs/console.mdx index 00e0779286aa..69717a2855de 100644 --- a/api_docs/console.mdx +++ b/api_docs/console.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/console title: "console" image: https://source.unsplash.com/400x175/?github description: API docs for the console plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'console'] --- import consoleObj from './console.devdocs.json'; diff --git a/api_docs/controls.mdx b/api_docs/controls.mdx index e1427ab3d19f..d120725ebf6c 100644 --- a/api_docs/controls.mdx +++ b/api_docs/controls.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/controls title: "controls" image: https://source.unsplash.com/400x175/?github description: API docs for the controls plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'controls'] --- import controlsObj from './controls.devdocs.json'; diff --git a/api_docs/core.mdx b/api_docs/core.mdx index 798c6c53ce34..2ce73b73214a 100644 --- a/api_docs/core.mdx +++ b/api_docs/core.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/core title: "core" image: https://source.unsplash.com/400x175/?github description: API docs for the core plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'core'] --- import coreObj from './core.devdocs.json'; diff --git a/api_docs/custom_integrations.devdocs.json b/api_docs/custom_integrations.devdocs.json index 03090384a055..44611a9497df 100644 --- a/api_docs/custom_integrations.devdocs.json +++ b/api_docs/custom_integrations.devdocs.json @@ -298,7 +298,7 @@ "label": "languageClientsUiComponents", "description": [], "signature": [ - "Map>" + "{ [x: string]: React.FC<{}>; }" ], "path": "src/plugins/custom_integrations/public/types.ts", "deprecated": false, diff --git a/api_docs/custom_integrations.mdx b/api_docs/custom_integrations.mdx index 77c928f34e58..c9bd9c16e721 100644 --- a/api_docs/custom_integrations.mdx +++ b/api_docs/custom_integrations.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/customIntegrations title: "customIntegrations" image: https://source.unsplash.com/400x175/?github description: API docs for the customIntegrations plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'customIntegrations'] --- import customIntegrationsObj from './custom_integrations.devdocs.json'; diff --git a/api_docs/dashboard.mdx b/api_docs/dashboard.mdx index 7a36e763bfea..7fa93934def0 100644 --- a/api_docs/dashboard.mdx +++ b/api_docs/dashboard.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dashboard title: "dashboard" image: https://source.unsplash.com/400x175/?github description: API docs for the dashboard plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dashboard'] --- import dashboardObj from './dashboard.devdocs.json'; diff --git a/api_docs/dashboard_enhanced.mdx b/api_docs/dashboard_enhanced.mdx index 06821933db67..4f0b134f643c 100644 --- a/api_docs/dashboard_enhanced.mdx +++ b/api_docs/dashboard_enhanced.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dashboardEnhanced title: "dashboardEnhanced" image: https://source.unsplash.com/400x175/?github description: API docs for the dashboardEnhanced plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dashboardEnhanced'] --- import dashboardEnhancedObj from './dashboard_enhanced.devdocs.json'; diff --git a/api_docs/data.mdx b/api_docs/data.mdx index e5c75be5fa09..3cda1cdf63de 100644 --- a/api_docs/data.mdx +++ b/api_docs/data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/data title: "data" image: https://source.unsplash.com/400x175/?github description: API docs for the data plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data'] --- import dataObj from './data.devdocs.json'; diff --git a/api_docs/data_query.mdx b/api_docs/data_query.mdx index fdd7cb4298da..09c0ef0d696b 100644 --- a/api_docs/data_query.mdx +++ b/api_docs/data_query.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/data-query title: "data.query" image: https://source.unsplash.com/400x175/?github description: API docs for the data.query plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data.query'] --- import dataQueryObj from './data_query.devdocs.json'; diff --git a/api_docs/data_search.mdx b/api_docs/data_search.mdx index 619cec4220ea..c3b582462fd7 100644 --- a/api_docs/data_search.mdx +++ b/api_docs/data_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/data-search title: "data.search" image: https://source.unsplash.com/400x175/?github description: API docs for the data.search plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data.search'] --- import dataSearchObj from './data_search.devdocs.json'; diff --git a/api_docs/data_view_editor.mdx b/api_docs/data_view_editor.mdx index f0d1bf1f9d45..34855c7100ce 100644 --- a/api_docs/data_view_editor.mdx +++ b/api_docs/data_view_editor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataViewEditor title: "dataViewEditor" image: https://source.unsplash.com/400x175/?github description: API docs for the dataViewEditor plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViewEditor'] --- import dataViewEditorObj from './data_view_editor.devdocs.json'; diff --git a/api_docs/data_view_field_editor.mdx b/api_docs/data_view_field_editor.mdx index 9800b25ff8ba..5daa20fdddfe 100644 --- a/api_docs/data_view_field_editor.mdx +++ b/api_docs/data_view_field_editor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataViewFieldEditor title: "dataViewFieldEditor" image: https://source.unsplash.com/400x175/?github description: API docs for the dataViewFieldEditor plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViewFieldEditor'] --- import dataViewFieldEditorObj from './data_view_field_editor.devdocs.json'; diff --git a/api_docs/data_view_management.mdx b/api_docs/data_view_management.mdx index d2f23607c286..fa43c84f3166 100644 --- a/api_docs/data_view_management.mdx +++ b/api_docs/data_view_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataViewManagement title: "dataViewManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the dataViewManagement plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViewManagement'] --- import dataViewManagementObj from './data_view_management.devdocs.json'; diff --git a/api_docs/data_views.devdocs.json b/api_docs/data_views.devdocs.json index c86863415866..cc6bd0a259d0 100644 --- a/api_docs/data_views.devdocs.json +++ b/api_docs/data_views.devdocs.json @@ -4164,6 +4164,45 @@ "returnComment": [], "children": [] }, + { + "parentPluginId": "dataViews", + "id": "def-public.DataViewsServicePublic.getIndices", + "type": "Function", + "tags": [], + "label": "getIndices", + "description": [], + "signature": [ + "(props: { pattern: string; showAllIndices?: boolean | undefined; isRollupIndex: (indexName: string) => boolean; }) => Promise<", + { + "pluginId": "dataViews", + "scope": "public", + "docId": "kibDataViewsPluginApi", + "section": "def-public.MatchedItem", + "text": "MatchedItem" + }, + "[]>" + ], + "path": "src/plugins/data_views/public/data_views_service_public.ts", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "dataViews", + "id": "def-public.DataViewsServicePublic.getIndices.$1", + "type": "Object", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "{ pattern: string; showAllIndices?: boolean | undefined; isRollupIndex: (indexName: string) => boolean; }" + ], + "path": "src/plugins/data_views/public/data_views_service_public.ts", + "deprecated": false, + "trackAdoption": false + } + ] + }, { "parentPluginId": "dataViews", "id": "def-public.DataViewsServicePublic.hasData", @@ -5398,6 +5437,101 @@ "path": "src/plugins/data_views/public/data_views_service_public.ts", "deprecated": false, "trackAdoption": false + }, + { + "parentPluginId": "dataViews", + "id": "def-public.DataViewsServicePublicDeps.getIndices", + "type": "Function", + "tags": [], + "label": "getIndices", + "description": [], + "signature": [ + "(props: { pattern: string; showAllIndices?: boolean | undefined; isRollupIndex: (indexName: string) => boolean; }) => Promise<", + { + "pluginId": "dataViews", + "scope": "public", + "docId": "kibDataViewsPluginApi", + "section": "def-public.MatchedItem", + "text": "MatchedItem" + }, + "[]>" + ], + "path": "src/plugins/data_views/public/data_views_service_public.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dataViews", + "id": "def-public.DataViewsServicePublicDeps.getIndices.$1", + "type": "Object", + "tags": [], + "label": "props", + "description": [], + "path": "src/plugins/data_views/public/data_views_service_public.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dataViews", + "id": "def-public.DataViewsServicePublicDeps.getIndices.$1.pattern", + "type": "string", + "tags": [], + "label": "pattern", + "description": [], + "path": "src/plugins/data_views/public/data_views_service_public.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dataViews", + "id": "def-public.DataViewsServicePublicDeps.getIndices.$1.showAllIndices", + "type": "CompoundType", + "tags": [], + "label": "showAllIndices", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/data_views/public/data_views_service_public.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dataViews", + "id": "def-public.DataViewsServicePublicDeps.getIndices.$1.isRollupIndex", + "type": "Function", + "tags": [], + "label": "isRollupIndex", + "description": [], + "signature": [ + "(indexName: string) => boolean" + ], + "path": "src/plugins/data_views/public/data_views_service_public.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dataViews", + "id": "def-public.DataViewsServicePublicDeps.getIndices.$1.isRollupIndex.$1", + "type": "string", + "tags": [], + "label": "indexName", + "description": [], + "signature": [ + "string" + ], + "path": "src/plugins/data_views/public/data_views_service_public.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] + } + ] + } + ], + "returnComment": [] } ], "initialIsOpen": false @@ -5906,6 +6040,68 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "dataViews", + "id": "def-public.MatchedItem", + "type": "Interface", + "tags": [], + "label": "MatchedItem", + "description": [], + "path": "src/plugins/data_views/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dataViews", + "id": "def-public.MatchedItem.name", + "type": "string", + "tags": [], + "label": "name", + "description": [], + "path": "src/plugins/data_views/public/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dataViews", + "id": "def-public.MatchedItem.tags", + "type": "Array", + "tags": [], + "label": "tags", + "description": [], + "signature": [ + { + "pluginId": "dataViews", + "scope": "public", + "docId": "kibDataViewsPluginApi", + "section": "def-public.Tag", + "text": "Tag" + }, + "[]" + ], + "path": "src/plugins/data_views/public/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dataViews", + "id": "def-public.MatchedItem.item", + "type": "Object", + "tags": [], + "label": "item", + "description": [], + "signature": [ + "{ name: string; backing_indices?: string[] | undefined; timestamp_field?: string | undefined; indices?: string[] | undefined; aliases?: string[] | undefined; attributes?: ", + "ResolveIndexResponseItemIndexAttrs", + "[] | undefined; data_stream?: string | undefined; }" + ], + "path": "src/plugins/data_views/public/types.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "dataViews", "id": "def-public.RuntimeField", @@ -6339,6 +6535,53 @@ } ], "initialIsOpen": false + }, + { + "parentPluginId": "dataViews", + "id": "def-public.Tag", + "type": "Interface", + "tags": [], + "label": "Tag", + "description": [], + "path": "src/plugins/data_views/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dataViews", + "id": "def-public.Tag.name", + "type": "string", + "tags": [], + "label": "name", + "description": [], + "path": "src/plugins/data_views/public/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dataViews", + "id": "def-public.Tag.key", + "type": "string", + "tags": [], + "label": "key", + "description": [], + "path": "src/plugins/data_views/public/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dataViews", + "id": "def-public.Tag.color", + "type": "string", + "tags": [], + "label": "color", + "description": [], + "path": "src/plugins/data_views/public/types.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false } ], "enums": [ @@ -6355,6 +6598,18 @@ "deprecated": false, "trackAdoption": false, "initialIsOpen": false + }, + { + "parentPluginId": "dataViews", + "id": "def-public.INDEX_PATTERN_TYPE", + "type": "Enum", + "tags": [], + "label": "INDEX_PATTERN_TYPE", + "description": [], + "path": "src/plugins/data_views/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false } ], "misc": [ diff --git a/api_docs/data_views.mdx b/api_docs/data_views.mdx index 3c9d9dc38bae..817619ccf49c 100644 --- a/api_docs/data_views.mdx +++ b/api_docs/data_views.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataViews title: "dataViews" image: https://source.unsplash.com/400x175/?github description: API docs for the dataViews plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataViews'] --- import dataViewsObj from './data_views.devdocs.json'; @@ -21,7 +21,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 966 | 0 | 208 | 1 | +| 983 | 0 | 225 | 2 | ## Client diff --git a/api_docs/data_visualizer.mdx b/api_docs/data_visualizer.mdx index 86bbfd4e83cf..6df0430d04c2 100644 --- a/api_docs/data_visualizer.mdx +++ b/api_docs/data_visualizer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/dataVisualizer title: "dataVisualizer" image: https://source.unsplash.com/400x175/?github description: API docs for the dataVisualizer plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dataVisualizer'] --- import dataVisualizerObj from './data_visualizer.devdocs.json'; diff --git a/api_docs/deprecations_by_api.mdx b/api_docs/deprecations_by_api.mdx index 547c12c8570c..3c34e78a89e7 100644 --- a/api_docs/deprecations_by_api.mdx +++ b/api_docs/deprecations_by_api.mdx @@ -7,7 +7,7 @@ id: kibDevDocsDeprecationsByApi slug: /kibana-dev-docs/api-meta/deprecated-api-list-by-api title: Deprecated API usage by API description: A list of deprecated APIs, which plugins are still referencing them, and when they need to be removed by. -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- diff --git a/api_docs/deprecations_by_plugin.mdx b/api_docs/deprecations_by_plugin.mdx index 3943c847158f..abe2810379ec 100644 --- a/api_docs/deprecations_by_plugin.mdx +++ b/api_docs/deprecations_by_plugin.mdx @@ -7,7 +7,7 @@ id: kibDevDocsDeprecationsByPlugin slug: /kibana-dev-docs/api-meta/deprecated-api-list-by-plugin title: Deprecated API usage by plugin description: A list of deprecated APIs, which plugins are still referencing them, and when they need to be removed by. -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- diff --git a/api_docs/deprecations_by_team.mdx b/api_docs/deprecations_by_team.mdx index da0e278bffa6..882abd4cb615 100644 --- a/api_docs/deprecations_by_team.mdx +++ b/api_docs/deprecations_by_team.mdx @@ -7,7 +7,7 @@ id: kibDevDocsDeprecationsDueByTeam slug: /kibana-dev-docs/api-meta/deprecations-due-by-team title: Deprecated APIs due to be removed, by team description: Lists the teams that are referencing deprecated APIs with a remove by date. -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- diff --git a/api_docs/dev_tools.mdx b/api_docs/dev_tools.mdx index b724ab15e695..76be86527aae 100644 --- a/api_docs/dev_tools.mdx +++ b/api_docs/dev_tools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/devTools title: "devTools" image: https://source.unsplash.com/400x175/?github description: API docs for the devTools plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'devTools'] --- import devToolsObj from './dev_tools.devdocs.json'; diff --git a/api_docs/discover.mdx b/api_docs/discover.mdx index 39b2814d4136..9c9793bd2bcf 100644 --- a/api_docs/discover.mdx +++ b/api_docs/discover.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/discover title: "discover" image: https://source.unsplash.com/400x175/?github description: API docs for the discover plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'discover'] --- import discoverObj from './discover.devdocs.json'; diff --git a/api_docs/discover_enhanced.mdx b/api_docs/discover_enhanced.mdx index e9974fbb2bf4..bc90ebb67c09 100644 --- a/api_docs/discover_enhanced.mdx +++ b/api_docs/discover_enhanced.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/discoverEnhanced title: "discoverEnhanced" image: https://source.unsplash.com/400x175/?github description: API docs for the discoverEnhanced plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'discoverEnhanced'] --- import discoverEnhancedObj from './discover_enhanced.devdocs.json'; diff --git a/api_docs/embeddable.mdx b/api_docs/embeddable.mdx index 8bbe0a063796..4c4b222a02a7 100644 --- a/api_docs/embeddable.mdx +++ b/api_docs/embeddable.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/embeddable title: "embeddable" image: https://source.unsplash.com/400x175/?github description: API docs for the embeddable plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'embeddable'] --- import embeddableObj from './embeddable.devdocs.json'; diff --git a/api_docs/embeddable_enhanced.mdx b/api_docs/embeddable_enhanced.mdx index c53b6a4aba7e..5ab087491141 100644 --- a/api_docs/embeddable_enhanced.mdx +++ b/api_docs/embeddable_enhanced.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/embeddableEnhanced title: "embeddableEnhanced" image: https://source.unsplash.com/400x175/?github description: API docs for the embeddableEnhanced plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'embeddableEnhanced'] --- import embeddableEnhancedObj from './embeddable_enhanced.devdocs.json'; diff --git a/api_docs/encrypted_saved_objects.mdx b/api_docs/encrypted_saved_objects.mdx index 6cc990a42eba..5aa1eae40de5 100644 --- a/api_docs/encrypted_saved_objects.mdx +++ b/api_docs/encrypted_saved_objects.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/encryptedSavedObjects title: "encryptedSavedObjects" image: https://source.unsplash.com/400x175/?github description: API docs for the encryptedSavedObjects plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'encryptedSavedObjects'] --- import encryptedSavedObjectsObj from './encrypted_saved_objects.devdocs.json'; diff --git a/api_docs/enterprise_search.mdx b/api_docs/enterprise_search.mdx index 8f80e15d3886..ba021086e294 100644 --- a/api_docs/enterprise_search.mdx +++ b/api_docs/enterprise_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/enterpriseSearch title: "enterpriseSearch" image: https://source.unsplash.com/400x175/?github description: API docs for the enterpriseSearch plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'enterpriseSearch'] --- import enterpriseSearchObj from './enterprise_search.devdocs.json'; diff --git a/api_docs/es_ui_shared.mdx b/api_docs/es_ui_shared.mdx index 6a4ca6fcb773..bf991156be21 100644 --- a/api_docs/es_ui_shared.mdx +++ b/api_docs/es_ui_shared.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/esUiShared title: "esUiShared" image: https://source.unsplash.com/400x175/?github description: API docs for the esUiShared plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'esUiShared'] --- import esUiSharedObj from './es_ui_shared.devdocs.json'; diff --git a/api_docs/event_annotation.mdx b/api_docs/event_annotation.mdx index 159a2f7167b0..2c09bd5d65d4 100644 --- a/api_docs/event_annotation.mdx +++ b/api_docs/event_annotation.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/eventAnnotation title: "eventAnnotation" image: https://source.unsplash.com/400x175/?github description: API docs for the eventAnnotation plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'eventAnnotation'] --- import eventAnnotationObj from './event_annotation.devdocs.json'; diff --git a/api_docs/event_log.mdx b/api_docs/event_log.mdx index b9be569d3a3e..482e1d361a15 100644 --- a/api_docs/event_log.mdx +++ b/api_docs/event_log.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/eventLog title: "eventLog" image: https://source.unsplash.com/400x175/?github description: API docs for the eventLog plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'eventLog'] --- import eventLogObj from './event_log.devdocs.json'; diff --git a/api_docs/expression_error.mdx b/api_docs/expression_error.mdx index 6d9a8d244589..2ab9af9772d0 100644 --- a/api_docs/expression_error.mdx +++ b/api_docs/expression_error.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionError title: "expressionError" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionError plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionError'] --- import expressionErrorObj from './expression_error.devdocs.json'; diff --git a/api_docs/expression_gauge.mdx b/api_docs/expression_gauge.mdx index b38b786ca55b..908d90469c75 100644 --- a/api_docs/expression_gauge.mdx +++ b/api_docs/expression_gauge.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionGauge title: "expressionGauge" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionGauge plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionGauge'] --- import expressionGaugeObj from './expression_gauge.devdocs.json'; diff --git a/api_docs/expression_heatmap.mdx b/api_docs/expression_heatmap.mdx index 9d856b882a31..aa2ac31f046e 100644 --- a/api_docs/expression_heatmap.mdx +++ b/api_docs/expression_heatmap.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionHeatmap title: "expressionHeatmap" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionHeatmap plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionHeatmap'] --- import expressionHeatmapObj from './expression_heatmap.devdocs.json'; diff --git a/api_docs/expression_image.mdx b/api_docs/expression_image.mdx index 84225e80ad00..fd4412ad3f9e 100644 --- a/api_docs/expression_image.mdx +++ b/api_docs/expression_image.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionImage title: "expressionImage" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionImage plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionImage'] --- import expressionImageObj from './expression_image.devdocs.json'; diff --git a/api_docs/expression_legacy_metric_vis.mdx b/api_docs/expression_legacy_metric_vis.mdx index e6902356f091..4f1bd9723f36 100644 --- a/api_docs/expression_legacy_metric_vis.mdx +++ b/api_docs/expression_legacy_metric_vis.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionLegacyMetricVis title: "expressionLegacyMetricVis" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionLegacyMetricVis plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionLegacyMetricVis'] --- import expressionLegacyMetricVisObj from './expression_legacy_metric_vis.devdocs.json'; diff --git a/api_docs/expression_metric.mdx b/api_docs/expression_metric.mdx index 60a4d843aad3..d17081eed3cb 100644 --- a/api_docs/expression_metric.mdx +++ b/api_docs/expression_metric.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionMetric title: "expressionMetric" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionMetric plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionMetric'] --- import expressionMetricObj from './expression_metric.devdocs.json'; diff --git a/api_docs/expression_metric_vis.mdx b/api_docs/expression_metric_vis.mdx index 85c6421d292d..daa61ecf37e7 100644 --- a/api_docs/expression_metric_vis.mdx +++ b/api_docs/expression_metric_vis.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionMetricVis title: "expressionMetricVis" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionMetricVis plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionMetricVis'] --- import expressionMetricVisObj from './expression_metric_vis.devdocs.json'; diff --git a/api_docs/expression_partition_vis.mdx b/api_docs/expression_partition_vis.mdx index 4d4a23fe3a6f..aaf66fd40fa4 100644 --- a/api_docs/expression_partition_vis.mdx +++ b/api_docs/expression_partition_vis.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionPartitionVis title: "expressionPartitionVis" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionPartitionVis plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionPartitionVis'] --- import expressionPartitionVisObj from './expression_partition_vis.devdocs.json'; diff --git a/api_docs/expression_repeat_image.mdx b/api_docs/expression_repeat_image.mdx index ff4af965c963..8e5467dc9cff 100644 --- a/api_docs/expression_repeat_image.mdx +++ b/api_docs/expression_repeat_image.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionRepeatImage title: "expressionRepeatImage" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionRepeatImage plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionRepeatImage'] --- import expressionRepeatImageObj from './expression_repeat_image.devdocs.json'; diff --git a/api_docs/expression_reveal_image.mdx b/api_docs/expression_reveal_image.mdx index 2d3ede34cf14..a2a032c0c0bd 100644 --- a/api_docs/expression_reveal_image.mdx +++ b/api_docs/expression_reveal_image.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionRevealImage title: "expressionRevealImage" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionRevealImage plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionRevealImage'] --- import expressionRevealImageObj from './expression_reveal_image.devdocs.json'; diff --git a/api_docs/expression_shape.mdx b/api_docs/expression_shape.mdx index 114bb0846272..e650bf57eac7 100644 --- a/api_docs/expression_shape.mdx +++ b/api_docs/expression_shape.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionShape title: "expressionShape" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionShape plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionShape'] --- import expressionShapeObj from './expression_shape.devdocs.json'; diff --git a/api_docs/expression_tagcloud.mdx b/api_docs/expression_tagcloud.mdx index 6a87768ff01e..cf00311b239a 100644 --- a/api_docs/expression_tagcloud.mdx +++ b/api_docs/expression_tagcloud.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionTagcloud title: "expressionTagcloud" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionTagcloud plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionTagcloud'] --- import expressionTagcloudObj from './expression_tagcloud.devdocs.json'; diff --git a/api_docs/expression_x_y.mdx b/api_docs/expression_x_y.mdx index bf0c8f9c49ae..0eed4b0b713d 100644 --- a/api_docs/expression_x_y.mdx +++ b/api_docs/expression_x_y.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressionXY title: "expressionXY" image: https://source.unsplash.com/400x175/?github description: API docs for the expressionXY plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressionXY'] --- import expressionXYObj from './expression_x_y.devdocs.json'; diff --git a/api_docs/expressions.devdocs.json b/api_docs/expressions.devdocs.json index bae5e63702f4..dfc68e39dd9c 100644 --- a/api_docs/expressions.devdocs.json +++ b/api_docs/expressions.devdocs.json @@ -363,7 +363,7 @@ "label": "invokeChain", "description": [], "signature": [ - "(chainArr: ", + "([head, ...tail]: ", { "pluginId": "expressions", "scope": "common", @@ -373,7 +373,15 @@ }, "[], input: unknown) => ", "Observable", - "" + "<", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueError", + "text": "ExpressionValueError" + }, + " | ChainOutput>" ], "path": "src/plugins/expressions/common/execution/execution.ts", "deprecated": false, @@ -384,7 +392,7 @@ "id": "def-public.Execution.invokeChain.$1", "type": "Array", "tags": [], - "label": "chainArr", + "label": "[head, ...tail]", "description": [], "signature": [ { @@ -13369,7 +13377,7 @@ "label": "invokeChain", "description": [], "signature": [ - "(chainArr: ", + "([head, ...tail]: ", { "pluginId": "expressions", "scope": "common", @@ -13379,7 +13387,15 @@ }, "[], input: unknown) => ", "Observable", - "" + "<", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueError", + "text": "ExpressionValueError" + }, + " | ChainOutput>" ], "path": "src/plugins/expressions/common/execution/execution.ts", "deprecated": false, @@ -13390,7 +13406,7 @@ "id": "def-server.Execution.invokeChain.$1", "type": "Array", "tags": [], - "label": "chainArr", + "label": "[head, ...tail]", "description": [], "signature": [ { @@ -22158,7 +22174,7 @@ "label": "invokeChain", "description": [], "signature": [ - "(chainArr: ", + "([head, ...tail]: ", { "pluginId": "expressions", "scope": "common", @@ -22168,7 +22184,15 @@ }, "[], input: unknown) => ", "Observable", - "" + "<", + { + "pluginId": "expressions", + "scope": "common", + "docId": "kibExpressionsPluginApi", + "section": "def-common.ExpressionValueError", + "text": "ExpressionValueError" + }, + " | ChainOutput>" ], "path": "src/plugins/expressions/common/execution/execution.ts", "deprecated": false, @@ -22179,7 +22203,7 @@ "id": "def-common.Execution.invokeChain.$1", "type": "Array", "tags": [], - "label": "chainArr", + "label": "[head, ...tail]", "description": [], "signature": [ { diff --git a/api_docs/expressions.mdx b/api_docs/expressions.mdx index cb5617b237f7..353dfa02a783 100644 --- a/api_docs/expressions.mdx +++ b/api_docs/expressions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/expressions title: "expressions" image: https://source.unsplash.com/400x175/?github description: API docs for the expressions plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressions'] --- import expressionsObj from './expressions.devdocs.json'; diff --git a/api_docs/features.mdx b/api_docs/features.mdx index 1c1d57aa91eb..8b7f40f4a359 100644 --- a/api_docs/features.mdx +++ b/api_docs/features.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/features title: "features" image: https://source.unsplash.com/400x175/?github description: API docs for the features plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'features'] --- import featuresObj from './features.devdocs.json'; diff --git a/api_docs/field_formats.mdx b/api_docs/field_formats.mdx index dc89d286ddfe..040d82060400 100644 --- a/api_docs/field_formats.mdx +++ b/api_docs/field_formats.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/fieldFormats title: "fieldFormats" image: https://source.unsplash.com/400x175/?github description: API docs for the fieldFormats plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'fieldFormats'] --- import fieldFormatsObj from './field_formats.devdocs.json'; diff --git a/api_docs/file_upload.mdx b/api_docs/file_upload.mdx index f29f32174d12..768f6188371f 100644 --- a/api_docs/file_upload.mdx +++ b/api_docs/file_upload.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/fileUpload title: "fileUpload" image: https://source.unsplash.com/400x175/?github description: API docs for the fileUpload plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'fileUpload'] --- import fileUploadObj from './file_upload.devdocs.json'; diff --git a/api_docs/files.mdx b/api_docs/files.mdx index 3cc10c4a1612..8491d90df244 100644 --- a/api_docs/files.mdx +++ b/api_docs/files.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/files title: "files" image: https://source.unsplash.com/400x175/?github description: API docs for the files plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'files'] --- import filesObj from './files.devdocs.json'; diff --git a/api_docs/fleet.devdocs.json b/api_docs/fleet.devdocs.json index 3059a8f9c9f8..59f0a3a2c3c9 100644 --- a/api_docs/fleet.devdocs.json +++ b/api_docs/fleet.devdocs.json @@ -9645,6 +9645,22 @@ "deprecated": false, "trackAdoption": false }, + { + "parentPluginId": "fleet", + "id": "def-common.FleetServerAgent.last_checkin_message", + "type": "string", + "tags": [], + "label": "last_checkin_message", + "description": [ + "\nLast checkin message" + ], + "signature": [ + "string | undefined" + ], + "path": "x-pack/plugins/fleet/common/types/models/agent.ts", + "deprecated": false, + "trackAdoption": false + }, { "parentPluginId": "fleet", "id": "def-common.FleetServerAgent.default_api_key_id", diff --git a/api_docs/fleet.mdx b/api_docs/fleet.mdx index 7c5beab0d5c9..b63495e17792 100644 --- a/api_docs/fleet.mdx +++ b/api_docs/fleet.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/fleet title: "fleet" image: https://source.unsplash.com/400x175/?github description: API docs for the fleet plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'fleet'] --- import fleetObj from './fleet.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Fleet](https://github.com/orgs/elastic/teams/fleet) for questions regar | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 996 | 3 | 893 | 17 | +| 997 | 3 | 893 | 17 | ## Client diff --git a/api_docs/global_search.mdx b/api_docs/global_search.mdx index 6803fa9d095e..97d12a56906f 100644 --- a/api_docs/global_search.mdx +++ b/api_docs/global_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/globalSearch title: "globalSearch" image: https://source.unsplash.com/400x175/?github description: API docs for the globalSearch plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'globalSearch'] --- import globalSearchObj from './global_search.devdocs.json'; diff --git a/api_docs/guided_onboarding.mdx b/api_docs/guided_onboarding.mdx index 062ffb1effb3..899b3205a819 100644 --- a/api_docs/guided_onboarding.mdx +++ b/api_docs/guided_onboarding.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/guidedOnboarding title: "guidedOnboarding" image: https://source.unsplash.com/400x175/?github description: API docs for the guidedOnboarding plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'guidedOnboarding'] --- import guidedOnboardingObj from './guided_onboarding.devdocs.json'; diff --git a/api_docs/home.mdx b/api_docs/home.mdx index 8f772016026c..30beb41d12fa 100644 --- a/api_docs/home.mdx +++ b/api_docs/home.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/home title: "home" image: https://source.unsplash.com/400x175/?github description: API docs for the home plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'home'] --- import homeObj from './home.devdocs.json'; diff --git a/api_docs/index_lifecycle_management.mdx b/api_docs/index_lifecycle_management.mdx index 29de31f6cf68..e3ee1798496d 100644 --- a/api_docs/index_lifecycle_management.mdx +++ b/api_docs/index_lifecycle_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/indexLifecycleManagement title: "indexLifecycleManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the indexLifecycleManagement plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'indexLifecycleManagement'] --- import indexLifecycleManagementObj from './index_lifecycle_management.devdocs.json'; diff --git a/api_docs/index_management.mdx b/api_docs/index_management.mdx index 3dac89fa09d7..34f9d8fcde85 100644 --- a/api_docs/index_management.mdx +++ b/api_docs/index_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/indexManagement title: "indexManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the indexManagement plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'indexManagement'] --- import indexManagementObj from './index_management.devdocs.json'; diff --git a/api_docs/infra.mdx b/api_docs/infra.mdx index 315978011a0b..7ab9b9d8573c 100644 --- a/api_docs/infra.mdx +++ b/api_docs/infra.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/infra title: "infra" image: https://source.unsplash.com/400x175/?github description: API docs for the infra plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'infra'] --- import infraObj from './infra.devdocs.json'; diff --git a/api_docs/inspector.mdx b/api_docs/inspector.mdx index 1eec7a67db10..4cb29a4632ca 100644 --- a/api_docs/inspector.mdx +++ b/api_docs/inspector.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/inspector title: "inspector" image: https://source.unsplash.com/400x175/?github description: API docs for the inspector plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'inspector'] --- import inspectorObj from './inspector.devdocs.json'; diff --git a/api_docs/interactive_setup.mdx b/api_docs/interactive_setup.mdx index ba3797cab67d..6f257bb85432 100644 --- a/api_docs/interactive_setup.mdx +++ b/api_docs/interactive_setup.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/interactiveSetup title: "interactiveSetup" image: https://source.unsplash.com/400x175/?github description: API docs for the interactiveSetup plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'interactiveSetup'] --- import interactiveSetupObj from './interactive_setup.devdocs.json'; diff --git a/api_docs/kbn_ace.mdx b/api_docs/kbn_ace.mdx index c6dcd6bde783..0dcf9a1b797b 100644 --- a/api_docs/kbn_ace.mdx +++ b/api_docs/kbn_ace.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ace title: "@kbn/ace" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ace plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ace'] --- import kbnAceObj from './kbn_ace.devdocs.json'; diff --git a/api_docs/kbn_aiops_components.mdx b/api_docs/kbn_aiops_components.mdx index 78c88adbe04a..60ab8f506c3a 100644 --- a/api_docs/kbn_aiops_components.mdx +++ b/api_docs/kbn_aiops_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-aiops-components title: "@kbn/aiops-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/aiops-components plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/aiops-components'] --- import kbnAiopsComponentsObj from './kbn_aiops_components.devdocs.json'; diff --git a/api_docs/kbn_aiops_utils.mdx b/api_docs/kbn_aiops_utils.mdx index 8e0003a6394a..c459ac8369da 100644 --- a/api_docs/kbn_aiops_utils.mdx +++ b/api_docs/kbn_aiops_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-aiops-utils title: "@kbn/aiops-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/aiops-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/aiops-utils'] --- import kbnAiopsUtilsObj from './kbn_aiops_utils.devdocs.json'; diff --git a/api_docs/kbn_alerts.mdx b/api_docs/kbn_alerts.mdx index b936fa218da1..aaf236aab90f 100644 --- a/api_docs/kbn_alerts.mdx +++ b/api_docs/kbn_alerts.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-alerts title: "@kbn/alerts" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/alerts plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/alerts'] --- import kbnAlertsObj from './kbn_alerts.devdocs.json'; diff --git a/api_docs/kbn_analytics.mdx b/api_docs/kbn_analytics.mdx index 480d1389d1d5..35df4e16f17c 100644 --- a/api_docs/kbn_analytics.mdx +++ b/api_docs/kbn_analytics.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics title: "@kbn/analytics" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics'] --- import kbnAnalyticsObj from './kbn_analytics.devdocs.json'; diff --git a/api_docs/kbn_analytics_client.mdx b/api_docs/kbn_analytics_client.mdx index 67d5f65e938a..0d18980e0b1c 100644 --- a/api_docs/kbn_analytics_client.mdx +++ b/api_docs/kbn_analytics_client.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-client title: "@kbn/analytics-client" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-client plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-client'] --- import kbnAnalyticsClientObj from './kbn_analytics_client.devdocs.json'; diff --git a/api_docs/kbn_analytics_shippers_elastic_v3_browser.mdx b/api_docs/kbn_analytics_shippers_elastic_v3_browser.mdx index 2c75bd5664b6..c4b9427b1a33 100644 --- a/api_docs/kbn_analytics_shippers_elastic_v3_browser.mdx +++ b/api_docs/kbn_analytics_shippers_elastic_v3_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-shippers-elastic-v3-browser title: "@kbn/analytics-shippers-elastic-v3-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-shippers-elastic-v3-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-shippers-elastic-v3-browser'] --- import kbnAnalyticsShippersElasticV3BrowserObj from './kbn_analytics_shippers_elastic_v3_browser.devdocs.json'; diff --git a/api_docs/kbn_analytics_shippers_elastic_v3_common.mdx b/api_docs/kbn_analytics_shippers_elastic_v3_common.mdx index af39931531e6..f06cb724cc72 100644 --- a/api_docs/kbn_analytics_shippers_elastic_v3_common.mdx +++ b/api_docs/kbn_analytics_shippers_elastic_v3_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-shippers-elastic-v3-common title: "@kbn/analytics-shippers-elastic-v3-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-shippers-elastic-v3-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-shippers-elastic-v3-common'] --- import kbnAnalyticsShippersElasticV3CommonObj from './kbn_analytics_shippers_elastic_v3_common.devdocs.json'; diff --git a/api_docs/kbn_analytics_shippers_elastic_v3_server.mdx b/api_docs/kbn_analytics_shippers_elastic_v3_server.mdx index 5515fe767880..cd5176593f6a 100644 --- a/api_docs/kbn_analytics_shippers_elastic_v3_server.mdx +++ b/api_docs/kbn_analytics_shippers_elastic_v3_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-shippers-elastic-v3-server title: "@kbn/analytics-shippers-elastic-v3-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-shippers-elastic-v3-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-shippers-elastic-v3-server'] --- import kbnAnalyticsShippersElasticV3ServerObj from './kbn_analytics_shippers_elastic_v3_server.devdocs.json'; diff --git a/api_docs/kbn_analytics_shippers_fullstory.mdx b/api_docs/kbn_analytics_shippers_fullstory.mdx index d85797746210..d6317c64bf48 100644 --- a/api_docs/kbn_analytics_shippers_fullstory.mdx +++ b/api_docs/kbn_analytics_shippers_fullstory.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-analytics-shippers-fullstory title: "@kbn/analytics-shippers-fullstory" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/analytics-shippers-fullstory plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/analytics-shippers-fullstory'] --- import kbnAnalyticsShippersFullstoryObj from './kbn_analytics_shippers_fullstory.devdocs.json'; diff --git a/api_docs/kbn_apm_config_loader.mdx b/api_docs/kbn_apm_config_loader.mdx index ec16bbb3798a..e916c19f1619 100644 --- a/api_docs/kbn_apm_config_loader.mdx +++ b/api_docs/kbn_apm_config_loader.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-apm-config-loader title: "@kbn/apm-config-loader" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/apm-config-loader plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-config-loader'] --- import kbnApmConfigLoaderObj from './kbn_apm_config_loader.devdocs.json'; diff --git a/api_docs/kbn_apm_synthtrace.mdx b/api_docs/kbn_apm_synthtrace.mdx index cd86d11a33dc..9ba0d5aeeacf 100644 --- a/api_docs/kbn_apm_synthtrace.mdx +++ b/api_docs/kbn_apm_synthtrace.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-apm-synthtrace title: "@kbn/apm-synthtrace" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/apm-synthtrace plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-synthtrace'] --- import kbnApmSynthtraceObj from './kbn_apm_synthtrace.devdocs.json'; diff --git a/api_docs/kbn_apm_utils.mdx b/api_docs/kbn_apm_utils.mdx index 24e76f781315..ca208a21625b 100644 --- a/api_docs/kbn_apm_utils.mdx +++ b/api_docs/kbn_apm_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-apm-utils title: "@kbn/apm-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/apm-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/apm-utils'] --- import kbnApmUtilsObj from './kbn_apm_utils.devdocs.json'; diff --git a/api_docs/kbn_axe_config.mdx b/api_docs/kbn_axe_config.mdx index a38a76d26da3..7a1ad1863e07 100644 --- a/api_docs/kbn_axe_config.mdx +++ b/api_docs/kbn_axe_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-axe-config title: "@kbn/axe-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/axe-config plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/axe-config'] --- import kbnAxeConfigObj from './kbn_axe_config.devdocs.json'; diff --git a/api_docs/kbn_chart_icons.mdx b/api_docs/kbn_chart_icons.mdx index 96f35a5ca85a..6e102733b051 100644 --- a/api_docs/kbn_chart_icons.mdx +++ b/api_docs/kbn_chart_icons.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-chart-icons title: "@kbn/chart-icons" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/chart-icons plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/chart-icons'] --- import kbnChartIconsObj from './kbn_chart_icons.devdocs.json'; diff --git a/api_docs/kbn_ci_stats_core.mdx b/api_docs/kbn_ci_stats_core.mdx index efc5f97cca9f..cfd53f8e091f 100644 --- a/api_docs/kbn_ci_stats_core.mdx +++ b/api_docs/kbn_ci_stats_core.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ci-stats-core title: "@kbn/ci-stats-core" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ci-stats-core plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ci-stats-core'] --- import kbnCiStatsCoreObj from './kbn_ci_stats_core.devdocs.json'; diff --git a/api_docs/kbn_ci_stats_performance_metrics.mdx b/api_docs/kbn_ci_stats_performance_metrics.mdx index 7030b63abaa1..c28b07464ba4 100644 --- a/api_docs/kbn_ci_stats_performance_metrics.mdx +++ b/api_docs/kbn_ci_stats_performance_metrics.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ci-stats-performance-metrics title: "@kbn/ci-stats-performance-metrics" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ci-stats-performance-metrics plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ci-stats-performance-metrics'] --- import kbnCiStatsPerformanceMetricsObj from './kbn_ci_stats_performance_metrics.devdocs.json'; diff --git a/api_docs/kbn_ci_stats_reporter.mdx b/api_docs/kbn_ci_stats_reporter.mdx index 464ef1f62934..d5c55b31b68c 100644 --- a/api_docs/kbn_ci_stats_reporter.mdx +++ b/api_docs/kbn_ci_stats_reporter.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ci-stats-reporter title: "@kbn/ci-stats-reporter" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ci-stats-reporter plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ci-stats-reporter'] --- import kbnCiStatsReporterObj from './kbn_ci_stats_reporter.devdocs.json'; diff --git a/api_docs/kbn_cli_dev_mode.mdx b/api_docs/kbn_cli_dev_mode.mdx index 7aac22dfeead..c2de5353062a 100644 --- a/api_docs/kbn_cli_dev_mode.mdx +++ b/api_docs/kbn_cli_dev_mode.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-cli-dev-mode title: "@kbn/cli-dev-mode" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/cli-dev-mode plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/cli-dev-mode'] --- import kbnCliDevModeObj from './kbn_cli_dev_mode.devdocs.json'; diff --git a/api_docs/kbn_coloring.mdx b/api_docs/kbn_coloring.mdx index edd9cb125e75..c5026a994bbf 100644 --- a/api_docs/kbn_coloring.mdx +++ b/api_docs/kbn_coloring.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-coloring title: "@kbn/coloring" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/coloring plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/coloring'] --- import kbnColoringObj from './kbn_coloring.devdocs.json'; diff --git a/api_docs/kbn_config.mdx b/api_docs/kbn_config.mdx index b82dc689dba2..a81d5f720c20 100644 --- a/api_docs/kbn_config.mdx +++ b/api_docs/kbn_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-config title: "@kbn/config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/config plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/config'] --- import kbnConfigObj from './kbn_config.devdocs.json'; diff --git a/api_docs/kbn_config_mocks.mdx b/api_docs/kbn_config_mocks.mdx index cebca9163e79..3ca7cf87f881 100644 --- a/api_docs/kbn_config_mocks.mdx +++ b/api_docs/kbn_config_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-config-mocks title: "@kbn/config-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/config-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/config-mocks'] --- import kbnConfigMocksObj from './kbn_config_mocks.devdocs.json'; diff --git a/api_docs/kbn_config_schema.mdx b/api_docs/kbn_config_schema.mdx index bd788d6e1868..f4fd135eead5 100644 --- a/api_docs/kbn_config_schema.mdx +++ b/api_docs/kbn_config_schema.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-config-schema title: "@kbn/config-schema" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/config-schema plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/config-schema'] --- import kbnConfigSchemaObj from './kbn_config_schema.devdocs.json'; diff --git a/api_docs/kbn_content_management_table_list.mdx b/api_docs/kbn_content_management_table_list.mdx index ac56135aa292..2cb822b64537 100644 --- a/api_docs/kbn_content_management_table_list.mdx +++ b/api_docs/kbn_content_management_table_list.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-content-management-table-list title: "@kbn/content-management-table-list" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/content-management-table-list plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/content-management-table-list'] --- import kbnContentManagementTableListObj from './kbn_content_management_table_list.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_browser.mdx b/api_docs/kbn_core_analytics_browser.mdx index eefeafb88d5d..2cf8df7f6fb1 100644 --- a/api_docs/kbn_core_analytics_browser.mdx +++ b/api_docs/kbn_core_analytics_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-browser title: "@kbn/core-analytics-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-browser'] --- import kbnCoreAnalyticsBrowserObj from './kbn_core_analytics_browser.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_browser_internal.mdx b/api_docs/kbn_core_analytics_browser_internal.mdx index 36b99e421559..217056d756e6 100644 --- a/api_docs/kbn_core_analytics_browser_internal.mdx +++ b/api_docs/kbn_core_analytics_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-browser-internal title: "@kbn/core-analytics-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-browser-internal'] --- import kbnCoreAnalyticsBrowserInternalObj from './kbn_core_analytics_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_browser_mocks.mdx b/api_docs/kbn_core_analytics_browser_mocks.mdx index abf361ac547b..8674be0b88a2 100644 --- a/api_docs/kbn_core_analytics_browser_mocks.mdx +++ b/api_docs/kbn_core_analytics_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-browser-mocks title: "@kbn/core-analytics-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-browser-mocks'] --- import kbnCoreAnalyticsBrowserMocksObj from './kbn_core_analytics_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_server.mdx b/api_docs/kbn_core_analytics_server.mdx index ec45043e4726..a3e9193110cf 100644 --- a/api_docs/kbn_core_analytics_server.mdx +++ b/api_docs/kbn_core_analytics_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-server title: "@kbn/core-analytics-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-server'] --- import kbnCoreAnalyticsServerObj from './kbn_core_analytics_server.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_server_internal.mdx b/api_docs/kbn_core_analytics_server_internal.mdx index 04e49781988c..87edbd5da157 100644 --- a/api_docs/kbn_core_analytics_server_internal.mdx +++ b/api_docs/kbn_core_analytics_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-server-internal title: "@kbn/core-analytics-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-server-internal'] --- import kbnCoreAnalyticsServerInternalObj from './kbn_core_analytics_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_analytics_server_mocks.mdx b/api_docs/kbn_core_analytics_server_mocks.mdx index 126ab218962c..eba99f774098 100644 --- a/api_docs/kbn_core_analytics_server_mocks.mdx +++ b/api_docs/kbn_core_analytics_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-analytics-server-mocks title: "@kbn/core-analytics-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-analytics-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-analytics-server-mocks'] --- import kbnCoreAnalyticsServerMocksObj from './kbn_core_analytics_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_application_browser.mdx b/api_docs/kbn_core_application_browser.mdx index 71e7fae504f5..6cd2f00a3f32 100644 --- a/api_docs/kbn_core_application_browser.mdx +++ b/api_docs/kbn_core_application_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-application-browser title: "@kbn/core-application-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-application-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-application-browser'] --- import kbnCoreApplicationBrowserObj from './kbn_core_application_browser.devdocs.json'; diff --git a/api_docs/kbn_core_application_browser_internal.mdx b/api_docs/kbn_core_application_browser_internal.mdx index 55beb31993bb..0e0674185951 100644 --- a/api_docs/kbn_core_application_browser_internal.mdx +++ b/api_docs/kbn_core_application_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-application-browser-internal title: "@kbn/core-application-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-application-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-application-browser-internal'] --- import kbnCoreApplicationBrowserInternalObj from './kbn_core_application_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_application_browser_mocks.mdx b/api_docs/kbn_core_application_browser_mocks.mdx index c777505da45d..f58bebcf2f5d 100644 --- a/api_docs/kbn_core_application_browser_mocks.mdx +++ b/api_docs/kbn_core_application_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-application-browser-mocks title: "@kbn/core-application-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-application-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-application-browser-mocks'] --- import kbnCoreApplicationBrowserMocksObj from './kbn_core_application_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_application_common.mdx b/api_docs/kbn_core_application_common.mdx index 10828fe0de71..3d4d7035f6c1 100644 --- a/api_docs/kbn_core_application_common.mdx +++ b/api_docs/kbn_core_application_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-application-common title: "@kbn/core-application-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-application-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-application-common'] --- import kbnCoreApplicationCommonObj from './kbn_core_application_common.devdocs.json'; diff --git a/api_docs/kbn_core_apps_browser_internal.mdx b/api_docs/kbn_core_apps_browser_internal.mdx index 978ac4faed76..7681b7a4a388 100644 --- a/api_docs/kbn_core_apps_browser_internal.mdx +++ b/api_docs/kbn_core_apps_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-apps-browser-internal title: "@kbn/core-apps-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-apps-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-apps-browser-internal'] --- import kbnCoreAppsBrowserInternalObj from './kbn_core_apps_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_apps_browser_mocks.mdx b/api_docs/kbn_core_apps_browser_mocks.mdx index 16fd9445d124..02a409c5881d 100644 --- a/api_docs/kbn_core_apps_browser_mocks.mdx +++ b/api_docs/kbn_core_apps_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-apps-browser-mocks title: "@kbn/core-apps-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-apps-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-apps-browser-mocks'] --- import kbnCoreAppsBrowserMocksObj from './kbn_core_apps_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_base_browser_mocks.mdx b/api_docs/kbn_core_base_browser_mocks.mdx index cdaf427d6802..b60d8471e15d 100644 --- a/api_docs/kbn_core_base_browser_mocks.mdx +++ b/api_docs/kbn_core_base_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-base-browser-mocks title: "@kbn/core-base-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-base-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-base-browser-mocks'] --- import kbnCoreBaseBrowserMocksObj from './kbn_core_base_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_base_common.mdx b/api_docs/kbn_core_base_common.mdx index 5bd2a717b5b8..39463461d916 100644 --- a/api_docs/kbn_core_base_common.mdx +++ b/api_docs/kbn_core_base_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-base-common title: "@kbn/core-base-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-base-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-base-common'] --- import kbnCoreBaseCommonObj from './kbn_core_base_common.devdocs.json'; diff --git a/api_docs/kbn_core_base_server_internal.mdx b/api_docs/kbn_core_base_server_internal.mdx index 76f931b4d756..2a64da20012e 100644 --- a/api_docs/kbn_core_base_server_internal.mdx +++ b/api_docs/kbn_core_base_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-base-server-internal title: "@kbn/core-base-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-base-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-base-server-internal'] --- import kbnCoreBaseServerInternalObj from './kbn_core_base_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_base_server_mocks.mdx b/api_docs/kbn_core_base_server_mocks.mdx index 77aa19a6800c..b2056befb2ac 100644 --- a/api_docs/kbn_core_base_server_mocks.mdx +++ b/api_docs/kbn_core_base_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-base-server-mocks title: "@kbn/core-base-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-base-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-base-server-mocks'] --- import kbnCoreBaseServerMocksObj from './kbn_core_base_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_capabilities_browser_mocks.mdx b/api_docs/kbn_core_capabilities_browser_mocks.mdx index e6bfe1ecd7db..6d28c5498417 100644 --- a/api_docs/kbn_core_capabilities_browser_mocks.mdx +++ b/api_docs/kbn_core_capabilities_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-capabilities-browser-mocks title: "@kbn/core-capabilities-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-capabilities-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-capabilities-browser-mocks'] --- import kbnCoreCapabilitiesBrowserMocksObj from './kbn_core_capabilities_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_capabilities_common.mdx b/api_docs/kbn_core_capabilities_common.mdx index e9475861b697..c7628a5a59c6 100644 --- a/api_docs/kbn_core_capabilities_common.mdx +++ b/api_docs/kbn_core_capabilities_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-capabilities-common title: "@kbn/core-capabilities-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-capabilities-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-capabilities-common'] --- import kbnCoreCapabilitiesCommonObj from './kbn_core_capabilities_common.devdocs.json'; diff --git a/api_docs/kbn_core_capabilities_server.mdx b/api_docs/kbn_core_capabilities_server.mdx index d6dc431b07fd..e01e96164ef4 100644 --- a/api_docs/kbn_core_capabilities_server.mdx +++ b/api_docs/kbn_core_capabilities_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-capabilities-server title: "@kbn/core-capabilities-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-capabilities-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-capabilities-server'] --- import kbnCoreCapabilitiesServerObj from './kbn_core_capabilities_server.devdocs.json'; diff --git a/api_docs/kbn_core_capabilities_server_mocks.mdx b/api_docs/kbn_core_capabilities_server_mocks.mdx index fdf7cc31d41f..9ef6e61852ed 100644 --- a/api_docs/kbn_core_capabilities_server_mocks.mdx +++ b/api_docs/kbn_core_capabilities_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-capabilities-server-mocks title: "@kbn/core-capabilities-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-capabilities-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-capabilities-server-mocks'] --- import kbnCoreCapabilitiesServerMocksObj from './kbn_core_capabilities_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_chrome_browser.mdx b/api_docs/kbn_core_chrome_browser.mdx index 73d538523658..57e8483cb0f7 100644 --- a/api_docs/kbn_core_chrome_browser.mdx +++ b/api_docs/kbn_core_chrome_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-chrome-browser title: "@kbn/core-chrome-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-chrome-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-chrome-browser'] --- import kbnCoreChromeBrowserObj from './kbn_core_chrome_browser.devdocs.json'; diff --git a/api_docs/kbn_core_chrome_browser_mocks.mdx b/api_docs/kbn_core_chrome_browser_mocks.mdx index a1f512749d43..c4fabecffea3 100644 --- a/api_docs/kbn_core_chrome_browser_mocks.mdx +++ b/api_docs/kbn_core_chrome_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-chrome-browser-mocks title: "@kbn/core-chrome-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-chrome-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-chrome-browser-mocks'] --- import kbnCoreChromeBrowserMocksObj from './kbn_core_chrome_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_config_server_internal.mdx b/api_docs/kbn_core_config_server_internal.mdx index 42574e3029ea..1d7858167c97 100644 --- a/api_docs/kbn_core_config_server_internal.mdx +++ b/api_docs/kbn_core_config_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-config-server-internal title: "@kbn/core-config-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-config-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-config-server-internal'] --- import kbnCoreConfigServerInternalObj from './kbn_core_config_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_browser.mdx b/api_docs/kbn_core_deprecations_browser.mdx index 6bb0bb64c5ba..3914aa766a64 100644 --- a/api_docs/kbn_core_deprecations_browser.mdx +++ b/api_docs/kbn_core_deprecations_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-browser title: "@kbn/core-deprecations-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-browser'] --- import kbnCoreDeprecationsBrowserObj from './kbn_core_deprecations_browser.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_browser_internal.mdx b/api_docs/kbn_core_deprecations_browser_internal.mdx index 938d8d6b38af..fca144e245a7 100644 --- a/api_docs/kbn_core_deprecations_browser_internal.mdx +++ b/api_docs/kbn_core_deprecations_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-browser-internal title: "@kbn/core-deprecations-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-browser-internal'] --- import kbnCoreDeprecationsBrowserInternalObj from './kbn_core_deprecations_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_browser_mocks.mdx b/api_docs/kbn_core_deprecations_browser_mocks.mdx index 9d33c64bd7f4..5be603ffa1f9 100644 --- a/api_docs/kbn_core_deprecations_browser_mocks.mdx +++ b/api_docs/kbn_core_deprecations_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-browser-mocks title: "@kbn/core-deprecations-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-browser-mocks'] --- import kbnCoreDeprecationsBrowserMocksObj from './kbn_core_deprecations_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_common.mdx b/api_docs/kbn_core_deprecations_common.mdx index 7f254dda6eee..afde35a745d3 100644 --- a/api_docs/kbn_core_deprecations_common.mdx +++ b/api_docs/kbn_core_deprecations_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-common title: "@kbn/core-deprecations-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-common'] --- import kbnCoreDeprecationsCommonObj from './kbn_core_deprecations_common.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_server.mdx b/api_docs/kbn_core_deprecations_server.mdx index 527a5f2be91e..92ba606e6044 100644 --- a/api_docs/kbn_core_deprecations_server.mdx +++ b/api_docs/kbn_core_deprecations_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-server title: "@kbn/core-deprecations-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-server'] --- import kbnCoreDeprecationsServerObj from './kbn_core_deprecations_server.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_server_internal.mdx b/api_docs/kbn_core_deprecations_server_internal.mdx index 7b470aeff355..9b3c1070f662 100644 --- a/api_docs/kbn_core_deprecations_server_internal.mdx +++ b/api_docs/kbn_core_deprecations_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-server-internal title: "@kbn/core-deprecations-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-server-internal'] --- import kbnCoreDeprecationsServerInternalObj from './kbn_core_deprecations_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_deprecations_server_mocks.mdx b/api_docs/kbn_core_deprecations_server_mocks.mdx index 34e0e5fb4d1f..e871d2dc0a94 100644 --- a/api_docs/kbn_core_deprecations_server_mocks.mdx +++ b/api_docs/kbn_core_deprecations_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-deprecations-server-mocks title: "@kbn/core-deprecations-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-deprecations-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-deprecations-server-mocks'] --- import kbnCoreDeprecationsServerMocksObj from './kbn_core_deprecations_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_doc_links_browser.mdx b/api_docs/kbn_core_doc_links_browser.mdx index 97c4d2e6d4b4..d591288b8131 100644 --- a/api_docs/kbn_core_doc_links_browser.mdx +++ b/api_docs/kbn_core_doc_links_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-doc-links-browser title: "@kbn/core-doc-links-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-doc-links-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-doc-links-browser'] --- import kbnCoreDocLinksBrowserObj from './kbn_core_doc_links_browser.devdocs.json'; diff --git a/api_docs/kbn_core_doc_links_browser_mocks.mdx b/api_docs/kbn_core_doc_links_browser_mocks.mdx index 0347b3f309a8..7cd809b6b97e 100644 --- a/api_docs/kbn_core_doc_links_browser_mocks.mdx +++ b/api_docs/kbn_core_doc_links_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-doc-links-browser-mocks title: "@kbn/core-doc-links-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-doc-links-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-doc-links-browser-mocks'] --- import kbnCoreDocLinksBrowserMocksObj from './kbn_core_doc_links_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_doc_links_server.mdx b/api_docs/kbn_core_doc_links_server.mdx index 5cccdf33b503..273051738c41 100644 --- a/api_docs/kbn_core_doc_links_server.mdx +++ b/api_docs/kbn_core_doc_links_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-doc-links-server title: "@kbn/core-doc-links-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-doc-links-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-doc-links-server'] --- import kbnCoreDocLinksServerObj from './kbn_core_doc_links_server.devdocs.json'; diff --git a/api_docs/kbn_core_doc_links_server_mocks.mdx b/api_docs/kbn_core_doc_links_server_mocks.mdx index e2c4d921a70b..0cddffa5aeab 100644 --- a/api_docs/kbn_core_doc_links_server_mocks.mdx +++ b/api_docs/kbn_core_doc_links_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-doc-links-server-mocks title: "@kbn/core-doc-links-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-doc-links-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-doc-links-server-mocks'] --- import kbnCoreDocLinksServerMocksObj from './kbn_core_doc_links_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_client_server_internal.mdx b/api_docs/kbn_core_elasticsearch_client_server_internal.mdx index 1d786ddcd349..88eb042d9820 100644 --- a/api_docs/kbn_core_elasticsearch_client_server_internal.mdx +++ b/api_docs/kbn_core_elasticsearch_client_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-client-server-internal title: "@kbn/core-elasticsearch-client-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-client-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-client-server-internal'] --- import kbnCoreElasticsearchClientServerInternalObj from './kbn_core_elasticsearch_client_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_client_server_mocks.mdx b/api_docs/kbn_core_elasticsearch_client_server_mocks.mdx index 25079df745e3..bbf4d1f0a58e 100644 --- a/api_docs/kbn_core_elasticsearch_client_server_mocks.mdx +++ b/api_docs/kbn_core_elasticsearch_client_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-client-server-mocks title: "@kbn/core-elasticsearch-client-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-client-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-client-server-mocks'] --- import kbnCoreElasticsearchClientServerMocksObj from './kbn_core_elasticsearch_client_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_server.mdx b/api_docs/kbn_core_elasticsearch_server.mdx index a5712d10acd3..c9f8fdbd9b45 100644 --- a/api_docs/kbn_core_elasticsearch_server.mdx +++ b/api_docs/kbn_core_elasticsearch_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-server title: "@kbn/core-elasticsearch-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-server'] --- import kbnCoreElasticsearchServerObj from './kbn_core_elasticsearch_server.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_server_internal.mdx b/api_docs/kbn_core_elasticsearch_server_internal.mdx index 2b2107d52082..f4032d04f97c 100644 --- a/api_docs/kbn_core_elasticsearch_server_internal.mdx +++ b/api_docs/kbn_core_elasticsearch_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-server-internal title: "@kbn/core-elasticsearch-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-server-internal'] --- import kbnCoreElasticsearchServerInternalObj from './kbn_core_elasticsearch_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_elasticsearch_server_mocks.mdx b/api_docs/kbn_core_elasticsearch_server_mocks.mdx index c9aa728e95fb..835c21903b6b 100644 --- a/api_docs/kbn_core_elasticsearch_server_mocks.mdx +++ b/api_docs/kbn_core_elasticsearch_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-elasticsearch-server-mocks title: "@kbn/core-elasticsearch-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-elasticsearch-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-elasticsearch-server-mocks'] --- import kbnCoreElasticsearchServerMocksObj from './kbn_core_elasticsearch_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_environment_server_internal.mdx b/api_docs/kbn_core_environment_server_internal.mdx index 630ee26b5024..47f64412fe99 100644 --- a/api_docs/kbn_core_environment_server_internal.mdx +++ b/api_docs/kbn_core_environment_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-environment-server-internal title: "@kbn/core-environment-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-environment-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-environment-server-internal'] --- import kbnCoreEnvironmentServerInternalObj from './kbn_core_environment_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_environment_server_mocks.mdx b/api_docs/kbn_core_environment_server_mocks.mdx index 62ed3d4b8afa..082f5dd46ece 100644 --- a/api_docs/kbn_core_environment_server_mocks.mdx +++ b/api_docs/kbn_core_environment_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-environment-server-mocks title: "@kbn/core-environment-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-environment-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-environment-server-mocks'] --- import kbnCoreEnvironmentServerMocksObj from './kbn_core_environment_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_browser.mdx b/api_docs/kbn_core_execution_context_browser.mdx index 1c33ab738b0e..492f874f833e 100644 --- a/api_docs/kbn_core_execution_context_browser.mdx +++ b/api_docs/kbn_core_execution_context_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-browser title: "@kbn/core-execution-context-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-browser'] --- import kbnCoreExecutionContextBrowserObj from './kbn_core_execution_context_browser.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_browser_internal.mdx b/api_docs/kbn_core_execution_context_browser_internal.mdx index 8d4402a7a2cd..f8426b783c45 100644 --- a/api_docs/kbn_core_execution_context_browser_internal.mdx +++ b/api_docs/kbn_core_execution_context_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-browser-internal title: "@kbn/core-execution-context-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-browser-internal'] --- import kbnCoreExecutionContextBrowserInternalObj from './kbn_core_execution_context_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_browser_mocks.mdx b/api_docs/kbn_core_execution_context_browser_mocks.mdx index 5e923792bc93..6efeffd1c91c 100644 --- a/api_docs/kbn_core_execution_context_browser_mocks.mdx +++ b/api_docs/kbn_core_execution_context_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-browser-mocks title: "@kbn/core-execution-context-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-browser-mocks'] --- import kbnCoreExecutionContextBrowserMocksObj from './kbn_core_execution_context_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_common.mdx b/api_docs/kbn_core_execution_context_common.mdx index f2336d9fdfb0..ed8e5ae438b3 100644 --- a/api_docs/kbn_core_execution_context_common.mdx +++ b/api_docs/kbn_core_execution_context_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-common title: "@kbn/core-execution-context-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-common'] --- import kbnCoreExecutionContextCommonObj from './kbn_core_execution_context_common.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_server.mdx b/api_docs/kbn_core_execution_context_server.mdx index 61e72d43c392..6441c8e32639 100644 --- a/api_docs/kbn_core_execution_context_server.mdx +++ b/api_docs/kbn_core_execution_context_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-server title: "@kbn/core-execution-context-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-server'] --- import kbnCoreExecutionContextServerObj from './kbn_core_execution_context_server.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_server_internal.mdx b/api_docs/kbn_core_execution_context_server_internal.mdx index 1c31d922fc68..4f0d3211fa39 100644 --- a/api_docs/kbn_core_execution_context_server_internal.mdx +++ b/api_docs/kbn_core_execution_context_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-server-internal title: "@kbn/core-execution-context-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-server-internal'] --- import kbnCoreExecutionContextServerInternalObj from './kbn_core_execution_context_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_execution_context_server_mocks.mdx b/api_docs/kbn_core_execution_context_server_mocks.mdx index 00772d47658c..02fa99d7cb6c 100644 --- a/api_docs/kbn_core_execution_context_server_mocks.mdx +++ b/api_docs/kbn_core_execution_context_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-execution-context-server-mocks title: "@kbn/core-execution-context-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-execution-context-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-execution-context-server-mocks'] --- import kbnCoreExecutionContextServerMocksObj from './kbn_core_execution_context_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_fatal_errors_browser.mdx b/api_docs/kbn_core_fatal_errors_browser.mdx index 7a8edbe3e3b3..40263469ee78 100644 --- a/api_docs/kbn_core_fatal_errors_browser.mdx +++ b/api_docs/kbn_core_fatal_errors_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-fatal-errors-browser title: "@kbn/core-fatal-errors-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-fatal-errors-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-fatal-errors-browser'] --- import kbnCoreFatalErrorsBrowserObj from './kbn_core_fatal_errors_browser.devdocs.json'; diff --git a/api_docs/kbn_core_fatal_errors_browser_mocks.mdx b/api_docs/kbn_core_fatal_errors_browser_mocks.mdx index 6dd6b8aebce6..a6af55aa79cb 100644 --- a/api_docs/kbn_core_fatal_errors_browser_mocks.mdx +++ b/api_docs/kbn_core_fatal_errors_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-fatal-errors-browser-mocks title: "@kbn/core-fatal-errors-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-fatal-errors-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-fatal-errors-browser-mocks'] --- import kbnCoreFatalErrorsBrowserMocksObj from './kbn_core_fatal_errors_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_browser.mdx b/api_docs/kbn_core_http_browser.mdx index 8014dbb2ceb6..a1c258a426f3 100644 --- a/api_docs/kbn_core_http_browser.mdx +++ b/api_docs/kbn_core_http_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-browser title: "@kbn/core-http-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-browser'] --- import kbnCoreHttpBrowserObj from './kbn_core_http_browser.devdocs.json'; diff --git a/api_docs/kbn_core_http_browser_internal.mdx b/api_docs/kbn_core_http_browser_internal.mdx index ed565e7b8f3b..a937dccab7fb 100644 --- a/api_docs/kbn_core_http_browser_internal.mdx +++ b/api_docs/kbn_core_http_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-browser-internal title: "@kbn/core-http-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-browser-internal'] --- import kbnCoreHttpBrowserInternalObj from './kbn_core_http_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_http_browser_mocks.mdx b/api_docs/kbn_core_http_browser_mocks.mdx index 632f5546a721..a6274dd34b37 100644 --- a/api_docs/kbn_core_http_browser_mocks.mdx +++ b/api_docs/kbn_core_http_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-browser-mocks title: "@kbn/core-http-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-browser-mocks'] --- import kbnCoreHttpBrowserMocksObj from './kbn_core_http_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_common.mdx b/api_docs/kbn_core_http_common.mdx index 92184cbab278..6293ae9b58af 100644 --- a/api_docs/kbn_core_http_common.mdx +++ b/api_docs/kbn_core_http_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-common title: "@kbn/core-http-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-common'] --- import kbnCoreHttpCommonObj from './kbn_core_http_common.devdocs.json'; diff --git a/api_docs/kbn_core_http_context_server_mocks.mdx b/api_docs/kbn_core_http_context_server_mocks.mdx index 52f62aad5c93..f11227d039fc 100644 --- a/api_docs/kbn_core_http_context_server_mocks.mdx +++ b/api_docs/kbn_core_http_context_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-context-server-mocks title: "@kbn/core-http-context-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-context-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-context-server-mocks'] --- import kbnCoreHttpContextServerMocksObj from './kbn_core_http_context_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_request_handler_context_server.mdx b/api_docs/kbn_core_http_request_handler_context_server.mdx index 0e41263673dd..d0ea0e82f768 100644 --- a/api_docs/kbn_core_http_request_handler_context_server.mdx +++ b/api_docs/kbn_core_http_request_handler_context_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-request-handler-context-server title: "@kbn/core-http-request-handler-context-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-request-handler-context-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-request-handler-context-server'] --- import kbnCoreHttpRequestHandlerContextServerObj from './kbn_core_http_request_handler_context_server.devdocs.json'; diff --git a/api_docs/kbn_core_http_router_server_internal.mdx b/api_docs/kbn_core_http_router_server_internal.mdx index 0fdb1bfe4318..7654b3f70cc8 100644 --- a/api_docs/kbn_core_http_router_server_internal.mdx +++ b/api_docs/kbn_core_http_router_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-router-server-internal title: "@kbn/core-http-router-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-router-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-router-server-internal'] --- import kbnCoreHttpRouterServerInternalObj from './kbn_core_http_router_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_http_router_server_mocks.mdx b/api_docs/kbn_core_http_router_server_mocks.mdx index b758dea2dd26..8a2d3a3de333 100644 --- a/api_docs/kbn_core_http_router_server_mocks.mdx +++ b/api_docs/kbn_core_http_router_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-router-server-mocks title: "@kbn/core-http-router-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-router-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-router-server-mocks'] --- import kbnCoreHttpRouterServerMocksObj from './kbn_core_http_router_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_http_server.mdx b/api_docs/kbn_core_http_server.mdx index bb3c7c1bd350..62b834449c23 100644 --- a/api_docs/kbn_core_http_server.mdx +++ b/api_docs/kbn_core_http_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-server title: "@kbn/core-http-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-server'] --- import kbnCoreHttpServerObj from './kbn_core_http_server.devdocs.json'; diff --git a/api_docs/kbn_core_http_server_internal.mdx b/api_docs/kbn_core_http_server_internal.mdx index 220d5282e1fc..bbda88d5c238 100644 --- a/api_docs/kbn_core_http_server_internal.mdx +++ b/api_docs/kbn_core_http_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-server-internal title: "@kbn/core-http-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-server-internal'] --- import kbnCoreHttpServerInternalObj from './kbn_core_http_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_http_server_mocks.mdx b/api_docs/kbn_core_http_server_mocks.mdx index ed120c45d977..e99fba0127cc 100644 --- a/api_docs/kbn_core_http_server_mocks.mdx +++ b/api_docs/kbn_core_http_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-http-server-mocks title: "@kbn/core-http-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-http-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-server-mocks'] --- import kbnCoreHttpServerMocksObj from './kbn_core_http_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_browser.mdx b/api_docs/kbn_core_i18n_browser.mdx index 9cb11bc93a1f..c6da1dc82bc9 100644 --- a/api_docs/kbn_core_i18n_browser.mdx +++ b/api_docs/kbn_core_i18n_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-browser title: "@kbn/core-i18n-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-browser'] --- import kbnCoreI18nBrowserObj from './kbn_core_i18n_browser.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_browser_mocks.mdx b/api_docs/kbn_core_i18n_browser_mocks.mdx index 1bb71320adbc..140e34612800 100644 --- a/api_docs/kbn_core_i18n_browser_mocks.mdx +++ b/api_docs/kbn_core_i18n_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-browser-mocks title: "@kbn/core-i18n-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-browser-mocks'] --- import kbnCoreI18nBrowserMocksObj from './kbn_core_i18n_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_server.mdx b/api_docs/kbn_core_i18n_server.mdx index edbbec7b5aac..ddd02e61d7ee 100644 --- a/api_docs/kbn_core_i18n_server.mdx +++ b/api_docs/kbn_core_i18n_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-server title: "@kbn/core-i18n-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-server'] --- import kbnCoreI18nServerObj from './kbn_core_i18n_server.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_server_internal.mdx b/api_docs/kbn_core_i18n_server_internal.mdx index 408a8656056a..56636905f7af 100644 --- a/api_docs/kbn_core_i18n_server_internal.mdx +++ b/api_docs/kbn_core_i18n_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-server-internal title: "@kbn/core-i18n-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-server-internal'] --- import kbnCoreI18nServerInternalObj from './kbn_core_i18n_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_i18n_server_mocks.mdx b/api_docs/kbn_core_i18n_server_mocks.mdx index 549c463617a5..f8ed8c6f0bec 100644 --- a/api_docs/kbn_core_i18n_server_mocks.mdx +++ b/api_docs/kbn_core_i18n_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-i18n-server-mocks title: "@kbn/core-i18n-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-i18n-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-i18n-server-mocks'] --- import kbnCoreI18nServerMocksObj from './kbn_core_i18n_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_injected_metadata_browser.mdx b/api_docs/kbn_core_injected_metadata_browser.mdx index 11a4ba2c541e..9a02125114dc 100644 --- a/api_docs/kbn_core_injected_metadata_browser.mdx +++ b/api_docs/kbn_core_injected_metadata_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-injected-metadata-browser title: "@kbn/core-injected-metadata-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-injected-metadata-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-injected-metadata-browser'] --- import kbnCoreInjectedMetadataBrowserObj from './kbn_core_injected_metadata_browser.devdocs.json'; diff --git a/api_docs/kbn_core_injected_metadata_browser_mocks.mdx b/api_docs/kbn_core_injected_metadata_browser_mocks.mdx index 579e9087903c..d6a078aef0df 100644 --- a/api_docs/kbn_core_injected_metadata_browser_mocks.mdx +++ b/api_docs/kbn_core_injected_metadata_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-injected-metadata-browser-mocks title: "@kbn/core-injected-metadata-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-injected-metadata-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-injected-metadata-browser-mocks'] --- import kbnCoreInjectedMetadataBrowserMocksObj from './kbn_core_injected_metadata_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_integrations_browser_internal.mdx b/api_docs/kbn_core_integrations_browser_internal.mdx index c88718d0e930..38c283eaaf97 100644 --- a/api_docs/kbn_core_integrations_browser_internal.mdx +++ b/api_docs/kbn_core_integrations_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-integrations-browser-internal title: "@kbn/core-integrations-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-integrations-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-integrations-browser-internal'] --- import kbnCoreIntegrationsBrowserInternalObj from './kbn_core_integrations_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_integrations_browser_mocks.mdx b/api_docs/kbn_core_integrations_browser_mocks.mdx index 6be7ee221009..5cc58ad5a914 100644 --- a/api_docs/kbn_core_integrations_browser_mocks.mdx +++ b/api_docs/kbn_core_integrations_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-integrations-browser-mocks title: "@kbn/core-integrations-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-integrations-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-integrations-browser-mocks'] --- import kbnCoreIntegrationsBrowserMocksObj from './kbn_core_integrations_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_lifecycle_browser.mdx b/api_docs/kbn_core_lifecycle_browser.mdx index 863f69b31518..1ab8822af225 100644 --- a/api_docs/kbn_core_lifecycle_browser.mdx +++ b/api_docs/kbn_core_lifecycle_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-lifecycle-browser title: "@kbn/core-lifecycle-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-lifecycle-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-lifecycle-browser'] --- import kbnCoreLifecycleBrowserObj from './kbn_core_lifecycle_browser.devdocs.json'; diff --git a/api_docs/kbn_core_lifecycle_browser_mocks.mdx b/api_docs/kbn_core_lifecycle_browser_mocks.mdx index add898c16abe..99d9d3f32d3e 100644 --- a/api_docs/kbn_core_lifecycle_browser_mocks.mdx +++ b/api_docs/kbn_core_lifecycle_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-lifecycle-browser-mocks title: "@kbn/core-lifecycle-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-lifecycle-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-lifecycle-browser-mocks'] --- import kbnCoreLifecycleBrowserMocksObj from './kbn_core_lifecycle_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_logging_server.mdx b/api_docs/kbn_core_logging_server.mdx index a488e40d01dd..5065fff3211f 100644 --- a/api_docs/kbn_core_logging_server.mdx +++ b/api_docs/kbn_core_logging_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-logging-server title: "@kbn/core-logging-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-logging-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-logging-server'] --- import kbnCoreLoggingServerObj from './kbn_core_logging_server.devdocs.json'; diff --git a/api_docs/kbn_core_logging_server_internal.mdx b/api_docs/kbn_core_logging_server_internal.mdx index 87082d1e3319..2e6959cc8759 100644 --- a/api_docs/kbn_core_logging_server_internal.mdx +++ b/api_docs/kbn_core_logging_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-logging-server-internal title: "@kbn/core-logging-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-logging-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-logging-server-internal'] --- import kbnCoreLoggingServerInternalObj from './kbn_core_logging_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_logging_server_mocks.mdx b/api_docs/kbn_core_logging_server_mocks.mdx index 7a746c627805..81a53652b4ea 100644 --- a/api_docs/kbn_core_logging_server_mocks.mdx +++ b/api_docs/kbn_core_logging_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-logging-server-mocks title: "@kbn/core-logging-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-logging-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-logging-server-mocks'] --- import kbnCoreLoggingServerMocksObj from './kbn_core_logging_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_collectors_server_internal.mdx b/api_docs/kbn_core_metrics_collectors_server_internal.mdx index a413d283cb4c..3d5b6fffdd51 100644 --- a/api_docs/kbn_core_metrics_collectors_server_internal.mdx +++ b/api_docs/kbn_core_metrics_collectors_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-collectors-server-internal title: "@kbn/core-metrics-collectors-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-collectors-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-collectors-server-internal'] --- import kbnCoreMetricsCollectorsServerInternalObj from './kbn_core_metrics_collectors_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_collectors_server_mocks.mdx b/api_docs/kbn_core_metrics_collectors_server_mocks.mdx index 3ad9c040ab8f..14756f136bd3 100644 --- a/api_docs/kbn_core_metrics_collectors_server_mocks.mdx +++ b/api_docs/kbn_core_metrics_collectors_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-collectors-server-mocks title: "@kbn/core-metrics-collectors-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-collectors-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-collectors-server-mocks'] --- import kbnCoreMetricsCollectorsServerMocksObj from './kbn_core_metrics_collectors_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_server.mdx b/api_docs/kbn_core_metrics_server.mdx index 4e9e0445e3f7..087dd2dd357c 100644 --- a/api_docs/kbn_core_metrics_server.mdx +++ b/api_docs/kbn_core_metrics_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-server title: "@kbn/core-metrics-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-server'] --- import kbnCoreMetricsServerObj from './kbn_core_metrics_server.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_server_internal.mdx b/api_docs/kbn_core_metrics_server_internal.mdx index 0cfd64309de9..5f5ea85f8005 100644 --- a/api_docs/kbn_core_metrics_server_internal.mdx +++ b/api_docs/kbn_core_metrics_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-server-internal title: "@kbn/core-metrics-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-server-internal'] --- import kbnCoreMetricsServerInternalObj from './kbn_core_metrics_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_metrics_server_mocks.mdx b/api_docs/kbn_core_metrics_server_mocks.mdx index 40f97497e1cf..6216a6d589ce 100644 --- a/api_docs/kbn_core_metrics_server_mocks.mdx +++ b/api_docs/kbn_core_metrics_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-metrics-server-mocks title: "@kbn/core-metrics-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-metrics-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-metrics-server-mocks'] --- import kbnCoreMetricsServerMocksObj from './kbn_core_metrics_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_mount_utils_browser.mdx b/api_docs/kbn_core_mount_utils_browser.mdx index 3e4d25261b36..82c2c06e0845 100644 --- a/api_docs/kbn_core_mount_utils_browser.mdx +++ b/api_docs/kbn_core_mount_utils_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-mount-utils-browser title: "@kbn/core-mount-utils-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-mount-utils-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-mount-utils-browser'] --- import kbnCoreMountUtilsBrowserObj from './kbn_core_mount_utils_browser.devdocs.json'; diff --git a/api_docs/kbn_core_node_server.mdx b/api_docs/kbn_core_node_server.mdx index 9ec6da0be76f..b4eeaf823c52 100644 --- a/api_docs/kbn_core_node_server.mdx +++ b/api_docs/kbn_core_node_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-node-server title: "@kbn/core-node-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-node-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-node-server'] --- import kbnCoreNodeServerObj from './kbn_core_node_server.devdocs.json'; diff --git a/api_docs/kbn_core_node_server_internal.mdx b/api_docs/kbn_core_node_server_internal.mdx index e1be058f6694..04c3664f49b6 100644 --- a/api_docs/kbn_core_node_server_internal.mdx +++ b/api_docs/kbn_core_node_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-node-server-internal title: "@kbn/core-node-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-node-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-node-server-internal'] --- import kbnCoreNodeServerInternalObj from './kbn_core_node_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_node_server_mocks.mdx b/api_docs/kbn_core_node_server_mocks.mdx index 2f8dd3d2d3cf..edcf4af2b62a 100644 --- a/api_docs/kbn_core_node_server_mocks.mdx +++ b/api_docs/kbn_core_node_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-node-server-mocks title: "@kbn/core-node-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-node-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-node-server-mocks'] --- import kbnCoreNodeServerMocksObj from './kbn_core_node_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_notifications_browser.mdx b/api_docs/kbn_core_notifications_browser.mdx index 99c39b3ae3bf..d120b6ccece7 100644 --- a/api_docs/kbn_core_notifications_browser.mdx +++ b/api_docs/kbn_core_notifications_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-notifications-browser title: "@kbn/core-notifications-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-notifications-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-notifications-browser'] --- import kbnCoreNotificationsBrowserObj from './kbn_core_notifications_browser.devdocs.json'; diff --git a/api_docs/kbn_core_notifications_browser_internal.mdx b/api_docs/kbn_core_notifications_browser_internal.mdx index b1abfcae9d1d..e4152c45f1f6 100644 --- a/api_docs/kbn_core_notifications_browser_internal.mdx +++ b/api_docs/kbn_core_notifications_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-notifications-browser-internal title: "@kbn/core-notifications-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-notifications-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-notifications-browser-internal'] --- import kbnCoreNotificationsBrowserInternalObj from './kbn_core_notifications_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_notifications_browser_mocks.mdx b/api_docs/kbn_core_notifications_browser_mocks.mdx index 6af7ea7a401a..a571fb85c2ef 100644 --- a/api_docs/kbn_core_notifications_browser_mocks.mdx +++ b/api_docs/kbn_core_notifications_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-notifications-browser-mocks title: "@kbn/core-notifications-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-notifications-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-notifications-browser-mocks'] --- import kbnCoreNotificationsBrowserMocksObj from './kbn_core_notifications_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_overlays_browser.mdx b/api_docs/kbn_core_overlays_browser.mdx index 4e53620f210c..8f4457512da8 100644 --- a/api_docs/kbn_core_overlays_browser.mdx +++ b/api_docs/kbn_core_overlays_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-overlays-browser title: "@kbn/core-overlays-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-overlays-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-overlays-browser'] --- import kbnCoreOverlaysBrowserObj from './kbn_core_overlays_browser.devdocs.json'; diff --git a/api_docs/kbn_core_overlays_browser_internal.mdx b/api_docs/kbn_core_overlays_browser_internal.mdx index 3cdf63fa196b..6e25c69de32e 100644 --- a/api_docs/kbn_core_overlays_browser_internal.mdx +++ b/api_docs/kbn_core_overlays_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-overlays-browser-internal title: "@kbn/core-overlays-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-overlays-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-overlays-browser-internal'] --- import kbnCoreOverlaysBrowserInternalObj from './kbn_core_overlays_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_overlays_browser_mocks.mdx b/api_docs/kbn_core_overlays_browser_mocks.mdx index ed9822ce6524..ce41f3aac1f4 100644 --- a/api_docs/kbn_core_overlays_browser_mocks.mdx +++ b/api_docs/kbn_core_overlays_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-overlays-browser-mocks title: "@kbn/core-overlays-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-overlays-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-overlays-browser-mocks'] --- import kbnCoreOverlaysBrowserMocksObj from './kbn_core_overlays_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_plugins_browser.mdx b/api_docs/kbn_core_plugins_browser.mdx index 0e35863807e9..0b413f962b27 100644 --- a/api_docs/kbn_core_plugins_browser.mdx +++ b/api_docs/kbn_core_plugins_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-plugins-browser title: "@kbn/core-plugins-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-plugins-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-plugins-browser'] --- import kbnCorePluginsBrowserObj from './kbn_core_plugins_browser.devdocs.json'; diff --git a/api_docs/kbn_core_plugins_browser_mocks.mdx b/api_docs/kbn_core_plugins_browser_mocks.mdx index e8513df53c90..b31af30c1603 100644 --- a/api_docs/kbn_core_plugins_browser_mocks.mdx +++ b/api_docs/kbn_core_plugins_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-plugins-browser-mocks title: "@kbn/core-plugins-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-plugins-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-plugins-browser-mocks'] --- import kbnCorePluginsBrowserMocksObj from './kbn_core_plugins_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_preboot_server.mdx b/api_docs/kbn_core_preboot_server.mdx index a33965c6f024..ec6b64842af4 100644 --- a/api_docs/kbn_core_preboot_server.mdx +++ b/api_docs/kbn_core_preboot_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-preboot-server title: "@kbn/core-preboot-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-preboot-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-preboot-server'] --- import kbnCorePrebootServerObj from './kbn_core_preboot_server.devdocs.json'; diff --git a/api_docs/kbn_core_preboot_server_mocks.mdx b/api_docs/kbn_core_preboot_server_mocks.mdx index 499f42fd91b2..583b5bc973ad 100644 --- a/api_docs/kbn_core_preboot_server_mocks.mdx +++ b/api_docs/kbn_core_preboot_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-preboot-server-mocks title: "@kbn/core-preboot-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-preboot-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-preboot-server-mocks'] --- import kbnCorePrebootServerMocksObj from './kbn_core_preboot_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_rendering_browser_mocks.mdx b/api_docs/kbn_core_rendering_browser_mocks.mdx index cedfc5029275..383e9c6511ef 100644 --- a/api_docs/kbn_core_rendering_browser_mocks.mdx +++ b/api_docs/kbn_core_rendering_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-rendering-browser-mocks title: "@kbn/core-rendering-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-rendering-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-rendering-browser-mocks'] --- import kbnCoreRenderingBrowserMocksObj from './kbn_core_rendering_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_api_browser.mdx b/api_docs/kbn_core_saved_objects_api_browser.mdx index de5b9aa205ca..e07f5797c7f7 100644 --- a/api_docs/kbn_core_saved_objects_api_browser.mdx +++ b/api_docs/kbn_core_saved_objects_api_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-api-browser title: "@kbn/core-saved-objects-api-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-api-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-api-browser'] --- import kbnCoreSavedObjectsApiBrowserObj from './kbn_core_saved_objects_api_browser.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_api_server.mdx b/api_docs/kbn_core_saved_objects_api_server.mdx index 7628f073dc94..8a3662b8b470 100644 --- a/api_docs/kbn_core_saved_objects_api_server.mdx +++ b/api_docs/kbn_core_saved_objects_api_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-api-server title: "@kbn/core-saved-objects-api-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-api-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-api-server'] --- import kbnCoreSavedObjectsApiServerObj from './kbn_core_saved_objects_api_server.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_api_server_internal.mdx b/api_docs/kbn_core_saved_objects_api_server_internal.mdx index a91351cf9f73..7244cfe8beb6 100644 --- a/api_docs/kbn_core_saved_objects_api_server_internal.mdx +++ b/api_docs/kbn_core_saved_objects_api_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-api-server-internal title: "@kbn/core-saved-objects-api-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-api-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-api-server-internal'] --- import kbnCoreSavedObjectsApiServerInternalObj from './kbn_core_saved_objects_api_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_api_server_mocks.mdx b/api_docs/kbn_core_saved_objects_api_server_mocks.mdx index fa562b3b2acf..9a62ec00bb37 100644 --- a/api_docs/kbn_core_saved_objects_api_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_api_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-api-server-mocks title: "@kbn/core-saved-objects-api-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-api-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-api-server-mocks'] --- import kbnCoreSavedObjectsApiServerMocksObj from './kbn_core_saved_objects_api_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_base_server_internal.mdx b/api_docs/kbn_core_saved_objects_base_server_internal.mdx index acc5f724b1bc..4068fcf5e73b 100644 --- a/api_docs/kbn_core_saved_objects_base_server_internal.mdx +++ b/api_docs/kbn_core_saved_objects_base_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-base-server-internal title: "@kbn/core-saved-objects-base-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-base-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-base-server-internal'] --- import kbnCoreSavedObjectsBaseServerInternalObj from './kbn_core_saved_objects_base_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_base_server_mocks.mdx b/api_docs/kbn_core_saved_objects_base_server_mocks.mdx index 114ad87c44b3..7af80f752794 100644 --- a/api_docs/kbn_core_saved_objects_base_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_base_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-base-server-mocks title: "@kbn/core-saved-objects-base-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-base-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-base-server-mocks'] --- import kbnCoreSavedObjectsBaseServerMocksObj from './kbn_core_saved_objects_base_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_browser.mdx b/api_docs/kbn_core_saved_objects_browser.mdx index 6731e2111977..83b6f0888728 100644 --- a/api_docs/kbn_core_saved_objects_browser.mdx +++ b/api_docs/kbn_core_saved_objects_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-browser title: "@kbn/core-saved-objects-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-browser'] --- import kbnCoreSavedObjectsBrowserObj from './kbn_core_saved_objects_browser.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_browser_internal.mdx b/api_docs/kbn_core_saved_objects_browser_internal.mdx index 276569792284..3d8e3d03be29 100644 --- a/api_docs/kbn_core_saved_objects_browser_internal.mdx +++ b/api_docs/kbn_core_saved_objects_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-browser-internal title: "@kbn/core-saved-objects-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-browser-internal'] --- import kbnCoreSavedObjectsBrowserInternalObj from './kbn_core_saved_objects_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_browser_mocks.mdx b/api_docs/kbn_core_saved_objects_browser_mocks.mdx index 9f0c9ea82ba6..ad03d6488f2a 100644 --- a/api_docs/kbn_core_saved_objects_browser_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-browser-mocks title: "@kbn/core-saved-objects-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-browser-mocks'] --- import kbnCoreSavedObjectsBrowserMocksObj from './kbn_core_saved_objects_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_common.mdx b/api_docs/kbn_core_saved_objects_common.mdx index bc3ea822a942..b06d26ed9bea 100644 --- a/api_docs/kbn_core_saved_objects_common.mdx +++ b/api_docs/kbn_core_saved_objects_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-common title: "@kbn/core-saved-objects-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-common'] --- import kbnCoreSavedObjectsCommonObj from './kbn_core_saved_objects_common.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_import_export_server_internal.mdx b/api_docs/kbn_core_saved_objects_import_export_server_internal.mdx index b5f3e61df18b..6532dfcaeaf8 100644 --- a/api_docs/kbn_core_saved_objects_import_export_server_internal.mdx +++ b/api_docs/kbn_core_saved_objects_import_export_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-import-export-server-internal title: "@kbn/core-saved-objects-import-export-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-import-export-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-import-export-server-internal'] --- import kbnCoreSavedObjectsImportExportServerInternalObj from './kbn_core_saved_objects_import_export_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_import_export_server_mocks.mdx b/api_docs/kbn_core_saved_objects_import_export_server_mocks.mdx index 99e95bfdab28..53092b90fc15 100644 --- a/api_docs/kbn_core_saved_objects_import_export_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_import_export_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-import-export-server-mocks title: "@kbn/core-saved-objects-import-export-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-import-export-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-import-export-server-mocks'] --- import kbnCoreSavedObjectsImportExportServerMocksObj from './kbn_core_saved_objects_import_export_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_migration_server_internal.mdx b/api_docs/kbn_core_saved_objects_migration_server_internal.mdx index 5edf8cbfddef..3d1544f4f110 100644 --- a/api_docs/kbn_core_saved_objects_migration_server_internal.mdx +++ b/api_docs/kbn_core_saved_objects_migration_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-migration-server-internal title: "@kbn/core-saved-objects-migration-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-migration-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-migration-server-internal'] --- import kbnCoreSavedObjectsMigrationServerInternalObj from './kbn_core_saved_objects_migration_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_migration_server_mocks.mdx b/api_docs/kbn_core_saved_objects_migration_server_mocks.mdx index 5ed2a4976d1c..c662be1f8fb0 100644 --- a/api_docs/kbn_core_saved_objects_migration_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_migration_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-migration-server-mocks title: "@kbn/core-saved-objects-migration-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-migration-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-migration-server-mocks'] --- import kbnCoreSavedObjectsMigrationServerMocksObj from './kbn_core_saved_objects_migration_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_server.mdx b/api_docs/kbn_core_saved_objects_server.mdx index 8f12d48e0f7a..8a27161ad18d 100644 --- a/api_docs/kbn_core_saved_objects_server.mdx +++ b/api_docs/kbn_core_saved_objects_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-server title: "@kbn/core-saved-objects-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-server'] --- import kbnCoreSavedObjectsServerObj from './kbn_core_saved_objects_server.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_server_internal.mdx b/api_docs/kbn_core_saved_objects_server_internal.mdx index 6de1b336be40..c73c73d97418 100644 --- a/api_docs/kbn_core_saved_objects_server_internal.mdx +++ b/api_docs/kbn_core_saved_objects_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-server-internal title: "@kbn/core-saved-objects-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-server-internal'] --- import kbnCoreSavedObjectsServerInternalObj from './kbn_core_saved_objects_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_server_mocks.mdx b/api_docs/kbn_core_saved_objects_server_mocks.mdx index 4fb52fecf871..e8fe3856fa57 100644 --- a/api_docs/kbn_core_saved_objects_server_mocks.mdx +++ b/api_docs/kbn_core_saved_objects_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-server-mocks title: "@kbn/core-saved-objects-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-server-mocks'] --- import kbnCoreSavedObjectsServerMocksObj from './kbn_core_saved_objects_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_saved_objects_utils_server.mdx b/api_docs/kbn_core_saved_objects_utils_server.mdx index 71fdb228446e..5eb6ed5fabf2 100644 --- a/api_docs/kbn_core_saved_objects_utils_server.mdx +++ b/api_docs/kbn_core_saved_objects_utils_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-saved-objects-utils-server title: "@kbn/core-saved-objects-utils-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-saved-objects-utils-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-saved-objects-utils-server'] --- import kbnCoreSavedObjectsUtilsServerObj from './kbn_core_saved_objects_utils_server.devdocs.json'; diff --git a/api_docs/kbn_core_status_common.mdx b/api_docs/kbn_core_status_common.mdx index 49314722d46a..3f9ec5be08ad 100644 --- a/api_docs/kbn_core_status_common.mdx +++ b/api_docs/kbn_core_status_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-status-common title: "@kbn/core-status-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-status-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-status-common'] --- import kbnCoreStatusCommonObj from './kbn_core_status_common.devdocs.json'; diff --git a/api_docs/kbn_core_status_common_internal.mdx b/api_docs/kbn_core_status_common_internal.mdx index 266265f2ee05..fd7956ee7ab4 100644 --- a/api_docs/kbn_core_status_common_internal.mdx +++ b/api_docs/kbn_core_status_common_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-status-common-internal title: "@kbn/core-status-common-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-status-common-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-status-common-internal'] --- import kbnCoreStatusCommonInternalObj from './kbn_core_status_common_internal.devdocs.json'; diff --git a/api_docs/kbn_core_status_server.mdx b/api_docs/kbn_core_status_server.mdx index 8d222376f5bf..71ceb6a7bede 100644 --- a/api_docs/kbn_core_status_server.mdx +++ b/api_docs/kbn_core_status_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-status-server title: "@kbn/core-status-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-status-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-status-server'] --- import kbnCoreStatusServerObj from './kbn_core_status_server.devdocs.json'; diff --git a/api_docs/kbn_core_status_server_internal.mdx b/api_docs/kbn_core_status_server_internal.mdx index f8cae5c4a550..3916cb3c3119 100644 --- a/api_docs/kbn_core_status_server_internal.mdx +++ b/api_docs/kbn_core_status_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-status-server-internal title: "@kbn/core-status-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-status-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-status-server-internal'] --- import kbnCoreStatusServerInternalObj from './kbn_core_status_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_status_server_mocks.mdx b/api_docs/kbn_core_status_server_mocks.mdx index 0dacdfd5af97..966876de9b0c 100644 --- a/api_docs/kbn_core_status_server_mocks.mdx +++ b/api_docs/kbn_core_status_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-status-server-mocks title: "@kbn/core-status-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-status-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-status-server-mocks'] --- import kbnCoreStatusServerMocksObj from './kbn_core_status_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_test_helpers_deprecations_getters.mdx b/api_docs/kbn_core_test_helpers_deprecations_getters.mdx index 99b4036abb6b..f3ad0c01cc37 100644 --- a/api_docs/kbn_core_test_helpers_deprecations_getters.mdx +++ b/api_docs/kbn_core_test_helpers_deprecations_getters.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-test-helpers-deprecations-getters title: "@kbn/core-test-helpers-deprecations-getters" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-test-helpers-deprecations-getters plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-test-helpers-deprecations-getters'] --- import kbnCoreTestHelpersDeprecationsGettersObj from './kbn_core_test_helpers_deprecations_getters.devdocs.json'; diff --git a/api_docs/kbn_core_test_helpers_http_setup_browser.mdx b/api_docs/kbn_core_test_helpers_http_setup_browser.mdx index 549cdfe3a58e..995497dffa50 100644 --- a/api_docs/kbn_core_test_helpers_http_setup_browser.mdx +++ b/api_docs/kbn_core_test_helpers_http_setup_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-test-helpers-http-setup-browser title: "@kbn/core-test-helpers-http-setup-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-test-helpers-http-setup-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-test-helpers-http-setup-browser'] --- import kbnCoreTestHelpersHttpSetupBrowserObj from './kbn_core_test_helpers_http_setup_browser.devdocs.json'; diff --git a/api_docs/kbn_core_theme_browser.mdx b/api_docs/kbn_core_theme_browser.mdx index c429de87e13d..2db8ecd68b0d 100644 --- a/api_docs/kbn_core_theme_browser.mdx +++ b/api_docs/kbn_core_theme_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-theme-browser title: "@kbn/core-theme-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-theme-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-theme-browser'] --- import kbnCoreThemeBrowserObj from './kbn_core_theme_browser.devdocs.json'; diff --git a/api_docs/kbn_core_theme_browser_internal.mdx b/api_docs/kbn_core_theme_browser_internal.mdx index 0888bc8875a2..38778f82b4a7 100644 --- a/api_docs/kbn_core_theme_browser_internal.mdx +++ b/api_docs/kbn_core_theme_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-theme-browser-internal title: "@kbn/core-theme-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-theme-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-theme-browser-internal'] --- import kbnCoreThemeBrowserInternalObj from './kbn_core_theme_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_theme_browser_mocks.mdx b/api_docs/kbn_core_theme_browser_mocks.mdx index 254373b7a14d..d561c846ba52 100644 --- a/api_docs/kbn_core_theme_browser_mocks.mdx +++ b/api_docs/kbn_core_theme_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-theme-browser-mocks title: "@kbn/core-theme-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-theme-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-theme-browser-mocks'] --- import kbnCoreThemeBrowserMocksObj from './kbn_core_theme_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_browser.mdx b/api_docs/kbn_core_ui_settings_browser.mdx index 61ceae147d70..f4b08646423d 100644 --- a/api_docs/kbn_core_ui_settings_browser.mdx +++ b/api_docs/kbn_core_ui_settings_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-browser title: "@kbn/core-ui-settings-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-browser'] --- import kbnCoreUiSettingsBrowserObj from './kbn_core_ui_settings_browser.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_browser_internal.mdx b/api_docs/kbn_core_ui_settings_browser_internal.mdx index 9b9365bc3081..607eaa47b682 100644 --- a/api_docs/kbn_core_ui_settings_browser_internal.mdx +++ b/api_docs/kbn_core_ui_settings_browser_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-browser-internal title: "@kbn/core-ui-settings-browser-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-browser-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-browser-internal'] --- import kbnCoreUiSettingsBrowserInternalObj from './kbn_core_ui_settings_browser_internal.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_browser_mocks.mdx b/api_docs/kbn_core_ui_settings_browser_mocks.mdx index baf48b87a0eb..15ecdc9fee50 100644 --- a/api_docs/kbn_core_ui_settings_browser_mocks.mdx +++ b/api_docs/kbn_core_ui_settings_browser_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-browser-mocks title: "@kbn/core-ui-settings-browser-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-browser-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-browser-mocks'] --- import kbnCoreUiSettingsBrowserMocksObj from './kbn_core_ui_settings_browser_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_common.mdx b/api_docs/kbn_core_ui_settings_common.mdx index 1aba4f31960a..6644389a6513 100644 --- a/api_docs/kbn_core_ui_settings_common.mdx +++ b/api_docs/kbn_core_ui_settings_common.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-common title: "@kbn/core-ui-settings-common" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-common plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-common'] --- import kbnCoreUiSettingsCommonObj from './kbn_core_ui_settings_common.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_server.mdx b/api_docs/kbn_core_ui_settings_server.mdx index b2fe92199314..d486425f2067 100644 --- a/api_docs/kbn_core_ui_settings_server.mdx +++ b/api_docs/kbn_core_ui_settings_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-server title: "@kbn/core-ui-settings-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-server'] --- import kbnCoreUiSettingsServerObj from './kbn_core_ui_settings_server.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_server_internal.mdx b/api_docs/kbn_core_ui_settings_server_internal.mdx index 91c104b8b9de..98b9aa8e6584 100644 --- a/api_docs/kbn_core_ui_settings_server_internal.mdx +++ b/api_docs/kbn_core_ui_settings_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-server-internal title: "@kbn/core-ui-settings-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-server-internal'] --- import kbnCoreUiSettingsServerInternalObj from './kbn_core_ui_settings_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_ui_settings_server_mocks.mdx b/api_docs/kbn_core_ui_settings_server_mocks.mdx index 31ba42e2554f..c287c7d3717f 100644 --- a/api_docs/kbn_core_ui_settings_server_mocks.mdx +++ b/api_docs/kbn_core_ui_settings_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-ui-settings-server-mocks title: "@kbn/core-ui-settings-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-ui-settings-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-ui-settings-server-mocks'] --- import kbnCoreUiSettingsServerMocksObj from './kbn_core_ui_settings_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_core_usage_data_server.mdx b/api_docs/kbn_core_usage_data_server.mdx index a25b0cfc501c..8d5b6922438e 100644 --- a/api_docs/kbn_core_usage_data_server.mdx +++ b/api_docs/kbn_core_usage_data_server.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-usage-data-server title: "@kbn/core-usage-data-server" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-usage-data-server plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-usage-data-server'] --- import kbnCoreUsageDataServerObj from './kbn_core_usage_data_server.devdocs.json'; diff --git a/api_docs/kbn_core_usage_data_server_internal.mdx b/api_docs/kbn_core_usage_data_server_internal.mdx index 101431a9c73d..e433b1846305 100644 --- a/api_docs/kbn_core_usage_data_server_internal.mdx +++ b/api_docs/kbn_core_usage_data_server_internal.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-usage-data-server-internal title: "@kbn/core-usage-data-server-internal" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-usage-data-server-internal plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-usage-data-server-internal'] --- import kbnCoreUsageDataServerInternalObj from './kbn_core_usage_data_server_internal.devdocs.json'; diff --git a/api_docs/kbn_core_usage_data_server_mocks.mdx b/api_docs/kbn_core_usage_data_server_mocks.mdx index 710a3c62d544..ad3dac588eb6 100644 --- a/api_docs/kbn_core_usage_data_server_mocks.mdx +++ b/api_docs/kbn_core_usage_data_server_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-core-usage-data-server-mocks title: "@kbn/core-usage-data-server-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/core-usage-data-server-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-usage-data-server-mocks'] --- import kbnCoreUsageDataServerMocksObj from './kbn_core_usage_data_server_mocks.devdocs.json'; diff --git a/api_docs/kbn_crypto.mdx b/api_docs/kbn_crypto.mdx index a8c5ebefe66c..0e4143134287 100644 --- a/api_docs/kbn_crypto.mdx +++ b/api_docs/kbn_crypto.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-crypto title: "@kbn/crypto" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/crypto plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/crypto'] --- import kbnCryptoObj from './kbn_crypto.devdocs.json'; diff --git a/api_docs/kbn_crypto_browser.mdx b/api_docs/kbn_crypto_browser.mdx index b7a8b4187db8..7f67262cf91c 100644 --- a/api_docs/kbn_crypto_browser.mdx +++ b/api_docs/kbn_crypto_browser.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-crypto-browser title: "@kbn/crypto-browser" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/crypto-browser plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/crypto-browser'] --- import kbnCryptoBrowserObj from './kbn_crypto_browser.devdocs.json'; diff --git a/api_docs/kbn_datemath.mdx b/api_docs/kbn_datemath.mdx index 77c10c205e81..86cc145ec159 100644 --- a/api_docs/kbn_datemath.mdx +++ b/api_docs/kbn_datemath.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-datemath title: "@kbn/datemath" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/datemath plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/datemath'] --- import kbnDatemathObj from './kbn_datemath.devdocs.json'; diff --git a/api_docs/kbn_dev_cli_errors.mdx b/api_docs/kbn_dev_cli_errors.mdx index f79bd78824a0..e46730cf719c 100644 --- a/api_docs/kbn_dev_cli_errors.mdx +++ b/api_docs/kbn_dev_cli_errors.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-dev-cli-errors title: "@kbn/dev-cli-errors" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/dev-cli-errors plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-cli-errors'] --- import kbnDevCliErrorsObj from './kbn_dev_cli_errors.devdocs.json'; diff --git a/api_docs/kbn_dev_cli_runner.mdx b/api_docs/kbn_dev_cli_runner.mdx index 156f2ad1e34d..54d0f8713d0f 100644 --- a/api_docs/kbn_dev_cli_runner.mdx +++ b/api_docs/kbn_dev_cli_runner.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-dev-cli-runner title: "@kbn/dev-cli-runner" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/dev-cli-runner plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-cli-runner'] --- import kbnDevCliRunnerObj from './kbn_dev_cli_runner.devdocs.json'; diff --git a/api_docs/kbn_dev_proc_runner.mdx b/api_docs/kbn_dev_proc_runner.mdx index c40a114fb200..b646fc86f43f 100644 --- a/api_docs/kbn_dev_proc_runner.mdx +++ b/api_docs/kbn_dev_proc_runner.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-dev-proc-runner title: "@kbn/dev-proc-runner" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/dev-proc-runner plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-proc-runner'] --- import kbnDevProcRunnerObj from './kbn_dev_proc_runner.devdocs.json'; diff --git a/api_docs/kbn_dev_utils.mdx b/api_docs/kbn_dev_utils.mdx index 6c817ebf71e7..83091d9879dc 100644 --- a/api_docs/kbn_dev_utils.mdx +++ b/api_docs/kbn_dev_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-dev-utils title: "@kbn/dev-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/dev-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-utils'] --- import kbnDevUtilsObj from './kbn_dev_utils.devdocs.json'; diff --git a/api_docs/kbn_doc_links.mdx b/api_docs/kbn_doc_links.mdx index 055b95affc24..8913a1a03ab8 100644 --- a/api_docs/kbn_doc_links.mdx +++ b/api_docs/kbn_doc_links.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-doc-links title: "@kbn/doc-links" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/doc-links plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/doc-links'] --- import kbnDocLinksObj from './kbn_doc_links.devdocs.json'; diff --git a/api_docs/kbn_docs_utils.mdx b/api_docs/kbn_docs_utils.mdx index f6a0a8c29e49..a5d4079c284b 100644 --- a/api_docs/kbn_docs_utils.mdx +++ b/api_docs/kbn_docs_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-docs-utils title: "@kbn/docs-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/docs-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/docs-utils'] --- import kbnDocsUtilsObj from './kbn_docs_utils.devdocs.json'; diff --git a/api_docs/kbn_ebt_tools.mdx b/api_docs/kbn_ebt_tools.mdx index fa63acb9d852..8370c22a01f1 100644 --- a/api_docs/kbn_ebt_tools.mdx +++ b/api_docs/kbn_ebt_tools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ebt-tools title: "@kbn/ebt-tools" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ebt-tools plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ebt-tools'] --- import kbnEbtToolsObj from './kbn_ebt_tools.devdocs.json'; diff --git a/api_docs/kbn_es_archiver.mdx b/api_docs/kbn_es_archiver.mdx index 9f608a801f2c..4ad77bfff655 100644 --- a/api_docs/kbn_es_archiver.mdx +++ b/api_docs/kbn_es_archiver.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-es-archiver title: "@kbn/es-archiver" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/es-archiver plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es-archiver'] --- import kbnEsArchiverObj from './kbn_es_archiver.devdocs.json'; diff --git a/api_docs/kbn_es_errors.mdx b/api_docs/kbn_es_errors.mdx index 1498ddb5d263..bf9c27ac92b2 100644 --- a/api_docs/kbn_es_errors.mdx +++ b/api_docs/kbn_es_errors.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-es-errors title: "@kbn/es-errors" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/es-errors plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es-errors'] --- import kbnEsErrorsObj from './kbn_es_errors.devdocs.json'; diff --git a/api_docs/kbn_es_query.mdx b/api_docs/kbn_es_query.mdx index 537db266a40f..632303fa82c9 100644 --- a/api_docs/kbn_es_query.mdx +++ b/api_docs/kbn_es_query.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-es-query title: "@kbn/es-query" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/es-query plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es-query'] --- import kbnEsQueryObj from './kbn_es_query.devdocs.json'; diff --git a/api_docs/kbn_es_types.mdx b/api_docs/kbn_es_types.mdx index 923c644404d7..6a6ac63f69ac 100644 --- a/api_docs/kbn_es_types.mdx +++ b/api_docs/kbn_es_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-es-types title: "@kbn/es-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/es-types plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/es-types'] --- import kbnEsTypesObj from './kbn_es_types.devdocs.json'; diff --git a/api_docs/kbn_eslint_plugin_imports.mdx b/api_docs/kbn_eslint_plugin_imports.mdx index 23893848967a..e0525000b5f9 100644 --- a/api_docs/kbn_eslint_plugin_imports.mdx +++ b/api_docs/kbn_eslint_plugin_imports.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-eslint-plugin-imports title: "@kbn/eslint-plugin-imports" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/eslint-plugin-imports plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/eslint-plugin-imports'] --- import kbnEslintPluginImportsObj from './kbn_eslint_plugin_imports.devdocs.json'; diff --git a/api_docs/kbn_field_types.mdx b/api_docs/kbn_field_types.mdx index a29e11c7f3f5..f9ad3846f19f 100644 --- a/api_docs/kbn_field_types.mdx +++ b/api_docs/kbn_field_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-field-types title: "@kbn/field-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/field-types plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/field-types'] --- import kbnFieldTypesObj from './kbn_field_types.devdocs.json'; diff --git a/api_docs/kbn_find_used_node_modules.mdx b/api_docs/kbn_find_used_node_modules.mdx index c3673495d2d9..9bc0b9216824 100644 --- a/api_docs/kbn_find_used_node_modules.mdx +++ b/api_docs/kbn_find_used_node_modules.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-find-used-node-modules title: "@kbn/find-used-node-modules" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/find-used-node-modules plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/find-used-node-modules'] --- import kbnFindUsedNodeModulesObj from './kbn_find_used_node_modules.devdocs.json'; diff --git a/api_docs/kbn_ftr_common_functional_services.mdx b/api_docs/kbn_ftr_common_functional_services.mdx index 29968a934531..359334478d03 100644 --- a/api_docs/kbn_ftr_common_functional_services.mdx +++ b/api_docs/kbn_ftr_common_functional_services.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ftr-common-functional-services title: "@kbn/ftr-common-functional-services" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ftr-common-functional-services plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ftr-common-functional-services'] --- import kbnFtrCommonFunctionalServicesObj from './kbn_ftr_common_functional_services.devdocs.json'; diff --git a/api_docs/kbn_generate.mdx b/api_docs/kbn_generate.mdx index 535192fd2288..151e0da4dd3b 100644 --- a/api_docs/kbn_generate.mdx +++ b/api_docs/kbn_generate.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-generate title: "@kbn/generate" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/generate plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/generate'] --- import kbnGenerateObj from './kbn_generate.devdocs.json'; diff --git a/api_docs/kbn_get_repo_files.mdx b/api_docs/kbn_get_repo_files.mdx index 270341543e97..161354bbbcb1 100644 --- a/api_docs/kbn_get_repo_files.mdx +++ b/api_docs/kbn_get_repo_files.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-get-repo-files title: "@kbn/get-repo-files" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/get-repo-files plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/get-repo-files'] --- import kbnGetRepoFilesObj from './kbn_get_repo_files.devdocs.json'; diff --git a/api_docs/kbn_handlebars.mdx b/api_docs/kbn_handlebars.mdx index 75d249e64bf7..1e054c0706c6 100644 --- a/api_docs/kbn_handlebars.mdx +++ b/api_docs/kbn_handlebars.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-handlebars title: "@kbn/handlebars" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/handlebars plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/handlebars'] --- import kbnHandlebarsObj from './kbn_handlebars.devdocs.json'; diff --git a/api_docs/kbn_hapi_mocks.mdx b/api_docs/kbn_hapi_mocks.mdx index d7346ce1b677..0852dda61f29 100644 --- a/api_docs/kbn_hapi_mocks.mdx +++ b/api_docs/kbn_hapi_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-hapi-mocks title: "@kbn/hapi-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/hapi-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/hapi-mocks'] --- import kbnHapiMocksObj from './kbn_hapi_mocks.devdocs.json'; diff --git a/api_docs/kbn_home_sample_data_card.mdx b/api_docs/kbn_home_sample_data_card.mdx index b1ce2043e27f..d4cca0681860 100644 --- a/api_docs/kbn_home_sample_data_card.mdx +++ b/api_docs/kbn_home_sample_data_card.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-home-sample-data-card title: "@kbn/home-sample-data-card" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/home-sample-data-card plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/home-sample-data-card'] --- import kbnHomeSampleDataCardObj from './kbn_home_sample_data_card.devdocs.json'; diff --git a/api_docs/kbn_home_sample_data_tab.mdx b/api_docs/kbn_home_sample_data_tab.mdx index 63510d74b009..54d4d15fc741 100644 --- a/api_docs/kbn_home_sample_data_tab.mdx +++ b/api_docs/kbn_home_sample_data_tab.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-home-sample-data-tab title: "@kbn/home-sample-data-tab" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/home-sample-data-tab plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/home-sample-data-tab'] --- import kbnHomeSampleDataTabObj from './kbn_home_sample_data_tab.devdocs.json'; diff --git a/api_docs/kbn_i18n.mdx b/api_docs/kbn_i18n.mdx index ce7de735a110..c7ff5b8ab505 100644 --- a/api_docs/kbn_i18n.mdx +++ b/api_docs/kbn_i18n.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-i18n title: "@kbn/i18n" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/i18n plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/i18n'] --- import kbnI18nObj from './kbn_i18n.devdocs.json'; diff --git a/api_docs/kbn_import_resolver.mdx b/api_docs/kbn_import_resolver.mdx index a96adba4a09b..262e79df335d 100644 --- a/api_docs/kbn_import_resolver.mdx +++ b/api_docs/kbn_import_resolver.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-import-resolver title: "@kbn/import-resolver" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/import-resolver plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/import-resolver'] --- import kbnImportResolverObj from './kbn_import_resolver.devdocs.json'; diff --git a/api_docs/kbn_interpreter.mdx b/api_docs/kbn_interpreter.mdx index d35da6c7ae88..df20b5d894c5 100644 --- a/api_docs/kbn_interpreter.mdx +++ b/api_docs/kbn_interpreter.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-interpreter title: "@kbn/interpreter" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/interpreter plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/interpreter'] --- import kbnInterpreterObj from './kbn_interpreter.devdocs.json'; diff --git a/api_docs/kbn_io_ts_utils.mdx b/api_docs/kbn_io_ts_utils.mdx index 623552a19ab9..4994d60766a4 100644 --- a/api_docs/kbn_io_ts_utils.mdx +++ b/api_docs/kbn_io_ts_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-io-ts-utils title: "@kbn/io-ts-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/io-ts-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/io-ts-utils'] --- import kbnIoTsUtilsObj from './kbn_io_ts_utils.devdocs.json'; diff --git a/api_docs/kbn_jest_serializers.mdx b/api_docs/kbn_jest_serializers.mdx index 46b40beb8bf3..e5e069f91c95 100644 --- a/api_docs/kbn_jest_serializers.mdx +++ b/api_docs/kbn_jest_serializers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-jest-serializers title: "@kbn/jest-serializers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/jest-serializers plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/jest-serializers'] --- import kbnJestSerializersObj from './kbn_jest_serializers.devdocs.json'; diff --git a/api_docs/kbn_journeys.mdx b/api_docs/kbn_journeys.mdx index e9b4b290f7d1..21477f1c435c 100644 --- a/api_docs/kbn_journeys.mdx +++ b/api_docs/kbn_journeys.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-journeys title: "@kbn/journeys" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/journeys plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/journeys'] --- import kbnJourneysObj from './kbn_journeys.devdocs.json'; diff --git a/api_docs/kbn_kibana_manifest_schema.mdx b/api_docs/kbn_kibana_manifest_schema.mdx index 3f19d6bc0c35..6d9b4a9bb317 100644 --- a/api_docs/kbn_kibana_manifest_schema.mdx +++ b/api_docs/kbn_kibana_manifest_schema.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-kibana-manifest-schema title: "@kbn/kibana-manifest-schema" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/kibana-manifest-schema plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/kibana-manifest-schema'] --- import kbnKibanaManifestSchemaObj from './kbn_kibana_manifest_schema.devdocs.json'; diff --git a/api_docs/kbn_logging.mdx b/api_docs/kbn_logging.mdx index da43bfec51c4..712dd79f5535 100644 --- a/api_docs/kbn_logging.mdx +++ b/api_docs/kbn_logging.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-logging title: "@kbn/logging" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/logging plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/logging'] --- import kbnLoggingObj from './kbn_logging.devdocs.json'; diff --git a/api_docs/kbn_logging_mocks.mdx b/api_docs/kbn_logging_mocks.mdx index 2770d7ccb6ac..6dcc57446aaa 100644 --- a/api_docs/kbn_logging_mocks.mdx +++ b/api_docs/kbn_logging_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-logging-mocks title: "@kbn/logging-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/logging-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/logging-mocks'] --- import kbnLoggingMocksObj from './kbn_logging_mocks.devdocs.json'; diff --git a/api_docs/kbn_managed_vscode_config.mdx b/api_docs/kbn_managed_vscode_config.mdx index 83b9321c6a3f..788e96c22f5c 100644 --- a/api_docs/kbn_managed_vscode_config.mdx +++ b/api_docs/kbn_managed_vscode_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-managed-vscode-config title: "@kbn/managed-vscode-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/managed-vscode-config plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/managed-vscode-config'] --- import kbnManagedVscodeConfigObj from './kbn_managed_vscode_config.devdocs.json'; diff --git a/api_docs/kbn_mapbox_gl.mdx b/api_docs/kbn_mapbox_gl.mdx index ae4854e96ac2..8e2ce8b3d9fd 100644 --- a/api_docs/kbn_mapbox_gl.mdx +++ b/api_docs/kbn_mapbox_gl.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-mapbox-gl title: "@kbn/mapbox-gl" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/mapbox-gl plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/mapbox-gl'] --- import kbnMapboxGlObj from './kbn_mapbox_gl.devdocs.json'; diff --git a/api_docs/kbn_ml_agg_utils.mdx b/api_docs/kbn_ml_agg_utils.mdx index dd5f5c5ace18..25b2b17e3997 100644 --- a/api_docs/kbn_ml_agg_utils.mdx +++ b/api_docs/kbn_ml_agg_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-agg-utils title: "@kbn/ml-agg-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-agg-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-agg-utils'] --- import kbnMlAggUtilsObj from './kbn_ml_agg_utils.devdocs.json'; diff --git a/api_docs/kbn_ml_is_populated_object.mdx b/api_docs/kbn_ml_is_populated_object.mdx index 4a750b0b7dfa..5f24dc1806b0 100644 --- a/api_docs/kbn_ml_is_populated_object.mdx +++ b/api_docs/kbn_ml_is_populated_object.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-is-populated-object title: "@kbn/ml-is-populated-object" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-is-populated-object plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-is-populated-object'] --- import kbnMlIsPopulatedObjectObj from './kbn_ml_is_populated_object.devdocs.json'; diff --git a/api_docs/kbn_ml_string_hash.mdx b/api_docs/kbn_ml_string_hash.mdx index 170269826262..2fa9ac8d84b7 100644 --- a/api_docs/kbn_ml_string_hash.mdx +++ b/api_docs/kbn_ml_string_hash.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ml-string-hash title: "@kbn/ml-string-hash" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ml-string-hash plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ml-string-hash'] --- import kbnMlStringHashObj from './kbn_ml_string_hash.devdocs.json'; diff --git a/api_docs/kbn_monaco.mdx b/api_docs/kbn_monaco.mdx index 987ec45f387a..c5b48fbeff00 100644 --- a/api_docs/kbn_monaco.mdx +++ b/api_docs/kbn_monaco.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-monaco title: "@kbn/monaco" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/monaco plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/monaco'] --- import kbnMonacoObj from './kbn_monaco.devdocs.json'; diff --git a/api_docs/kbn_optimizer.mdx b/api_docs/kbn_optimizer.mdx index ed7566b575b5..2a5d7bc10afb 100644 --- a/api_docs/kbn_optimizer.mdx +++ b/api_docs/kbn_optimizer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-optimizer title: "@kbn/optimizer" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/optimizer plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/optimizer'] --- import kbnOptimizerObj from './kbn_optimizer.devdocs.json'; diff --git a/api_docs/kbn_optimizer_webpack_helpers.mdx b/api_docs/kbn_optimizer_webpack_helpers.mdx index 7c45eeef92b5..3f87a2b8b79d 100644 --- a/api_docs/kbn_optimizer_webpack_helpers.mdx +++ b/api_docs/kbn_optimizer_webpack_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-optimizer-webpack-helpers title: "@kbn/optimizer-webpack-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/optimizer-webpack-helpers plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/optimizer-webpack-helpers'] --- import kbnOptimizerWebpackHelpersObj from './kbn_optimizer_webpack_helpers.devdocs.json'; diff --git a/api_docs/kbn_osquery_io_ts_types.mdx b/api_docs/kbn_osquery_io_ts_types.mdx index 859b6a067644..76d9089526ce 100644 --- a/api_docs/kbn_osquery_io_ts_types.mdx +++ b/api_docs/kbn_osquery_io_ts_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-osquery-io-ts-types title: "@kbn/osquery-io-ts-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/osquery-io-ts-types plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/osquery-io-ts-types'] --- import kbnOsqueryIoTsTypesObj from './kbn_osquery_io_ts_types.devdocs.json'; diff --git a/api_docs/kbn_performance_testing_dataset_extractor.mdx b/api_docs/kbn_performance_testing_dataset_extractor.mdx index aedd0101a45a..3e83e64f435d 100644 --- a/api_docs/kbn_performance_testing_dataset_extractor.mdx +++ b/api_docs/kbn_performance_testing_dataset_extractor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-performance-testing-dataset-extractor title: "@kbn/performance-testing-dataset-extractor" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/performance-testing-dataset-extractor plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/performance-testing-dataset-extractor'] --- import kbnPerformanceTestingDatasetExtractorObj from './kbn_performance_testing_dataset_extractor.devdocs.json'; diff --git a/api_docs/kbn_plugin_generator.mdx b/api_docs/kbn_plugin_generator.mdx index bfd4b4e6b5af..dc887c9ce305 100644 --- a/api_docs/kbn_plugin_generator.mdx +++ b/api_docs/kbn_plugin_generator.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-plugin-generator title: "@kbn/plugin-generator" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/plugin-generator plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/plugin-generator'] --- import kbnPluginGeneratorObj from './kbn_plugin_generator.devdocs.json'; diff --git a/api_docs/kbn_plugin_helpers.mdx b/api_docs/kbn_plugin_helpers.mdx index 3ca9f9e155f1..30cf3560edd3 100644 --- a/api_docs/kbn_plugin_helpers.mdx +++ b/api_docs/kbn_plugin_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-plugin-helpers title: "@kbn/plugin-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/plugin-helpers plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/plugin-helpers'] --- import kbnPluginHelpersObj from './kbn_plugin_helpers.devdocs.json'; diff --git a/api_docs/kbn_react_field.mdx b/api_docs/kbn_react_field.mdx index 293fa5190545..ae485f79249a 100644 --- a/api_docs/kbn_react_field.mdx +++ b/api_docs/kbn_react_field.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-react-field title: "@kbn/react-field" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/react-field plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/react-field'] --- import kbnReactFieldObj from './kbn_react_field.devdocs.json'; diff --git a/api_docs/kbn_repo_source_classifier.mdx b/api_docs/kbn_repo_source_classifier.mdx index aaf5d45ea057..8249b1eae5a3 100644 --- a/api_docs/kbn_repo_source_classifier.mdx +++ b/api_docs/kbn_repo_source_classifier.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-repo-source-classifier title: "@kbn/repo-source-classifier" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/repo-source-classifier plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/repo-source-classifier'] --- import kbnRepoSourceClassifierObj from './kbn_repo_source_classifier.devdocs.json'; diff --git a/api_docs/kbn_rule_data_utils.mdx b/api_docs/kbn_rule_data_utils.mdx index 4f65db7503fc..a4ef149f8033 100644 --- a/api_docs/kbn_rule_data_utils.mdx +++ b/api_docs/kbn_rule_data_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-rule-data-utils title: "@kbn/rule-data-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/rule-data-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/rule-data-utils'] --- import kbnRuleDataUtilsObj from './kbn_rule_data_utils.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_autocomplete.mdx b/api_docs/kbn_securitysolution_autocomplete.mdx index 5a9078575773..ea7380185e08 100644 --- a/api_docs/kbn_securitysolution_autocomplete.mdx +++ b/api_docs/kbn_securitysolution_autocomplete.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-autocomplete title: "@kbn/securitysolution-autocomplete" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-autocomplete plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-autocomplete'] --- import kbnSecuritysolutionAutocompleteObj from './kbn_securitysolution_autocomplete.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_es_utils.mdx b/api_docs/kbn_securitysolution_es_utils.mdx index dc5fcdbd1d0f..4f2b01b57863 100644 --- a/api_docs/kbn_securitysolution_es_utils.mdx +++ b/api_docs/kbn_securitysolution_es_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-es-utils title: "@kbn/securitysolution-es-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-es-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-es-utils'] --- import kbnSecuritysolutionEsUtilsObj from './kbn_securitysolution_es_utils.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_exception_list_components.mdx b/api_docs/kbn_securitysolution_exception_list_components.mdx index 1bcc5017dfc5..35651464e503 100644 --- a/api_docs/kbn_securitysolution_exception_list_components.mdx +++ b/api_docs/kbn_securitysolution_exception_list_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-exception-list-components title: "@kbn/securitysolution-exception-list-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-exception-list-components plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-exception-list-components'] --- import kbnSecuritysolutionExceptionListComponentsObj from './kbn_securitysolution_exception_list_components.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_hook_utils.mdx b/api_docs/kbn_securitysolution_hook_utils.mdx index a22707f2957b..74a60ea3a6e0 100644 --- a/api_docs/kbn_securitysolution_hook_utils.mdx +++ b/api_docs/kbn_securitysolution_hook_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-hook-utils title: "@kbn/securitysolution-hook-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-hook-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-hook-utils'] --- import kbnSecuritysolutionHookUtilsObj from './kbn_securitysolution_hook_utils.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_io_ts_alerting_types.mdx b/api_docs/kbn_securitysolution_io_ts_alerting_types.mdx index cdc1b3ea54ed..a2e5cb79e7ec 100644 --- a/api_docs/kbn_securitysolution_io_ts_alerting_types.mdx +++ b/api_docs/kbn_securitysolution_io_ts_alerting_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-io-ts-alerting-types title: "@kbn/securitysolution-io-ts-alerting-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-io-ts-alerting-types plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-io-ts-alerting-types'] --- import kbnSecuritysolutionIoTsAlertingTypesObj from './kbn_securitysolution_io_ts_alerting_types.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_io_ts_list_types.mdx b/api_docs/kbn_securitysolution_io_ts_list_types.mdx index 185f8a6c2a54..878d21884f5a 100644 --- a/api_docs/kbn_securitysolution_io_ts_list_types.mdx +++ b/api_docs/kbn_securitysolution_io_ts_list_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-io-ts-list-types title: "@kbn/securitysolution-io-ts-list-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-io-ts-list-types plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-io-ts-list-types'] --- import kbnSecuritysolutionIoTsListTypesObj from './kbn_securitysolution_io_ts_list_types.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_io_ts_types.mdx b/api_docs/kbn_securitysolution_io_ts_types.mdx index ee826f79d080..7009b4610d37 100644 --- a/api_docs/kbn_securitysolution_io_ts_types.mdx +++ b/api_docs/kbn_securitysolution_io_ts_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-io-ts-types title: "@kbn/securitysolution-io-ts-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-io-ts-types plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-io-ts-types'] --- import kbnSecuritysolutionIoTsTypesObj from './kbn_securitysolution_io_ts_types.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_io_ts_utils.mdx b/api_docs/kbn_securitysolution_io_ts_utils.mdx index 79363d1648a7..1a8635741da3 100644 --- a/api_docs/kbn_securitysolution_io_ts_utils.mdx +++ b/api_docs/kbn_securitysolution_io_ts_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-io-ts-utils title: "@kbn/securitysolution-io-ts-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-io-ts-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-io-ts-utils'] --- import kbnSecuritysolutionIoTsUtilsObj from './kbn_securitysolution_io_ts_utils.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_list_api.mdx b/api_docs/kbn_securitysolution_list_api.mdx index bad03cd4ead9..ba0f3639d8e0 100644 --- a/api_docs/kbn_securitysolution_list_api.mdx +++ b/api_docs/kbn_securitysolution_list_api.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-list-api title: "@kbn/securitysolution-list-api" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-list-api plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-list-api'] --- import kbnSecuritysolutionListApiObj from './kbn_securitysolution_list_api.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_list_constants.mdx b/api_docs/kbn_securitysolution_list_constants.mdx index d2e797f19a3e..cc6cd2e0e30a 100644 --- a/api_docs/kbn_securitysolution_list_constants.mdx +++ b/api_docs/kbn_securitysolution_list_constants.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-list-constants title: "@kbn/securitysolution-list-constants" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-list-constants plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-list-constants'] --- import kbnSecuritysolutionListConstantsObj from './kbn_securitysolution_list_constants.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_list_hooks.mdx b/api_docs/kbn_securitysolution_list_hooks.mdx index aadd62030a1b..c160feacf522 100644 --- a/api_docs/kbn_securitysolution_list_hooks.mdx +++ b/api_docs/kbn_securitysolution_list_hooks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-list-hooks title: "@kbn/securitysolution-list-hooks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-list-hooks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-list-hooks'] --- import kbnSecuritysolutionListHooksObj from './kbn_securitysolution_list_hooks.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_list_utils.mdx b/api_docs/kbn_securitysolution_list_utils.mdx index 37f5836577b4..1a0fb17e5ced 100644 --- a/api_docs/kbn_securitysolution_list_utils.mdx +++ b/api_docs/kbn_securitysolution_list_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-list-utils title: "@kbn/securitysolution-list-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-list-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-list-utils'] --- import kbnSecuritysolutionListUtilsObj from './kbn_securitysolution_list_utils.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_rules.mdx b/api_docs/kbn_securitysolution_rules.mdx index 7aa2954ee0c0..7aa3b1237d1b 100644 --- a/api_docs/kbn_securitysolution_rules.mdx +++ b/api_docs/kbn_securitysolution_rules.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-rules title: "@kbn/securitysolution-rules" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-rules plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-rules'] --- import kbnSecuritysolutionRulesObj from './kbn_securitysolution_rules.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_t_grid.mdx b/api_docs/kbn_securitysolution_t_grid.mdx index 99fe2b585b0b..7b831d821337 100644 --- a/api_docs/kbn_securitysolution_t_grid.mdx +++ b/api_docs/kbn_securitysolution_t_grid.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-t-grid title: "@kbn/securitysolution-t-grid" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-t-grid plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-t-grid'] --- import kbnSecuritysolutionTGridObj from './kbn_securitysolution_t_grid.devdocs.json'; diff --git a/api_docs/kbn_securitysolution_utils.mdx b/api_docs/kbn_securitysolution_utils.mdx index e132797fea85..e82e1785f249 100644 --- a/api_docs/kbn_securitysolution_utils.mdx +++ b/api_docs/kbn_securitysolution_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-securitysolution-utils title: "@kbn/securitysolution-utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/securitysolution-utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-utils'] --- import kbnSecuritysolutionUtilsObj from './kbn_securitysolution_utils.devdocs.json'; diff --git a/api_docs/kbn_server_http_tools.mdx b/api_docs/kbn_server_http_tools.mdx index 48d0d4756ef6..60f6a7802671 100644 --- a/api_docs/kbn_server_http_tools.mdx +++ b/api_docs/kbn_server_http_tools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-server-http-tools title: "@kbn/server-http-tools" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/server-http-tools plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/server-http-tools'] --- import kbnServerHttpToolsObj from './kbn_server_http_tools.devdocs.json'; diff --git a/api_docs/kbn_server_route_repository.mdx b/api_docs/kbn_server_route_repository.mdx index 5c184c9a583c..d5b974e9060a 100644 --- a/api_docs/kbn_server_route_repository.mdx +++ b/api_docs/kbn_server_route_repository.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-server-route-repository title: "@kbn/server-route-repository" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/server-route-repository plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/server-route-repository'] --- import kbnServerRouteRepositoryObj from './kbn_server_route_repository.devdocs.json'; diff --git a/api_docs/kbn_shared_svg.mdx b/api_docs/kbn_shared_svg.mdx index 249f6a00cf7e..434f6ebf7360 100644 --- a/api_docs/kbn_shared_svg.mdx +++ b/api_docs/kbn_shared_svg.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-svg title: "@kbn/shared-svg" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-svg plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-svg'] --- import kbnSharedSvgObj from './kbn_shared_svg.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_avatar_user_profile_components.mdx b/api_docs/kbn_shared_ux_avatar_user_profile_components.mdx index e5e0f236974f..aca5844ce1aa 100644 --- a/api_docs/kbn_shared_ux_avatar_user_profile_components.mdx +++ b/api_docs/kbn_shared_ux_avatar_user_profile_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-avatar-user-profile-components title: "@kbn/shared-ux-avatar-user-profile-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-avatar-user-profile-components plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-avatar-user-profile-components'] --- import kbnSharedUxAvatarUserProfileComponentsObj from './kbn_shared_ux_avatar_user_profile_components.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_button_exit_full_screen_mocks.mdx b/api_docs/kbn_shared_ux_button_exit_full_screen_mocks.mdx index b78abda31ac5..64ff483b257b 100644 --- a/api_docs/kbn_shared_ux_button_exit_full_screen_mocks.mdx +++ b/api_docs/kbn_shared_ux_button_exit_full_screen_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-button-exit-full-screen-mocks title: "@kbn/shared-ux-button-exit-full-screen-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-button-exit-full-screen-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-button-exit-full-screen-mocks'] --- import kbnSharedUxButtonExitFullScreenMocksObj from './kbn_shared_ux_button_exit_full_screen_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_button_toolbar.mdx b/api_docs/kbn_shared_ux_button_toolbar.mdx index dda07aa08205..98810e33e0a4 100644 --- a/api_docs/kbn_shared_ux_button_toolbar.mdx +++ b/api_docs/kbn_shared_ux_button_toolbar.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-button-toolbar title: "@kbn/shared-ux-button-toolbar" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-button-toolbar plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-button-toolbar'] --- import kbnSharedUxButtonToolbarObj from './kbn_shared_ux_button_toolbar.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_card_no_data.mdx b/api_docs/kbn_shared_ux_card_no_data.mdx index 92fa45970a95..f7ca5b161911 100644 --- a/api_docs/kbn_shared_ux_card_no_data.mdx +++ b/api_docs/kbn_shared_ux_card_no_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-card-no-data title: "@kbn/shared-ux-card-no-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-card-no-data plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-card-no-data'] --- import kbnSharedUxCardNoDataObj from './kbn_shared_ux_card_no_data.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_card_no_data_mocks.mdx b/api_docs/kbn_shared_ux_card_no_data_mocks.mdx index 67fd1537b953..bae9391ff07c 100644 --- a/api_docs/kbn_shared_ux_card_no_data_mocks.mdx +++ b/api_docs/kbn_shared_ux_card_no_data_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-card-no-data-mocks title: "@kbn/shared-ux-card-no-data-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-card-no-data-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-card-no-data-mocks'] --- import kbnSharedUxCardNoDataMocksObj from './kbn_shared_ux_card_no_data_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_link_redirect_app_mocks.mdx b/api_docs/kbn_shared_ux_link_redirect_app_mocks.mdx index dba90c297e1b..aeabec4b1421 100644 --- a/api_docs/kbn_shared_ux_link_redirect_app_mocks.mdx +++ b/api_docs/kbn_shared_ux_link_redirect_app_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-link-redirect-app-mocks title: "@kbn/shared-ux-link-redirect-app-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-link-redirect-app-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-link-redirect-app-mocks'] --- import kbnSharedUxLinkRedirectAppMocksObj from './kbn_shared_ux_link_redirect_app_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_analytics_no_data.mdx b/api_docs/kbn_shared_ux_page_analytics_no_data.mdx index eb63fe71719d..7dc8d4c97313 100644 --- a/api_docs/kbn_shared_ux_page_analytics_no_data.mdx +++ b/api_docs/kbn_shared_ux_page_analytics_no_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-analytics-no-data title: "@kbn/shared-ux-page-analytics-no-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-analytics-no-data plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-analytics-no-data'] --- import kbnSharedUxPageAnalyticsNoDataObj from './kbn_shared_ux_page_analytics_no_data.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_analytics_no_data_mocks.mdx b/api_docs/kbn_shared_ux_page_analytics_no_data_mocks.mdx index 312cc6dc442d..5386d337930e 100644 --- a/api_docs/kbn_shared_ux_page_analytics_no_data_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_analytics_no_data_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-analytics-no-data-mocks title: "@kbn/shared-ux-page-analytics-no-data-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-analytics-no-data-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-analytics-no-data-mocks'] --- import kbnSharedUxPageAnalyticsNoDataMocksObj from './kbn_shared_ux_page_analytics_no_data_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_kibana_no_data.mdx b/api_docs/kbn_shared_ux_page_kibana_no_data.mdx index fc5ddb138a55..77248704888b 100644 --- a/api_docs/kbn_shared_ux_page_kibana_no_data.mdx +++ b/api_docs/kbn_shared_ux_page_kibana_no_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-kibana-no-data title: "@kbn/shared-ux-page-kibana-no-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-kibana-no-data plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-kibana-no-data'] --- import kbnSharedUxPageKibanaNoDataObj from './kbn_shared_ux_page_kibana_no_data.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_kibana_no_data_mocks.mdx b/api_docs/kbn_shared_ux_page_kibana_no_data_mocks.mdx index 00f4e0b05251..100b84a823c9 100644 --- a/api_docs/kbn_shared_ux_page_kibana_no_data_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_kibana_no_data_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-kibana-no-data-mocks title: "@kbn/shared-ux-page-kibana-no-data-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-kibana-no-data-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-kibana-no-data-mocks'] --- import kbnSharedUxPageKibanaNoDataMocksObj from './kbn_shared_ux_page_kibana_no_data_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_kibana_template.mdx b/api_docs/kbn_shared_ux_page_kibana_template.mdx index 22e5de7cb344..fc9392a85f8e 100644 --- a/api_docs/kbn_shared_ux_page_kibana_template.mdx +++ b/api_docs/kbn_shared_ux_page_kibana_template.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-kibana-template title: "@kbn/shared-ux-page-kibana-template" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-kibana-template plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-kibana-template'] --- import kbnSharedUxPageKibanaTemplateObj from './kbn_shared_ux_page_kibana_template.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_kibana_template_mocks.mdx b/api_docs/kbn_shared_ux_page_kibana_template_mocks.mdx index de0d8b5ff101..75c7b818d2b9 100644 --- a/api_docs/kbn_shared_ux_page_kibana_template_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_kibana_template_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-kibana-template-mocks title: "@kbn/shared-ux-page-kibana-template-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-kibana-template-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-kibana-template-mocks'] --- import kbnSharedUxPageKibanaTemplateMocksObj from './kbn_shared_ux_page_kibana_template_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_no_data.mdx b/api_docs/kbn_shared_ux_page_no_data.mdx index b1597719e26a..46c1575ac211 100644 --- a/api_docs/kbn_shared_ux_page_no_data.mdx +++ b/api_docs/kbn_shared_ux_page_no_data.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-no-data title: "@kbn/shared-ux-page-no-data" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-no-data plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-no-data'] --- import kbnSharedUxPageNoDataObj from './kbn_shared_ux_page_no_data.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_no_data_config.mdx b/api_docs/kbn_shared_ux_page_no_data_config.mdx index 254ce88f6ed0..ab3b48e84863 100644 --- a/api_docs/kbn_shared_ux_page_no_data_config.mdx +++ b/api_docs/kbn_shared_ux_page_no_data_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-no-data-config title: "@kbn/shared-ux-page-no-data-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-no-data-config plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-no-data-config'] --- import kbnSharedUxPageNoDataConfigObj from './kbn_shared_ux_page_no_data_config.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_no_data_config_mocks.mdx b/api_docs/kbn_shared_ux_page_no_data_config_mocks.mdx index 4b7ce948af06..be35872625c4 100644 --- a/api_docs/kbn_shared_ux_page_no_data_config_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_no_data_config_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-no-data-config-mocks title: "@kbn/shared-ux-page-no-data-config-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-no-data-config-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-no-data-config-mocks'] --- import kbnSharedUxPageNoDataConfigMocksObj from './kbn_shared_ux_page_no_data_config_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_no_data_mocks.mdx b/api_docs/kbn_shared_ux_page_no_data_mocks.mdx index 4bebd9fa27f9..b5afba9ff421 100644 --- a/api_docs/kbn_shared_ux_page_no_data_mocks.mdx +++ b/api_docs/kbn_shared_ux_page_no_data_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-no-data-mocks title: "@kbn/shared-ux-page-no-data-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-no-data-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-no-data-mocks'] --- import kbnSharedUxPageNoDataMocksObj from './kbn_shared_ux_page_no_data_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_page_solution_nav.mdx b/api_docs/kbn_shared_ux_page_solution_nav.mdx index a3b2ddd97a17..da1478041d72 100644 --- a/api_docs/kbn_shared_ux_page_solution_nav.mdx +++ b/api_docs/kbn_shared_ux_page_solution_nav.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-page-solution-nav title: "@kbn/shared-ux-page-solution-nav" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-page-solution-nav plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-page-solution-nav'] --- import kbnSharedUxPageSolutionNavObj from './kbn_shared_ux_page_solution_nav.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_prompt_no_data_views.mdx b/api_docs/kbn_shared_ux_prompt_no_data_views.mdx index 0a1d772cc031..1b1327a86bd0 100644 --- a/api_docs/kbn_shared_ux_prompt_no_data_views.mdx +++ b/api_docs/kbn_shared_ux_prompt_no_data_views.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-prompt-no-data-views title: "@kbn/shared-ux-prompt-no-data-views" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-prompt-no-data-views plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-prompt-no-data-views'] --- import kbnSharedUxPromptNoDataViewsObj from './kbn_shared_ux_prompt_no_data_views.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_prompt_no_data_views_mocks.mdx b/api_docs/kbn_shared_ux_prompt_no_data_views_mocks.mdx index 70d3cf84c5ef..0e7e8889a58c 100644 --- a/api_docs/kbn_shared_ux_prompt_no_data_views_mocks.mdx +++ b/api_docs/kbn_shared_ux_prompt_no_data_views_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-prompt-no-data-views-mocks title: "@kbn/shared-ux-prompt-no-data-views-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-prompt-no-data-views-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-prompt-no-data-views-mocks'] --- import kbnSharedUxPromptNoDataViewsMocksObj from './kbn_shared_ux_prompt_no_data_views_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_router.mdx b/api_docs/kbn_shared_ux_router.mdx index 61fe760de503..f9c07c50257c 100644 --- a/api_docs/kbn_shared_ux_router.mdx +++ b/api_docs/kbn_shared_ux_router.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-router title: "@kbn/shared-ux-router" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-router plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-router'] --- import kbnSharedUxRouterObj from './kbn_shared_ux_router.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_router_mocks.mdx b/api_docs/kbn_shared_ux_router_mocks.mdx index 02064c4eacc6..a0aca2fcd5aa 100644 --- a/api_docs/kbn_shared_ux_router_mocks.mdx +++ b/api_docs/kbn_shared_ux_router_mocks.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-router-mocks title: "@kbn/shared-ux-router-mocks" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-router-mocks plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-router-mocks'] --- import kbnSharedUxRouterMocksObj from './kbn_shared_ux_router_mocks.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_storybook_config.mdx b/api_docs/kbn_shared_ux_storybook_config.mdx index 86606778f8df..aeae1c356a86 100644 --- a/api_docs/kbn_shared_ux_storybook_config.mdx +++ b/api_docs/kbn_shared_ux_storybook_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-storybook-config title: "@kbn/shared-ux-storybook-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-storybook-config plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-storybook-config'] --- import kbnSharedUxStorybookConfigObj from './kbn_shared_ux_storybook_config.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_storybook_mock.mdx b/api_docs/kbn_shared_ux_storybook_mock.mdx index 180ae33f7885..d5712323de82 100644 --- a/api_docs/kbn_shared_ux_storybook_mock.mdx +++ b/api_docs/kbn_shared_ux_storybook_mock.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-storybook-mock title: "@kbn/shared-ux-storybook-mock" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-storybook-mock plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-storybook-mock'] --- import kbnSharedUxStorybookMockObj from './kbn_shared_ux_storybook_mock.devdocs.json'; diff --git a/api_docs/kbn_shared_ux_utility.mdx b/api_docs/kbn_shared_ux_utility.mdx index 7c2f7cc09c77..346607202705 100644 --- a/api_docs/kbn_shared_ux_utility.mdx +++ b/api_docs/kbn_shared_ux_utility.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-shared-ux-utility title: "@kbn/shared-ux-utility" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/shared-ux-utility plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/shared-ux-utility'] --- import kbnSharedUxUtilityObj from './kbn_shared_ux_utility.devdocs.json'; diff --git a/api_docs/kbn_some_dev_log.mdx b/api_docs/kbn_some_dev_log.mdx index ef8d669ed27a..d6c26edac107 100644 --- a/api_docs/kbn_some_dev_log.mdx +++ b/api_docs/kbn_some_dev_log.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-some-dev-log title: "@kbn/some-dev-log" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/some-dev-log plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/some-dev-log'] --- import kbnSomeDevLogObj from './kbn_some_dev_log.devdocs.json'; diff --git a/api_docs/kbn_sort_package_json.mdx b/api_docs/kbn_sort_package_json.mdx index 0e8f9505b35f..13db8c8155fd 100644 --- a/api_docs/kbn_sort_package_json.mdx +++ b/api_docs/kbn_sort_package_json.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-sort-package-json title: "@kbn/sort-package-json" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/sort-package-json plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/sort-package-json'] --- import kbnSortPackageJsonObj from './kbn_sort_package_json.devdocs.json'; diff --git a/api_docs/kbn_std.mdx b/api_docs/kbn_std.mdx index c2a9a2019695..e96bc3e61652 100644 --- a/api_docs/kbn_std.mdx +++ b/api_docs/kbn_std.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-std title: "@kbn/std" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/std plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/std'] --- import kbnStdObj from './kbn_std.devdocs.json'; diff --git a/api_docs/kbn_stdio_dev_helpers.mdx b/api_docs/kbn_stdio_dev_helpers.mdx index 9662e0b7958f..b4aac204fc2f 100644 --- a/api_docs/kbn_stdio_dev_helpers.mdx +++ b/api_docs/kbn_stdio_dev_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-stdio-dev-helpers title: "@kbn/stdio-dev-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/stdio-dev-helpers plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/stdio-dev-helpers'] --- import kbnStdioDevHelpersObj from './kbn_stdio_dev_helpers.devdocs.json'; diff --git a/api_docs/kbn_storybook.mdx b/api_docs/kbn_storybook.mdx index f279425a1128..13b0046b3c5f 100644 --- a/api_docs/kbn_storybook.mdx +++ b/api_docs/kbn_storybook.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-storybook title: "@kbn/storybook" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/storybook plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/storybook'] --- import kbnStorybookObj from './kbn_storybook.devdocs.json'; diff --git a/api_docs/kbn_telemetry_tools.mdx b/api_docs/kbn_telemetry_tools.mdx index 70dd586f3b9f..5dc57b83e3ca 100644 --- a/api_docs/kbn_telemetry_tools.mdx +++ b/api_docs/kbn_telemetry_tools.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-telemetry-tools title: "@kbn/telemetry-tools" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/telemetry-tools plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/telemetry-tools'] --- import kbnTelemetryToolsObj from './kbn_telemetry_tools.devdocs.json'; diff --git a/api_docs/kbn_test.mdx b/api_docs/kbn_test.mdx index 2d4b1f7a3e30..924a8f1d2d36 100644 --- a/api_docs/kbn_test.mdx +++ b/api_docs/kbn_test.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-test title: "@kbn/test" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/test plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/test'] --- import kbnTestObj from './kbn_test.devdocs.json'; diff --git a/api_docs/kbn_test_jest_helpers.mdx b/api_docs/kbn_test_jest_helpers.mdx index f0c472ec736d..cc4a486b6dc8 100644 --- a/api_docs/kbn_test_jest_helpers.mdx +++ b/api_docs/kbn_test_jest_helpers.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-test-jest-helpers title: "@kbn/test-jest-helpers" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/test-jest-helpers plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/test-jest-helpers'] --- import kbnTestJestHelpersObj from './kbn_test_jest_helpers.devdocs.json'; diff --git a/api_docs/kbn_test_subj_selector.mdx b/api_docs/kbn_test_subj_selector.mdx index 421399623af6..38fd9ee19295 100644 --- a/api_docs/kbn_test_subj_selector.mdx +++ b/api_docs/kbn_test_subj_selector.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-test-subj-selector title: "@kbn/test-subj-selector" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/test-subj-selector plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/test-subj-selector'] --- import kbnTestSubjSelectorObj from './kbn_test_subj_selector.devdocs.json'; diff --git a/api_docs/kbn_tooling_log.mdx b/api_docs/kbn_tooling_log.mdx index 8c06707332c2..efc952ecde5a 100644 --- a/api_docs/kbn_tooling_log.mdx +++ b/api_docs/kbn_tooling_log.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-tooling-log title: "@kbn/tooling-log" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/tooling-log plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/tooling-log'] --- import kbnToolingLogObj from './kbn_tooling_log.devdocs.json'; diff --git a/api_docs/kbn_type_summarizer.mdx b/api_docs/kbn_type_summarizer.mdx index a03912522bea..1c63f3fb9930 100644 --- a/api_docs/kbn_type_summarizer.mdx +++ b/api_docs/kbn_type_summarizer.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-type-summarizer title: "@kbn/type-summarizer" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/type-summarizer plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/type-summarizer'] --- import kbnTypeSummarizerObj from './kbn_type_summarizer.devdocs.json'; diff --git a/api_docs/kbn_type_summarizer_core.mdx b/api_docs/kbn_type_summarizer_core.mdx index 7d6e18575e25..346fc07253bf 100644 --- a/api_docs/kbn_type_summarizer_core.mdx +++ b/api_docs/kbn_type_summarizer_core.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-type-summarizer-core title: "@kbn/type-summarizer-core" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/type-summarizer-core plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/type-summarizer-core'] --- import kbnTypeSummarizerCoreObj from './kbn_type_summarizer_core.devdocs.json'; diff --git a/api_docs/kbn_typed_react_router_config.mdx b/api_docs/kbn_typed_react_router_config.mdx index 3d387dbca9d5..cc16ed53a0ad 100644 --- a/api_docs/kbn_typed_react_router_config.mdx +++ b/api_docs/kbn_typed_react_router_config.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-typed-react-router-config title: "@kbn/typed-react-router-config" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/typed-react-router-config plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/typed-react-router-config'] --- import kbnTypedReactRouterConfigObj from './kbn_typed_react_router_config.devdocs.json'; diff --git a/api_docs/kbn_ui_theme.mdx b/api_docs/kbn_ui_theme.mdx index 80555e578ee9..768d7656e3a8 100644 --- a/api_docs/kbn_ui_theme.mdx +++ b/api_docs/kbn_ui_theme.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-ui-theme title: "@kbn/ui-theme" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/ui-theme plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/ui-theme'] --- import kbnUiThemeObj from './kbn_ui_theme.devdocs.json'; diff --git a/api_docs/kbn_user_profile_components.mdx b/api_docs/kbn_user_profile_components.mdx index 0396c24bc40e..321db07786d4 100644 --- a/api_docs/kbn_user_profile_components.mdx +++ b/api_docs/kbn_user_profile_components.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-user-profile-components title: "@kbn/user-profile-components" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/user-profile-components plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/user-profile-components'] --- import kbnUserProfileComponentsObj from './kbn_user_profile_components.devdocs.json'; diff --git a/api_docs/kbn_utility_types.mdx b/api_docs/kbn_utility_types.mdx index de93a8fe050a..59733af69605 100644 --- a/api_docs/kbn_utility_types.mdx +++ b/api_docs/kbn_utility_types.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-utility-types title: "@kbn/utility-types" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/utility-types plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/utility-types'] --- import kbnUtilityTypesObj from './kbn_utility_types.devdocs.json'; diff --git a/api_docs/kbn_utility_types_jest.mdx b/api_docs/kbn_utility_types_jest.mdx index fe8d933d19a3..d34f5eb451f6 100644 --- a/api_docs/kbn_utility_types_jest.mdx +++ b/api_docs/kbn_utility_types_jest.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-utility-types-jest title: "@kbn/utility-types-jest" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/utility-types-jest plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/utility-types-jest'] --- import kbnUtilityTypesJestObj from './kbn_utility_types_jest.devdocs.json'; diff --git a/api_docs/kbn_utils.mdx b/api_docs/kbn_utils.mdx index e9e1e8d327df..3301abb7449f 100644 --- a/api_docs/kbn_utils.mdx +++ b/api_docs/kbn_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-utils title: "@kbn/utils" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/utils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/utils'] --- import kbnUtilsObj from './kbn_utils.devdocs.json'; diff --git a/api_docs/kbn_yarn_lock_validator.mdx b/api_docs/kbn_yarn_lock_validator.mdx index 96ce8b5f78b1..7aba97a043a2 100644 --- a/api_docs/kbn_yarn_lock_validator.mdx +++ b/api_docs/kbn_yarn_lock_validator.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kbn-yarn-lock-validator title: "@kbn/yarn-lock-validator" image: https://source.unsplash.com/400x175/?github description: API docs for the @kbn/yarn-lock-validator plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/yarn-lock-validator'] --- import kbnYarnLockValidatorObj from './kbn_yarn_lock_validator.devdocs.json'; diff --git a/api_docs/kibana_overview.mdx b/api_docs/kibana_overview.mdx index 2a28c3743374..99437dfa2d79 100644 --- a/api_docs/kibana_overview.mdx +++ b/api_docs/kibana_overview.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kibanaOverview title: "kibanaOverview" image: https://source.unsplash.com/400x175/?github description: API docs for the kibanaOverview plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'kibanaOverview'] --- import kibanaOverviewObj from './kibana_overview.devdocs.json'; diff --git a/api_docs/kibana_react.mdx b/api_docs/kibana_react.mdx index 7ab80f87e401..b563f5461da0 100644 --- a/api_docs/kibana_react.mdx +++ b/api_docs/kibana_react.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kibanaReact title: "kibanaReact" image: https://source.unsplash.com/400x175/?github description: API docs for the kibanaReact plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'kibanaReact'] --- import kibanaReactObj from './kibana_react.devdocs.json'; diff --git a/api_docs/kibana_utils.mdx b/api_docs/kibana_utils.mdx index 21d349683d8e..5bb528b47021 100644 --- a/api_docs/kibana_utils.mdx +++ b/api_docs/kibana_utils.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kibanaUtils title: "kibanaUtils" image: https://source.unsplash.com/400x175/?github description: API docs for the kibanaUtils plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'kibanaUtils'] --- import kibanaUtilsObj from './kibana_utils.devdocs.json'; diff --git a/api_docs/kubernetes_security.mdx b/api_docs/kubernetes_security.mdx index b7d40f28432a..b08fc593fdcc 100644 --- a/api_docs/kubernetes_security.mdx +++ b/api_docs/kubernetes_security.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/kubernetesSecurity title: "kubernetesSecurity" image: https://source.unsplash.com/400x175/?github description: API docs for the kubernetesSecurity plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'kubernetesSecurity'] --- import kubernetesSecurityObj from './kubernetes_security.devdocs.json'; diff --git a/api_docs/lens.devdocs.json b/api_docs/lens.devdocs.json index 4d4561547ed2..d29c21bc24d3 100644 --- a/api_docs/lens.devdocs.json +++ b/api_docs/lens.devdocs.json @@ -4254,6 +4254,53 @@ ], "returnComment": [] }, + { + "parentPluginId": "lens", + "id": "def-public.Visualization.getUsedDataView", + "type": "Function", + "tags": [], + "label": "getUsedDataView", + "description": [], + "signature": [ + "((state: T, layerId: string) => string | undefined) | undefined" + ], + "path": "x-pack/plugins/lens/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "lens", + "id": "def-public.Visualization.getUsedDataView.$1", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "T" + ], + "path": "x-pack/plugins/lens/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + }, + { + "parentPluginId": "lens", + "id": "def-public.Visualization.getUsedDataView.$2", + "type": "string", + "tags": [], + "label": "layerId", + "description": [], + "signature": [ + "string" + ], + "path": "x-pack/plugins/lens/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] + }, { "parentPluginId": "lens", "id": "def-public.Visualization.getUsedDataViews", @@ -4532,7 +4579,15 @@ }, " | ", "VisualizeEditorContext", - " | undefined) => T) | undefined" + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.Configuration", + "text": "Configuration" + }, + "> | undefined) => T) | undefined" ], "path": "x-pack/plugins/lens/public/types.ts", "deprecated": false, @@ -4586,7 +4641,15 @@ }, " | ", "VisualizeEditorContext", - " | undefined" + "<", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.Configuration", + "text": "Configuration" + }, + "> | undefined" ], "path": "x-pack/plugins/lens/public/types.ts", "deprecated": false, @@ -4978,13 +5041,84 @@ ], "returnComment": [] }, + { + "parentPluginId": "lens", + "id": "def-public.Visualization.getSupportedActionsForLayer", + "type": "Function", + "tags": [], + "label": "getSupportedActionsForLayer", + "description": [ + "\nreturns a list of custom actions supported by the visualization layer.\nDefault actions like delete/clear are not included in this list and are managed by the editor frame" + ], + "signature": [ + "((layerId: string, state: T, setState: ", + "StateSetter", + ") => ", + "LayerAction", + "[]) | undefined" + ], + "path": "x-pack/plugins/lens/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "lens", + "id": "def-public.Visualization.getSupportedActionsForLayer.$1", + "type": "string", + "tags": [], + "label": "layerId", + "description": [], + "signature": [ + "string" + ], + "path": "x-pack/plugins/lens/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + }, + { + "parentPluginId": "lens", + "id": "def-public.Visualization.getSupportedActionsForLayer.$2", + "type": "Uncategorized", + "tags": [], + "label": "state", + "description": [], + "signature": [ + "T" + ], + "path": "x-pack/plugins/lens/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + }, + { + "parentPluginId": "lens", + "id": "def-public.Visualization.getSupportedActionsForLayer.$3", + "type": "Function", + "tags": [], + "label": "setState", + "description": [], + "signature": [ + "StateSetter", + "" + ], + "path": "x-pack/plugins/lens/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] + }, { "parentPluginId": "lens", "id": "def-public.Visualization.getLayerType", "type": "Function", "tags": [], "label": "getLayerType", - "description": [], + "description": [ + "returns the type string of the given layer" + ], "signature": [ "(layerId: string, state?: T | undefined) => ", { @@ -5478,6 +5612,43 @@ ], "returnComment": [] }, + { + "parentPluginId": "lens", + "id": "def-public.Visualization.getDropProps", + "type": "Function", + "tags": [], + "label": "getDropProps", + "description": [], + "signature": [ + "((dropProps: ", + "GetDropPropsArgs", + ") => { dropTypes: ", + "DropType", + "[]; nextLabel?: string | undefined; } | undefined) | undefined" + ], + "path": "x-pack/plugins/lens/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "lens", + "id": "def-public.Visualization.getDropProps.$1", + "type": "Object", + "tags": [], + "label": "dropProps", + "description": [], + "signature": [ + "GetDropPropsArgs", + "" + ], + "path": "x-pack/plugins/lens/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] + }, { "parentPluginId": "lens", "id": "def-public.Visualization.renderDimensionEditor", @@ -6415,7 +6586,7 @@ "signature": [ "((props: VisualizationStateFromContextChangeProps) => ", "Suggestion", - ") | undefined" + " | undefined) | undefined" ], "path": "x-pack/plugins/lens/public/types.ts", "deprecated": false, diff --git a/api_docs/lens.mdx b/api_docs/lens.mdx index 0cb5e40b3b4c..ee26d7bf7b87 100644 --- a/api_docs/lens.mdx +++ b/api_docs/lens.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/lens title: "lens" image: https://source.unsplash.com/400x175/?github description: API docs for the lens plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'lens'] --- import lensObj from './lens.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 649 | 0 | 560 | 42 | +| 658 | 0 | 567 | 45 | ## Client diff --git a/api_docs/license_api_guard.mdx b/api_docs/license_api_guard.mdx index 63d15a7c4065..f3039f89e8db 100644 --- a/api_docs/license_api_guard.mdx +++ b/api_docs/license_api_guard.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/licenseApiGuard title: "licenseApiGuard" image: https://source.unsplash.com/400x175/?github description: API docs for the licenseApiGuard plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'licenseApiGuard'] --- import licenseApiGuardObj from './license_api_guard.devdocs.json'; diff --git a/api_docs/license_management.mdx b/api_docs/license_management.mdx index 88e17bcee6fe..a2bbb989390e 100644 --- a/api_docs/license_management.mdx +++ b/api_docs/license_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/licenseManagement title: "licenseManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the licenseManagement plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'licenseManagement'] --- import licenseManagementObj from './license_management.devdocs.json'; diff --git a/api_docs/licensing.mdx b/api_docs/licensing.mdx index c7000d51761c..a1ea39b243d1 100644 --- a/api_docs/licensing.mdx +++ b/api_docs/licensing.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/licensing title: "licensing" image: https://source.unsplash.com/400x175/?github description: API docs for the licensing plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'licensing'] --- import licensingObj from './licensing.devdocs.json'; diff --git a/api_docs/lists.mdx b/api_docs/lists.mdx index 9deb279fb73b..167f95ca81b4 100644 --- a/api_docs/lists.mdx +++ b/api_docs/lists.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/lists title: "lists" image: https://source.unsplash.com/400x175/?github description: API docs for the lists plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'lists'] --- import listsObj from './lists.devdocs.json'; diff --git a/api_docs/management.mdx b/api_docs/management.mdx index 2cec82774807..7b13b081164f 100644 --- a/api_docs/management.mdx +++ b/api_docs/management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/management title: "management" image: https://source.unsplash.com/400x175/?github description: API docs for the management plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'management'] --- import managementObj from './management.devdocs.json'; diff --git a/api_docs/maps.mdx b/api_docs/maps.mdx index 2667e8f19bae..84567432aed6 100644 --- a/api_docs/maps.mdx +++ b/api_docs/maps.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/maps title: "maps" image: https://source.unsplash.com/400x175/?github description: API docs for the maps plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'maps'] --- import mapsObj from './maps.devdocs.json'; diff --git a/api_docs/maps_ems.mdx b/api_docs/maps_ems.mdx index 558352f89505..7e0c0528fef4 100644 --- a/api_docs/maps_ems.mdx +++ b/api_docs/maps_ems.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/mapsEms title: "mapsEms" image: https://source.unsplash.com/400x175/?github description: API docs for the mapsEms plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'mapsEms'] --- import mapsEmsObj from './maps_ems.devdocs.json'; diff --git a/api_docs/ml.mdx b/api_docs/ml.mdx index b1abe52cefe1..a7a7a0517b9b 100644 --- a/api_docs/ml.mdx +++ b/api_docs/ml.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/ml title: "ml" image: https://source.unsplash.com/400x175/?github description: API docs for the ml plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ml'] --- import mlObj from './ml.devdocs.json'; diff --git a/api_docs/monitoring.mdx b/api_docs/monitoring.mdx index b9332eb4163e..e884c213dddb 100644 --- a/api_docs/monitoring.mdx +++ b/api_docs/monitoring.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/monitoring title: "monitoring" image: https://source.unsplash.com/400x175/?github description: API docs for the monitoring plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'monitoring'] --- import monitoringObj from './monitoring.devdocs.json'; diff --git a/api_docs/monitoring_collection.mdx b/api_docs/monitoring_collection.mdx index 23c398899ccb..37856b288370 100644 --- a/api_docs/monitoring_collection.mdx +++ b/api_docs/monitoring_collection.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/monitoringCollection title: "monitoringCollection" image: https://source.unsplash.com/400x175/?github description: API docs for the monitoringCollection plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'monitoringCollection'] --- import monitoringCollectionObj from './monitoring_collection.devdocs.json'; diff --git a/api_docs/navigation.mdx b/api_docs/navigation.mdx index bfa907ab0926..283d52b0a4c3 100644 --- a/api_docs/navigation.mdx +++ b/api_docs/navigation.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/navigation title: "navigation" image: https://source.unsplash.com/400x175/?github description: API docs for the navigation plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'navigation'] --- import navigationObj from './navigation.devdocs.json'; diff --git a/api_docs/newsfeed.mdx b/api_docs/newsfeed.mdx index 4336085d004c..278b15e23d47 100644 --- a/api_docs/newsfeed.mdx +++ b/api_docs/newsfeed.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/newsfeed title: "newsfeed" image: https://source.unsplash.com/400x175/?github description: API docs for the newsfeed plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'newsfeed'] --- import newsfeedObj from './newsfeed.devdocs.json'; diff --git a/api_docs/observability.mdx b/api_docs/observability.mdx index db3f0906e614..2f29ba44a8c0 100644 --- a/api_docs/observability.mdx +++ b/api_docs/observability.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/observability title: "observability" image: https://source.unsplash.com/400x175/?github description: API docs for the observability plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'observability'] --- import observabilityObj from './observability.devdocs.json'; diff --git a/api_docs/osquery.mdx b/api_docs/osquery.mdx index c569e301708d..5b05f78a15a0 100644 --- a/api_docs/osquery.mdx +++ b/api_docs/osquery.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/osquery title: "osquery" image: https://source.unsplash.com/400x175/?github description: API docs for the osquery plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'osquery'] --- import osqueryObj from './osquery.devdocs.json'; diff --git a/api_docs/plugin_directory.mdx b/api_docs/plugin_directory.mdx index 568f38705df0..b6b1d856686d 100644 --- a/api_docs/plugin_directory.mdx +++ b/api_docs/plugin_directory.mdx @@ -7,7 +7,7 @@ id: kibDevDocsPluginDirectory slug: /kibana-dev-docs/api-meta/plugin-api-directory title: Directory description: Directory of public APIs available through plugins or packages. -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- @@ -21,7 +21,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | API Count | Any Count | Missing comments | Missing exports | |--------------|----------|-----------------|--------| -| 31953 | 179 | 21502 | 1003 | +| 32016 | 179 | 21562 | 1007 | ## Plugin Directory @@ -51,7 +51,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | This plugin provides the ability to create data views via a modal flyout inside Kibana apps | 15 | 0 | 7 | 0 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Reusable data view field editor across Kibana | 60 | 0 | 30 | 0 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Data view management app | 2 | 0 | 2 | 0 | -| | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Data services are useful for searching and querying data from Elasticsearch. Helpful utilities include: a re-usable react query bar, KQL autocomplete, async search, Data Views (Index Patterns) and field formatters. | 966 | 0 | 208 | 1 | +| | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Data services are useful for searching and querying data from Elasticsearch. Helpful utilities include: a re-usable react query bar, KQL autocomplete, async search, Data Views (Index Patterns) and field formatters. | 983 | 0 | 225 | 2 | | | [Machine Learning UI](https://github.com/orgs/elastic/teams/ml-ui) | The Data Visualizer tools help you understand your data, by analyzing the metrics and fields in a log file or an existing Elasticsearch index. | 28 | 3 | 24 | 1 | | | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 10 | 0 | 8 | 2 | | | [Data Discovery](https://github.com/orgs/elastic/teams/kibana-data-discovery) | This plugin contains the Discover application and the saved search embeddable. | 97 | 0 | 80 | 4 | @@ -81,7 +81,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Index pattern fields and ambiguous values formatters | 288 | 5 | 249 | 3 | | | [Machine Learning UI](https://github.com/orgs/elastic/teams/ml-ui) | The file upload plugin contains components and services for uploading a file, analyzing its data, and then importing the data into an Elasticsearch index. Supported file types include CSV, TSV, newline-delimited JSON and GeoJSON. | 62 | 0 | 62 | 2 | | | [@elastic/kibana-app-services](https://github.com/orgs/elastic/teams/team:AppServicesUx) | File upload, download, sharing, and serving over HTTP implementation in Kibana. | 263 | 0 | 14 | 2 | -| | [Fleet](https://github.com/orgs/elastic/teams/fleet) | - | 996 | 3 | 893 | 17 | +| | [Fleet](https://github.com/orgs/elastic/teams/fleet) | - | 997 | 3 | 893 | 17 | | | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 68 | 0 | 14 | 5 | | globalSearchBar | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 0 | 0 | 0 | 0 | | globalSearchProviders | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 0 | 0 | 0 | 0 | @@ -101,7 +101,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | kibanaUsageCollection | [Kibana Telemetry](https://github.com/orgs/elastic/teams/kibana-telemetry) | - | 0 | 0 | 0 | 0 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | - | 615 | 3 | 418 | 9 | | | [Security Team](https://github.com/orgs/elastic/teams/security-team) | - | 3 | 0 | 3 | 1 | -| | [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | Visualization editor allowing to quickly and easily configure compelling visualizations to use on dashboards and canvas workpads. Exposes components to embed visualizations and link into the Lens editor from within other apps in Kibana. | 649 | 0 | 560 | 42 | +| | [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | Visualization editor allowing to quickly and easily configure compelling visualizations to use on dashboards and canvas workpads. Exposes components to embed visualizations and link into the Lens editor from within other apps in Kibana. | 658 | 0 | 567 | 45 | | | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 8 | 0 | 8 | 0 | | | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 3 | 0 | 3 | 0 | | | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 117 | 0 | 42 | 10 | @@ -153,10 +153,10 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [Machine Learning UI](https://github.com/orgs/elastic/teams/ml-ui) | This plugin provides access to the transforms features provided by Elastic. Transforms enable you to convert existing Elasticsearch indices into summarized indices, which provide opportunities for new insights and analytics. | 4 | 0 | 4 | 1 | | translations | [Kibana Localization](https://github.com/orgs/elastic/teams/kibana-localization) | - | 0 | 0 | 0 | 0 | | | [Response Ops](https://github.com/orgs/elastic/teams/response-ops) | - | 512 | 1 | 485 | 48 | -| | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Adds UI Actions service to Kibana | 132 | 0 | 91 | 11 | +| | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Adds UI Actions service to Kibana | 133 | 0 | 92 | 11 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Extends UI Actions plugin with more functionality | 206 | 0 | 142 | 9 | | | [Data Discovery](https://github.com/orgs/elastic/teams/kibana-data-discovery) | Contains functionality for the field list which can be integrated into apps | 61 | 0 | 59 | 2 | -| | [Unified Search](https://github.com/orgs/elastic/teams/kibana-app-services) | Contains all the key functionality of Kibana's unified search experience.Contains all the key functionality of Kibana's unified search experience. | 125 | 2 | 99 | 17 | +| | [Unified Search](https://github.com/orgs/elastic/teams/kibana-app-services) | Contains all the key functionality of Kibana's unified search experience.Contains all the key functionality of Kibana's unified search experience. | 128 | 2 | 102 | 17 | | upgradeAssistant | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 0 | 0 | 0 | 0 | | urlDrilldown | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Adds drilldown implementations to Kibana | 0 | 0 | 0 | 0 | | | [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | - | 12 | 0 | 12 | 0 | @@ -175,7 +175,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | Registers the vega visualization. Is the elastic version of vega and vega-lite libraries. | 2 | 0 | 2 | 0 | | | [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | Contains the vislib visualizations. These are the classical area/line/bar, pie, gauge/goal and heatmap charts. We want to replace them with elastic-charts. | 26 | 0 | 25 | 1 | | | [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | Contains the new xy-axis chart using the elastic-charts library, which will eventually replace the vislib xy-axis charts including bar, area, and line. | 53 | 0 | 50 | 5 | -| | [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | Contains the shared architecture among all the legacy visualizations, e.g. the visualization type registry or the visualization embeddable. | 693 | 12 | 663 | 18 | +| | [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | Contains the shared architecture among all the legacy visualizations, e.g. the visualization type registry or the visualization embeddable. | 725 | 12 | 695 | 18 | | watcher | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 0 | 0 | 0 | 0 | ## Package Directory diff --git a/api_docs/presentation_util.mdx b/api_docs/presentation_util.mdx index 099351a2d0f2..f9b349676713 100644 --- a/api_docs/presentation_util.mdx +++ b/api_docs/presentation_util.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/presentationUtil title: "presentationUtil" image: https://source.unsplash.com/400x175/?github description: API docs for the presentationUtil plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'presentationUtil'] --- import presentationUtilObj from './presentation_util.devdocs.json'; diff --git a/api_docs/profiling.mdx b/api_docs/profiling.mdx index 2ef17ce2192f..489f7c32b600 100644 --- a/api_docs/profiling.mdx +++ b/api_docs/profiling.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/profiling title: "profiling" image: https://source.unsplash.com/400x175/?github description: API docs for the profiling plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'profiling'] --- import profilingObj from './profiling.devdocs.json'; diff --git a/api_docs/remote_clusters.mdx b/api_docs/remote_clusters.mdx index 8a248f78f1fa..6a8252bfebe7 100644 --- a/api_docs/remote_clusters.mdx +++ b/api_docs/remote_clusters.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/remoteClusters title: "remoteClusters" image: https://source.unsplash.com/400x175/?github description: API docs for the remoteClusters plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'remoteClusters'] --- import remoteClustersObj from './remote_clusters.devdocs.json'; diff --git a/api_docs/reporting.mdx b/api_docs/reporting.mdx index 9589edc812df..fbdfd3cb5bd0 100644 --- a/api_docs/reporting.mdx +++ b/api_docs/reporting.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/reporting title: "reporting" image: https://source.unsplash.com/400x175/?github description: API docs for the reporting plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'reporting'] --- import reportingObj from './reporting.devdocs.json'; diff --git a/api_docs/rollup.mdx b/api_docs/rollup.mdx index 1964dc994cd2..11313a6dc5f2 100644 --- a/api_docs/rollup.mdx +++ b/api_docs/rollup.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/rollup title: "rollup" image: https://source.unsplash.com/400x175/?github description: API docs for the rollup plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'rollup'] --- import rollupObj from './rollup.devdocs.json'; diff --git a/api_docs/rule_registry.mdx b/api_docs/rule_registry.mdx index d4539ef64efa..3ac4843ea417 100644 --- a/api_docs/rule_registry.mdx +++ b/api_docs/rule_registry.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/ruleRegistry title: "ruleRegistry" image: https://source.unsplash.com/400x175/?github description: API docs for the ruleRegistry plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ruleRegistry'] --- import ruleRegistryObj from './rule_registry.devdocs.json'; diff --git a/api_docs/runtime_fields.mdx b/api_docs/runtime_fields.mdx index 8112f8684b55..17f5b0c7f230 100644 --- a/api_docs/runtime_fields.mdx +++ b/api_docs/runtime_fields.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/runtimeFields title: "runtimeFields" image: https://source.unsplash.com/400x175/?github description: API docs for the runtimeFields plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'runtimeFields'] --- import runtimeFieldsObj from './runtime_fields.devdocs.json'; diff --git a/api_docs/saved_objects.mdx b/api_docs/saved_objects.mdx index 613f942ef906..5063707c3abd 100644 --- a/api_docs/saved_objects.mdx +++ b/api_docs/saved_objects.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjects title: "savedObjects" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjects plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjects'] --- import savedObjectsObj from './saved_objects.devdocs.json'; diff --git a/api_docs/saved_objects_finder.mdx b/api_docs/saved_objects_finder.mdx index 23cf7d31ca48..53186cbce436 100644 --- a/api_docs/saved_objects_finder.mdx +++ b/api_docs/saved_objects_finder.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjectsFinder title: "savedObjectsFinder" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjectsFinder plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjectsFinder'] --- import savedObjectsFinderObj from './saved_objects_finder.devdocs.json'; diff --git a/api_docs/saved_objects_management.mdx b/api_docs/saved_objects_management.mdx index c9cc4aa61ea7..0032f71ba648 100644 --- a/api_docs/saved_objects_management.mdx +++ b/api_docs/saved_objects_management.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjectsManagement title: "savedObjectsManagement" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjectsManagement plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjectsManagement'] --- import savedObjectsManagementObj from './saved_objects_management.devdocs.json'; diff --git a/api_docs/saved_objects_tagging.mdx b/api_docs/saved_objects_tagging.mdx index 1450399aefd8..b3c954d358cb 100644 --- a/api_docs/saved_objects_tagging.mdx +++ b/api_docs/saved_objects_tagging.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjectsTagging title: "savedObjectsTagging" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjectsTagging plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjectsTagging'] --- import savedObjectsTaggingObj from './saved_objects_tagging.devdocs.json'; diff --git a/api_docs/saved_objects_tagging_oss.mdx b/api_docs/saved_objects_tagging_oss.mdx index 1ed5aa9d511e..280c60872da7 100644 --- a/api_docs/saved_objects_tagging_oss.mdx +++ b/api_docs/saved_objects_tagging_oss.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedObjectsTaggingOss title: "savedObjectsTaggingOss" image: https://source.unsplash.com/400x175/?github description: API docs for the savedObjectsTaggingOss plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjectsTaggingOss'] --- import savedObjectsTaggingOssObj from './saved_objects_tagging_oss.devdocs.json'; diff --git a/api_docs/saved_search.mdx b/api_docs/saved_search.mdx index 6c1900781f66..eac6e8187a83 100644 --- a/api_docs/saved_search.mdx +++ b/api_docs/saved_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/savedSearch title: "savedSearch" image: https://source.unsplash.com/400x175/?github description: API docs for the savedSearch plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedSearch'] --- import savedSearchObj from './saved_search.devdocs.json'; diff --git a/api_docs/screenshot_mode.mdx b/api_docs/screenshot_mode.mdx index 883f8e26e2cc..50deed0a47fd 100644 --- a/api_docs/screenshot_mode.mdx +++ b/api_docs/screenshot_mode.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/screenshotMode title: "screenshotMode" image: https://source.unsplash.com/400x175/?github description: API docs for the screenshotMode plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'screenshotMode'] --- import screenshotModeObj from './screenshot_mode.devdocs.json'; diff --git a/api_docs/screenshotting.mdx b/api_docs/screenshotting.mdx index df0feab2c445..64b2f1e872dd 100644 --- a/api_docs/screenshotting.mdx +++ b/api_docs/screenshotting.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/screenshotting title: "screenshotting" image: https://source.unsplash.com/400x175/?github description: API docs for the screenshotting plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'screenshotting'] --- import screenshottingObj from './screenshotting.devdocs.json'; diff --git a/api_docs/security.mdx b/api_docs/security.mdx index 814d0173f69c..b62b787d9d0e 100644 --- a/api_docs/security.mdx +++ b/api_docs/security.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/security title: "security" image: https://source.unsplash.com/400x175/?github description: API docs for the security plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'security'] --- import securityObj from './security.devdocs.json'; diff --git a/api_docs/security_solution.mdx b/api_docs/security_solution.mdx index a86c48a48dfc..088b9d7a12e2 100644 --- a/api_docs/security_solution.mdx +++ b/api_docs/security_solution.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/securitySolution title: "securitySolution" image: https://source.unsplash.com/400x175/?github description: API docs for the securitySolution plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'securitySolution'] --- import securitySolutionObj from './security_solution.devdocs.json'; diff --git a/api_docs/session_view.mdx b/api_docs/session_view.mdx index 66978ad664e0..eaddd45f9b77 100644 --- a/api_docs/session_view.mdx +++ b/api_docs/session_view.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/sessionView title: "sessionView" image: https://source.unsplash.com/400x175/?github description: API docs for the sessionView plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'sessionView'] --- import sessionViewObj from './session_view.devdocs.json'; diff --git a/api_docs/share.mdx b/api_docs/share.mdx index 0086ad02ab5a..c6ba8145d4c6 100644 --- a/api_docs/share.mdx +++ b/api_docs/share.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/share title: "share" image: https://source.unsplash.com/400x175/?github description: API docs for the share plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'share'] --- import shareObj from './share.devdocs.json'; diff --git a/api_docs/snapshot_restore.mdx b/api_docs/snapshot_restore.mdx index 7bce31d6e183..daaaceba668b 100644 --- a/api_docs/snapshot_restore.mdx +++ b/api_docs/snapshot_restore.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/snapshotRestore title: "snapshotRestore" image: https://source.unsplash.com/400x175/?github description: API docs for the snapshotRestore plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'snapshotRestore'] --- import snapshotRestoreObj from './snapshot_restore.devdocs.json'; diff --git a/api_docs/spaces.mdx b/api_docs/spaces.mdx index decf22f6da09..1196b40d5c3b 100644 --- a/api_docs/spaces.mdx +++ b/api_docs/spaces.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/spaces title: "spaces" image: https://source.unsplash.com/400x175/?github description: API docs for the spaces plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'spaces'] --- import spacesObj from './spaces.devdocs.json'; diff --git a/api_docs/stack_alerts.mdx b/api_docs/stack_alerts.mdx index e68ecfcdfb99..fdd5dfbc025b 100644 --- a/api_docs/stack_alerts.mdx +++ b/api_docs/stack_alerts.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/stackAlerts title: "stackAlerts" image: https://source.unsplash.com/400x175/?github description: API docs for the stackAlerts plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'stackAlerts'] --- import stackAlertsObj from './stack_alerts.devdocs.json'; diff --git a/api_docs/stack_connectors.mdx b/api_docs/stack_connectors.mdx index 5363b913fbe0..89056c9ebd08 100644 --- a/api_docs/stack_connectors.mdx +++ b/api_docs/stack_connectors.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/stackConnectors title: "stackConnectors" image: https://source.unsplash.com/400x175/?github description: API docs for the stackConnectors plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'stackConnectors'] --- import stackConnectorsObj from './stack_connectors.devdocs.json'; diff --git a/api_docs/task_manager.mdx b/api_docs/task_manager.mdx index 7377ef34d529..1b7e13dd4d65 100644 --- a/api_docs/task_manager.mdx +++ b/api_docs/task_manager.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/taskManager title: "taskManager" image: https://source.unsplash.com/400x175/?github description: API docs for the taskManager plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'taskManager'] --- import taskManagerObj from './task_manager.devdocs.json'; diff --git a/api_docs/telemetry.mdx b/api_docs/telemetry.mdx index 1a95f8384f24..8e865875b83f 100644 --- a/api_docs/telemetry.mdx +++ b/api_docs/telemetry.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/telemetry title: "telemetry" image: https://source.unsplash.com/400x175/?github description: API docs for the telemetry plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetry'] --- import telemetryObj from './telemetry.devdocs.json'; diff --git a/api_docs/telemetry_collection_manager.mdx b/api_docs/telemetry_collection_manager.mdx index 355a38255c9c..e5cbc94c567a 100644 --- a/api_docs/telemetry_collection_manager.mdx +++ b/api_docs/telemetry_collection_manager.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/telemetryCollectionManager title: "telemetryCollectionManager" image: https://source.unsplash.com/400x175/?github description: API docs for the telemetryCollectionManager plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetryCollectionManager'] --- import telemetryCollectionManagerObj from './telemetry_collection_manager.devdocs.json'; diff --git a/api_docs/telemetry_collection_xpack.mdx b/api_docs/telemetry_collection_xpack.mdx index e607fc3598bd..7b775d1ce3bc 100644 --- a/api_docs/telemetry_collection_xpack.mdx +++ b/api_docs/telemetry_collection_xpack.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/telemetryCollectionXpack title: "telemetryCollectionXpack" image: https://source.unsplash.com/400x175/?github description: API docs for the telemetryCollectionXpack plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetryCollectionXpack'] --- import telemetryCollectionXpackObj from './telemetry_collection_xpack.devdocs.json'; diff --git a/api_docs/telemetry_management_section.mdx b/api_docs/telemetry_management_section.mdx index f538309dd462..7312616ea8a6 100644 --- a/api_docs/telemetry_management_section.mdx +++ b/api_docs/telemetry_management_section.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/telemetryManagementSection title: "telemetryManagementSection" image: https://source.unsplash.com/400x175/?github description: API docs for the telemetryManagementSection plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetryManagementSection'] --- import telemetryManagementSectionObj from './telemetry_management_section.devdocs.json'; diff --git a/api_docs/threat_intelligence.mdx b/api_docs/threat_intelligence.mdx index bcebf8f8b934..4abe6fedf3bf 100644 --- a/api_docs/threat_intelligence.mdx +++ b/api_docs/threat_intelligence.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/threatIntelligence title: "threatIntelligence" image: https://source.unsplash.com/400x175/?github description: API docs for the threatIntelligence plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'threatIntelligence'] --- import threatIntelligenceObj from './threat_intelligence.devdocs.json'; diff --git a/api_docs/timelines.mdx b/api_docs/timelines.mdx index 7a96d016a99c..692501acd7de 100644 --- a/api_docs/timelines.mdx +++ b/api_docs/timelines.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/timelines title: "timelines" image: https://source.unsplash.com/400x175/?github description: API docs for the timelines plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'timelines'] --- import timelinesObj from './timelines.devdocs.json'; diff --git a/api_docs/transform.mdx b/api_docs/transform.mdx index 7d3c611c084b..9603096cd2b9 100644 --- a/api_docs/transform.mdx +++ b/api_docs/transform.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/transform title: "transform" image: https://source.unsplash.com/400x175/?github description: API docs for the transform plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'transform'] --- import transformObj from './transform.devdocs.json'; diff --git a/api_docs/triggers_actions_ui.mdx b/api_docs/triggers_actions_ui.mdx index e40b4b0c4d44..a9c60110ba13 100644 --- a/api_docs/triggers_actions_ui.mdx +++ b/api_docs/triggers_actions_ui.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/triggersActionsUi title: "triggersActionsUi" image: https://source.unsplash.com/400x175/?github description: API docs for the triggersActionsUi plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'triggersActionsUi'] --- import triggersActionsUiObj from './triggers_actions_ui.devdocs.json'; diff --git a/api_docs/ui_actions.devdocs.json b/api_docs/ui_actions.devdocs.json index 293aa53e4d80..d224e96cb9e8 100644 --- a/api_docs/ui_actions.devdocs.json +++ b/api_docs/ui_actions.devdocs.json @@ -2191,6 +2191,21 @@ "path": "src/plugins/ui_actions/public/types.ts", "deprecated": false, "trackAdoption": false + }, + { + "parentPluginId": "uiActions", + "id": "def-public.VisualizeFieldContext.query", + "type": "CompoundType", + "tags": [], + "label": "query", + "description": [], + "signature": [ + "AggregateQuery", + " | undefined" + ], + "path": "src/plugins/ui_actions/public/types.ts", + "deprecated": false, + "trackAdoption": false } ], "initialIsOpen": false diff --git a/api_docs/ui_actions.mdx b/api_docs/ui_actions.mdx index 9a4994646988..734e896cbdf2 100644 --- a/api_docs/ui_actions.mdx +++ b/api_docs/ui_actions.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/uiActions title: "uiActions" image: https://source.unsplash.com/400x175/?github description: API docs for the uiActions plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'uiActions'] --- import uiActionsObj from './ui_actions.devdocs.json'; @@ -21,7 +21,7 @@ Contact [App Services](https://github.com/orgs/elastic/teams/kibana-app-services | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 132 | 0 | 91 | 11 | +| 133 | 0 | 92 | 11 | ## Client diff --git a/api_docs/ui_actions_enhanced.mdx b/api_docs/ui_actions_enhanced.mdx index e1fd951d5e2a..5ac50aa29c08 100644 --- a/api_docs/ui_actions_enhanced.mdx +++ b/api_docs/ui_actions_enhanced.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/uiActionsEnhanced title: "uiActionsEnhanced" image: https://source.unsplash.com/400x175/?github description: API docs for the uiActionsEnhanced plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'uiActionsEnhanced'] --- import uiActionsEnhancedObj from './ui_actions_enhanced.devdocs.json'; diff --git a/api_docs/unified_field_list.mdx b/api_docs/unified_field_list.mdx index 254b1228a31f..2818641379fb 100644 --- a/api_docs/unified_field_list.mdx +++ b/api_docs/unified_field_list.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/unifiedFieldList title: "unifiedFieldList" image: https://source.unsplash.com/400x175/?github description: API docs for the unifiedFieldList plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'unifiedFieldList'] --- import unifiedFieldListObj from './unified_field_list.devdocs.json'; diff --git a/api_docs/unified_search.devdocs.json b/api_docs/unified_search.devdocs.json index 8a490ca91dd2..5678db92f00c 100644 --- a/api_docs/unified_search.devdocs.json +++ b/api_docs/unified_search.devdocs.json @@ -11,7 +11,7 @@ "label": "DataViewPicker", "description": [], "signature": [ - "({ isMissingCurrent, currentDataViewId, adHocDataViews, onChangeDataView, onAddField, onDataViewCreated, trigger, selectableProps, textBasedLanguages, onSaveTextLanguageQuery, onTextLangQuerySubmit, textBasedLanguage, isDisabled, }: ", + "({ isMissingCurrent, currentDataViewId, adHocDataViews, onChangeDataView, onAddField, onDataViewCreated, trigger, selectableProps, textBasedLanguages, onSaveTextLanguageQuery, onTextLangQuerySubmit, textBasedLanguage, onCreateDefaultAdHocDataView, isDisabled, }: ", "DataViewPickerPropsExtended", ") => JSX.Element" ], @@ -24,7 +24,7 @@ "id": "def-public.DataViewPicker.$1", "type": "Object", "tags": [], - "label": "{\n isMissingCurrent,\n currentDataViewId,\n adHocDataViews,\n onChangeDataView,\n onAddField,\n onDataViewCreated,\n trigger,\n selectableProps,\n textBasedLanguages,\n onSaveTextLanguageQuery,\n onTextLangQuerySubmit,\n textBasedLanguage,\n isDisabled,\n}", + "label": "{\n isMissingCurrent,\n currentDataViewId,\n adHocDataViews,\n onChangeDataView,\n onAddField,\n onDataViewCreated,\n trigger,\n selectableProps,\n textBasedLanguages,\n onSaveTextLanguageQuery,\n onTextLangQuerySubmit,\n textBasedLanguage,\n onCreateDefaultAdHocDataView,\n isDisabled,\n}", "description": [], "signature": [ "DataViewPickerPropsExtended" @@ -645,6 +645,38 @@ "children": [], "returnComment": [] }, + { + "parentPluginId": "unifiedSearch", + "id": "def-public.DataViewPickerProps.onCreateDefaultAdHocDataView", + "type": "Function", + "tags": [], + "label": "onCreateDefaultAdHocDataView", + "description": [], + "signature": [ + "((pattern: string) => void) | undefined" + ], + "path": "src/plugins/unified_search/public/dataview_picker/index.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "unifiedSearch", + "id": "def-public.DataViewPickerProps.onCreateDefaultAdHocDataView.$1", + "type": "string", + "tags": [], + "label": "pattern", + "description": [], + "signature": [ + "string" + ], + "path": "src/plugins/unified_search/public/dataview_picker/index.tsx", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] + }, { "parentPluginId": "unifiedSearch", "id": "def-public.DataViewPickerProps.textBasedLanguages", @@ -1058,6 +1090,26 @@ "deprecated": false, "trackAdoption": false }, + { + "parentPluginId": "unifiedSearch", + "id": "def-public.IUnifiedSearchPluginServices.dataViews", + "type": "Object", + "tags": [], + "label": "dataViews", + "description": [], + "signature": [ + { + "pluginId": "dataViews", + "scope": "public", + "docId": "kibDataViewsPluginApi", + "section": "def-public.DataViewsServicePublic", + "text": "DataViewsServicePublic" + } + ], + "path": "src/plugins/unified_search/public/types.ts", + "deprecated": false, + "trackAdoption": false + }, { "parentPluginId": "unifiedSearch", "id": "def-public.IUnifiedSearchPluginServices.usageCollection", diff --git a/api_docs/unified_search.mdx b/api_docs/unified_search.mdx index 5015d2debdc4..ed31e74c5d7e 100644 --- a/api_docs/unified_search.mdx +++ b/api_docs/unified_search.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/unifiedSearch title: "unifiedSearch" image: https://source.unsplash.com/400x175/?github description: API docs for the unifiedSearch plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'unifiedSearch'] --- import unifiedSearchObj from './unified_search.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Unified Search](https://github.com/orgs/elastic/teams/kibana-app-servic | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 125 | 2 | 99 | 17 | +| 128 | 2 | 102 | 17 | ## Client diff --git a/api_docs/unified_search_autocomplete.mdx b/api_docs/unified_search_autocomplete.mdx index 5a40018e6081..e75d86bbab21 100644 --- a/api_docs/unified_search_autocomplete.mdx +++ b/api_docs/unified_search_autocomplete.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/unifiedSearch-autocomplete title: "unifiedSearch.autocomplete" image: https://source.unsplash.com/400x175/?github description: API docs for the unifiedSearch.autocomplete plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'unifiedSearch.autocomplete'] --- import unifiedSearchAutocompleteObj from './unified_search_autocomplete.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Unified Search](https://github.com/orgs/elastic/teams/kibana-app-servic | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 125 | 2 | 99 | 17 | +| 128 | 2 | 102 | 17 | ## Client diff --git a/api_docs/url_forwarding.mdx b/api_docs/url_forwarding.mdx index f57d70892e70..0ac5762c42af 100644 --- a/api_docs/url_forwarding.mdx +++ b/api_docs/url_forwarding.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/urlForwarding title: "urlForwarding" image: https://source.unsplash.com/400x175/?github description: API docs for the urlForwarding plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'urlForwarding'] --- import urlForwardingObj from './url_forwarding.devdocs.json'; diff --git a/api_docs/usage_collection.mdx b/api_docs/usage_collection.mdx index f40f15636c94..b493774dc1eb 100644 --- a/api_docs/usage_collection.mdx +++ b/api_docs/usage_collection.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/usageCollection title: "usageCollection" image: https://source.unsplash.com/400x175/?github description: API docs for the usageCollection plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'usageCollection'] --- import usageCollectionObj from './usage_collection.devdocs.json'; diff --git a/api_docs/ux.mdx b/api_docs/ux.mdx index d462e4d19616..f3c60dc8b7b4 100644 --- a/api_docs/ux.mdx +++ b/api_docs/ux.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/ux title: "ux" image: https://source.unsplash.com/400x175/?github description: API docs for the ux plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'ux'] --- import uxObj from './ux.devdocs.json'; diff --git a/api_docs/vis_default_editor.mdx b/api_docs/vis_default_editor.mdx index 0b2993331260..ec4208a4a06d 100644 --- a/api_docs/vis_default_editor.mdx +++ b/api_docs/vis_default_editor.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visDefaultEditor title: "visDefaultEditor" image: https://source.unsplash.com/400x175/?github description: API docs for the visDefaultEditor plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visDefaultEditor'] --- import visDefaultEditorObj from './vis_default_editor.devdocs.json'; diff --git a/api_docs/vis_type_gauge.mdx b/api_docs/vis_type_gauge.mdx index cc20cda9db10..43f73daa0807 100644 --- a/api_docs/vis_type_gauge.mdx +++ b/api_docs/vis_type_gauge.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeGauge title: "visTypeGauge" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeGauge plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeGauge'] --- import visTypeGaugeObj from './vis_type_gauge.devdocs.json'; diff --git a/api_docs/vis_type_heatmap.mdx b/api_docs/vis_type_heatmap.mdx index 609c06b1a92c..d537797699ca 100644 --- a/api_docs/vis_type_heatmap.mdx +++ b/api_docs/vis_type_heatmap.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeHeatmap title: "visTypeHeatmap" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeHeatmap plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeHeatmap'] --- import visTypeHeatmapObj from './vis_type_heatmap.devdocs.json'; diff --git a/api_docs/vis_type_pie.mdx b/api_docs/vis_type_pie.mdx index 3f8c15b314a0..08324c72b813 100644 --- a/api_docs/vis_type_pie.mdx +++ b/api_docs/vis_type_pie.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypePie title: "visTypePie" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypePie plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypePie'] --- import visTypePieObj from './vis_type_pie.devdocs.json'; diff --git a/api_docs/vis_type_table.mdx b/api_docs/vis_type_table.mdx index 5aa2bd8b01f5..7d052e7dd40f 100644 --- a/api_docs/vis_type_table.mdx +++ b/api_docs/vis_type_table.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeTable title: "visTypeTable" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeTable plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeTable'] --- import visTypeTableObj from './vis_type_table.devdocs.json'; diff --git a/api_docs/vis_type_timelion.mdx b/api_docs/vis_type_timelion.mdx index 2219fc96f2e3..696edbd5d321 100644 --- a/api_docs/vis_type_timelion.mdx +++ b/api_docs/vis_type_timelion.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeTimelion title: "visTypeTimelion" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeTimelion plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeTimelion'] --- import visTypeTimelionObj from './vis_type_timelion.devdocs.json'; diff --git a/api_docs/vis_type_timeseries.mdx b/api_docs/vis_type_timeseries.mdx index 2608ea12c24f..ef87c344661e 100644 --- a/api_docs/vis_type_timeseries.mdx +++ b/api_docs/vis_type_timeseries.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeTimeseries title: "visTypeTimeseries" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeTimeseries plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeTimeseries'] --- import visTypeTimeseriesObj from './vis_type_timeseries.devdocs.json'; diff --git a/api_docs/vis_type_vega.mdx b/api_docs/vis_type_vega.mdx index e535d8ca970e..1a5a44160bf4 100644 --- a/api_docs/vis_type_vega.mdx +++ b/api_docs/vis_type_vega.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeVega title: "visTypeVega" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeVega plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeVega'] --- import visTypeVegaObj from './vis_type_vega.devdocs.json'; diff --git a/api_docs/vis_type_vislib.mdx b/api_docs/vis_type_vislib.mdx index c6bd5fba0b06..8651bb82ad81 100644 --- a/api_docs/vis_type_vislib.mdx +++ b/api_docs/vis_type_vislib.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeVislib title: "visTypeVislib" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeVislib plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeVislib'] --- import visTypeVislibObj from './vis_type_vislib.devdocs.json'; diff --git a/api_docs/vis_type_xy.mdx b/api_docs/vis_type_xy.mdx index 8caa2a67dab8..440839b51793 100644 --- a/api_docs/vis_type_xy.mdx +++ b/api_docs/vis_type_xy.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visTypeXy title: "visTypeXy" image: https://source.unsplash.com/400x175/?github description: API docs for the visTypeXy plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visTypeXy'] --- import visTypeXyObj from './vis_type_xy.devdocs.json'; diff --git a/api_docs/visualizations.devdocs.json b/api_docs/visualizations.devdocs.json index 95b3390b94ce..befca8a83486 100644 --- a/api_docs/visualizations.devdocs.json +++ b/api_docs/visualizations.devdocs.json @@ -9665,6 +9665,327 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState", + "type": "Interface", + "tags": [], + "label": "PartitionLayerState", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.layerId", + "type": "string", + "tags": [], + "label": "layerId", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.layerType", + "type": "CompoundType", + "tags": [], + "label": "layerType", + "description": [], + "signature": [ + "\"data\" | \"referenceLine\" | \"annotations\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.primaryGroups", + "type": "Array", + "tags": [], + "label": "primaryGroups", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.secondaryGroups", + "type": "Array", + "tags": [], + "label": "secondaryGroups", + "description": [], + "signature": [ + "string[] | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.metric", + "type": "string", + "tags": [], + "label": "metric", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.collapseFns", + "type": "Object", + "tags": [], + "label": "collapseFns", + "description": [], + "signature": [ + "Record | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.numberDisplay", + "type": "CompoundType", + "tags": [], + "label": "numberDisplay", + "description": [], + "signature": [ + "\"value\" | \"percent\" | \"hidden\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.categoryDisplay", + "type": "CompoundType", + "tags": [], + "label": "categoryDisplay", + "description": [], + "signature": [ + "\"default\" | \"hide\" | \"inside\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.legendDisplay", + "type": "CompoundType", + "tags": [], + "label": "legendDisplay", + "description": [], + "signature": [ + "\"default\" | \"hide\" | \"show\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.legendPosition", + "type": "CompoundType", + "tags": [], + "label": "legendPosition", + "description": [], + "signature": [ + "Position", + " | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.showValuesInLegend", + "type": "CompoundType", + "tags": [], + "label": "showValuesInLegend", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.nestedLegend", + "type": "CompoundType", + "tags": [], + "label": "nestedLegend", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.percentDecimals", + "type": "number", + "tags": [], + "label": "percentDecimals", + "description": [], + "signature": [ + "number | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.emptySizeRatio", + "type": "number", + "tags": [], + "label": "emptySizeRatio", + "description": [], + "signature": [ + "number | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.legendMaxLines", + "type": "number", + "tags": [], + "label": "legendMaxLines", + "description": [], + "signature": [ + "number | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.legendSize", + "type": "CompoundType", + "tags": [], + "label": "legendSize", + "description": [], + "signature": [ + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.LegendSize", + "text": "LegendSize" + }, + " | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionLayerState.truncateLegend", + "type": "CompoundType", + "tags": [], + "label": "truncateLegend", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionVisConfiguration", + "type": "Interface", + "tags": [], + "label": "PartitionVisConfiguration", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionVisConfiguration.shape", + "type": "CompoundType", + "tags": [], + "label": "shape", + "description": [], + "signature": [ + "\"pie\" | \"donut\" | \"treemap\" | \"mosaic\" | \"waffle\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionVisConfiguration.layers", + "type": "Array", + "tags": [], + "label": "layers", + "description": [], + "signature": [ + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.PartitionLayerState", + "text": "PartitionLayerState" + }, + "[]" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionVisConfiguration.palette", + "type": "Object", + "tags": [], + "label": "palette", + "description": [], + "signature": [ + "PaletteOutput", + "<{ [key: string]: unknown; }> | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "visualizations", "id": "def-common.PercentileParams", @@ -12007,6 +12328,21 @@ "trackAdoption": false, "initialIsOpen": false }, + { + "parentPluginId": "visualizations", + "id": "def-common.CategoryDisplayType", + "type": "Type", + "tags": [], + "label": "CategoryDisplayType", + "description": [], + "signature": [ + "\"default\" | \"hide\" | \"inside\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, { "parentPluginId": "visualizations", "id": "def-common.Column", @@ -12090,6 +12426,14 @@ "text": "TableVisConfiguration" }, " | ", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.PartitionVisConfiguration", + "text": "PartitionVisConfiguration" + }, + " | ", { "pluginId": "visualizations", "scope": "common", @@ -12532,6 +12876,36 @@ "trackAdoption": false, "initialIsOpen": false }, + { + "parentPluginId": "visualizations", + "id": "def-common.LayerType", + "type": "Type", + "tags": [], + "label": "LayerType", + "description": [], + "signature": [ + "\"data\" | \"referenceLine\" | \"annotations\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.LegendDisplayType", + "type": "Type", + "tags": [], + "label": "LegendDisplayType", + "description": [], + "signature": [ + "\"default\" | \"hide\" | \"show\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, { "parentPluginId": "visualizations", "id": "def-common.MaxColumn", @@ -12715,6 +13089,21 @@ "trackAdoption": false, "initialIsOpen": false }, + { + "parentPluginId": "visualizations", + "id": "def-common.NumberDisplayType", + "type": "Type", + "tags": [], + "label": "NumberDisplayType", + "description": [], + "signature": [ + "\"value\" | \"percent\" | \"hidden\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, { "parentPluginId": "visualizations", "id": "def-common.Operation", @@ -12760,6 +13149,21 @@ "trackAdoption": false, "initialIsOpen": false }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionChartType", + "type": "Type", + "tags": [], + "label": "PartitionChartType", + "description": [], + "signature": [ + "\"pie\" | \"donut\" | \"treemap\" | \"mosaic\" | \"waffle\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, { "parentPluginId": "visualizations", "id": "def-common.PercentileColumn", @@ -13210,6 +13614,21 @@ } ], "objects": [ + { + "parentPluginId": "visualizations", + "id": "def-common.CategoryDisplayTypes", + "type": "Object", + "tags": [], + "label": "CategoryDisplayTypes", + "description": [], + "signature": [ + "{ readonly DEFAULT: \"default\"; readonly INSIDE: \"inside\"; readonly HIDE: \"hide\"; }" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/constants.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, { "parentPluginId": "visualizations", "id": "def-common.FillTypes", @@ -13220,7 +13639,37 @@ "signature": [ "{ readonly NONE: \"none\"; readonly ABOVE: \"above\"; readonly BELOW: \"below\"; }" ], - "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "path": "src/plugins/visualizations/common/convert_to_lens/constants.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.LayerTypes", + "type": "Object", + "tags": [], + "label": "LayerTypes", + "description": [], + "signature": [ + "{ readonly DATA: \"data\"; readonly REFERENCELINE: \"referenceLine\"; readonly ANNOTATIONS: \"annotations\"; }" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/constants.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.LegendDisplayTypes", + "type": "Object", + "tags": [], + "label": "LegendDisplayTypes", + "description": [], + "signature": [ + "{ readonly DEFAULT: \"default\"; readonly SHOW: \"show\"; readonly HIDE: \"hide\"; }" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/constants.ts", "deprecated": false, "trackAdoption": false, "initialIsOpen": false @@ -13240,6 +13689,21 @@ "trackAdoption": false, "initialIsOpen": false }, + { + "parentPluginId": "visualizations", + "id": "def-common.NumberDisplayTypes", + "type": "Object", + "tags": [], + "label": "NumberDisplayTypes", + "description": [], + "signature": [ + "{ readonly HIDDEN: \"hidden\"; readonly PERCENT: \"percent\"; readonly VALUE: \"value\"; }" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/constants.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, { "parentPluginId": "visualizations", "id": "def-common.Operations", @@ -13285,6 +13749,21 @@ "trackAdoption": false, "initialIsOpen": false }, + { + "parentPluginId": "visualizations", + "id": "def-common.PartitionChartTypes", + "type": "Object", + "tags": [], + "label": "PartitionChartTypes", + "description": [], + "signature": [ + "{ readonly PIE: \"pie\"; readonly DONUT: \"donut\"; readonly TREEMAP: \"treemap\"; readonly MOSAIC: \"mosaic\"; readonly WAFFLE: \"waffle\"; }" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/constants.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, { "parentPluginId": "visualizations", "id": "def-common.RANGE_MODES", @@ -13310,7 +13789,7 @@ "signature": [ "{ readonly BAR: \"bar\"; readonly LINE: \"line\"; readonly AREA: \"area\"; readonly BAR_STACKED: \"bar_stacked\"; readonly AREA_STACKED: \"area_stacked\"; readonly BAR_HORIZONTAL: \"bar_horizontal\"; readonly BAR_PERCENTAGE_STACKED: \"bar_percentage_stacked\"; readonly BAR_HORIZONTAL_STACKED: \"bar_horizontal_stacked\"; readonly AREA_PERCENTAGE_STACKED: \"area_percentage_stacked\"; readonly BAR_HORIZONTAL_PERCENTAGE_STACKED: \"bar_horizontal_percentage_stacked\"; }" ], - "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "path": "src/plugins/visualizations/common/convert_to_lens/constants.ts", "deprecated": false, "trackAdoption": false, "initialIsOpen": false @@ -13325,7 +13804,7 @@ "signature": [ "{ readonly LINEAR: \"LINEAR\"; readonly CURVE_MONOTONE_X: \"CURVE_MONOTONE_X\"; readonly CURVE_STEP_AFTER: \"CURVE_STEP_AFTER\"; }" ], - "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "path": "src/plugins/visualizations/common/convert_to_lens/constants.ts", "deprecated": false, "trackAdoption": false, "initialIsOpen": false @@ -13340,7 +13819,7 @@ "signature": [ "{ readonly AUTO: \"auto\"; readonly LEFT: \"left\"; readonly RIGHT: \"right\"; readonly BOTTOM: \"bottom\"; }" ], - "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "path": "src/plugins/visualizations/common/convert_to_lens/constants.ts", "deprecated": false, "trackAdoption": false, "initialIsOpen": false diff --git a/api_docs/visualizations.mdx b/api_docs/visualizations.mdx index 6e29fc3d03f2..2edc6b736c5b 100644 --- a/api_docs/visualizations.mdx +++ b/api_docs/visualizations.mdx @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/visualizations title: "visualizations" image: https://source.unsplash.com/400x175/?github description: API docs for the visualizations plugin -date: 2022-09-29 +date: 2022-10-03 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'visualizations'] --- import visualizationsObj from './visualizations.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Vis Editors](https://github.com/orgs/elastic/teams/kibana-vis-editors) | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 693 | 12 | 663 | 18 | +| 725 | 12 | 695 | 18 | ## Client diff --git a/docs/api-generated/machine-learning/ml-apis.asciidoc b/docs/api-generated/machine-learning/ml-apis.asciidoc index 3482109d4ab3..60aff48267f0 100644 --- a/docs/api-generated/machine-learning/ml-apis.asciidoc +++ b/docs/api-generated/machine-learning/ml-apis.asciidoc @@ -1,4 +1,4 @@ -[[machine-learning-api]] +[[machine-learning-apis]] == Machine learning APIs preview::[] diff --git a/docs/api/machine-learning/ml_apis_v2_defs.asciidoc b/docs/api/machine-learning/ml_apis_v2_defs.asciidoc deleted file mode 100644 index 691557bfb963..000000000000 --- a/docs/api/machine-learning/ml_apis_v2_defs.asciidoc +++ /dev/null @@ -1,240 +0,0 @@ -[[Machine_learning_APIs-definitions]] -== Definitions - -* <> -* <> -* <> -* <> -* <> -* <> - -[[MLSyncResponse]] -=== `MLSyncResponse` - -The sync machine learning saved objects API returns this list of machine learning saved objects that required synchronization. - - -==== Properties - -`datafeedsAdded` (++map[string,++<>++]++):: -If a saved object for an anomaly detection job is missing a datafeed identifier, it is added when you run the sync machine learning saved objects API. - - -`datafeedsRemoved` (++map[string,++<>++]++):: -If a saved object for an anomaly detection job references a datafeed that no longer exists, it is deleted when you run the sync machine learning saved objects API. - - -`savedObjectsCreated` (<>):: -If saved objects are missing for machine learning jobs or trained models, they are created when you run the sync machine learning saved objects API. - - -`savedObjectsDeleted` (<>):: -If saved objects exist for machine learning jobs or trained models that no longer exist, they are deleted when you run the sync machine learning saved objects API. - - -==== Example - -[source,json] --------- -{ - "datafeedsAdded" : { - "some_property" : { - "success" : true - } - }, - "datafeedsRemoved" : { - "some_property" : { - "success" : true - } - }, - "savedObjectsCreated" : { - "anomaly-detector" : { - "some_property" : { - "success" : true - } - }, - "data-frame-analytics" : { - "some_property" : { - "success" : true - } - }, - "trained-model" : { - "some_property" : { - "success" : true - } - } - }, - "savedObjectsDeleted" : { - "anomaly-detector" : { - "some_property" : { - "success" : true - } - }, - "data-frame-analytics" : { - "some_property" : { - "success" : true - } - }, - "trained-model" : { - "some_property" : { - "success" : true - } - } - } -} - --------- - -[[MLSyncResponse-Datafeeds]] -=== `MLSyncResponse-Datafeeds` - -The sync machine learning saved objects API response contains this object when there are datafeeds affected by the synchronization. There is an object for each relevant datafeed, which contains the synchronization status. - - -==== Properties - -`success` (+boolean+):: -The success or failure of the synchronization. - - -==== Example - -[source,json] --------- -{ - "success" : true -} - --------- - -[[MLSyncResponse-Jobs]] -=== `MLSyncResponse-Jobs` - -The sync machine learning saved objects API response contains this object when there are machine learning jobs affected by the synchronization. There is an object for each relevant job, which contains the synchronization status. - - -==== Properties - -`success` (+boolean+):: -The success or failure of the synchronization. - - -==== Example - -[source,json] --------- -{ - "success" : true -} - --------- - -[[MLSyncResponse-Models]] -=== `MLSyncResponse-Models` - -The sync machine learning saved objects API response contains this object when there are trained models affected by the synchronization. There is an object for each relevant trained model, which contains the synchronization status. - - -==== Properties - -`success` (+boolean+):: -The success or failure of the synchronization. - - -==== Example - -[source,json] --------- -{ - "success" : true -} - --------- - -[[MLSyncResponse-SavedObjectsCreated]] -=== `MLSyncResponse-SavedObjectsCreated` - -If saved objects are missing for machine learning jobs or trained models, they are created when you run the sync machine learning saved objects API. - - -==== Properties - -`anomaly-detector` (++map[string,++<>++]++):: -This object is present if there are anomaly detection jobs affected by the synchronization. - - -`data-frame-analytics` (++map[string,++<>++]++):: -This object is present if there are data frame analytics jobs affected by the synchronization. - - -`trained-model` (++map[string,++<>++]++):: -This object is present if there are trained models affected by the synchronization. - - -==== Example - -[source,json] --------- -{ - "anomaly-detector" : { - "some_property" : { - "success" : true - } - }, - "data-frame-analytics" : { - "some_property" : { - "success" : true - } - }, - "trained-model" : { - "some_property" : { - "success" : true - } - } -} - --------- - -[[MLSyncResponse-SavedObjectsDeleted]] -=== `MLSyncResponse-SavedObjectsDeleted` - -If saved objects exist for machine learning jobs or trained models that no longer exist, they are deleted when you run the sync machine learning saved objects API. - - -==== Properties - -`anomaly-detector` (++map[string,++<>++]++):: -This object is present if there are anomaly detection jobs affected by the synchronization. - - -`data-frame-analytics` (++map[string,++<>++]++):: -This object is present if there are data frame analytics jobs affected by the synchronization. - - -`trained-model` (++map[string,++<>++]++):: -This object is present if there are trained models affected by the synchronization. - - -==== Example - -[source,json] --------- -{ - "anomaly-detector" : { - "some_property" : { - "success" : true - } - }, - "data-frame-analytics" : { - "some_property" : { - "success" : true - } - }, - "trained-model" : { - "some_property" : { - "success" : true - } - } -} - --------- diff --git a/docs/api/machine-learning/ml_apis_v2_docs.asciidoc b/docs/api/machine-learning/ml_apis_v2_docs.asciidoc deleted file mode 100644 index f4a01cad9420..000000000000 --- a/docs/api/machine-learning/ml_apis_v2_docs.asciidoc +++ /dev/null @@ -1,49 +0,0 @@ -[[Machine_learning_APIs]] -== Machine learning APIs - -* <> - -[[ml-sync]] -=== Sync machine learning objects - -Synchronizes Kibana saved objects for machine learning jobs and trained models. You must have `all` privileges for the *Machine Learning* feature in the *Analytics* section of the Kibana feature privileges. This API runs automatically when you start Kibana and periodically thereafter. - - -==== Request - -`GET /s/{spaceId}/api/ml/saved_objects/sync` - -==== Path parameters - -[options="header"] -|========== -|Name |Type |Required |Description -|`spaceId` |+string+ |Y |An identifier for the space. If you omit `/s/` and this identifier from the path, the default space is used. - -|========== -==== Query parameters - -[options="header"] -|========== -|Name |Type |Required |Description -|`simulate` |+boolean+; default: ++false++ |N |When true, simulates the synchronization by returning only the list actions that would be performed. - -|========== -==== Responses - -`200`:: -+ --- -(<>) - -Indicates a successful call. - --- - -==== Request example - -[source,json] --------- -curl -XGET https://localhost:5601/s/{spaceId}/api/ml/saved_objects/sync \ --u USER:PASSWORD --------- \ No newline at end of file diff --git a/docs/api/machine-learning/sync.asciidoc b/docs/api/machine-learning/sync.asciidoc new file mode 100644 index 000000000000..af4f797ade1f --- /dev/null +++ b/docs/api/machine-learning/sync.asciidoc @@ -0,0 +1,95 @@ +[[machine-learning-api-sync]] +=== Sync {ml} saved objects API +++++ +Sync {ml} saved objects +++++ + +Synchronizes {kib} saved objects for {ml} jobs and trained models. + +[NOTE] +==== +For the most up-to-date API details, refer to the +{kib-repo}/tree/{branch}/x-pack/plugins/ml/common/openapi[open API specification]. For a preview, check out <>. +==== + +[[machine-learning-api-sync-request]] +==== {api-request-title} + +`GET :/api/ml/saved_objects/sync` + +`GET :/s//api/ml/saved_objects/sync` + +[[machine-learning-api-sync-prereq]] +==== {api-prereq-title} + +You must have `all` privileges for the *Machine Learning* feature in the *Analytics* section of the +<>. + +[[machine-learning-api-sync-desc]] +==== {api-description-title} + +This API runs automatically when you start {kib} and periodically thereafter. + +[[machine-learning-api-sync-path-params]] +==== {api-path-parms-title} + +`space_id`:: +(Optional, string) An identifier for the space. If `space_id` is not provided in +the URL the default space is used. + +[[machine-learning-api-sync-query-params]] +==== {api-query-parms-title} + +`simulate`:: +(Optional, boolean) When `true`, simulates the synchronization by only returning +the list actions that _would_ be performed. + +[[machine-learning-api-sync-response-body]] +==== {api-response-body-title} + +`datafeedsAdded`:: +(array) If a saved object for an {anomaly-job} is missing a {dfeed} identifier, +it is added. This list contains the {dfeed} identifiers and indicates whether +the synchronization was successful. + +`datafeedsRemoved`:: +(array) If a saved object for an anomaly detection job references a datafeed +that no longer exists, it is deleted. This list contains the {dfeed} identifiers +and indicates whether the synchronization was successful. + +`savedObjectsCreated`:: +(array) If saved objects are missing for {ml} jobs or trained models, they are +created. This list contains the job and model identifiers and indicates whether +the synchronization was successful. + +`savedObjectsDeleted`:: +(array) If saved objects exist for {ml} jobs or trained models that no longer +exist, they are deleted. This list contains the job and model identifiers and +indicates whether the synchronization was successful. + +[[machine-learning-api-sync-codes]] +==== {api-response-codes-title} + +`200`:: + Indicates a successful call. + +[[machine-learning-api-sync-example]] +==== {api-examples-title} + +Retrieve the list of {ml} saved objects that require synchronization: + +[source,sh] +-------------------------------------------------- +GET api/ml/saved_objects/sync?simulate=true +-------------------------------------------------- +// KIBANA + +If there are two jobs that need to be synchronized, for example, the API returns +the following response: + +[source,sh] +-------------------------------------------------- +{"savedObjectsCreated":{"anomaly_detector":{"myjob1":{"success":true},"myjob2":{"success":true}}},"savedObjectsDeleted":{},"datafeedsAdded":{},"datafeedsRemoved":{}} +-------------------------------------------------- + +To perform the synchronization, re-run the API and omit the `simulate` parameter. \ No newline at end of file diff --git a/docs/osquery/images/live-query-check-results.png b/docs/osquery/images/live-query-check-results.png index cd1362e7e977..6b84a3bf9f7c 100644 Binary files a/docs/osquery/images/live-query-check-results.png and b/docs/osquery/images/live-query-check-results.png differ diff --git a/docs/osquery/osquery.asciidoc b/docs/osquery/osquery.asciidoc index 66edbc95526e..e854904b6baf 100644 --- a/docs/osquery/osquery.asciidoc +++ b/docs/osquery/osquery.asciidoc @@ -61,12 +61,11 @@ TIP: To save a single query for future use, click *Save for later* and define th [[osquery-view-history]] == View or rerun previous live queries -The *Live queries history* section on the *Live queries* tab shows a log of queries run over the last 30 days. -Each query has the following options: +The *Live queries history* section on the *Live queries* tab shows a log of queries run over the last 30 days. From the Live queries table, you can: -* Click image:images/play-icon.png[Right-pointing triangle] to rerun a query. +* Click the run icon (image:images/play-icon.png[Right-pointing triangle]) to rerun a single query or a query pack. -* Click image:images/table-icon.png[Table icon] to view the query <> and <>. +* Click the table icon (image:images/table-icon.png[Table icon]) to examine the <> for a single query or a query pack. From the results table, you can also find the query <>. + [role="screenshot"] image::images/live-query-check-results.png[Results of OSquery] diff --git a/docs/redirects.asciidoc b/docs/redirects.asciidoc index 5c12048315de..fe1f3b9521cf 100644 --- a/docs/redirects.asciidoc +++ b/docs/redirects.asciidoc @@ -416,7 +416,7 @@ This page has been deleted. Refer to <>. This page has been deleted. Refer to <>. -[role="exclude",id="machine-learning-api-sync"] -== Sync machine learning saved objects API +[role="exclude",id="ml-sync"] +== Sync machine learning objects API -This page has been deleted. Refer to <>. +This page has been deleted. Refer to <>. \ No newline at end of file diff --git a/docs/user/api.asciidoc b/docs/user/api.asciidoc index 8f55645e5b91..aa567487b296 100644 --- a/docs/user/api.asciidoc +++ b/docs/user/api.asciidoc @@ -100,8 +100,7 @@ include::{kib-repo-dir}/api/actions-and-connectors.asciidoc[] include::{kib-repo-dir}/api/cases.asciidoc[] include::{kib-repo-dir}/api/dashboard-api.asciidoc[] include::{kib-repo-dir}/api/logstash-configuration-management.asciidoc[] -include::{kib-repo-dir}/api/machine-learning/ml_apis_v2_docs.asciidoc[] -include::{kib-repo-dir}/api/machine-learning/ml_apis_v2_defs.asciidoc[leveloffset=+1] +include::{kib-repo-dir}/api/machine-learning.asciidoc[] include::{kib-repo-dir}/api/osquery-manager.asciidoc[] include::{kib-repo-dir}/api/short-urls.asciidoc[] include::{kib-repo-dir}/api/task-manager/health.asciidoc[] diff --git a/docs/user/ml/images/ml-log-pattern-analysis.png b/docs/user/ml/images/ml-log-pattern-analysis.png new file mode 100644 index 000000000000..0cf16105a11e Binary files /dev/null and b/docs/user/ml/images/ml-log-pattern-analysis.png differ diff --git a/docs/user/ml/index.asciidoc b/docs/user/ml/index.asciidoc index c58408d85d37..7467d99ca22e 100644 --- a/docs/user/ml/index.asciidoc +++ b/docs/user/ml/index.asciidoc @@ -118,8 +118,8 @@ Examine the histogram chart of the log rates for a given {data-source}, and find the reason behind a particular change possibly in millions of log events across multiple fields and values. -You can find explain log rate spikes under **{ml-app}** > **AIOps** where you -can select the {data-source} or saved search that you want to analyze. +You can find explain log rate spikes under **{ml-app}** > **AIOps Labs** where +you can select the {data-source} or saved search that you want to analyze. [role="screenshot"] image::user/ml/images/ml-explain-log-rate-before.png[Log event histogram chart] @@ -142,3 +142,27 @@ deviation and rerun the analysis with the modified values. [role="screenshot"] image::user/ml/images/ml-explain-log-rate.png[Log rate spike explained] + +[discrete] +[[log-pattern-analysis]] +=== Log pattern analysis + +preview::[] + +Log pattern analysis helps you to find patterns in unstructured log messages and +makes it easier to examine your data. It performs categorization analysis on a +selected field of a {data-source}, creates categories based on the data and +displays them together with a chart that shows the distribution of each category +and an example document that matches the category. + +You can find log pattern analysis under **{ml-app}** > **AIOps Labs** where you +can select the {data-source} or saved search that you want to analyze. + +[role="screenshot"] +image::user/ml/images/ml-log-pattern-analysis.png[Log pattern analysis UI] + +Select a field for categorization and optionally apply any filters that you +want, then start the analysis. The analysis uses the same algorithms as a {ml} +categorization job. The results of the analysis are shown in a table that makes +it possible to open **Discover** and show or filter out the given category +there, which helps you to further examine your log messages. \ No newline at end of file diff --git a/package.json b/package.json index 3bbcabba0cdd..4108e83b0e6c 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "@dnd-kit/utilities": "^2.0.0", "@elastic/apm-rum": "^5.12.0", "@elastic/apm-rum-react": "^1.4.2", - "@elastic/charts": "49.0.0", + "@elastic/charts": "50.0.1", "@elastic/datemath": "5.0.3", "@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.3.0-canary.1", "@elastic/ems-client": "8.3.3", @@ -254,6 +254,7 @@ "@kbn/core-overlays-browser": "link:bazel-bin/packages/core/overlays/core-overlays-browser", "@kbn/core-overlays-browser-internal": "link:bazel-bin/packages/core/overlays/core-overlays-browser-internal", "@kbn/core-overlays-browser-mocks": "link:bazel-bin/packages/core/overlays/core-overlays-browser-mocks", + "@kbn/core-plugins-base-server-internal": "link:bazel-bin/packages/core/plugins/core-plugins-base-server-internal", "@kbn/core-plugins-browser": "link:bazel-bin/packages/core/plugins/core-plugins-browser", "@kbn/core-plugins-browser-internal": "link:bazel-bin/packages/core/plugins/core-plugins-browser-internal", "@kbn/core-plugins-browser-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-browser-mocks", @@ -262,6 +263,8 @@ "@kbn/core-preboot-server-mocks": "link:bazel-bin/packages/core/preboot/core-preboot-server-mocks", "@kbn/core-rendering-browser-internal": "link:bazel-bin/packages/core/rendering/core-rendering-browser-internal", "@kbn/core-rendering-browser-mocks": "link:bazel-bin/packages/core/rendering/core-rendering-browser-mocks", + "@kbn/core-rendering-server-internal": "link:bazel-bin/packages/core/rendering/core-rendering-server-internal", + "@kbn/core-rendering-server-mocks": "link:bazel-bin/packages/core/rendering/core-rendering-server-mocks", "@kbn/core-root-browser-internal": "link:bazel-bin/packages/core/root/core-root-browser-internal", "@kbn/core-saved-objects-api-browser": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-browser", "@kbn/core-saved-objects-api-server": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server", @@ -978,6 +981,7 @@ "@types/kbn__core-overlays-browser": "link:bazel-bin/packages/core/overlays/core-overlays-browser/npm_module_types", "@types/kbn__core-overlays-browser-internal": "link:bazel-bin/packages/core/overlays/core-overlays-browser-internal/npm_module_types", "@types/kbn__core-overlays-browser-mocks": "link:bazel-bin/packages/core/overlays/core-overlays-browser-mocks/npm_module_types", + "@types/kbn__core-plugins-base-server-internal": "link:bazel-bin/packages/core/plugins/core-plugins-base-server-internal/npm_module_types", "@types/kbn__core-plugins-browser": "link:bazel-bin/packages/core/plugins/core-plugins-browser/npm_module_types", "@types/kbn__core-plugins-browser-internal": "link:bazel-bin/packages/core/plugins/core-plugins-browser-internal/npm_module_types", "@types/kbn__core-plugins-browser-mocks": "link:bazel-bin/packages/core/plugins/core-plugins-browser-mocks/npm_module_types", @@ -987,6 +991,8 @@ "@types/kbn__core-public-internal-base": "link:bazel-bin/packages/core/public/internal-base/npm_module_types", "@types/kbn__core-rendering-browser-internal": "link:bazel-bin/packages/core/rendering/core-rendering-browser-internal/npm_module_types", "@types/kbn__core-rendering-browser-mocks": "link:bazel-bin/packages/core/rendering/core-rendering-browser-mocks/npm_module_types", + "@types/kbn__core-rendering-server-internal": "link:bazel-bin/packages/core/rendering/core-rendering-server-internal/npm_module_types", + "@types/kbn__core-rendering-server-mocks": "link:bazel-bin/packages/core/rendering/core-rendering-server-mocks/npm_module_types", "@types/kbn__core-root-browser-internal": "link:bazel-bin/packages/core/root/core-root-browser-internal/npm_module_types", "@types/kbn__core-saved-objects-api-browser": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-browser/npm_module_types", "@types/kbn__core-saved-objects-api-server": "link:bazel-bin/packages/core/saved-objects/core-saved-objects-api-server/npm_module_types", @@ -1286,7 +1292,7 @@ "cssnano": "^5.1.12", "cssnano-preset-default": "^5.2.12", "csstype": "^3.0.2", - "cypress": "^10.7.0", + "cypress": "^10.9.0", "cypress-axe": "^1.0.0", "cypress-file-upload": "^5.0.8", "cypress-multi-reporters": "^1.6.1", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index cf97e501df09..0d5ecd4bc4cf 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -120,6 +120,7 @@ filegroup( "//packages/core/overlays/core-overlays-browser:build", "//packages/core/overlays/core-overlays-browser-internal:build", "//packages/core/overlays/core-overlays-browser-mocks:build", + "//packages/core/plugins/core-plugins-base-server-internal:build", "//packages/core/plugins/core-plugins-browser:build", "//packages/core/plugins/core-plugins-browser-internal:build", "//packages/core/plugins/core-plugins-browser-mocks:build", @@ -128,6 +129,8 @@ filegroup( "//packages/core/preboot/core-preboot-server-mocks:build", "//packages/core/rendering/core-rendering-browser-internal:build", "//packages/core/rendering/core-rendering-browser-mocks:build", + "//packages/core/rendering/core-rendering-server-internal:build", + "//packages/core/rendering/core-rendering-server-mocks:build", "//packages/core/root/core-root-browser-internal:build", "//packages/core/saved-objects/core-saved-objects-api-browser:build", "//packages/core/saved-objects/core-saved-objects-api-server:build", @@ -454,6 +457,7 @@ filegroup( "//packages/core/overlays/core-overlays-browser:build_types", "//packages/core/overlays/core-overlays-browser-internal:build_types", "//packages/core/overlays/core-overlays-browser-mocks:build_types", + "//packages/core/plugins/core-plugins-base-server-internal:build_types", "//packages/core/plugins/core-plugins-browser:build_types", "//packages/core/plugins/core-plugins-browser-internal:build_types", "//packages/core/plugins/core-plugins-browser-mocks:build_types", @@ -462,6 +466,8 @@ filegroup( "//packages/core/preboot/core-preboot-server-mocks:build_types", "//packages/core/rendering/core-rendering-browser-internal:build_types", "//packages/core/rendering/core-rendering-browser-mocks:build_types", + "//packages/core/rendering/core-rendering-server-internal:build_types", + "//packages/core/rendering/core-rendering-server-mocks:build_types", "//packages/core/root/core-root-browser-internal:build_types", "//packages/core/saved-objects/core-saved-objects-api-browser:build_types", "//packages/core/saved-objects/core-saved-objects-api-server:build_types", diff --git a/packages/core/plugins/core-plugins-base-server-internal/BUILD.bazel b/packages/core/plugins/core-plugins-base-server-internal/BUILD.bazel new file mode 100644 index 000000000000..7e4d73b638a7 --- /dev/null +++ b/packages/core/plugins/core-plugins-base-server-internal/BUILD.bazel @@ -0,0 +1,107 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-plugins-base-server-internal" +PKG_REQUIRE_NAME = "@kbn/core-plugins-base-server-internal" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.mock.*", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__/**", + "**/integration_tests/**", + "**/mocks/**", + "**/scripts/**", + "**/storybook/**", + "**/test_fixtures/**", + "**/test_helpers/**", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//rxjs", + "//packages/core/base/core-base-common:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/plugins/core-plugins-base-server-internal/README.md b/packages/core/plugins/core-plugins-base-server-internal/README.md new file mode 100644 index 000000000000..565082ebccc0 --- /dev/null +++ b/packages/core/plugins/core-plugins-base-server-internal/README.md @@ -0,0 +1,3 @@ +# @kbn/core-plugins-base-server-internal + +This package contains base internal types of the `plugins` domain used across other core domains. diff --git a/packages/core/plugins/core-plugins-base-server-internal/index.ts b/packages/core/plugins/core-plugins-base-server-internal/index.ts new file mode 100644 index 000000000000..3052f46e9fe7 --- /dev/null +++ b/packages/core/plugins/core-plugins-base-server-internal/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 + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export type { UiPlugins, InternalPluginInfo } from './src'; diff --git a/packages/core/plugins/core-plugins-base-server-internal/jest.config.js b/packages/core/plugins/core-plugins-base-server-internal/jest.config.js new file mode 100644 index 000000000000..9a9b5aa5ec9b --- /dev/null +++ b/packages/core/plugins/core-plugins-base-server-internal/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/plugins/core-plugins-base-server-internal'], +}; diff --git a/packages/core/plugins/core-plugins-base-server-internal/kibana.jsonc b/packages/core/plugins/core-plugins-base-server-internal/kibana.jsonc new file mode 100644 index 000000000000..a593530ab5fc --- /dev/null +++ b/packages/core/plugins/core-plugins-base-server-internal/kibana.jsonc @@ -0,0 +1,7 @@ +{ + "type": "shared-common", + "id": "@kbn/core-plugins-base-server-internal", + "owner": "@elastic/kibana-core", + "runtimeDeps": [], + "typeDeps": [], +} diff --git a/packages/core/plugins/core-plugins-base-server-internal/package.json b/packages/core/plugins/core-plugins-base-server-internal/package.json new file mode 100644 index 000000000000..6af3453f1a29 --- /dev/null +++ b/packages/core/plugins/core-plugins-base-server-internal/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-plugins-base-server-internal", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/core/plugins/core-plugins-base-server-internal/src/index.ts b/packages/core/plugins/core-plugins-base-server-internal/src/index.ts new file mode 100644 index 000000000000..ade9e77fc178 --- /dev/null +++ b/packages/core/plugins/core-plugins-base-server-internal/src/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 + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export type { UiPlugins, InternalPluginInfo } from './types'; diff --git a/packages/core/plugins/core-plugins-base-server-internal/src/types.ts b/packages/core/plugins/core-plugins-base-server-internal/src/types.ts new file mode 100644 index 000000000000..d0afcce5dba5 --- /dev/null +++ b/packages/core/plugins/core-plugins-base-server-internal/src/types.ts @@ -0,0 +1,51 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { Observable } from 'rxjs'; +import type { DiscoveredPlugin, PluginName } from '@kbn/core-base-common'; + +/** @internal */ +export interface UiPlugins { + /** + * Paths to all discovered ui plugin entrypoints on the filesystem, even if + * disabled. + */ + internal: Map; + + /** + * Information needed by client-side to load plugins and wire dependencies. + */ + public: Map; + + /** + * Configuration for plugins to be exposed to the client-side. + */ + browserConfigs: Map>; +} + +/** + * @internal + */ +export interface InternalPluginInfo { + /** + * Version of the plugin + */ + readonly version: string; + /** + * Bundles that must be loaded for this plugin + */ + readonly requiredBundles: readonly string[]; + /** + * Path to the target/public directory of the plugin which should be served + */ + readonly publicTargetDir: string; + /** + * Path to the plugin assets directory. + */ + readonly publicAssetsDir: string; +} diff --git a/packages/core/plugins/core-plugins-base-server-internal/tsconfig.json b/packages/core/plugins/core-plugins-base-server-internal/tsconfig.json new file mode 100644 index 000000000000..71bb40fe57f3 --- /dev/null +++ b/packages/core/plugins/core-plugins-base-server-internal/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/rendering/core-rendering-server-internal/BUILD.bazel b/packages/core/rendering/core-rendering-server-internal/BUILD.bazel new file mode 100644 index 000000000000..b02ff0926469 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-internal/BUILD.bazel @@ -0,0 +1,127 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-rendering-server-internal" +PKG_REQUIRE_NAME = "@kbn/core-rendering-server-internal" + +SOURCE_FILES = glob( + [ + "**/*.ts", + "**/*.tsx", + ], + exclude = [ + "**/*.config.js", + "**/*.mock.*", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__/**", + "**/integration_tests/**", + "**/mocks/**", + "**/scripts/**", + "**/storybook/**", + "**/test_fixtures/**", + "**/test_helpers/**", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ + "@npm//react", + "@npm//react-dom", + "@npm//rxjs", + "//packages/kbn-i18n", + "//packages/kbn-ui-shared-deps-npm", + "//packages/kbn-ui-shared-deps-src", +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//@types/react", + "@npm//@types/react-dom", + "@npm//rxjs", + "//packages/kbn-i18n:npm_module_types", + "//packages/kbn-ui-shared-deps-npm:npm_module_types", + "//packages/kbn-ui-shared-deps-src:npm_module_types", + "//packages/core/base/core-base-server-internal:npm_module_types", + "//packages/core/injected-metadata/core-injected-metadata-common-internal:npm_module_types", + "//packages/core/http/core-http-server:npm_module_types", + "//packages/core/http/core-http-server-internal:npm_module_types", + "//packages/core/elasticsearch/core-elasticsearch-server-internal:npm_module_types", + "//packages/core/status/core-status-server-internal:npm_module_types", + "//packages/core/ui-settings/core-ui-settings-common:npm_module_types", + "//packages/core/ui-settings/core-ui-settings-server:npm_module_types", + "//packages/core/plugins/core-plugins-base-server-internal:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/rendering/core-rendering-server-internal/README.md b/packages/core/rendering/core-rendering-server-internal/README.md new file mode 100644 index 000000000000..629ac2047de0 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-internal/README.md @@ -0,0 +1,3 @@ +# @kbn/core-rendering-server-internal + +This package contains the internal types and implementation for Core's server-side rendering service. diff --git a/packages/core/rendering/core-rendering-server-internal/index.ts b/packages/core/rendering/core-rendering-server-internal/index.ts new file mode 100644 index 000000000000..7ddc442a7425 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-internal/index.ts @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { RenderingService, Fonts } from './src'; +export type { + InternalRenderingServicePreboot, + InternalRenderingServiceSetup, + IRenderOptions, + RenderingMetadata, + RenderingPrebootDeps, + RenderingSetupDeps, +} from './src'; diff --git a/packages/core/rendering/core-rendering-server-internal/jest.config.js b/packages/core/rendering/core-rendering-server-internal/jest.config.js new file mode 100644 index 000000000000..48ca2e89b976 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-internal/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/rendering/core-rendering-server-internal'], +}; diff --git a/packages/core/rendering/core-rendering-server-internal/kibana.jsonc b/packages/core/rendering/core-rendering-server-internal/kibana.jsonc new file mode 100644 index 000000000000..2ce227d70528 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-internal/kibana.jsonc @@ -0,0 +1,7 @@ +{ + "type": "shared-common", + "id": "@kbn/core-rendering-server-internal", + "owner": "@elastic/kibana-core", + "runtimeDeps": [], + "typeDeps": [], +} diff --git a/packages/core/rendering/core-rendering-server-internal/package.json b/packages/core/rendering/core-rendering-server-internal/package.json new file mode 100644 index 000000000000..ef29d29e9fa2 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-internal/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-rendering-server-internal", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap b/packages/core/rendering/core-rendering-server-internal/src/__snapshots__/rendering_service.test.ts.snap similarity index 100% rename from src/core/server/rendering/__snapshots__/rendering_service.test.ts.snap rename to packages/core/rendering/core-rendering-server-internal/src/__snapshots__/rendering_service.test.ts.snap diff --git a/src/core/server/rendering/bootstrap/__snapshots__/render_template.test.ts.snap b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/__snapshots__/render_template.test.ts.snap similarity index 100% rename from src/core/server/rendering/bootstrap/__snapshots__/render_template.test.ts.snap rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/__snapshots__/render_template.test.ts.snap diff --git a/src/core/server/rendering/bootstrap/bootstrap_renderer.test.mocks.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/bootstrap_renderer.test.mocks.ts similarity index 100% rename from src/core/server/rendering/bootstrap/bootstrap_renderer.test.mocks.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/bootstrap_renderer.test.mocks.ts diff --git a/src/core/server/rendering/bootstrap/bootstrap_renderer.test.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/bootstrap_renderer.test.ts similarity index 98% rename from src/core/server/rendering/bootstrap/bootstrap_renderer.test.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/bootstrap_renderer.test.ts index a1ed415f72c4..af9de3fbd6ff 100644 --- a/src/core/server/rendering/bootstrap/bootstrap_renderer.test.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/bootstrap_renderer.test.ts @@ -15,7 +15,7 @@ import { import { PackageInfo } from '@kbn/config'; import { AuthStatus } from '@kbn/core-http-server'; -import { UiPlugins } from '../../plugins'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { httpServiceMock, httpServerMock } from '@kbn/core-http-server-mocks'; import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks'; import { bootstrapRendererFactory, BootstrapRenderer } from './bootstrap_renderer'; diff --git a/src/core/server/rendering/bootstrap/bootstrap_renderer.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/bootstrap_renderer.ts similarity index 97% rename from src/core/server/rendering/bootstrap/bootstrap_renderer.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/bootstrap_renderer.ts index 4c20f8d3d799..8424bb3e68a1 100644 --- a/src/core/server/rendering/bootstrap/bootstrap_renderer.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/bootstrap_renderer.ts @@ -11,7 +11,7 @@ import { PackageInfo } from '@kbn/config'; import { ThemeVersion } from '@kbn/ui-shared-deps-npm'; import type { KibanaRequest, HttpAuth } from '@kbn/core-http-server'; import type { IUiSettingsClient } from '@kbn/core-ui-settings-server'; -import { UiPlugins } from '../../plugins'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { getPluginsBundlePaths } from './get_plugin_bundle_paths'; import { getJsDependencyPaths } from './get_js_dependency_paths'; import { getThemeTag } from './get_theme_tag'; diff --git a/src/core/server/rendering/bootstrap/get_js_dependency_paths.test.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_js_dependency_paths.test.ts similarity index 100% rename from src/core/server/rendering/bootstrap/get_js_dependency_paths.test.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_js_dependency_paths.test.ts diff --git a/src/core/server/rendering/bootstrap/get_js_dependency_paths.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_js_dependency_paths.ts similarity index 100% rename from src/core/server/rendering/bootstrap/get_js_dependency_paths.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_js_dependency_paths.ts diff --git a/src/core/server/rendering/bootstrap/get_plugin_bundle_paths.test.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_plugin_bundle_paths.test.ts similarity index 94% rename from src/core/server/rendering/bootstrap/get_plugin_bundle_paths.test.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_plugin_bundle_paths.test.ts index e3746eeb17a0..619765cdc7b6 100644 --- a/src/core/server/rendering/bootstrap/get_plugin_bundle_paths.test.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_plugin_bundle_paths.test.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import { InternalPluginInfo, PluginType, UiPlugins } from '../../plugins'; +import { PluginType } from '@kbn/core-base-common'; +import type { InternalPluginInfo, UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { getPluginsBundlePaths } from './get_plugin_bundle_paths'; const createUiPlugins = (pluginDeps: Record) => { diff --git a/src/core/server/rendering/bootstrap/get_plugin_bundle_paths.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_plugin_bundle_paths.ts similarity index 95% rename from src/core/server/rendering/bootstrap/get_plugin_bundle_paths.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_plugin_bundle_paths.ts index e5a9ed9fdd3d..ad9f3edb4aa5 100644 --- a/src/core/server/rendering/bootstrap/get_plugin_bundle_paths.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_plugin_bundle_paths.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { UiPlugins } from '../../plugins'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { filterUiPlugins } from '../filter_ui_plugins'; export interface PluginInfo { diff --git a/src/core/server/rendering/bootstrap/get_theme_tag.test.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_theme_tag.test.ts similarity index 100% rename from src/core/server/rendering/bootstrap/get_theme_tag.test.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_theme_tag.test.ts diff --git a/src/core/server/rendering/bootstrap/get_theme_tag.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_theme_tag.ts similarity index 100% rename from src/core/server/rendering/bootstrap/get_theme_tag.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/get_theme_tag.ts diff --git a/src/core/server/rendering/bootstrap/index.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/index.ts similarity index 100% rename from src/core/server/rendering/bootstrap/index.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/index.ts diff --git a/src/core/server/rendering/bootstrap/register_bootstrap_route.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/register_bootstrap_route.ts similarity index 100% rename from src/core/server/rendering/bootstrap/register_bootstrap_route.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/register_bootstrap_route.ts diff --git a/src/core/server/rendering/bootstrap/render_template.test.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/render_template.test.ts similarity index 100% rename from src/core/server/rendering/bootstrap/render_template.test.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/render_template.test.ts diff --git a/src/core/server/rendering/bootstrap/render_template.ts b/packages/core/rendering/core-rendering-server-internal/src/bootstrap/render_template.ts similarity index 100% rename from src/core/server/rendering/bootstrap/render_template.ts rename to packages/core/rendering/core-rendering-server-internal/src/bootstrap/render_template.ts diff --git a/src/core/server/rendering/filter_ui_plugins.test.ts b/packages/core/rendering/core-rendering-server-internal/src/filter_ui_plugins.test.ts similarity index 93% rename from src/core/server/rendering/filter_ui_plugins.test.ts rename to packages/core/rendering/core-rendering-server-internal/src/filter_ui_plugins.test.ts index fc013b4be0d0..096e0cc57b1f 100644 --- a/src/core/server/rendering/filter_ui_plugins.test.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/filter_ui_plugins.test.ts @@ -6,7 +6,8 @@ * Side Public License, v 1. */ -import type { DiscoveredPlugin, PluginName, UiPlugins } from '../plugins'; +import type { PluginName, DiscoveredPlugin } from '@kbn/core-base-common'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { filterUiPlugins } from './filter_ui_plugins'; function createMockPlugin(params: Partial) { diff --git a/src/core/server/rendering/filter_ui_plugins.ts b/packages/core/rendering/core-rendering-server-internal/src/filter_ui_plugins.ts similarity index 95% rename from src/core/server/rendering/filter_ui_plugins.ts rename to packages/core/rendering/core-rendering-server-internal/src/filter_ui_plugins.ts index d3ca102a3575..e1be7719bfea 100644 --- a/src/core/server/rendering/filter_ui_plugins.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/filter_ui_plugins.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { UiPlugins } from '../plugins'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; /** * Gets the array of plugins that should be enabled on the page. diff --git a/src/core/server/rendering/index.ts b/packages/core/rendering/core-rendering-server-internal/src/index.ts similarity index 94% rename from src/core/server/rendering/index.ts rename to packages/core/rendering/core-rendering-server-internal/src/index.ts index 6cf0e2a74aa1..e1cac45f7765 100644 --- a/src/core/server/rendering/index.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/index.ts @@ -7,6 +7,7 @@ */ export { RenderingService } from './rendering_service'; +export { Fonts } from './views'; export type { InternalRenderingServicePreboot, InternalRenderingServiceSetup, diff --git a/src/core/server/rendering/internal_types.ts b/packages/core/rendering/core-rendering-server-internal/src/internal_types.ts similarity index 100% rename from src/core/server/rendering/internal_types.ts rename to packages/core/rendering/core-rendering-server-internal/src/internal_types.ts diff --git a/src/core/server/rendering/render_utils.test.ts b/packages/core/rendering/core-rendering-server-internal/src/render_utils.test.ts similarity index 100% rename from src/core/server/rendering/render_utils.test.ts rename to packages/core/rendering/core-rendering-server-internal/src/render_utils.test.ts diff --git a/src/core/server/rendering/render_utils.ts b/packages/core/rendering/core-rendering-server-internal/src/render_utils.ts similarity index 100% rename from src/core/server/rendering/render_utils.ts rename to packages/core/rendering/core-rendering-server-internal/src/render_utils.ts diff --git a/src/core/server/rendering/rendering_service.test.mocks.ts b/packages/core/rendering/core-rendering-server-internal/src/rendering_service.test.mocks.ts similarity index 100% rename from src/core/server/rendering/rendering_service.test.mocks.ts rename to packages/core/rendering/core-rendering-server-internal/src/rendering_service.test.mocks.ts diff --git a/src/core/server/rendering/rendering_service.test.ts b/packages/core/rendering/core-rendering-server-internal/src/rendering_service.test.ts similarity index 99% rename from src/core/server/rendering/rendering_service.test.ts rename to packages/core/rendering/core-rendering-server-internal/src/rendering_service.test.ts index 424bcd8a6533..48196717c6f9 100644 --- a/src/core/server/rendering/rendering_service.test.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/rendering_service.test.ts @@ -22,7 +22,7 @@ import { mockRenderingServiceParams, mockRenderingPrebootDeps, mockRenderingSetupDeps, -} from './__mocks__/params'; +} from './test_helpers/params'; import { InternalRenderingServicePreboot, InternalRenderingServiceSetup } from './types'; import { RenderingService } from './rendering_service'; import { AuthStatus } from '@kbn/core-http-server'; diff --git a/src/core/server/rendering/rendering_service.tsx b/packages/core/rendering/core-rendering-server-internal/src/rendering_service.tsx similarity index 98% rename from src/core/server/rendering/rendering_service.tsx rename to packages/core/rendering/core-rendering-server-internal/src/rendering_service.tsx index c5b56a06782b..653768c83d78 100644 --- a/src/core/server/rendering/rendering_service.tsx +++ b/packages/core/rendering/core-rendering-server-internal/src/rendering_service.tsx @@ -8,15 +8,15 @@ import React from 'react'; import { renderToStaticMarkup } from 'react-dom/server'; +import { firstValueFrom, of } from 'rxjs'; import { catchError, take, timeout } from 'rxjs/operators'; import { i18n } from '@kbn/i18n'; import type { ThemeVersion } from '@kbn/ui-shared-deps-npm'; -import { firstValueFrom, of } from 'rxjs'; import type { CoreContext } from '@kbn/core-base-server-internal'; import type { KibanaRequest, HttpAuth } from '@kbn/core-http-server'; import type { IUiSettingsClient } from '@kbn/core-ui-settings-server'; -import type { UiPlugins } from '../plugins'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { Template } from './views'; import { IRenderOptions, diff --git a/src/core/server/rendering/__mocks__/params.ts b/packages/core/rendering/core-rendering-server-internal/src/test_helpers/params.ts similarity index 85% rename from src/core/server/rendering/__mocks__/params.ts rename to packages/core/rendering/core-rendering-server-internal/src/test_helpers/params.ts index c75353b87a65..51dfab71efd2 100644 --- a/src/core/server/rendering/__mocks__/params.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/test_helpers/params.ts @@ -10,7 +10,6 @@ import { mockCoreContext } from '@kbn/core-base-server-mocks'; import { httpServiceMock } from '@kbn/core-http-server-mocks'; import { elasticsearchServiceMock } from '@kbn/core-elasticsearch-server-mocks'; import { statusServiceMock } from '@kbn/core-status-server-mocks'; -import { pluginServiceMock } from '../../plugins/plugins_service.mock'; const context = mockCoreContext.create(); const httpPreboot = httpServiceMock.createInternalPrebootContract(); @@ -18,14 +17,22 @@ const httpSetup = httpServiceMock.createInternalSetupContract(); const status = statusServiceMock.createInternalSetupContract(); const elasticsearch = elasticsearchServiceMock.createInternalSetup(); +function createUiPlugins() { + return { + browserConfigs: new Map(), + internal: new Map(), + public: new Map(), + }; +} + export const mockRenderingServiceParams = context; export const mockRenderingPrebootDeps = { http: httpPreboot, - uiPlugins: pluginServiceMock.createUiPlugins(), + uiPlugins: createUiPlugins(), }; export const mockRenderingSetupDeps = { elasticsearch, http: httpSetup, - uiPlugins: pluginServiceMock.createUiPlugins(), + uiPlugins: createUiPlugins(), status, }; diff --git a/src/core/server/rendering/__mocks__/rendering_service.ts b/packages/core/rendering/core-rendering-server-internal/src/test_helpers/rendering_service.ts similarity index 100% rename from src/core/server/rendering/__mocks__/rendering_service.ts rename to packages/core/rendering/core-rendering-server-internal/src/test_helpers/rendering_service.ts diff --git a/src/core/server/rendering/types.ts b/packages/core/rendering/core-rendering-server-internal/src/types.ts similarity index 96% rename from src/core/server/rendering/types.ts rename to packages/core/rendering/core-rendering-server-internal/src/types.ts index 7068d2a9b789..e2f7797ac5c4 100644 --- a/src/core/server/rendering/types.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/types.ts @@ -17,7 +17,7 @@ import type { import type { InternalElasticsearchServiceSetup } from '@kbn/core-elasticsearch-server-internal'; import type { InternalStatusServiceSetup } from '@kbn/core-status-server-internal'; import type { IUiSettingsClient } from '@kbn/core-ui-settings-server'; -import { UiPlugins } from '../plugins'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; /** @internal */ export interface RenderingMetadata { @@ -46,7 +46,7 @@ export interface RenderingSetupDeps { uiPlugins: UiPlugins; } -/** @public */ +/** @internal */ export interface IRenderOptions { /** * Set whether the page is anonymous, which determines what plugins are enabled and whether to output user settings in the page metadata. diff --git a/src/core/server/rendering/views/fonts.tsx b/packages/core/rendering/core-rendering-server-internal/src/views/fonts.tsx similarity index 100% rename from src/core/server/rendering/views/fonts.tsx rename to packages/core/rendering/core-rendering-server-internal/src/views/fonts.tsx diff --git a/src/core/server/rendering/views/index.ts b/packages/core/rendering/core-rendering-server-internal/src/views/index.ts similarity index 92% rename from src/core/server/rendering/views/index.ts rename to packages/core/rendering/core-rendering-server-internal/src/views/index.ts index 1aa6e658e3d2..01f395261ecc 100644 --- a/src/core/server/rendering/views/index.ts +++ b/packages/core/rendering/core-rendering-server-internal/src/views/index.ts @@ -7,3 +7,4 @@ */ export { Template } from './template'; +export { Fonts } from './fonts'; diff --git a/src/core/server/rendering/views/logo.tsx b/packages/core/rendering/core-rendering-server-internal/src/views/logo.tsx similarity index 100% rename from src/core/server/rendering/views/logo.tsx rename to packages/core/rendering/core-rendering-server-internal/src/views/logo.tsx diff --git a/src/core/server/rendering/views/styles.tsx b/packages/core/rendering/core-rendering-server-internal/src/views/styles.tsx similarity index 100% rename from src/core/server/rendering/views/styles.tsx rename to packages/core/rendering/core-rendering-server-internal/src/views/styles.tsx diff --git a/src/core/server/rendering/views/template.tsx b/packages/core/rendering/core-rendering-server-internal/src/views/template.tsx similarity index 100% rename from src/core/server/rendering/views/template.tsx rename to packages/core/rendering/core-rendering-server-internal/src/views/template.tsx diff --git a/packages/core/rendering/core-rendering-server-internal/tsconfig.json b/packages/core/rendering/core-rendering-server-internal/tsconfig.json new file mode 100644 index 000000000000..73c8a6666ff7 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-internal/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "stripInternal": false, + "types": [ + "jest", + "node", + "react", + ] + }, + "include": [ + "**/*.ts", + "**/*.tsx", + ] +} diff --git a/packages/core/rendering/core-rendering-server-mocks/BUILD.bazel b/packages/core/rendering/core-rendering-server-mocks/BUILD.bazel new file mode 100644 index 000000000000..9ec36da1a1f6 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-mocks/BUILD.bazel @@ -0,0 +1,106 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "core-rendering-server-mocks" +PKG_REQUIRE_NAME = "@kbn/core-rendering-server-mocks" + +SOURCE_FILES = glob( + [ + "**/*.ts", + ], + exclude = [ + "**/*.config.js", + "**/*.test.*", + "**/*.stories.*", + "**/__snapshots__/**", + "**/integration_tests/**", + "**/mocks/**", + "**/scripts/**", + "**/storybook/**", + "**/test_fixtures/**", + "**/test_helpers/**", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +RUNTIME_DEPS = [ +] + +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "//packages/kbn-utility-types:npm_module_types", + "//packages/core/rendering/core-rendering-server-internal:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/core/rendering/core-rendering-server-mocks/README.md b/packages/core/rendering/core-rendering-server-mocks/README.md new file mode 100644 index 000000000000..72df54931919 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-mocks/README.md @@ -0,0 +1,4 @@ +# @kbn/core-rendering-server-mocks + +This package contains mocks for Core's server-side rendering service. +- `renderingServiceMock` diff --git a/packages/core/rendering/core-rendering-server-mocks/index.ts b/packages/core/rendering/core-rendering-server-mocks/index.ts new file mode 100644 index 000000000000..e7ce72ce797f --- /dev/null +++ b/packages/core/rendering/core-rendering-server-mocks/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 + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { renderingServiceMock } from './src'; diff --git a/packages/core/rendering/core-rendering-server-mocks/jest.config.js b/packages/core/rendering/core-rendering-server-mocks/jest.config.js new file mode 100644 index 000000000000..5dc1ae51c50b --- /dev/null +++ b/packages/core/rendering/core-rendering-server-mocks/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../..', + roots: ['/packages/core/rendering/core-rendering-server-mocks'], +}; diff --git a/packages/core/rendering/core-rendering-server-mocks/kibana.jsonc b/packages/core/rendering/core-rendering-server-mocks/kibana.jsonc new file mode 100644 index 000000000000..a04eae9cadc2 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-mocks/kibana.jsonc @@ -0,0 +1,7 @@ +{ + "type": "shared-common", + "id": "@kbn/core-rendering-server-mocks", + "owner": "@elastic/kibana-core", + "runtimeDeps": [], + "typeDeps": [], +} diff --git a/packages/core/rendering/core-rendering-server-mocks/package.json b/packages/core/rendering/core-rendering-server-mocks/package.json new file mode 100644 index 000000000000..572e1d553058 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-mocks/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/core-rendering-server-mocks", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "author": "Kibana Core", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/core/rendering/core-rendering-server-mocks/src/index.ts b/packages/core/rendering/core-rendering-server-mocks/src/index.ts new file mode 100644 index 000000000000..d56794e3e9ac --- /dev/null +++ b/packages/core/rendering/core-rendering-server-mocks/src/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 + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { renderingServiceMock } from './rendering_service.mock'; diff --git a/src/core/server/rendering/rendering_service.mock.ts b/packages/core/rendering/core-rendering-server-mocks/src/rendering_service.mock.ts similarity index 55% rename from src/core/server/rendering/rendering_service.mock.ts rename to packages/core/rendering/core-rendering-server-mocks/src/rendering_service.mock.ts index 3d8213da62c6..5cdf5c92f923 100644 --- a/src/core/server/rendering/rendering_service.mock.ts +++ b/packages/core/rendering/core-rendering-server-mocks/src/rendering_service.mock.ts @@ -6,7 +6,14 @@ * Side Public License, v 1. */ -import { InternalRenderingServicePreboot, InternalRenderingServiceSetup } from './types'; +import type { PublicMethodsOf } from '@kbn/utility-types'; +import type { + InternalRenderingServicePreboot, + InternalRenderingServiceSetup, + RenderingService, +} from '@kbn/core-rendering-server-internal'; + +export type RenderingServiceMock = jest.Mocked>; function createRenderingPreboot() { const mocked: jest.Mocked = { @@ -22,7 +29,21 @@ function createRenderingSetup() { return mocked; } -export const renderingMock = { +function createRenderingService() { + const mock: RenderingServiceMock = { + preboot: jest.fn(), + setup: jest.fn(), + stop: jest.fn(), + }; + + mock.preboot.mockResolvedValue(createRenderingPreboot()); + mock.setup.mockResolvedValue(createRenderingSetup()); + + return mock; +} + +export const renderingServiceMock = { + create: createRenderingService, createPrebootContract: createRenderingPreboot, createSetupContract: createRenderingSetup, }; diff --git a/packages/core/rendering/core-rendering-server-mocks/tsconfig.json b/packages/core/rendering/core-rendering-server-mocks/tsconfig.json new file mode 100644 index 000000000000..71bb40fe57f3 --- /dev/null +++ b/packages/core/rendering/core-rendering-server-mocks/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ] +} diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/saved_objects_exporter.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/saved_objects_exporter.test.ts index 614c9e3680ac..fed06cbf2f74 100644 --- a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/saved_objects_exporter.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/saved_objects_exporter.test.ts @@ -146,16 +146,18 @@ describe('getSortedObjectsForExport()', () => { attributes = {}, sort = [], type = 'index-pattern', + idPrefix = '', }: { attributes?: Record; sort?: string[]; type?: string; + idPrefix?: string; } = {} ) { const hits = []; for (let i = 1; i <= hitCount; i++) { hits.push({ - id: `${i}`, + id: `${idPrefix}${i}`, type, attributes, sort, @@ -247,7 +249,7 @@ describe('getSortedObjectsForExport()', () => { describe('>1k hits', () => { const firstMockHits = generateHits(1000, { sort: ['a', 'b'] }); - const secondMockHits = generateHits(500); + const secondMockHits = generateHits(500, { idPrefix: 'second-hit-' }); test('requests multiple pages', async () => { savedObjectsClient.find.mockResolvedValueOnce({ diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.test.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.test.ts index 1f663ea5dbc5..27fbb09a3701 100644 --- a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.test.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.test.ts @@ -6,7 +6,9 @@ * Side Public License, v 1. */ +import { range } from 'lodash'; import { sortObjects } from './sort_objects'; +import type { SavedObject } from '@kbn/core-saved-objects-common'; describe('sortObjects()', () => { test('should return on empty array', () => { @@ -309,6 +311,7 @@ describe('sortObjects()', () => { ] `); }); + test('should not fail on complex circular dependencies', () => { const docs = [ { @@ -424,4 +427,38 @@ describe('sortObjects()', () => { ] `); }); + + test('should not fail on large graph of objects', () => { + // create an object that references all objects with a higher `index` up to `depth`. + const createComplexNode = (index: number, depth: number): SavedObject => { + return { + type: 'test', + id: `${index}`, + attributes: {}, + references: range(index + 1, depth).map((refIndex) => ({ + type: 'test', + id: `${refIndex}`, + name: `test-${refIndex}`, + })), + }; + }; + + const createComplexGraph = (depth: number): SavedObject[] => { + const nodes: SavedObject[] = []; + for (let i = 0; i < depth; i++) { + nodes.push(createComplexNode(i, depth)); + } + return nodes; + }; + + const depth = 100; + const graph = createComplexGraph(depth); + const sorted = sortObjects(graph); + + expect(sorted.map(({ type, id }) => `${type}:${id}`)).toEqual( + range(depth) + .reverse() + .map((index) => `test:${index}`) + ); + }); }); diff --git a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.ts b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.ts index 487622877e25..551ba3989e52 100644 --- a/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.ts +++ b/packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/export/sort_objects.ts @@ -8,27 +8,29 @@ import type { SavedObject } from '@kbn/core-saved-objects-common'; +const getId = (object: { type: string; id: string }) => `${object.type}:${object.id}`; + export function sortObjects(savedObjects: SavedObject[]): SavedObject[] { - const path = new Set(); + const traversed = new Set(); const sorted = new Set(); const objectsByTypeId = new Map( - savedObjects.map((object) => [`${object.type}:${object.id}`, object] as [string, SavedObject]) + savedObjects.map((object) => [getId(object), object] as [string, SavedObject]) ); function includeObjects(objects: SavedObject[]) { for (const object of objects) { - if (path.has(object)) { + const objectId = getId(object); + if (traversed.has(objectId)) { continue; } - const refdObjects = object.references - .map((ref) => objectsByTypeId.get(`${ref.type}:${ref.id}`)) + const objectRefs = object.references + .map((ref) => objectsByTypeId.get(getId(ref))) .filter((ref): ref is SavedObject => !!ref); - if (refdObjects.length) { - path.add(object); - includeObjects(refdObjects); - path.delete(object); + traversed.add(objectId); + if (objectRefs.length) { + includeObjects(objectRefs); } sorted.add(object); @@ -36,5 +38,6 @@ export function sortObjects(savedObjects: SavedObject[]): SavedObject[] { } includeObjects(savedObjects); + return [...sorted]; } diff --git a/packages/kbn-eslint-plugin-imports/src/rules/no_boundary_crossing.ts b/packages/kbn-eslint-plugin-imports/src/rules/no_boundary_crossing.ts index 4f3defc21d29..832b4d2e3c67 100644 --- a/packages/kbn-eslint-plugin-imports/src/rules/no_boundary_crossing.ts +++ b/packages/kbn-eslint-plugin-imports/src/rules/no_boundary_crossing.ts @@ -19,15 +19,17 @@ import { getSourcePath } from '../helpers/source'; import { getRepoSourceClassifier } from '../helpers/repo_source_classifier'; import { getImportResolver } from '../get_import_resolver'; -const IMPORTABLE_FROM: Record = { +const ANY_FILE_IN_BAZEL = Symbol(); + +const IMPORTABLE_FROM: Record = { 'non-package': ['non-package', 'server package', 'browser package', 'common package', 'static'], 'server package': ['common package', 'server package', 'static'], 'browser package': ['common package', 'browser package', 'static'], 'common package': ['common package', 'static'], static: [], - 'tests or mocks': '*', - tooling: '*', + 'tests or mocks': ANY_FILE_IN_BAZEL, + tooling: ANY_FILE_IN_BAZEL, }; const toList = (strings: string[]) => { @@ -87,6 +89,7 @@ export const NoBoundaryCrossingRule: Rule.RuleModule = { }, messages: { TYPE_MISMATCH: `"{{importedType}}" code can not be imported from "{{ownType}}" code.{{suggestion}}`, + FILE_OUTSIDE_OF_PACKAGE: `"{{ownType}}" code can import any code already within packages, but not files outside of packages.`, }, }, create(context) { @@ -98,12 +101,7 @@ export const NoBoundaryCrossingRule: Rule.RuleModule = { const self = classifier.classify(sourcePath); const importable = IMPORTABLE_FROM[self.type]; - if (importable === '*') { - // don't check imports in files which can import anything - return {}; - } - - return visitAllImportStatements((req, { node, importer }) => { + return visitAllImportStatements((req, { node, importer, type }) => { if ( req === null || // we can ignore imports using the raw-loader, they will need to be resolved but can be managed on a case by case basis @@ -121,6 +119,27 @@ export const NoBoundaryCrossingRule: Rule.RuleModule = { const imported = classifier.classify(result.absolute); + if (importable === ANY_FILE_IN_BAZEL) { + if (type === 'jest' && imported.repoRel === 'package.json') { + // we allow jest.mock() calls to mock out the `package.json` file... it's a very + // specific exception for a very specific implementation + return; + } + + if (self.pkgInfo?.isBazelPackage ? imported.pkgInfo?.isBazelPackage : true) { + return; + } + + context.report({ + node: node as ESTree.Node, + messageId: 'FILE_OUTSIDE_OF_PACKAGE', + data: { + ownType: self.type, + }, + }); + return; + } + if (!importable.includes(imported.type)) { context.report({ node: node as ESTree.Node, diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 440ff3ce2b12..5cd145802862 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -23,7 +23,7 @@ pageLoadAssetSize: dataViewEditor: 12000 dataViewFieldEditor: 27000 dataViewManagement: 5000 - dataViews: 44532 + dataViews: 46532 dataVisualizer: 27530 devTools: 38637 discover: 99999 diff --git a/packages/kbn-repo-source-classifier/src/pkg_info.ts b/packages/kbn-repo-source-classifier/src/pkg_info.ts index 89d66092737b..a7f7100ba959 100644 --- a/packages/kbn-repo-source-classifier/src/pkg_info.ts +++ b/packages/kbn-repo-source-classifier/src/pkg_info.ts @@ -13,4 +13,6 @@ export interface PkgInfo { rel: string; /** Absolute path to the package directory */ pkgDir: string; + /** Is the package a bazel package? If false, then the package is a "synthetic" plugin package */ + isBazelPackage: boolean; } diff --git a/packages/kbn-repo-source-classifier/src/repo_path.ts b/packages/kbn-repo-source-classifier/src/repo_path.ts index 05eef7105a71..cd13adf0cb82 100644 --- a/packages/kbn-repo-source-classifier/src/repo_path.ts +++ b/packages/kbn-repo-source-classifier/src/repo_path.ts @@ -93,6 +93,7 @@ export class RepoPath { pkgDir, pkgId, rel, + isBazelPackage: this.resolver.isBazelPackage(pkgId), }; } } diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.test.tsx index 78feab598c14..7f7f20dfc234 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.test.tsx @@ -7,8 +7,8 @@ */ import React from 'react'; -import { getExceptionListItemSchemaMock } from '@kbn/lists-plugin/common/schemas/response/exception_list_item_schema.mock'; +import { getExceptionListItemSchemaMock } from '../../test_helpers/exception_list_item_schema.mock'; import * as i18n from '../translations'; import { ExceptionItemCardHeader } from './header'; import { fireEvent, render } from '@testing-library/react'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.test.tsx index e97b03607bb6..87a8a3bd3b52 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.test.tsx @@ -10,8 +10,8 @@ import React from 'react'; import { fireEvent, render } from '@testing-library/react'; import { ExceptionItemCard } from '.'; -import { getExceptionListItemSchemaMock } from '@kbn/lists-plugin/common/schemas/response/exception_list_item_schema.mock'; -import { getCommentsArrayMock } from '@kbn/lists-plugin/common/schemas/types/comment.mock'; +import { getExceptionListItemSchemaMock } from '../test_helpers/exception_list_item_schema.mock'; +import { getCommentsArrayMock } from '../test_helpers/comments.mock'; import { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; const ruleReferences: unknown[] = [ diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.test.tsx index 14bdef771d6b..c5ad9bd7af31 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { getExceptionListItemSchemaMock } from '@kbn/lists-plugin/common/schemas/response/exception_list_item_schema.mock'; +import { getExceptionListItemSchemaMock } from '../../test_helpers/exception_list_item_schema.mock'; import { ExceptionItemCardMetaInfo } from './meta'; import { RuleReference } from '../../types'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_items/exception_items.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_items/exception_items.test.tsx index 3fe2d7eb6d0b..39c429dd1f1d 100644 --- a/packages/kbn-securitysolution-exception-list-components/src/exception_items/exception_items.test.tsx +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_items/exception_items.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; -import { getExceptionListItemSchemaMock } from '@kbn/lists-plugin/common/schemas/response/exception_list_item_schema.mock'; +import { getExceptionListItemSchemaMock } from '../test_helpers/exception_list_item_schema.mock'; import { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; import { ExceptionItems } from './exception_items'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/test_helpers/comments.mock.ts b/packages/kbn-securitysolution-exception-list-components/src/test_helpers/comments.mock.ts new file mode 100644 index 000000000000..3e83aa53f0f2 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/test_helpers/comments.mock.ts @@ -0,0 +1,18 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { Comment, CommentsArray } from '@kbn/securitysolution-io-ts-list-types'; + +export const getCommentsMock = (): Comment => ({ + comment: 'some old comment', + created_at: '2020-04-20T15:25:31.830Z', + created_by: 'some user', + id: 'uuid_here', +}); + +export const getCommentsArrayMock = (): CommentsArray => [getCommentsMock(), getCommentsMock()]; diff --git a/packages/kbn-securitysolution-exception-list-components/src/test_helpers/exception_list_item_schema.mock.ts b/packages/kbn-securitysolution-exception-list-components/src/test_helpers/exception_list_item_schema.mock.ts new file mode 100644 index 000000000000..40f6d5292f31 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/test_helpers/exception_list_item_schema.mock.ts @@ -0,0 +1,42 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; + +export const getExceptionListItemSchemaMock = ( + overrides?: Partial +): ExceptionListItemSchema => ({ + _version: undefined, + comments: [], + created_at: '2020-04-20T15:25:31.830Z', + created_by: 'some user', + description: 'some description', + entries: [ + { + entries: [ + { field: 'nested.field', operator: 'included', type: 'match', value: 'some value' }, + ], + field: 'some.parentField', + type: 'nested', + }, + { field: 'some.not.nested.field', operator: 'included', type: 'match', value: 'some value' }, + ], + id: '1', + item_id: 'endpoint_list_item', + list_id: 'endpoint_list_id', + meta: {}, + name: 'some name', + namespace_type: 'single', + os_types: [], + tags: ['user added string for a tag', 'malware'], + tie_breaker_id: '6a76b69d-80df-4ab2-8c3e-85f466b06a0e', + type: 'simple', + updated_at: '2020-04-20T15:25:31.830Z', + updated_by: 'some user', + ...(overrides || {}), +}); diff --git a/packages/kbn-test/jest_integration/jest-preset.js b/packages/kbn-test/jest_integration/jest-preset.js index b039329893d3..d150f8bd9e45 100644 --- a/packages/kbn-test/jest_integration/jest-preset.js +++ b/packages/kbn-test/jest_integration/jest-preset.js @@ -15,9 +15,8 @@ module.exports = { (pattern) => !pattern.includes('integration_tests') ), setupFilesAfterEnv: [ + ...preset.setupFilesAfterEnv, '/node_modules/@kbn/test/target_node/src/jest/setup/after_env.integration.js', - '/node_modules/@kbn/test/target_node/src/jest/setup/mocks.moment_timezone.js', - '/node_modules/@kbn/test/target_node/src/jest/setup/mocks.eui.js', ], reporters: [ 'default', diff --git a/src/core/server/core_app/bundle_routes/register_bundle_routes.test.ts b/src/core/server/core_app/bundle_routes/register_bundle_routes.test.ts index 12f3041ec53f..f816a85404f7 100644 --- a/src/core/server/core_app/bundle_routes/register_bundle_routes.test.ts +++ b/src/core/server/core_app/bundle_routes/register_bundle_routes.test.ts @@ -10,7 +10,7 @@ import { registerRouteForBundleMock } from './register_bundle_routes.test.mocks' import { PackageInfo } from '@kbn/config'; import { httpServiceMock } from '@kbn/core-http-server-mocks'; -import { InternalPluginInfo, UiPlugins } from '../../plugins'; +import type { InternalPluginInfo, UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { registerBundleRoutes } from './register_bundle_routes'; import { FileHashCache } from './file_hash_cache'; diff --git a/src/core/server/core_app/bundle_routes/register_bundle_routes.ts b/src/core/server/core_app/bundle_routes/register_bundle_routes.ts index 6f701b46dcc8..4adb50fdc96c 100644 --- a/src/core/server/core_app/bundle_routes/register_bundle_routes.ts +++ b/src/core/server/core_app/bundle_routes/register_bundle_routes.ts @@ -12,7 +12,7 @@ import { fromRoot } from '@kbn/utils'; import UiSharedDepsNpm from '@kbn/ui-shared-deps-npm'; import * as UiSharedDepsSrc from '@kbn/ui-shared-deps-src'; import type { IRouter } from '@kbn/core-http-server'; -import { UiPlugins } from '../../plugins'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { FileHashCache } from './file_hash_cache'; import { registerRouteForBundle } from './bundles_route'; diff --git a/src/core/server/core_app/core_app.test.ts b/src/core/server/core_app/core_app.test.ts index 913ac2aa9ef6..76663eeed2fd 100644 --- a/src/core/server/core_app/core_app.test.ts +++ b/src/core/server/core_app/core_app.test.ts @@ -10,9 +10,9 @@ import { registerBundleRoutesMock } from './core_app.test.mocks'; import { mockCoreContext } from '@kbn/core-base-server-mocks'; import { mockRouter } from '@kbn/core-http-router-server-mocks'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { coreMock, httpServerMock } from '../mocks'; import { httpResourcesMock } from '../http_resources/http_resources_service.mock'; -import type { UiPlugins } from '../plugins'; import { PluginType } from '../plugins'; import { CoreApp } from './core_app'; import { RequestHandlerContext } from '..'; diff --git a/src/core/server/core_app/core_app.ts b/src/core/server/core_app/core_app.ts index d6f305698fc9..b8701d7646b7 100644 --- a/src/core/server/core_app/core_app.ts +++ b/src/core/server/core_app/core_app.ts @@ -20,10 +20,10 @@ import type { KibanaRequest, IBasePath, } from '@kbn/core-http-server'; +import type { UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { HttpResources, HttpResourcesServiceToolkit } from '../http_resources'; import { InternalCorePreboot, InternalCoreSetup } from '../internal_types'; import { registerBundleRoutes } from './bundle_routes'; -import { UiPlugins } from '../plugins'; import type { InternalCoreAppRequestHandlerContext } from './internal_types'; /** @internal */ diff --git a/src/core/server/http_resources/http_resources_service.test.ts b/src/core/server/http_resources/http_resources_service.test.ts index 47b0ef049485..ea04f3084750 100644 --- a/src/core/server/http_resources/http_resources_service.test.ts +++ b/src/core/server/http_resources/http_resources_service.test.ts @@ -13,7 +13,7 @@ import type { RouteConfig } from '@kbn/core-http-server'; import { mockCoreContext } from '@kbn/core-base-server-mocks'; import { httpServiceMock, httpServerMock } from '@kbn/core-http-server-mocks'; import { coreMock } from '../mocks'; -import { renderingMock } from '../rendering/rendering_service.mock'; +import { renderingServiceMock } from '@kbn/core-rendering-server-mocks'; import { HttpResourcesService, PrebootDeps, SetupDeps } from './http_resources_service'; import { httpResourcesMock } from './http_resources_service.mock'; import { HttpResources } from '..'; @@ -37,11 +37,11 @@ describe('HttpResources service', () => { beforeEach(() => { prebootDeps = { http: httpServiceMock.createInternalPrebootContract(), - rendering: renderingMock.createPrebootContract(), + rendering: renderingServiceMock.createPrebootContract(), }; setupDeps = { http: httpServiceMock.createInternalSetupContract(), - rendering: renderingMock.createSetupContract(), + rendering: renderingServiceMock.createSetupContract(), }; service = new HttpResourcesService(coreContext); router = httpServiceMock.createRouter(); diff --git a/src/core/server/http_resources/http_resources_service.ts b/src/core/server/http_resources/http_resources_service.ts index 5db20bf45e40..7cc88699ea7b 100644 --- a/src/core/server/http_resources/http_resources_service.ts +++ b/src/core/server/http_resources/http_resources_service.ts @@ -18,8 +18,11 @@ import type { InternalHttpServiceSetup, InternalHttpServicePreboot, } from '@kbn/core-http-server-internal'; +import type { + InternalRenderingServicePreboot, + InternalRenderingServiceSetup, +} from '@kbn/core-rendering-server-internal'; import type { RequestHandlerContext } from '@kbn/core-http-request-handler-context-server'; -import { InternalRenderingServicePreboot, InternalRenderingServiceSetup } from '../rendering'; import { InternalHttpResourcesSetup, HttpResources, diff --git a/src/core/server/index.ts b/src/core/server/index.ts index 020975c15fb1..dafd53e374fe 100644 --- a/src/core/server/index.ts +++ b/src/core/server/index.ts @@ -230,7 +230,6 @@ export type { HttpResourcesRequestHandler, } from './http_resources'; -export type { IRenderOptions } from './rendering'; export type { LoggingServiceSetup, LoggerContextConfigInput, diff --git a/src/core/server/internal_types.ts b/src/core/server/internal_types.ts index e744ae01d1be..683d08fe4f84 100644 --- a/src/core/server/internal_types.ts +++ b/src/core/server/internal_types.ts @@ -58,7 +58,7 @@ import type { InternalUiSettingsServiceSetup, InternalUiSettingsServiceStart, } from '@kbn/core-ui-settings-server-internal'; -import { InternalRenderingServiceSetup } from './rendering'; +import type { InternalRenderingServiceSetup } from '@kbn/core-rendering-server-internal'; import { InternalHttpResourcesPreboot, InternalHttpResourcesSetup } from './http_resources'; /** @internal */ diff --git a/src/core/server/mocks.ts b/src/core/server/mocks.ts index 6c2ef712cbf5..cd0429415e7c 100644 --- a/src/core/server/mocks.ts +++ b/src/core/server/mocks.ts @@ -31,6 +31,7 @@ import { coreUsageDataServiceMock } from '@kbn/core-usage-data-server-mocks'; import { i18nServiceMock } from '@kbn/core-i18n-server-mocks'; import { statusServiceMock } from '@kbn/core-status-server-mocks'; import { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks'; +import { renderingServiceMock } from '@kbn/core-rendering-server-mocks'; import type { PluginInitializerContext, CoreSetup, @@ -40,7 +41,6 @@ import type { RequestHandlerContext, } from '.'; import { httpResourcesMock } from './http_resources/http_resources_service.mock'; -import { renderingMock } from './rendering/rendering_service.mock'; import { SharedGlobalConfig } from './plugins'; export { configServiceMock, configDeprecationsMock } from '@kbn/config-mocks'; @@ -57,7 +57,7 @@ export { export { migrationMocks } from '@kbn/core-saved-objects-migration-server-mocks'; export { uiSettingsServiceMock } from '@kbn/core-ui-settings-server-mocks'; export { metricsServiceMock } from '@kbn/core-metrics-server-mocks'; -export { renderingMock } from './rendering/rendering_service.mock'; +export { renderingServiceMock } from '@kbn/core-rendering-server-mocks'; export { statusServiceMock } from '@kbn/core-status-server-mocks'; export { contextServiceMock } from '@kbn/core-http-context-server-mocks'; export { capabilitiesServiceMock } from '@kbn/core-capabilities-server-mocks'; @@ -237,7 +237,7 @@ function createInternalCoreSetupMock() { environment: environmentServiceMock.createSetupContract(), i18n: i18nServiceMock.createSetupContract(), httpResources: httpResourcesMock.createSetupContract(), - rendering: renderingMock.createSetupContract(), + rendering: renderingServiceMock.createSetupContract(), uiSettings: uiSettingsServiceMock.createSetupContract(), logging: loggingServiceMock.createInternalSetupContract(), metrics: metricsServiceMock.createInternalSetupContract(), diff --git a/src/core/server/plugins/index.ts b/src/core/server/plugins/index.ts index 1b655ccd8bd9..2111d467ef3c 100644 --- a/src/core/server/plugins/index.ts +++ b/src/core/server/plugins/index.ts @@ -10,7 +10,6 @@ export { PluginsService } from './plugins_service'; export type { PluginsServiceSetup, PluginsServiceStart, - UiPlugins, DiscoveredPlugins, } from './plugins_service'; export { config } from './plugins_config'; diff --git a/src/core/server/plugins/plugins_service.ts b/src/core/server/plugins/plugins_service.ts index a95619f3bc45..3305ff0a06b4 100644 --- a/src/core/server/plugins/plugins_service.ts +++ b/src/core/server/plugins/plugins_service.ts @@ -17,15 +17,10 @@ import type { CoreContext, CoreService } from '@kbn/core-base-server-internal'; import type { PluginName } from '@kbn/core-base-common'; import type { InternalEnvironmentServicePreboot } from '@kbn/core-environment-server-internal'; import type { InternalNodeServicePreboot } from '@kbn/core-node-server-internal'; +import type { InternalPluginInfo, UiPlugins } from '@kbn/core-plugins-base-server-internal'; import { discover, PluginDiscoveryError, PluginDiscoveryErrorType } from './discovery'; import { PluginWrapper } from './plugin'; -import { - DiscoveredPlugin, - InternalPluginInfo, - PluginConfigDescriptor, - PluginDependencies, - PluginType, -} from './types'; +import { DiscoveredPlugin, PluginConfigDescriptor, PluginDependencies, PluginType } from './types'; import { PluginsConfig, PluginsConfigType } from './plugins_config'; import { PluginsSystem } from './plugins_system'; import { createBrowserConfig } from './create_browser_config'; @@ -48,25 +43,6 @@ export interface PluginsServiceSetup { contracts: Map; } -/** @internal */ -export interface UiPlugins { - /** - * Paths to all discovered ui plugin entrypoints on the filesystem, even if - * disabled. - */ - internal: Map; - - /** - * Information needed by client-side to load plugins and wire dependencies. - */ - public: Map; - - /** - * Configuration for plugins to be exposed to the client-side. - */ - browserConfigs: Map>; -} - /** @internal */ export interface PluginsServiceStart { /** Start contracts returned by plugins. */ diff --git a/src/core/server/plugins/types.ts b/src/core/server/plugins/types.ts index f8b20b66f506..699631bc4411 100644 --- a/src/core/server/plugins/types.ts +++ b/src/core/server/plugins/types.ts @@ -254,28 +254,6 @@ export interface PluginManifest { readonly enabledOnAnonymousPages?: boolean; } -/** - * @internal - */ -export interface InternalPluginInfo { - /** - * Version of the plugin - */ - readonly version: string; - /** - * Bundles that must be loaded for this plugin - */ - readonly requiredBundles: readonly string[]; - /** - * Path to the target/public directory of the plugin which should be served - */ - readonly publicTargetDir: string; - /** - * Path to the plugin assets directory. - */ - readonly publicAssetsDir: string; -} - /** * The interface that should be returned by a `PluginInitializer` for a `preboot` plugin. * diff --git a/src/core/server/server.test.mocks.ts b/src/core/server/server.test.mocks.ts index dec2b17ae8c6..3e1d5c0e3a28 100644 --- a/src/core/server/server.test.mocks.ts +++ b/src/core/server/server.test.mocks.ts @@ -63,10 +63,12 @@ jest.doMock('@kbn/core-config-server-internal', () => ({ ensureValidConfiguration: mockEnsureValidConfiguration, })); -import { RenderingService, mockRenderingService } from './rendering/__mocks__/rendering_service'; +import { renderingServiceMock } from '@kbn/core-rendering-server-mocks'; -export { mockRenderingService }; -jest.doMock('./rendering/rendering_service', () => ({ RenderingService })); +export const mockRenderingService = renderingServiceMock.create(); +jest.doMock('@kbn/core-rendering-server-internal', () => ({ + RenderingService: jest.fn(() => mockRenderingService), +})); import { environmentServiceMock } from '@kbn/core-environment-server-mocks'; diff --git a/src/core/server/server.ts b/src/core/server/server.ts index e333e8b81a40..b7f41dd31dd0 100644 --- a/src/core/server/server.ts +++ b/src/core/server/server.ts @@ -66,10 +66,10 @@ import type { RequestHandlerContext, PrebootRequestHandlerContext, } from '@kbn/core-http-request-handler-context-server'; +import { RenderingService } from '@kbn/core-rendering-server-internal'; import { CoreApp } from './core_app'; import { HttpResourcesService } from './http_resources'; -import { RenderingService } from './rendering'; import { PluginsService, config as pluginsConfig } from './plugins'; import { InternalCorePreboot, InternalCoreSetup, InternalCoreStart } from './internal_types'; import { DiscoveredPlugins } from './plugins'; diff --git a/src/dev/build/args.test.ts b/src/dev/build/args.test.ts index 6a7436284b2e..3e1b1c72f88f 100644 --- a/src/dev/build/args.test.ts +++ b/src/dev/build/args.test.ts @@ -28,13 +28,13 @@ it('build default and oss dist for current platform, without packages, by defaul Object { "buildOptions": Object { "buildCanvasShareableRuntime": true, + "buildExamplePlugins": false, "createArchives": true, "createDebPackage": false, "createDockerCloud": false, "createDockerContexts": true, "createDockerUBI": false, "createDockerUbuntu": false, - "createExamplePlugins": false, "createGenericFolders": true, "createPlatformFolders": true, "createRpmPackage": false, @@ -62,13 +62,13 @@ it('builds packages if --all-platforms is passed', () => { Object { "buildOptions": Object { "buildCanvasShareableRuntime": true, + "buildExamplePlugins": false, "createArchives": true, "createDebPackage": true, "createDockerCloud": true, "createDockerContexts": true, "createDockerUBI": true, "createDockerUbuntu": true, - "createExamplePlugins": false, "createGenericFolders": true, "createPlatformFolders": true, "createRpmPackage": true, @@ -96,13 +96,13 @@ it('limits packages if --rpm passed with --all-platforms', () => { Object { "buildOptions": Object { "buildCanvasShareableRuntime": true, + "buildExamplePlugins": false, "createArchives": true, "createDebPackage": false, "createDockerCloud": false, "createDockerContexts": true, "createDockerUBI": false, "createDockerUbuntu": false, - "createExamplePlugins": false, "createGenericFolders": true, "createPlatformFolders": true, "createRpmPackage": true, @@ -130,13 +130,13 @@ it('limits packages if --deb passed with --all-platforms', () => { Object { "buildOptions": Object { "buildCanvasShareableRuntime": true, + "buildExamplePlugins": false, "createArchives": true, "createDebPackage": true, "createDockerCloud": false, "createDockerContexts": true, "createDockerUBI": false, "createDockerUbuntu": false, - "createExamplePlugins": false, "createGenericFolders": true, "createPlatformFolders": true, "createRpmPackage": false, @@ -165,13 +165,13 @@ it('limits packages if --docker passed with --all-platforms', () => { Object { "buildOptions": Object { "buildCanvasShareableRuntime": true, + "buildExamplePlugins": false, "createArchives": true, "createDebPackage": false, "createDockerCloud": true, "createDockerContexts": true, "createDockerUBI": true, "createDockerUbuntu": true, - "createExamplePlugins": false, "createGenericFolders": true, "createPlatformFolders": true, "createRpmPackage": false, @@ -207,13 +207,13 @@ it('limits packages if --docker passed with --skip-docker-ubi and --all-platform Object { "buildOptions": Object { "buildCanvasShareableRuntime": true, + "buildExamplePlugins": false, "createArchives": true, "createDebPackage": false, "createDockerCloud": true, "createDockerContexts": true, "createDockerUBI": false, "createDockerUbuntu": true, - "createExamplePlugins": false, "createGenericFolders": true, "createPlatformFolders": true, "createRpmPackage": false, @@ -242,13 +242,13 @@ it('limits packages if --all-platforms passed with --skip-docker-ubuntu', () => Object { "buildOptions": Object { "buildCanvasShareableRuntime": true, + "buildExamplePlugins": false, "createArchives": true, "createDebPackage": true, "createDockerCloud": true, "createDockerContexts": true, "createDockerUBI": true, "createDockerUbuntu": false, - "createExamplePlugins": false, "createGenericFolders": true, "createPlatformFolders": true, "createRpmPackage": true, diff --git a/src/dev/build/args.ts b/src/dev/build/args.ts index c3d1a19f82a3..c3cd4f164a48 100644 --- a/src/dev/build/args.ts +++ b/src/dev/build/args.ts @@ -127,7 +127,7 @@ export function readCliArgs(argv: string[]) { createGenericFolders: !Boolean(flags['skip-generic-folders']), createPlatformFolders: !Boolean(flags['skip-platform-folders']), createArchives: !Boolean(flags['skip-archives']), - createExamplePlugins: Boolean(flags['example-plugins']), + buildExamplePlugins: Boolean(flags['example-plugins']), createRpmPackage: isOsPackageDesired('rpm'), createDebPackage: isOsPackageDesired('deb'), createDockerUbuntu: diff --git a/src/dev/build/build_distributables.ts b/src/dev/build/build_distributables.ts index 0649c5ddc946..40a1afa51add 100644 --- a/src/dev/build/build_distributables.ts +++ b/src/dev/build/build_distributables.ts @@ -32,7 +32,7 @@ export interface BuildOptions { createDockerContexts: boolean; versionQualifier: string | undefined; targetAllPlatforms: boolean; - createExamplePlugins: boolean; + buildExamplePlugins: boolean; eprRegistry: 'production' | 'snapshot'; } @@ -58,13 +58,6 @@ export async function buildDistributables(log: ToolingLog, options: BuildOptions await run(Tasks.ExtractNodeBuilds); } - /** - * build example plugins - */ - if (options.createExamplePlugins) { - await run(Tasks.BuildKibanaExamplePlugins); - } - /** * run platform-generic build tasks */ @@ -79,6 +72,9 @@ export async function buildDistributables(log: ToolingLog, options: BuildOptions await run(Tasks.BuildCanvasShareableRuntime); } await run(Tasks.BuildKibanaPlatformPlugins); + if (options.buildExamplePlugins) { + await run(Tasks.BuildKibanaExamplePlugins); + } await run(Tasks.CreatePackageJson); await run(Tasks.InstallDependencies); await run(Tasks.GeneratePackagesOptimizedAssets); diff --git a/src/dev/build/tasks/build_kibana_example_plugins.ts b/src/dev/build/tasks/build_kibana_example_plugins.ts index 0208ba2ed61b..6fc53e10390c 100644 --- a/src/dev/build/tasks/build_kibana_example_plugins.ts +++ b/src/dev/build/tasks/build_kibana_example_plugins.ts @@ -9,14 +9,16 @@ import Path from 'path'; import Fs from 'fs'; import { REPO_ROOT } from '@kbn/utils'; -import { exec, mkdirp, copyAll, Task } from '../lib'; +import { exec, Task } from '../lib'; export const BuildKibanaExamplePlugins: Task = { description: 'Building distributable versions of Kibana example plugins', - async run(config, log) { + async run(config, log, build) { + const pluginsDir = build.resolvePath('plugins'); const args = [ Path.resolve(REPO_ROOT, 'scripts/plugin_helpers'), 'build', + '--skip-archive', `--kibana-version=${config.getBuildVersion()}`, ]; @@ -42,15 +44,12 @@ export const BuildKibanaExamplePlugins: Task = { cwd: examplePlugin, level: 'info', }); + log.info('Copying build to distribution'); + const pluginBuild = Path.resolve(examplePlugin, 'build', 'kibana'); + Fs.cpSync(pluginBuild, pluginsDir, { recursive: true }); } catch (e) { log.info(`Skipping ${examplePlugin}, no kibana.json`); } } - - const pluginsDir = config.resolveFromTarget('example_plugins'); - await mkdirp(pluginsDir); - await copyAll(REPO_ROOT, pluginsDir, { - select: ['examples/*/build/*.zip', 'x-pack/examples/*/build/*.zip'], - }); }, }; diff --git a/src/plugins/dashboard/public/application/lib/diff_dashboard_state.ts b/src/plugins/dashboard/public/application/lib/diff_dashboard_state.ts index 1c57d1bd2afa..e5432b50550e 100644 --- a/src/plugins/dashboard/public/application/lib/diff_dashboard_state.ts +++ b/src/plugins/dashboard/public/application/lib/diff_dashboard_state.ts @@ -101,12 +101,17 @@ export const diffDashboardState = async ({ getEmbeddable ); const optionsAreEqual = getOptionsAreEqual(originalState.options, newState.options); - const filtersAreEqual = getFiltersAreEqual(originalState.filters, newState.filters, true); const controlGroupIsEqual = persistableControlGroupInputIsEqual( originalState.controlGroupInput, newState.controlGroupInput ); + const filterStateDiff = getFiltersAreEqual(originalState.filters, newState.filters, true) + ? {} + : { + filters: newState.filters.filter((f) => !isFilterPinned(f)), + }; + const timeStatediff = getTimeSettingsAreEqual({ currentTimeRestore: newState.timeRestore, lastSaved: { ...pick(originalState, ['timeRange', 'timeRestore', 'refreshInterval']) }, @@ -117,9 +122,9 @@ export const diffDashboardState = async ({ return { ...commonStateDiff, ...(panelsAreEqual ? {} : { panels: newState.panels }), - ...(filtersAreEqual ? {} : { filters: newState.filters }), ...(optionsAreEqual ? {} : { options: newState.options }), ...(controlGroupIsEqual ? {} : { controlGroupInput: newState.controlGroupInput }), + ...filterStateDiff, ...timeStatediff, }; }; @@ -174,7 +179,7 @@ const getFiltersAreEqual = ( ignorePinned?: boolean ): boolean => { return compareFilters( - filtersA, + ignorePinned ? filtersA.filter((f) => !isFilterPinned(f)) : filtersA, ignorePinned ? filtersB.filter((f) => !isFilterPinned(f)) : filtersB, COMPARE_ALL_OPTIONS ); diff --git a/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx b/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx index c9baa374ed1d..08a13c7f43d4 100644 --- a/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx +++ b/src/plugins/data_view_editor/public/components/data_view_editor_flyout_content.tsx @@ -10,7 +10,12 @@ import React, { useState, useEffect, useCallback, useRef } from 'react'; import { EuiTitle, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiLoadingSpinner } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import memoizeOne from 'memoize-one'; -import { DataViewField } from '@kbn/data-views-plugin/public'; +import { + DataViewField, + DataViewsPublicPluginStart, + INDEX_PATTERN_TYPE, + MatchedItem, +} from '@kbn/data-views-plugin/public'; import { DataView, @@ -23,16 +28,14 @@ import { UseField, } from '../shared_imports'; -import { ensureMinimumTime, getIndices, extractTimeFields, getMatchedIndices } from '../lib'; +import { ensureMinimumTime, extractTimeFields, getMatchedIndices } from '../lib'; import { FlyoutPanels } from './flyout_panels'; import { removeSpaces } from '../lib'; import { - MatchedItem, DataViewEditorContext, RollupIndicesCapsResponse, - INDEX_PATTERN_TYPE, IndexPatternConfig, MatchedIndicesSet, FormInternal, @@ -176,18 +179,19 @@ const IndexPatternEditorFlyoutContentComponent = ({ // load all data sources and set initial matchedIndices const loadSources = useCallback(() => { - getIndices({ - http, - isRollupIndex: () => false, - pattern: '*', - showAllIndices: allowHidden, - }).then((dataSources) => { - setAllSources(dataSources); - const matchedSet = getMatchedIndices(dataSources, [], [], allowHidden); - setMatchedIndices(matchedSet); - setIsLoadingSources(false); - }); - }, [http, allowHidden]); + dataViews + .getIndices({ + isRollupIndex: () => false, + pattern: '*', + showAllIndices: allowHidden, + }) + .then((dataSources) => { + setAllSources(dataSources); + const matchedSet = getMatchedIndices(dataSources, [], [], allowHidden); + setMatchedIndices(matchedSet); + setIsLoadingSources(false); + }); + }, [allowHidden, dataViews]); // loading list of index patterns useEffect(() => { @@ -271,7 +275,7 @@ const IndexPatternEditorFlyoutContentComponent = ({ const { matchedIndicesResult, exactMatched } = !isLoadingSources ? await loadMatchedIndices(query, allowHidden, allSources, { isRollupIndex, - http, + dataViews, }) : { matchedIndicesResult: { @@ -302,7 +306,7 @@ const IndexPatternEditorFlyoutContentComponent = ({ return fetchIndices(newTitle); }, - [http, allowHidden, allSources, type, rollupIndicesCapabilities, isLoadingSources] + [dataViews, allowHidden, allSources, type, rollupIndicesCapabilities, isLoadingSources] ); // If editData exists, loadSources so that MatchedIndices can be loaded for the Timestampfields @@ -453,10 +457,10 @@ const loadMatchedIndices = memoizeOne( allSources: MatchedItem[], { isRollupIndex, - http, + dataViews, }: { isRollupIndex: (index: string) => boolean; - http: DataViewEditorContext['http']; + dataViews: DataViewsPublicPluginStart; } ): Promise<{ matchedIndicesResult: MatchedIndicesSet; @@ -466,8 +470,7 @@ const loadMatchedIndices = memoizeOne( const indexRequests = []; if (query?.endsWith('*')) { - const exactMatchedQuery = getIndices({ - http, + const exactMatchedQuery = dataViews.getIndices({ isRollupIndex, pattern: query, showAllIndices: allowHidden, @@ -476,14 +479,12 @@ const loadMatchedIndices = memoizeOne( // provide default value when not making a request for the partialMatchQuery indexRequests.push(Promise.resolve([])); } else { - const exactMatchQuery = getIndices({ - http, + const exactMatchQuery = dataViews.getIndices({ isRollupIndex, pattern: query, showAllIndices: allowHidden, }); - const partialMatchQuery = getIndices({ - http, + const partialMatchQuery = dataViews.getIndices({ isRollupIndex, pattern: `${query}*`, showAllIndices: allowHidden, diff --git a/src/plugins/data_view_editor/public/components/form_fields/title_field.tsx b/src/plugins/data_view_editor/public/components/form_fields/title_field.tsx index 822de9506500..9a4c209a56eb 100644 --- a/src/plugins/data_view_editor/public/components/form_fields/title_field.tsx +++ b/src/plugins/data_view_editor/public/components/form_fields/title_field.tsx @@ -9,6 +9,7 @@ import React, { ChangeEvent, useState, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiFieldText } from '@elastic/eui'; +import { MatchedItem } from '@kbn/data-views-plugin/public'; import { UseField, getFieldValidityAndErrorMessage, @@ -17,12 +18,7 @@ import { } from '../../shared_imports'; import { canAppendWildcard, removeSpaces } from '../../lib'; import { schema } from '../form_schema'; -import { - MatchedItem, - RollupIndicesCapsResponse, - IndexPatternConfig, - MatchedIndicesSet, -} from '../../types'; +import { RollupIndicesCapsResponse, IndexPatternConfig, MatchedIndicesSet } from '../../types'; interface RefreshMatchedIndicesResult { matchedIndicesResult: MatchedIndicesSet; diff --git a/src/plugins/data_view_editor/public/components/form_fields/type_field.tsx b/src/plugins/data_view_editor/public/components/form_fields/type_field.tsx index 11b46c7ee31f..b11d8ac2e03e 100644 --- a/src/plugins/data_view_editor/public/components/form_fields/type_field.tsx +++ b/src/plugins/data_view_editor/public/components/form_fields/type_field.tsx @@ -20,9 +20,10 @@ import { EuiBadge, } from '@elastic/eui'; +import { INDEX_PATTERN_TYPE } from '@kbn/data-views-plugin/public'; import { UseField } from '../../shared_imports'; -import { INDEX_PATTERN_TYPE, IndexPatternConfig } from '../../types'; +import { IndexPatternConfig } from '../../types'; interface TypeFieldProps { onChange: (type: INDEX_PATTERN_TYPE) => void; diff --git a/src/plugins/data_view_editor/public/components/form_schema.ts b/src/plugins/data_view_editor/public/components/form_schema.ts index 98c3a3b5322e..59e195a1f128 100644 --- a/src/plugins/data_view_editor/public/components/form_schema.ts +++ b/src/plugins/data_view_editor/public/components/form_schema.ts @@ -6,9 +6,9 @@ * Side Public License, v 1. */ +import { INDEX_PATTERN_TYPE } from '@kbn/data-views-plugin/public'; import { i18n } from '@kbn/i18n'; import { fieldValidators, ValidationFunc } from '../shared_imports'; -import { INDEX_PATTERN_TYPE } from '../types'; export const singleAstriskValidator = ( ...args: Parameters diff --git a/src/plugins/data_view_editor/public/components/preview_panel/indices_list/indices_list.test.tsx b/src/plugins/data_view_editor/public/components/preview_panel/indices_list/indices_list.test.tsx index cad9f323f95e..074865006a38 100644 --- a/src/plugins/data_view_editor/public/components/preview_panel/indices_list/indices_list.test.tsx +++ b/src/plugins/data_view_editor/public/components/preview_panel/indices_list/indices_list.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { IndicesList } from '.'; import { shallow } from 'enzyme'; -import { MatchedItem } from '../../../types'; +import { MatchedItem } from '@kbn/data-views-plugin/public'; const indices = [ { name: 'kibana', tags: [] }, diff --git a/src/plugins/data_view_editor/public/components/preview_panel/indices_list/indices_list.tsx b/src/plugins/data_view_editor/public/components/preview_panel/indices_list/indices_list.tsx index db3d1dc49145..51405efc5879 100644 --- a/src/plugins/data_view_editor/public/components/preview_panel/indices_list/indices_list.tsx +++ b/src/plugins/data_view_editor/public/components/preview_panel/indices_list/indices_list.tsx @@ -27,7 +27,7 @@ import { import { Pager } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { MatchedItem, Tag } from '../../../types'; +import { MatchedItem, Tag } from '@kbn/data-views-plugin/public'; interface IndicesListProps { indices: MatchedItem[]; diff --git a/src/plugins/data_view_editor/public/components/preview_panel/preview_panel.tsx b/src/plugins/data_view_editor/public/components/preview_panel/preview_panel.tsx index 28413debdb2a..26f6b2b1c2a7 100644 --- a/src/plugins/data_view_editor/public/components/preview_panel/preview_panel.tsx +++ b/src/plugins/data_view_editor/public/components/preview_panel/preview_panel.tsx @@ -8,10 +8,11 @@ import React from 'react'; import { EuiSpacer } from '@elastic/eui'; +import { INDEX_PATTERN_TYPE } from '@kbn/data-views-plugin/public'; import { StatusMessage } from './status_message'; import { IndicesList } from './indices_list'; -import { INDEX_PATTERN_TYPE, MatchedIndicesSet } from '../../types'; +import { MatchedIndicesSet } from '../../types'; interface Props { type: INDEX_PATTERN_TYPE; diff --git a/src/plugins/data_view_editor/public/components/preview_panel/status_message/status_message.test.tsx b/src/plugins/data_view_editor/public/components/preview_panel/status_message/status_message.test.tsx index 858a00f025e9..23f0e1b8a6b0 100644 --- a/src/plugins/data_view_editor/public/components/preview_panel/status_message/status_message.test.tsx +++ b/src/plugins/data_view_editor/public/components/preview_panel/status_message/status_message.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { StatusMessage } from '.'; import { shallow } from 'enzyme'; -import { MatchedItem } from '../../../types'; +import { MatchedItem } from '@kbn/data-views-plugin/public'; const tagsPartial = { tags: [], diff --git a/src/plugins/data_view_editor/public/lib/get_matched_indices.test.ts b/src/plugins/data_view_editor/public/lib/get_matched_indices.test.ts index b1c80791a134..a5f12f7221ab 100644 --- a/src/plugins/data_view_editor/public/lib/get_matched_indices.test.ts +++ b/src/plugins/data_view_editor/public/lib/get_matched_indices.test.ts @@ -6,8 +6,9 @@ * Side Public License, v 1. */ +import { MatchedItem } from '@kbn/data-views-plugin/public'; +import { Tag } from '@kbn/data-views-plugin/public/types'; import { getMatchedIndices } from './get_matched_indices'; -import { Tag, MatchedItem } from '../types'; jest.mock('../constants', () => ({ MAX_NUMBER_OF_MATCHING_INDICES: 6, diff --git a/src/plugins/data_view_editor/public/lib/get_matched_indices.ts b/src/plugins/data_view_editor/public/lib/get_matched_indices.ts index 0b659aa5fbc7..e35ba8f1e8fa 100644 --- a/src/plugins/data_view_editor/public/lib/get_matched_indices.ts +++ b/src/plugins/data_view_editor/public/lib/get_matched_indices.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { MatchedItem } from '@kbn/data-views-plugin/public'; import { MAX_NUMBER_OF_MATCHING_INDICES } from '../constants'; function isSystemIndex(index: string): boolean { @@ -50,7 +51,7 @@ function filterSystemIndices(indices: MatchedItem[], isIncludingSystemIndices: b We call this `exact` matches because ES is telling us exactly what it matches */ -import { MatchedItem, MatchedIndicesSet } from '../types'; +import { MatchedIndicesSet } from '../types'; export function getMatchedIndices( unfilteredAllIndices: MatchedItem[], diff --git a/src/plugins/data_view_editor/public/lib/index.ts b/src/plugins/data_view_editor/public/lib/index.ts index 981c9df03527..97a1f08d3504 100644 --- a/src/plugins/data_view_editor/public/lib/index.ts +++ b/src/plugins/data_view_editor/public/lib/index.ts @@ -10,8 +10,6 @@ export { canAppendWildcard } from './can_append_wildcard'; export { ensureMinimumTime } from './ensure_minimum_time'; -export { getIndices } from './get_indices'; - export { getMatchedIndices } from './get_matched_indices'; export { containsIllegalCharacters } from './contains_illegal_characters'; diff --git a/src/plugins/data_view_editor/public/types.ts b/src/plugins/data_view_editor/public/types.ts index 5b177f65b060..4500e522119d 100644 --- a/src/plugins/data_view_editor/public/types.ts +++ b/src/plugins/data_view_editor/public/types.ts @@ -17,7 +17,12 @@ import { import { EuiComboBoxOptionOption } from '@elastic/eui'; -import type { DataView, DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; +import type { + DataView, + DataViewsPublicPluginStart, + INDEX_PATTERN_TYPE, + MatchedItem, +} from '@kbn/data-views-plugin/public'; import { DataPublicPluginStart, IndexPatternAggRestrictions } from './shared_imports'; export interface DataViewEditorContext { @@ -80,51 +85,6 @@ export interface StartPlugins { export type CloseEditor = () => void; -export interface MatchedItem { - name: string; - tags: Tag[]; - item: { - name: string; - backing_indices?: string[]; - timestamp_field?: string; - indices?: string[]; - aliases?: string[]; - attributes?: ResolveIndexResponseItemIndexAttrs[]; - data_stream?: string; - }; -} - -// for showing index matches -export interface ResolveIndexResponse { - indices?: ResolveIndexResponseItemIndex[]; - aliases?: ResolveIndexResponseItemAlias[]; - data_streams?: ResolveIndexResponseItemDataStream[]; -} - -export interface ResolveIndexResponseItem { - name: string; -} - -export interface ResolveIndexResponseItemDataStream extends ResolveIndexResponseItem { - backing_indices: string[]; - timestamp_field: string; -} - -export interface ResolveIndexResponseItemAlias extends ResolveIndexResponseItem { - indices: string[]; -} - -export interface ResolveIndexResponseItemIndex extends ResolveIndexResponseItem { - aliases?: string[]; - attributes?: ResolveIndexResponseItemIndexAttrs[]; - data_stream?: string; -} - -export interface Tag { - name: string; - key: string; - color: string; -} // end for index matches export interface IndexPatternTableItem { @@ -135,13 +95,6 @@ export interface IndexPatternTableItem { sort: string; } -export enum ResolveIndexResponseItemIndexAttrs { - OPEN = 'open', - CLOSED = 'closed', - HIDDEN = 'hidden', - FROZEN = 'frozen', -} - export interface RollupIndiciesCapability { aggs: Record; error: string; @@ -149,11 +102,6 @@ export interface RollupIndiciesCapability { export type RollupIndicesCapsResponse = Record; -export enum INDEX_PATTERN_TYPE { - ROLLUP = 'rollup', - DEFAULT = 'default', -} - export interface IndexPatternConfig { title: string; timestampField?: EuiComboBoxOptionOption; diff --git a/src/plugins/data_views/public/data_views_service_public.ts b/src/plugins/data_views/public/data_views_service_public.ts index 4693e7000b2a..30625b1b59da 100644 --- a/src/plugins/data_views/public/data_views_service_public.ts +++ b/src/plugins/data_views/public/data_views_service_public.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { DataViewsService } from '.'; +import { DataViewsService, MatchedItem } from '.'; import { DataViewsServiceDeps } from '../common/data_views/data_views'; import { HasDataService } from '../common'; @@ -24,6 +24,11 @@ export interface DataViewsServicePublicDeps extends DataViewsServiceDeps { * Has data service */ hasData: HasDataService; + getIndices: (props: { + pattern: string; + showAllIndices?: boolean; + isRollupIndex: (indexName: string) => boolean; + }) => Promise; } /** @@ -32,6 +37,12 @@ export interface DataViewsServicePublicDeps extends DataViewsServiceDeps { */ export class DataViewsServicePublic extends DataViewsService { public getCanSaveSync: () => boolean; + + public getIndices: (props: { + pattern: string; + showAllIndices?: boolean; + isRollupIndex: (indexName: string) => boolean; + }) => Promise; public hasData: HasDataService; /** @@ -43,5 +54,6 @@ export class DataViewsServicePublic extends DataViewsService { super(deps); this.getCanSaveSync = deps.getCanSaveSync; this.hasData = deps.hasData; + this.getIndices = deps.getIndices; } } diff --git a/src/plugins/data_views/public/index.ts b/src/plugins/data_views/public/index.ts index f886d60696b8..8ee149622f39 100644 --- a/src/plugins/data_views/public/index.ts +++ b/src/plugins/data_views/public/index.ts @@ -32,7 +32,14 @@ export { getFieldSubtypeNested, } from '../common'; -export type { DataViewsPublicSetupDependencies, DataViewsPublicStartDependencies } from './types'; +export type { + DataViewsPublicSetupDependencies, + DataViewsPublicStartDependencies, + MatchedItem, + Tag, +} from './types'; + +export { INDEX_PATTERN_TYPE } from './types'; export type { DataViewsServicePublic, diff --git a/src/plugins/data_views/public/plugin.ts b/src/plugins/data_views/public/plugin.ts index df379ab18964..415a6c97bc73 100644 --- a/src/plugins/data_views/public/plugin.ts +++ b/src/plugins/data_views/public/plugin.ts @@ -21,7 +21,7 @@ import { SavedObjectsClientPublicToCommon } from './saved_objects_client_wrapper import { UiSettingsPublicToCommon } from './ui_settings_wrapper'; import { DataViewsServicePublic } from './data_views_service_public'; -import { HasData } from './services'; +import { getIndices, HasData } from './services'; import { debounceByKey } from './debounce_by_key'; @@ -76,6 +76,7 @@ export class DataViewsPublicPlugin getCanSaveSync: () => application.capabilities.indexPatterns.save === true, getCanSaveAdvancedSettings: () => Promise.resolve(application.capabilities.advancedSettings.save === true), + getIndices: (props) => getIndices({ ...props, http: core.http }), }); } diff --git a/src/plugins/data_view_editor/public/lib/__snapshots__/get_indices.test.ts.snap b/src/plugins/data_views/public/services/__snapshots__/get_indices.test.ts.snap similarity index 100% rename from src/plugins/data_view_editor/public/lib/__snapshots__/get_indices.test.ts.snap rename to src/plugins/data_views/public/services/__snapshots__/get_indices.test.ts.snap diff --git a/src/plugins/data_view_editor/public/lib/get_indices.test.ts b/src/plugins/data_views/public/services/get_indices.test.ts similarity index 100% rename from src/plugins/data_view_editor/public/lib/get_indices.test.ts rename to src/plugins/data_views/public/services/get_indices.test.ts diff --git a/src/plugins/data_view_editor/public/lib/get_indices.ts b/src/plugins/data_views/public/services/get_indices.ts similarity index 90% rename from src/plugins/data_view_editor/public/lib/get_indices.ts rename to src/plugins/data_views/public/services/get_indices.ts index 2c04d6e38996..fba500436752 100644 --- a/src/plugins/data_view_editor/public/lib/get_indices.ts +++ b/src/plugins/data_views/public/services/get_indices.ts @@ -12,20 +12,20 @@ import { i18n } from '@kbn/i18n'; import { Tag, INDEX_PATTERN_TYPE } from '../types'; import { MatchedItem, ResolveIndexResponse, ResolveIndexResponseItemIndexAttrs } from '../types'; -const aliasLabel = i18n.translate('indexPatternEditor.aliasLabel', { defaultMessage: 'Alias' }); -const dataStreamLabel = i18n.translate('indexPatternEditor.dataStreamLabel', { +const aliasLabel = i18n.translate('dataViews.aliasLabel', { defaultMessage: 'Alias' }); +const dataStreamLabel = i18n.translate('dataViews.dataStreamLabel', { defaultMessage: 'Data stream', }); -const indexLabel = i18n.translate('indexPatternEditor.indexLabel', { +const indexLabel = i18n.translate('dataViews.indexLabel', { defaultMessage: 'Index', }); -const frozenLabel = i18n.translate('indexPatternEditor.frozenLabel', { +const frozenLabel = i18n.translate('dataViews.frozenLabel', { defaultMessage: 'Frozen', }); -const rollupLabel = i18n.translate('indexPatternEditor.rollupLabel', { +const rollupLabel = i18n.translate('dataViews.rollupLabel', { defaultMessage: 'Rollup', }); diff --git a/src/plugins/data_views/public/services/index.ts b/src/plugins/data_views/public/services/index.ts index 36d35d69bcb5..af3787bd5dbd 100644 --- a/src/plugins/data_views/public/services/index.ts +++ b/src/plugins/data_views/public/services/index.ts @@ -6,4 +6,17 @@ * Side Public License, v 1. */ +import { HttpStart } from '@kbn/core/public'; +import { MatchedItem } from '../types'; + export * from './has_data'; + +export async function getIndices(props: { + http: HttpStart; + pattern: string; + showAllIndices?: boolean; + isRollupIndex: (indexName: string) => boolean; +}): Promise { + const { getIndices: getIndicesLazy } = await import('./get_indices'); + return getIndicesLazy(props); +} diff --git a/src/plugins/data_views/public/types.ts b/src/plugins/data_views/public/types.ts index fc888d2c42c8..637d4191c671 100644 --- a/src/plugins/data_views/public/types.ts +++ b/src/plugins/data_views/public/types.ts @@ -11,6 +11,11 @@ import { FieldFormatsSetup, FieldFormatsStart } from '@kbn/field-formats-plugin/ import { DataViewsServicePublicMethods } from './data_views'; import { HasDataService } from '../common'; +export enum INDEX_PATTERN_TYPE { + ROLLUP = 'rollup', + DEFAULT = 'default', +} + export enum IndicesResponseItemIndexAttrs { OPEN = 'open', CLOSED = 'closed', @@ -98,6 +103,11 @@ export interface DataViewsPublicPluginSetup {} export interface DataViewsServicePublic extends DataViewsServicePublicMethods { getCanSaveSync: () => boolean; hasData: HasDataService; + getIndices: (props: { + pattern: string; + showAllIndices?: boolean; + isRollupIndex: (indexName: string) => boolean; + }) => Promise; } export type DataViewsContract = DataViewsServicePublic; @@ -106,3 +116,55 @@ export type DataViewsContract = DataViewsServicePublic; * Data views plugin public Start contract */ export type DataViewsPublicPluginStart = DataViewsServicePublic; + +export interface MatchedItem { + name: string; + tags: Tag[]; + item: { + name: string; + backing_indices?: string[]; + timestamp_field?: string; + indices?: string[]; + aliases?: string[]; + attributes?: ResolveIndexResponseItemIndexAttrs[]; + data_stream?: string; + }; +} + +// for showing index matches +export interface ResolveIndexResponse { + indices?: ResolveIndexResponseItemIndex[]; + aliases?: ResolveIndexResponseItemAlias[]; + data_streams?: ResolveIndexResponseItemDataStream[]; +} + +export interface ResolveIndexResponseItem { + name: string; +} + +export interface ResolveIndexResponseItemDataStream extends ResolveIndexResponseItem { + backing_indices: string[]; + timestamp_field: string; +} + +export interface ResolveIndexResponseItemAlias extends ResolveIndexResponseItem { + indices: string[]; +} + +export interface ResolveIndexResponseItemIndex extends ResolveIndexResponseItem { + aliases?: string[]; + attributes?: ResolveIndexResponseItemIndexAttrs[]; + data_stream?: string; +} + +export interface Tag { + name: string; + key: string; + color: string; +} +export enum ResolveIndexResponseItemIndexAttrs { + OPEN = 'open', + CLOSED = 'closed', + HIDDEN = 'hidden', + FROZEN = 'frozen', +} diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx index 22d33215b1ea..666b75a68949 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.test.tsx @@ -194,4 +194,14 @@ describe('discover sidebar', function () { const createDataViewButton = findTestSubject(compWithPickerInViewerMode, 'dataview-create-new'); expect(createDataViewButton.length).toBe(0); }); + + it('should render the Visualize in Lens button in text based languages mode', () => { + const compInViewerMode = mountWithIntl( + + + + ); + const visualizeField = findTestSubject(compInViewerMode, 'textBased-visualize'); + expect(visualizeField.length).toBe(1); + }); }); diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.tsx index d7e227df94b8..355512da5c52 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_sidebar.tsx @@ -22,6 +22,7 @@ import { useResizeObserver, EuiButton, } from '@elastic/eui'; +import { isOfAggregateQueryType } from '@kbn/es-query'; import useShallowCompareEffect from 'react-use/lib/useShallowCompareEffect'; import { isEqual } from 'lodash'; import { FormattedMessage } from '@kbn/i18n-react'; @@ -39,6 +40,7 @@ import { DiscoverSidebarResponsiveProps } from './discover_sidebar_responsive'; import { VIEW_MODE } from '../../../../components/view_mode_toggle'; import { DISCOVER_TOUR_STEP_ANCHOR_IDS } from '../../../../components/discover_tour'; import type { DataTableRecord } from '../../../../types'; +import { triggerVisualizeActionsTextBasedLanguages } from './lib/visualize_trigger_utils'; /** * Default number of available fields displayed and added on scroll @@ -309,6 +311,12 @@ export function DiscoverSidebarComponent({ const filterChanged = useMemo(() => isEqual(fieldFilter, getDefaultFieldFilter()), [fieldFilter]); + const visualizeAggregateQuery = useCallback(() => { + const aggregateQuery = + state.query && isOfAggregateQueryType(state.query) ? state.query : undefined; + triggerVisualizeActionsTextBasedLanguages(columns, selectedDataView, aggregateQuery); + }, [columns, selectedDataView, state.query]); + if (!selectedDataView) { return null; } @@ -532,6 +540,20 @@ export function DiscoverSidebarComponent({ )} + {isPlainRecord && ( + + + {i18n.translate('discover.textBasedLanguages.visualize.label', { + defaultMessage: 'Visualize in Lens', + })} + + + )} ); diff --git a/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.ts b/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.ts index 005accf3021f..85537df2ef36 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.ts +++ b/src/plugins/discover/public/application/main/components/sidebar/lib/visualize_trigger_utils.ts @@ -12,6 +12,7 @@ import { visualizeFieldTrigger, visualizeGeoFieldTrigger, } from '@kbn/ui-actions-plugin/public'; +import type { AggregateQuery } from '@kbn/es-query'; import type { DataViewField, DataView } from '@kbn/data-views-plugin/public'; import { KBN_FIELD_TYPES } from '@kbn/data-plugin/public'; import { getUiActions } from '../../../../../kibana_services'; @@ -59,6 +60,22 @@ export function triggerVisualizeActions( getUiActions().getTrigger(trigger).exec(triggerOptions); } +export function triggerVisualizeActionsTextBasedLanguages( + contextualFields: string[], + dataView?: DataView, + query?: AggregateQuery +) { + if (!dataView) return; + const triggerOptions = { + dataViewSpec: dataView.toSpec(false), + fieldName: '', + contextualFields, + originatingApp: PLUGIN_ID, + query, + }; + getUiActions().getTrigger(VISUALIZE_FIELD_TRIGGER).exec(triggerOptions); +} + export interface VisualizeInformation { field: DataViewField; href?: string; diff --git a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx index 241a20a0a155..82f3b1aadadb 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx @@ -66,7 +66,7 @@ export const DiscoverTopNav = ({ [dataView] ); const services = useDiscoverServices(); - const { dataViewEditor, navigation, dataViewFieldEditor, data, uiSettings } = services; + const { dataViewEditor, navigation, dataViewFieldEditor, data, uiSettings, dataViews } = services; const canEditDataView = Boolean(dataViewEditor?.userPermissions.editDataView()); @@ -141,6 +141,19 @@ export const DiscoverTopNav = ({ [canEditDataView, dataViewEditor, onChangeDataView] ); + const onCreateDefaultAdHocDataView = useCallback( + async (pattern: string) => { + const newDataView = await dataViews.create({ + title: pattern, + }); + if (newDataView.fields.getByName('@timestamp')?.type === 'date') { + newDataView.timeFieldName = '@timestamp'; + } + onChangeDataView(newDataView.id!); + }, + [dataViews, onChangeDataView] + ); + const topNavMenu = useMemo( () => getTopNavLinks({ @@ -201,6 +214,7 @@ export const DiscoverTopNav = ({ currentDataViewId: dataView?.id, onAddField: addField, onDataViewCreated: createNewDataView, + onCreateDefaultAdHocDataView, onChangeDataView, textBasedLanguages: supportedTextBasedLanguages as DataViewPickerProps['textBasedLanguages'], adHocDataViews: adHocDataViewList, diff --git a/src/plugins/ui_actions/public/types.ts b/src/plugins/ui_actions/public/types.ts index a76a8aa760ed..fb2d9869e21c 100644 --- a/src/plugins/ui_actions/public/types.ts +++ b/src/plugins/ui_actions/public/types.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import type { AggregateQuery } from '@kbn/es-query'; import type { DataViewSpec } from '@kbn/data-views-plugin/public'; import { ActionInternal } from './actions/action_internal'; import { TriggerInternal } from './triggers/trigger_internal'; @@ -19,6 +20,7 @@ export interface VisualizeFieldContext { dataViewSpec: DataViewSpec; contextualFields?: string[]; originatingApp?: string; + query?: AggregateQuery; } export const ACTION_VISUALIZE_FIELD = 'ACTION_VISUALIZE_FIELD'; diff --git a/src/plugins/unified_search/public/dataview_picker/change_dataview.tsx b/src/plugins/unified_search/public/dataview_picker/change_dataview.tsx index 2f641cd2d4e2..72a2d8fea290 100644 --- a/src/plugins/unified_search/public/dataview_picker/change_dataview.tsx +++ b/src/plugins/unified_search/public/dataview_picker/change_dataview.tsx @@ -7,7 +7,7 @@ */ import { i18n } from '@kbn/i18n'; -import React, { useState, useEffect, useCallback } from 'react'; +import React, { useState, useEffect, useCallback, useRef } from 'react'; import { css } from '@emotion/react'; import { EuiPopover, @@ -24,6 +24,7 @@ import { EuiFlexItem, EuiButtonEmpty, EuiToolTip, + EuiSpacer, } from '@elastic/eui'; import type { DataViewListItem } from '@kbn/data-views-plugin/public'; import { useKibana } from '@kbn/kibana-react-plugin/public'; @@ -71,9 +72,13 @@ export function ChangeDataView({ onTextLangQuerySubmit, textBasedLanguage, isDisabled, + onCreateDefaultAdHocDataView, }: DataViewPickerPropsExtended) { const { euiTheme } = useEuiTheme(); const [isPopoverOpen, setPopoverIsOpen] = useState(false); + const [noDataViewMatches, setNoDataViewMatches] = useState(false); + const [dataViewSearchString, setDataViewSearchString] = useState(''); + const [indexMatches, setIndexMatches] = useState(0); const [dataViewsList, setDataViewsList] = useState([]); const [triggerLabel, setTriggerLabel] = useState(''); const [isTextBasedLangSelected, setIsTextBasedLangSelected] = useState( @@ -111,6 +116,24 @@ export function ChangeDataView({ fetchDataViews(); }, [data, currentDataViewId, adHocDataViews]); + const pendingIndexMatch = useRef(); + useEffect(() => { + async function checkIndices() { + if (dataViewSearchString !== '' && noDataViewMatches) { + const matches = await kibana.services.dataViews.getIndices({ + pattern: dataViewSearchString, + isRollupIndex: () => false, + showAllIndices: false, + }); + setIndexMatches(matches.length); + } + } + if (pendingIndexMatch.current) { + clearTimeout(pendingIndexMatch.current); + } + pendingIndexMatch.current = setTimeout(checkIndices, 250); + }, [dataViewSearchString, kibana.services.dataViews, noDataViewMatches]); + useEffect(() => { if (trigger.label) { if (textBasedLanguage) { @@ -282,10 +305,57 @@ export function ChangeDataView({ } }} currentDataViewId={currentDataViewId} - selectableProps={selectableProps} + selectableProps={{ + ...(selectableProps || {}), + // @ts-expect-error Some EUI weirdness + searchProps: { + ...(selectableProps?.searchProps || {}), + onChange: (value, matches) => { + selectableProps?.searchProps?.onChange?.(value, matches); + setNoDataViewMatches(matches.length === 0 && dataViewsList.length > 0); + setDataViewSearchString(value); + }, + }, + }} searchListInputId={searchListInputId} isTextBasedLangSelected={isTextBasedLangSelected} /> + {onCreateDefaultAdHocDataView && noDataViewMatches && indexMatches > 0 && ( + + + { + setPopoverIsOpen(false); + onCreateDefaultAdHocDataView(dataViewSearchString); + }} + > + {i18n.translate( + 'unifiedSearch.query.queryBar.indexPattern.createForMatchingIndices', + { + defaultMessage: `Explore {indicesLength, plural, + one {# matching index} + other {# matching indices}}`, + values: { + indicesLength: indexMatches, + }, + } + )} + + + + + )} ); diff --git a/src/plugins/unified_search/public/dataview_picker/index.tsx b/src/plugins/unified_search/public/dataview_picker/index.tsx index 1cc0a8219af9..9fb794d58e64 100644 --- a/src/plugins/unified_search/public/dataview_picker/index.tsx +++ b/src/plugins/unified_search/public/dataview_picker/index.tsx @@ -63,6 +63,8 @@ export interface DataViewPickerProps { * Also works as a flag to show the create dataview button. */ onDataViewCreated?: () => void; + + onCreateDefaultAdHocDataView?: (pattern: string) => void; /** * List of the supported text based languages (SQL, ESQL) etc. * Defined per application, if not provided, no text based languages @@ -104,6 +106,7 @@ export const DataViewPicker = ({ onSaveTextLanguageQuery, onTextLangQuerySubmit, textBasedLanguage, + onCreateDefaultAdHocDataView, isDisabled, }: DataViewPickerPropsExtended) => { return ( @@ -113,6 +116,7 @@ export const DataViewPicker = ({ onChangeDataView={onChangeDataView} onAddField={onAddField} onDataViewCreated={onDataViewCreated} + onCreateDefaultAdHocDataView={onCreateDefaultAdHocDataView} trigger={trigger} adHocDataViews={adHocDataViews} selectableProps={selectableProps} diff --git a/src/plugins/unified_search/public/types.ts b/src/plugins/unified_search/public/types.ts index d079cd72edf8..85f32a9d4b7e 100755 --- a/src/plugins/unified_search/public/types.ts +++ b/src/plugins/unified_search/public/types.ts @@ -86,5 +86,6 @@ export interface IUnifiedSearchPluginServices extends Partial { storage: IStorageWrapper; docLinks: DocLinksStart; data: DataPublicPluginStart; + dataViews: DataViewsPublicPluginStart; usageCollection?: UsageCollectionStart; } diff --git a/src/plugins/unified_search/tsconfig.json b/src/plugins/unified_search/tsconfig.json index 61b1f8305882..2f09d27c84b0 100644 --- a/src/plugins/unified_search/tsconfig.json +++ b/src/plugins/unified_search/tsconfig.json @@ -17,6 +17,7 @@ { "path": "../../core/tsconfig.json" }, { "path": "../data/tsconfig.json" }, { "path": "../data_views/tsconfig.json" }, + { "path": "../data_view_editor/tsconfig.json" }, { "path": "../embeddable/tsconfig.json" }, { "path": "../usage_collection/tsconfig.json" }, { "path": "../kibana_utils/tsconfig.json" }, diff --git a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/configurations/xy/layers.test.ts b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/configurations/xy/layers.test.ts index f869ac64380c..6c94971397d3 100644 --- a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/configurations/xy/layers.test.ts +++ b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/configurations/xy/layers.test.ts @@ -229,6 +229,31 @@ describe('getLayers', () => { ], series: [createSeries({ metrics: staticValueMetric })], }); + + const panelWithSingleAnnotationWithoutQueryStringAndTimefield = createPanel({ + annotations: [ + { + fields: 'geo.src,host', + template: 'Security Error from {{geo.src}} on {{host}}', + id: 'ann1', + color: 'rgba(211,49,21,0.7)', + icon: 'fa-asterisk', + ignore_global_filters: 1, + ignore_panel_filters: 1, + time_field: '', + query_string: { + query: '', + language: 'lucene', + }, + hidden: true, + index_pattern: { + id: 'test', + }, + }, + ], + series: [createSeries({ metrics: staticValueMetric })], + }); + const panelWithMultiAnnotations = createPanel({ annotations: [ { @@ -284,6 +309,27 @@ describe('getLayers', () => { ], series: [createSeries({ metrics: staticValueMetric })], }); + const panelWithSingleAnnotationDefaultDataView = createPanel({ + annotations: [ + { + fields: 'geo.src,host', + template: 'Security Error from {{geo.src}} on {{host}}', + query_string: { + query: 'tags:error AND tags:security', + language: 'lucene', + }, + id: 'ann1', + color: 'rgba(211,49,21,0.7)', + time_field: 'timestamp', + icon: 'fa-asterisk', + ignore_global_filters: 1, + ignore_panel_filters: 1, + hidden: true, + index_pattern: '', + }, + ], + series: [createSeries({ metrics: staticValueMetric })], + }); test.each<[string, [Record, Panel], Array>]>([ [ @@ -411,6 +457,51 @@ describe('getLayers', () => { }, ], ], + [ + 'annotation layer should gets correct default params', + [dataSourceLayersWithStatic, panelWithSingleAnnotationWithoutQueryStringAndTimefield], + [ + { + layerType: 'referenceLine', + accessors: ['column-id-1'], + layerId: 'test-layer-1', + yConfig: [ + { + forAccessor: 'column-id-1', + axisMode: 'right', + color: '#68BC00', + fill: 'below', + }, + ], + }, + { + layerId: 'test-id', + layerType: 'annotations', + ignoreGlobalFilters: true, + annotations: [ + { + color: '#D33115', + extraFields: ['geo.src'], + filter: { + language: 'lucene', + query: '*', + type: 'kibana_query', + }, + icon: 'asterisk', + id: 'ann1', + isHidden: true, + key: { + type: 'point_in_time', + }, + label: 'Event', + timeField: 'test_field', + type: 'query', + }, + ], + indexPatternId: 'test', + }, + ], + ], [ 'multiple annotations with different data views create separate layers', [dataSourceLayersWithStatic, panelWithMultiAnnotations], @@ -451,6 +542,14 @@ describe('getLayers', () => { timeField: 'timestamp', type: 'query', }, + ], + indexPatternId: 'test', + }, + { + layerId: 'test-id', + layerType: 'annotations', + ignoreGlobalFilters: false, + annotations: [ { color: '#0000FF', filter: { @@ -497,6 +596,51 @@ describe('getLayers', () => { }, ], ], + [ + 'annotation layer gets correct dataView when none is defined', + [dataSourceLayersWithStatic, panelWithSingleAnnotationDefaultDataView], + [ + { + layerType: 'referenceLine', + accessors: ['column-id-1'], + layerId: 'test-layer-1', + yConfig: [ + { + forAccessor: 'column-id-1', + axisMode: 'right', + color: '#68BC00', + fill: 'below', + }, + ], + }, + { + layerId: 'test-id', + layerType: 'annotations', + ignoreGlobalFilters: true, + annotations: [ + { + color: '#D33115', + extraFields: ['geo.src'], + filter: { + language: 'lucene', + query: 'tags:error AND tags:security', + type: 'kibana_query', + }, + icon: 'asterisk', + id: 'ann1', + isHidden: true, + key: { + type: 'point_in_time', + }, + label: 'Event', + timeField: 'timestamp', + type: 'query', + }, + ], + indexPatternId: 'default', + }, + ], + ], ])('should return %s', async (_, input, expected) => { const layers = await getLayers(...input, indexPatternsService as DataViewsPublicPluginStart); expect(layers).toEqual(expected.map(expect.objectContaining)); @@ -507,13 +651,20 @@ const mockedIndices = [ { id: 'test', title: 'test', + timeFieldName: 'test_field', getFieldByName: (name: string) => ({ aggregatable: name !== 'host' }), }, ] as unknown as DataView[]; const indexPatternsService = { - getDefault: jest.fn(() => Promise.resolve({ id: 'default', title: 'index' })), - get: jest.fn(() => Promise.resolve(mockedIndices[0])), + getDefault: jest.fn(() => + Promise.resolve({ + id: 'default', + title: 'index', + getFieldByName: (name: string) => ({ aggregatable: name !== 'host' }), + }) + ), + get: jest.fn((id) => Promise.resolve({ ...mockedIndices[0], id })), find: jest.fn((search: string, size: number) => { if (size !== 1) { // shouldn't request more than one data view since there is a significant performance penalty diff --git a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/configurations/xy/layers.ts b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/configurations/xy/layers.ts index 6815e278e0f3..ec0e24e2db87 100644 --- a/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/configurations/xy/layers.ts +++ b/src/plugins/vis_types/timeseries/public/convert_to_lens/lib/configurations/xy/layers.ts @@ -20,6 +20,7 @@ import Color from 'color'; import { euiLightVars } from '@kbn/ui-theme'; import { groupBy } from 'lodash'; import { DataViewsPublicPluginStart, DataView } from '@kbn/data-plugin/public/data_views'; +import { getDefaultQueryLanguage } from '../../../../application/components/lib/get_default_query_language'; import { fetchIndexPattern } from '../../../../../common/index_patterns_utils'; import { ICON_TYPES_MAP } from '../../../../application/visualizations/constants'; import { SUPPORTED_METRICS } from '../../metrics'; @@ -62,7 +63,7 @@ function getColor( } function nonNullable(value: T): value is NonNullable { - return value !== null && value !== undefined; + return value != null; } export const getLayers = async ( @@ -131,16 +132,22 @@ export const getLayers = async ( return nonAnnotationsLayers; } - const annotationsByIndexPattern = groupBy( - model.annotations, - (a) => typeof a.index_pattern === 'object' && 'id' in a.index_pattern && a.index_pattern.id - ); + const annotationsByIndexPatternAndIgnoreFlag = groupBy(model.annotations, (a) => { + const id = typeof a.index_pattern === 'object' && 'id' in a.index_pattern && a.index_pattern.id; + return `${id}-${Boolean(a.ignore_global_filters)}`; + }); try { const annotationsLayers: Array = await Promise.all( - Object.entries(annotationsByIndexPattern).map(async ([indexPatternId, annotations]) => { + Object.values(annotationsByIndexPatternAndIgnoreFlag).map(async (annotations) => { + const [firstAnnotation] = annotations; + const indexPatternId = + typeof firstAnnotation.index_pattern === 'string' + ? firstAnnotation.index_pattern + : firstAnnotation.index_pattern?.id; const convertedAnnotations: EventAnnotationConfig[] = []; - const { indexPattern } = (await fetchIndexPattern({ id: indexPatternId }, dataViews)) || {}; + const { indexPattern } = + (await fetchIndexPattern(indexPatternId && { id: indexPatternId }, dataViews)) || {}; if (indexPattern) { annotations.forEach((a: Annotation) => { @@ -152,9 +159,9 @@ export const getLayers = async ( return { layerId: v4(), layerType: 'annotations', - ignoreGlobalFilters: true, + ignoreGlobalFilters: Boolean(firstAnnotation.ignore_global_filters), annotations: convertedAnnotations, - indexPatternId, + indexPatternId: indexPattern.id!, }; } }) @@ -170,38 +177,36 @@ const convertAnnotation = ( annotation: Annotation, dataView: DataView ): EventAnnotationConfig | undefined => { - if (annotation.query_string) { - const extraFields = annotation.fields - ? annotation.fields - ?.replace(/\s/g, '') - ?.split(',') - .map((field) => { - const dataViewField = dataView.getFieldByName(field); - return dataViewField && dataViewField.aggregatable ? field : undefined; - }) - .filter(nonNullable) - : undefined; - return { - type: 'query', - id: annotation.id, - label: 'Event', - key: { - type: 'point_in_time', - }, - color: new Color(transparentize(annotation.color || euiLightVars.euiColorAccent, 1)).hex(), - timeField: annotation.time_field, - icon: - annotation.icon && - ICON_TYPES_MAP[annotation.icon] && - typeof ICON_TYPES_MAP[annotation.icon] === 'string' - ? ICON_TYPES_MAP[annotation.icon] - : 'triangle', - filter: { - type: 'kibana_query', - ...annotation.query_string, - }, - extraFields, - isHidden: annotation.hidden, - }; - } + const extraFields = annotation.fields + ?.replace(/\s/g, '') + .split(',') + .map((field) => { + const dataViewField = dataView.getFieldByName(field); + return dataViewField && dataViewField.aggregatable ? field : undefined; + }) + .filter(nonNullable); + + return { + type: 'query', + id: annotation.id, + label: 'Event', + key: { + type: 'point_in_time', + }, + color: new Color(transparentize(annotation.color || euiLightVars.euiColorAccent, 1)).hex(), + timeField: annotation.time_field || dataView.timeFieldName, + icon: + annotation.icon && + ICON_TYPES_MAP[annotation.icon] && + typeof ICON_TYPES_MAP[annotation.icon] === 'string' + ? ICON_TYPES_MAP[annotation.icon] + : 'triangle', + filter: { + type: 'kibana_query', + query: annotation.query_string?.query || '*', + language: annotation.query_string?.language || getDefaultQueryLanguage(), + }, + extraFields, + isHidden: annotation.hidden, + }; }; diff --git a/x-pack/packages/ml/aiops_components/BUILD.bazel b/x-pack/packages/ml/aiops_components/BUILD.bazel index 37ed6c171c4a..08b49643adc2 100644 --- a/x-pack/packages/ml/aiops_components/BUILD.bazel +++ b/x-pack/packages/ml/aiops_components/BUILD.bazel @@ -55,6 +55,8 @@ RUNTIME_DEPS = [ "@npm//react", "@npm//@elastic/charts", "@npm//@elastic/eui", + "@npm//@emotion/react", + "@npm//@emotion/css", "//packages/kbn-i18n-react", "//x-pack/packages/ml/aiops_utils", ] @@ -78,6 +80,8 @@ TYPES_DEPS = [ "@npm//@types/react", "@npm//@elastic/charts", "@npm//@elastic/eui", + "@npm//@emotion/react", + "@npm//@emotion/css", "//packages/kbn-i18n-react:npm_module_types", "//x-pack/packages/ml/aiops_utils:npm_module_types", ] diff --git a/x-pack/packages/ml/aiops_components/src/progress_controls/progress_controls.tsx b/x-pack/packages/ml/aiops_components/src/progress_controls/progress_controls.tsx index 579c528d16dc..af8f0ec1ad31 100644 --- a/x-pack/packages/ml/aiops_components/src/progress_controls/progress_controls.tsx +++ b/x-pack/packages/ml/aiops_components/src/progress_controls/progress_controls.tsx @@ -5,7 +5,10 @@ * 2.0. */ +import React from 'react'; + import { + useEuiTheme, EuiButton, EuiFlexGroup, EuiFlexItem, @@ -13,9 +16,11 @@ import { EuiProgress, EuiText, } from '@elastic/eui'; + import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import React from 'react'; + +import { useAnimatedProgressBarBackground } from './use_animated_progress_bar_background'; // TODO Consolidate with duplicate component `CorrelationsProgressControls` in // `x-pack/plugins/apm/public/components/app/correlations/progress_controls.tsx` @@ -37,6 +42,9 @@ export function ProgressControls({ isRunning, shouldRerunAnalysis, }: ProgressControlProps) { + const { euiTheme } = useEuiTheme(); + const runningProgressBarStyles = useAnimatedProgressBarBackground(euiTheme.colors.success); + return ( @@ -51,7 +59,7 @@ export function ProgressControls({ /> - + { + return useMemo(() => { + const progressBackground = { + background: `repeating-linear-gradient( + -45deg, + transparent 0 6px, + rgba(0, 0, 0, 0.1) 6px 12px + ), + ${color}`, + // 0.707 = cos(45deg) + backgroundSize: 'calc(12px / 0.707) 100%, 100% 800%', + backgroundPosition: 'inherit', + }; + + return css({ + 'progress[value]': { + animation: 'aiopsAnimatedProgress 4s infinite linear', + + '::-webkit-progress-inner-element': { + overflow: 'hidden', + backgroundPosition: 'inherit', + }, + '::-webkit-progress-bar': { + backgroundColor: 'transparent', + backgroundPosition: 'inherit', + }, + + '::-webkit-progress-value': progressBackground, + '::-moz-progress-bar': progressBackground, + + '@keyframes aiopsAnimatedProgress': { + '0%': { + backgroundPosition: '0 0', + }, + '100%': { + backgroundPosition: 'calc(10 * (12px / 0.707)) 100%', + }, + }, + }, + }); + }, [color]); +}; diff --git a/x-pack/packages/ml/aiops_components/tsconfig.json b/x-pack/packages/ml/aiops_components/tsconfig.json index 8bca748268ac..cdb1c5d8d000 100644 --- a/x-pack/packages/ml/aiops_components/tsconfig.json +++ b/x-pack/packages/ml/aiops_components/tsconfig.json @@ -12,7 +12,8 @@ "@types/d3-transition", "jest", "node", - "react" + "react", + "@emotion/react/types/css-prop" ] }, "include": [ diff --git a/x-pack/plugins/aiops/kibana.json b/x-pack/plugins/aiops/kibana.json index 6648816b0784..ce8057bc03f0 100755 --- a/x-pack/plugins/aiops/kibana.json +++ b/x-pack/plugins/aiops/kibana.json @@ -15,6 +15,6 @@ "licensing" ], "optionalPlugins": [], - "requiredBundles": ["fieldFormats"], + "requiredBundles": ["fieldFormats", "kibanaReact"], "extraPublicDirs": ["common"] } diff --git a/x-pack/plugins/aiops/public/components/date_picker_wrapper/date_picker_wrapper.tsx b/x-pack/plugins/aiops/public/components/date_picker_wrapper/date_picker_wrapper.tsx index 605f130594bc..6b3e57200b90 100644 --- a/x-pack/plugins/aiops/public/components/date_picker_wrapper/date_picker_wrapper.tsx +++ b/x-pack/plugins/aiops/public/components/date_picker_wrapper/date_picker_wrapper.tsx @@ -7,19 +7,33 @@ // TODO Consolidate with duplicate component `DatePickerWrapper` in // `x-pack/plugins/data_visualizer/public/application/common/components/date_picker_wrapper/date_picker_wrapper.tsx` - +// `x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.tsx` import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { Subscription } from 'rxjs'; import { debounce } from 'lodash'; -import { EuiSuperDatePicker, OnRefreshProps } from '@elastic/eui'; +import { + EuiButton, + EuiFlexGroup, + EuiFlexItem, + EuiSuperDatePicker, + OnRefreshProps, + OnTimeChangeProps, +} from '@elastic/eui'; import type { TimeRange } from '@kbn/es-query'; -import { TimeHistoryContract, UI_SETTINGS } from '@kbn/data-plugin/public'; +import { TimefilterContract, TimeHistoryContract, UI_SETTINGS } from '@kbn/data-plugin/public'; +import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; +import useObservable from 'react-use/lib/useObservable'; +import { map } from 'rxjs/operators'; +import { toMountPoint, wrapWithTheme } from '@kbn/kibana-react-plugin/public'; import { useUrlState } from '../../hooks/use_url_state'; import { useAiopsAppContext } from '../../hooks/use_aiops_app_context'; import { aiopsRefresh$ } from '../../application/services/timefilter_refresh_service'; +const DEFAULT_REFRESH_INTERVAL_MS = 5000; + interface TimePickerQuickRange { from: string; to: string; @@ -49,19 +63,64 @@ function getRecentlyUsedRangesFactory(timeHistory: TimeHistoryContract) { }; } -function updateLastRefresh(timeRange: OnRefreshProps) { +function updateLastRefresh(timeRange?: OnRefreshProps) { aiopsRefresh$.next({ lastRefresh: Date.now(), timeRange }); } +export const useRefreshIntervalUpdates = (timefilter: TimefilterContract) => { + return useObservable( + timefilter.getRefreshIntervalUpdate$().pipe(map(timefilter.getRefreshInterval)), + timefilter.getRefreshInterval() + ); +}; + +export const useTimeRangeUpdates = (timefilter: TimefilterContract, absolute = false) => { + const getTimeCallback = absolute + ? timefilter.getAbsoluteTime.bind(timefilter) + : timefilter.getTime.bind(timefilter); + + return useObservable(timefilter.getTimeUpdate$().pipe(map(getTimeCallback)), getTimeCallback()); +}; + export const DatePickerWrapper: FC = () => { - const { uiSettings, data } = useAiopsAppContext(); - const { timefilter, history } = data.query.timefilter; + const services = useAiopsAppContext(); + const { toasts } = services.notifications; + const config = services.uiSettings; + + const { timefilter, history } = services.data.query.timefilter; + const theme$ = services.theme.theme$; const [globalState, setGlobalState] = useUrlState('_g'); const getRecentlyUsedRanges = getRecentlyUsedRangesFactory(history); - const refreshInterval: RefreshInterval = - globalState?.refreshInterval ?? timefilter.getRefreshInterval(); + const timeFilterRefreshInterval = useRefreshIntervalUpdates(timefilter); + const time = useTimeRangeUpdates(timefilter); + + useEffect( + function syncTimRangeFromUrlState() { + if (globalState?.time !== undefined) { + timefilter.setTime({ + from: globalState.time.from, + to: globalState.time.to, + }); + } + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [globalState?.time?.from, globalState?.time?.to, globalState?.time?.ts] + ); + + useEffect( + function syncRefreshIntervalFromUrlState() { + if (globalState?.refreshInterval !== undefined) { + timefilter.setRefreshInterval({ + pause: !!globalState?.refreshInterval?.pause, + value: globalState?.refreshInterval?.value, + }); + } + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [globalState?.refreshInterval] + ); // eslint-disable-next-line react-hooks/exhaustive-deps const setRefreshInterval = useCallback( @@ -71,7 +130,6 @@ export const DatePickerWrapper: FC = () => { [setGlobalState] ); - const [time, setTime] = useState(timefilter.getTime()); const [recentlyUsedRanges, setRecentlyUsedRanges] = useState(getRecentlyUsedRanges()); const [isAutoRefreshSelectorEnabled, setIsAutoRefreshSelectorEnabled] = useState( timefilter.isAutoRefreshSelectorEnabled() @@ -80,8 +138,69 @@ export const DatePickerWrapper: FC = () => { timefilter.isTimeRangeSelectorEnabled() ); - const dateFormat = uiSettings.get('dateFormat'); - const timePickerQuickRanges = uiSettings.get( + const refreshInterval = useMemo( + (): RefreshInterval => globalState?.refreshInterval ?? timeFilterRefreshInterval, + // eslint-disable-next-line react-hooks/exhaustive-deps + [JSON.stringify(globalState?.refreshInterval), timeFilterRefreshInterval] + ); + + useEffect( + function warnAboutShortRefreshInterval() { + const isResolvedFromUrlState = !!globalState?.refreshInterval; + const isTooShort = refreshInterval.value < DEFAULT_REFRESH_INTERVAL_MS; + + // Only warn about short interval with enabled auto-refresh. + if (!isTooShort || refreshInterval.pause) return; + + toasts.addWarning( + { + title: isResolvedFromUrlState + ? i18n.translate('xpack.aiops.datePicker.shortRefreshIntervalURLWarningMessage', { + defaultMessage: + 'The refresh interval in the URL is shorter than the minimum supported by Machine Learning.', + }) + : i18n.translate( + 'xpack.aiops.datePicker.shortRefreshIntervalTimeFilterWarningMessage', + { + defaultMessage: + 'The refresh interval in Advanced Settings is shorter than the minimum supported by Machine Learning.', + } + ), + text: toMountPoint( + wrapWithTheme( + + + , + theme$ + ) + ), + }, + { toastLifeTimeMs: 30000 } + ); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [ + // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(refreshInterval), + // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(globalState?.refreshInterval), + setRefreshInterval, + ] + ); + + const dateFormat = config.get('dateFormat'); + const timePickerQuickRanges = config.get( UI_SETTINGS.TIMEPICKER_QUICK_RANGES ); @@ -97,22 +216,7 @@ export const DatePickerWrapper: FC = () => { useEffect(() => { const subscriptions = new Subscription(); - const refreshIntervalUpdate$ = timefilter.getRefreshIntervalUpdate$(); - if (refreshIntervalUpdate$ !== undefined) { - subscriptions.add( - refreshIntervalUpdate$.subscribe((r) => { - setRefreshInterval(timefilter.getRefreshInterval()); - }) - ); - } - const timeUpdate$ = timefilter.getTimeUpdate$(); - if (timeUpdate$ !== undefined) { - subscriptions.add( - timeUpdate$.subscribe((v) => { - setTime(timefilter.getTime()); - }) - ); - } + const enabledUpdated$ = timefilter.getEnabledUpdated$(); if (enabledUpdated$ !== undefined) { subscriptions.add( @@ -126,15 +230,21 @@ export const DatePickerWrapper: FC = () => { return function cleanup() { subscriptions.unsubscribe(); }; - }, [setRefreshInterval, timefilter]); - - function updateFilter({ start, end }: Duration) { - const newTime = { from: start, to: end }; - // Update timefilter for controllers listening for changes - timefilter.setTime(newTime); - setTime(newTime); - setRecentlyUsedRanges(getRecentlyUsedRanges()); - } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + const updateTimeFilter = useCallback( + ({ start, end }: OnTimeChangeProps) => { + setRecentlyUsedRanges(getRecentlyUsedRanges()); + setGlobalState('time', { + from: start, + to: end, + ...(start === 'now' || end === 'now' ? { ts: Date.now() } : {}), + }); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [setGlobalState] + ); function updateInterval({ isPaused: pause, @@ -146,26 +256,41 @@ export const DatePickerWrapper: FC = () => { setRefreshInterval({ pause, value }); } - /** - * Enforce pause when it's set to false with 0 refresh interval. - */ - const isPaused = refreshInterval.pause || (!refreshInterval.pause && !refreshInterval.value); - return isAutoRefreshSelectorEnabled || isTimeRangeSelectorEnabled ? ( -
- -
+ + + + + + {isTimeRangeSelectorEnabled ? null : ( + + updateLastRefresh()} + data-test-subj="aiOpsRefreshPageButton" + > + + + + )} + ) : null; }; diff --git a/x-pack/plugins/aiops/public/hooks/use_aiops_app_context.ts b/x-pack/plugins/aiops/public/hooks/use_aiops_app_context.ts index 3c44ae7bdb0a..ddbfca3eb8b1 100644 --- a/x-pack/plugins/aiops/public/hooks/use_aiops_app_context.ts +++ b/x-pack/plugins/aiops/public/hooks/use_aiops_app_context.ts @@ -15,6 +15,7 @@ import type { ChartsPluginStart } from '@kbn/charts-plugin/public'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import type { SharePluginStart } from '@kbn/share-plugin/public'; import type { CoreStart, CoreSetup, HttpStart, IUiSettingsClient } from '@kbn/core/public'; +import type { ThemeServiceStart } from '@kbn/core/public'; export interface AiopsAppDependencies { application: CoreStart['application']; @@ -24,6 +25,7 @@ export interface AiopsAppDependencies { http: HttpStart; notifications: CoreSetup['notifications']; storage: IStorageWrapper; + theme: ThemeServiceStart; uiSettings: IUiSettingsClient; unifiedSearch: UnifiedSearchPublicPluginStart; share: SharePluginStart; diff --git a/x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts b/x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts index 48ea2dbddb1c..8a8a7372f80e 100644 --- a/x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts +++ b/x-pack/plugins/aiops/server/routes/explain_log_rate_spikes.ts @@ -52,8 +52,10 @@ import { // Overall progress is a float from 0 to 1. const LOADED_FIELD_CANDIDATES = 0.2; -const PROGRESS_STEP_P_VALUES = 0.6; -const PROGRESS_STEP_HISTOGRAMS = 0.2; +const PROGRESS_STEP_P_VALUES = 0.5; +const PROGRESS_STEP_GROUPING = 0.1; +const PROGRESS_STEP_HISTOGRAMS = 0.1; +const PROGRESS_STEP_HISTOGRAMS_GROUPS = 0.1; export const defineExplainLogRateSpikesRoute = ( router: IRouter, @@ -233,7 +235,35 @@ export const defineExplainLogRateSpikesRoute = ( undefined )) as [NumericChartData]; + function pushHistogramDataLoadingState() { + push( + updateLoadingStateAction({ + ccsWarning: false, + loaded, + loadingState: i18n.translate( + 'xpack.aiops.explainLogRateSpikes.loadingState.loadingHistogramData', + { + defaultMessage: 'Loading histogram data.', + } + ), + }) + ); + } + if (groupingEnabled) { + push( + updateLoadingStateAction({ + ccsWarning: false, + loaded, + loadingState: i18n.translate( + 'xpack.aiops.explainLogRateSpikes.loadingState.groupingResults', + { + defaultMessage: 'Transforming significant field/value pairs into groups.', + } + ), + }) + ); + // To optimize the `frequent_items` query, we identify duplicate change points by count attributes. // Note this is a compromise and not 100% accurate because there could be change points that // have the exact same counts but still don't co-occur. @@ -389,6 +419,10 @@ export const defineExplainLogRateSpikesRoute = ( push(addChangePointsGroupAction(changePointGroups)); } + loaded += PROGRESS_STEP_GROUPING; + + pushHistogramDataLoadingState(); + if (changePointGroups) { await asyncForEach(changePointGroups, async (cpg, index) => { const histogramQuery = { @@ -445,6 +479,8 @@ export const defineExplainLogRateSpikesRoute = ( } } + loaded += PROGRESS_STEP_HISTOGRAMS_GROUPS; + // time series filtered by fields if (changePoints) { await asyncForEach(changePoints, async (cp, index) => { @@ -496,18 +532,7 @@ export const defineExplainLogRateSpikesRoute = ( const { fieldName, fieldValue } = cp; loaded += (1 / changePoints.length) * PROGRESS_STEP_HISTOGRAMS; - push( - updateLoadingStateAction({ - ccsWarning: false, - loaded, - loadingState: i18n.translate( - 'xpack.aiops.explainLogRateSpikes.loadingState.loadingHistogramData', - { - defaultMessage: 'Loading histogram data.', - } - ), - }) - ); + pushHistogramDataLoadingState(); push( addChangePointsHistogramAction([ { diff --git a/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/runtime_attachment/runtime_attachment.stories.tsx b/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/runtime_attachment/runtime_attachment.stories.tsx index fd3ee2f3e455..bef88a78f684 100644 --- a/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/runtime_attachment/runtime_attachment.stories.tsx +++ b/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/runtime_attachment/runtime_attachment.stories.tsx @@ -118,7 +118,6 @@ const policy = { namespace: 'default', policy_id: 'policy-elastic-agent-on-cloud', enabled: true, - output_id: '', inputs: [ { type: 'apm', @@ -341,7 +340,6 @@ const newPolicy = { namespace: 'default', policy_id: 'policy-elastic-agent-on-cloud', enabled: true, - output_id: '', package: { name: 'apm', title: 'Elastic APM', diff --git a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/edit_apm_policy_form.stories.tsx b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/edit_apm_policy_form.stories.tsx index c1bfa7ac6cf6..b4243124766a 100644 --- a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/edit_apm_policy_form.stories.tsx +++ b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/edit_apm_policy_form.stories.tsx @@ -81,7 +81,6 @@ const policy = { namespace: 'default', enabled: true, policy_id: 'policy-elastic-agent-on-cloud', - output_id: '', package: { name: 'apm', version: '8.3.0', diff --git a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/index.tsx b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/index.tsx index 8a8a44282fb7..bad43923934a 100644 --- a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/index.tsx +++ b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/index.tsx @@ -133,7 +133,6 @@ export function APMPolicyForm({ vars = {}, updateAPMPolicy }: Props) { } ), settings: tailSamplingSettings, - isBeta: false, isPlatinumLicence: true, }, ] diff --git a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_form/index.tsx b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_form/index.tsx index a834c4109879..d32ace193342 100644 --- a/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_form/index.tsx +++ b/x-pack/plugins/apm/public/components/fleet_integration/apm_policy_form/settings_form/index.tsx @@ -92,7 +92,6 @@ export interface SettingsSection { title: string; subtitle?: string; settings: SettingsRow[]; - isBeta?: boolean; isPlatinumLicence?: boolean; } diff --git a/x-pack/plugins/apm/server/routes/fleet/get_apm_package_policy_definition.ts b/x-pack/plugins/apm/server/routes/fleet/get_apm_package_policy_definition.ts index 023ba2755ea9..d2eea5db4ef1 100644 --- a/x-pack/plugins/apm/server/routes/fleet/get_apm_package_policy_definition.ts +++ b/x-pack/plugins/apm/server/routes/fleet/get_apm_package_policy_definition.ts @@ -40,7 +40,6 @@ export async function getApmPackagePolicyDefinition({ namespace: 'default', enabled: true, policy_id: POLICY_ELASTIC_AGENT_ON_CLOUD, - output_id: '', inputs: [ { type: 'apm', diff --git a/x-pack/plugins/apm/server/routes/fleet/source_maps.test.ts b/x-pack/plugins/apm/server/routes/fleet/source_maps.test.ts index d4f9b79e516c..0f617b076ab8 100644 --- a/x-pack/plugins/apm/server/routes/fleet/source_maps.test.ts +++ b/x-pack/plugins/apm/server/routes/fleet/source_maps.test.ts @@ -19,7 +19,6 @@ const packagePolicy = { namespace: 'default', policy_id: '7a87c160-c961-11eb-81e2-f7327d61c92a', enabled: true, - output_id: '', inputs: [ { policy_template: 'apmserver', diff --git a/x-pack/plugins/data_visualizer/public/application/common/components/date_picker_wrapper/date_picker_wrapper.tsx b/x-pack/plugins/data_visualizer/public/application/common/components/date_picker_wrapper/date_picker_wrapper.tsx index 7130841d0a6a..12d6b257ec29 100644 --- a/x-pack/plugins/data_visualizer/public/application/common/components/date_picker_wrapper/date_picker_wrapper.tsx +++ b/x-pack/plugins/data_visualizer/public/application/common/components/date_picker_wrapper/date_picker_wrapper.tsx @@ -5,17 +5,35 @@ * 2.0. */ +// TODO Consolidate with duplicate component `DatePickerWrapper` in +// `x-pack/plugins/aiops/public/components/date_picker_wrapper/date_picker_wrapper.tsx` + import React, { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { Subscription } from 'rxjs'; import { debounce } from 'lodash'; -import { EuiSuperDatePicker, OnRefreshProps } from '@elastic/eui'; +import { + EuiButton, + EuiFlexGroup, + EuiFlexItem, + EuiSuperDatePicker, + OnRefreshProps, + OnTimeChangeProps, +} from '@elastic/eui'; import type { TimeRange } from '@kbn/es-query'; import { TimeHistoryContract, UI_SETTINGS } from '@kbn/data-plugin/public'; - -import { useUrlState } from '../../util/url_state'; +import { i18n } from '@kbn/i18n'; +import { wrapWithTheme } from '@kbn/kibana-react-plugin/public'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { + useRefreshIntervalUpdates, + useTimeRangeUpdates, +} from '../../../index_data_visualizer/hooks/use_time_filter'; import { useDataVisualizerKibana } from '../../../kibana_context'; import { dataVisualizerRefresh$ } from '../../../index_data_visualizer/services/timefilter_refresh_service'; +import { useUrlState } from '../../util/url_state'; + +const DEFAULT_REFRESH_INTERVAL_MS = 5000; interface TimePickerQuickRange { from: string; @@ -46,20 +64,52 @@ function getRecentlyUsedRangesFactory(timeHistory: TimeHistoryContract) { }; } -function updateLastRefresh(timeRange: OnRefreshProps) { +function updateLastRefresh(timeRange?: OnRefreshProps) { dataVisualizerRefresh$.next({ lastRefresh: Date.now(), timeRange }); } +// FIXME: Consolidate this component with ML and AIOps's component export const DatePickerWrapper: FC = () => { - const { services } = useDataVisualizerKibana(); + const { + services, + notifications: { toasts }, + } = useDataVisualizerKibana(); const config = services.uiSettings; + const theme$ = services.theme.theme$; + const { timefilter, history } = services.data.query.timefilter; const [globalState, setGlobalState] = useUrlState('_g'); const getRecentlyUsedRanges = getRecentlyUsedRangesFactory(history); - const refreshInterval: RefreshInterval = - globalState?.refreshInterval ?? timefilter.getRefreshInterval(); + const timeFilterRefreshInterval = useRefreshIntervalUpdates(); + const time = useTimeRangeUpdates(); + + useEffect( + function syncTimRangeFromUrlState() { + if (globalState?.time !== undefined) { + timefilter.setTime({ + from: globalState.time.from, + to: globalState.time.to, + }); + } + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [globalState?.time?.from, globalState?.time?.to, globalState?.time?.ts] + ); + + useEffect( + function syncRefreshIntervalFromUrlState() { + if (globalState?.refreshInterval !== undefined) { + timefilter.setRefreshInterval({ + pause: !!globalState?.refreshInterval?.pause, + value: globalState?.refreshInterval?.value, + }); + } + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [globalState?.refreshInterval] + ); // eslint-disable-next-line react-hooks/exhaustive-deps const setRefreshInterval = useCallback( @@ -69,7 +119,6 @@ export const DatePickerWrapper: FC = () => { [setGlobalState] ); - const [time, setTime] = useState(timefilter.getTime()); const [recentlyUsedRanges, setRecentlyUsedRanges] = useState(getRecentlyUsedRanges()); const [isAutoRefreshSelectorEnabled, setIsAutoRefreshSelectorEnabled] = useState( timefilter.isAutoRefreshSelectorEnabled() @@ -78,6 +127,57 @@ export const DatePickerWrapper: FC = () => { timefilter.isTimeRangeSelectorEnabled() ); + const refreshInterval = useMemo( + (): RefreshInterval => globalState?.refreshInterval ?? timeFilterRefreshInterval, + // eslint-disable-next-line react-hooks/exhaustive-deps + [JSON.stringify(globalState?.refreshInterval), timeFilterRefreshInterval] + ); + + useEffect( + function warnAboutShortRefreshInterval() { + const isTooShort = refreshInterval.value < DEFAULT_REFRESH_INTERVAL_MS; + + // Only warn about short interval with enabled auto-refresh. + if (!isTooShort || refreshInterval.pause) return; + + toasts.warning({ + title: i18n.translate( + 'xpack.dataVisualizer.index.datePicker.shortRefreshIntervalURLWarningMessage', + { + defaultMessage: + 'The refresh interval in the URL is shorter than the minimum supported by Machine Learning.', + } + ), + body: wrapWithTheme( + + + , + theme$ + ), + toastLifeTimeMs: 30000, + }); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [ + // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(refreshInterval), + // eslint-disable-next-line react-hooks/exhaustive-deps + JSON.stringify(globalState?.refreshInterval), + setRefreshInterval, + ] + ); + const dateFormat = config.get('dateFormat'); const timePickerQuickRanges = config.get( UI_SETTINGS.TIMEPICKER_QUICK_RANGES @@ -95,22 +195,7 @@ export const DatePickerWrapper: FC = () => { useEffect(() => { const subscriptions = new Subscription(); - const refreshIntervalUpdate$ = timefilter.getRefreshIntervalUpdate$(); - if (refreshIntervalUpdate$ !== undefined) { - subscriptions.add( - refreshIntervalUpdate$.subscribe((r) => { - setRefreshInterval(timefilter.getRefreshInterval()); - }) - ); - } - const timeUpdate$ = timefilter.getTimeUpdate$(); - if (timeUpdate$ !== undefined) { - subscriptions.add( - timeUpdate$.subscribe((v) => { - setTime(timefilter.getTime()); - }) - ); - } + const enabledUpdated$ = timefilter.getEnabledUpdated$(); if (enabledUpdated$ !== undefined) { subscriptions.add( @@ -124,15 +209,21 @@ export const DatePickerWrapper: FC = () => { return function cleanup() { subscriptions.unsubscribe(); }; - }, [setRefreshInterval, timefilter]); - - function updateFilter({ start, end }: Duration) { - const newTime = { from: start, to: end }; - // Update timefilter for controllers listening for changes - timefilter.setTime(newTime); - setTime(newTime); - setRecentlyUsedRanges(getRecentlyUsedRanges()); - } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + const updateTimeFilter = useCallback( + ({ start, end }: OnTimeChangeProps) => { + setRecentlyUsedRanges(getRecentlyUsedRanges()); + setGlobalState('time', { + from: start, + to: end, + ...(start === 'now' || end === 'now' ? { ts: Date.now() } : {}), + }); + }, + // eslint-disable-next-line react-hooks/exhaustive-deps + [setGlobalState] + ); function updateInterval({ isPaused: pause, @@ -144,26 +235,44 @@ export const DatePickerWrapper: FC = () => { setRefreshInterval({ pause, value }); } - /** - * Enforce pause when it's set to false with 0 refresh interval. - */ - const isPaused = refreshInterval.pause || (!refreshInterval.pause && !refreshInterval.value); - return isAutoRefreshSelectorEnabled || isTimeRangeSelectorEnabled ? ( -
- -
+ + + + + + {isTimeRangeSelectorEnabled ? null : ( + + updateLastRefresh()} + data-test-subj="dataVisualizerRefreshPageButton" + > + + + + )} + ) : null; }; diff --git a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/hooks/use_time_filter.ts b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/hooks/use_time_filter.ts index 132d03c81c0e..727c8bab88dc 100644 --- a/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/hooks/use_time_filter.ts +++ b/x-pack/plugins/data_visualizer/public/application/index_data_visualizer/hooks/use_time_filter.ts @@ -6,6 +6,8 @@ */ import { useEffect } from 'react'; +import useObservable from 'react-use/lib/useObservable'; +import { map } from 'rxjs/operators'; import { useDataVisualizerKibana } from '../../kibana_context'; interface UseTimefilterOptions { @@ -36,3 +38,22 @@ export const useTimefilter = ({ return timefilter; }; + +export const useRefreshIntervalUpdates = () => { + const timefilter = useTimefilter(); + + return useObservable( + timefilter.getRefreshIntervalUpdate$().pipe(map(timefilter.getRefreshInterval)), + timefilter.getRefreshInterval() + ); +}; + +export const useTimeRangeUpdates = (absolute = false) => { + const timefilter = useTimefilter(); + + const getTimeCallback = absolute + ? timefilter.getAbsoluteTime.bind(timefilter) + : timefilter.getTime.bind(timefilter); + + return useObservable(timefilter.getTimeUpdate$().pipe(map(getTimeCallback)), getTimeCallback()); +}; diff --git a/x-pack/plugins/enterprise_search/common/ml_inference_pipeline/index.test.ts b/x-pack/plugins/enterprise_search/common/ml_inference_pipeline/index.test.ts new file mode 100644 index 000000000000..29becfa3e99a --- /dev/null +++ b/x-pack/plugins/enterprise_search/common/ml_inference_pipeline/index.test.ts @@ -0,0 +1,52 @@ +/* + * 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 { MlTrainedModelConfig } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { BUILT_IN_MODEL_TAG } from '@kbn/ml-plugin/common/constants/data_frame_analytics'; + +import { getMlModelTypesForModelConfig, BUILT_IN_MODEL_TAG as LOCAL_BUILT_IN_MODEL_TAG } from '.'; + +describe('getMlModelTypesForModelConfig lib function', () => { + const mockModel: MlTrainedModelConfig = { + inference_config: { + ner: {}, + }, + input: { + field_names: [], + }, + model_id: 'test_id', + model_type: 'pytorch', + tags: ['test_tag'], + }; + const builtInMockModel: MlTrainedModelConfig = { + inference_config: { + text_classification: {}, + }, + input: { + field_names: [], + }, + model_id: 'test_id', + model_type: 'lang_ident', + tags: [BUILT_IN_MODEL_TAG], + }; + + it('should return the model type and inference config type', () => { + const expected = ['pytorch', 'ner']; + const response = getMlModelTypesForModelConfig(mockModel); + expect(response.sort()).toEqual(expected.sort()); + }); + + it('should include the built in type', () => { + const expected = ['lang_ident', 'text_classification', BUILT_IN_MODEL_TAG]; + const response = getMlModelTypesForModelConfig(builtInMockModel); + expect(response.sort()).toEqual(expected.sort()); + }); + + it('local BUILT_IN_MODEL_TAG matches ml plugin', () => { + expect(LOCAL_BUILT_IN_MODEL_TAG).toEqual(BUILT_IN_MODEL_TAG); + }); +}); diff --git a/x-pack/plugins/enterprise_search/common/ml_inference_pipeline/index.ts b/x-pack/plugins/enterprise_search/common/ml_inference_pipeline/index.ts new file mode 100644 index 000000000000..3bc43fa14d7b --- /dev/null +++ b/x-pack/plugins/enterprise_search/common/ml_inference_pipeline/index.ts @@ -0,0 +1,96 @@ +/* + * 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 { MlTrainedModelConfig } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; + +import { MlInferencePipeline } from '../types/pipelines'; + +// Getting an error importing this from @kbn/ml-plugin/common/constants/data_frame_analytics' +// So defining it locally for now with a test to make sure it matches. +export const BUILT_IN_MODEL_TAG = 'prepackaged'; + +export interface MlInferencePipelineParams { + description?: string; + destinationField: string; + model: MlTrainedModelConfig; + pipelineName: string; + sourceField: string; +} + +/** + * Generates the pipeline body for a machine learning inference pipeline + * @param pipelineConfiguration machine learning inference pipeline configuration parameters + * @returns pipeline body + */ +export const generateMlInferencePipelineBody = ({ + description, + destinationField, + model, + pipelineName, + sourceField, +}: MlInferencePipelineParams): MlInferencePipeline => { + // if model returned no input field, insert a placeholder + const modelInputField = + model.input?.field_names?.length > 0 ? model.input.field_names[0] : 'MODEL_INPUT_FIELD'; + return { + description: description ?? '', + processors: [ + { + remove: { + field: `ml.inference.${destinationField}`, + ignore_missing: true, + }, + }, + { + inference: { + field_map: { + [sourceField]: modelInputField, + }, + model_id: model.model_id, + target_field: `ml.inference.${destinationField}`, + }, + }, + { + append: { + field: '_source._ingest.processors', + value: [ + { + model_version: model.version, + pipeline: pipelineName, + processed_timestamp: '{{{ _ingest.timestamp }}}', + types: getMlModelTypesForModelConfig(model), + }, + ], + }, + }, + ], + version: 1, + }; +}; + +/** + * Parses model types list from the given configuration of a trained machine learning model + * @param trainedModel configuration for a trained machine learning model + * @returns list of model types + */ +export const getMlModelTypesForModelConfig = (trainedModel: MlTrainedModelConfig): string[] => { + if (!trainedModel) return []; + + const isBuiltIn = trainedModel.tags?.includes(BUILT_IN_MODEL_TAG); + + return [ + trainedModel.model_type, + ...Object.keys(trainedModel.inference_config || {}), + ...(isBuiltIn ? [BUILT_IN_MODEL_TAG] : []), + ].filter((type): type is string => type !== undefined); +}; + +export const formatPipelineName = (rawName: string) => + rawName + .trim() + .replace(/\s+/g, '_') // Convert whitespaces to underscores + .toLowerCase(); diff --git a/x-pack/plugins/enterprise_search/common/types/pipelines.ts b/x-pack/plugins/enterprise_search/common/types/pipelines.ts index 269f7149cc7b..8652eb57f9b4 100644 --- a/x-pack/plugins/enterprise_search/common/types/pipelines.ts +++ b/x-pack/plugins/enterprise_search/common/types/pipelines.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { IngestPipeline } from '@elastic/elasticsearch/lib/api/types'; + export interface InferencePipeline { modelState: TrainedModelState; modelStateReason?: string; @@ -19,3 +21,7 @@ export enum TrainedModelState { Started = 'started', Failed = 'failed', } + +export interface MlInferencePipeline extends IngestPipeline { + version?: number; +} diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/add_ml_inference_pipeline_modal.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/add_ml_inference_pipeline_modal.tsx index 8b2cfb1d4b5d..916a295df005 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/add_ml_inference_pipeline_modal.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/add_ml_inference_pipeline_modal.tsx @@ -15,6 +15,8 @@ import { EuiCallOut, EuiFlexGroup, EuiFlexItem, + EuiStepsHorizontal, + EuiStepsHorizontalProps, EuiModal, EuiModalBody, EuiModalFooter, @@ -26,11 +28,18 @@ import { import { i18n } from '@kbn/i18n'; +import { + BACK_BUTTON_LABEL, + CANCEL_BUTTON_LABEL, + CONTINUE_BUTTON_LABEL, +} from '../../../../../shared/constants'; import { IndexNameLogic } from '../../index_name_logic'; import { ConfigurePipeline } from './configure_pipeline'; -import { MLInferenceLogic, AddInferencePipelineModal } from './ml_inference_logic'; +import { AddInferencePipelineSteps, MLInferenceLogic } from './ml_inference_logic'; import { NoModelsPanel } from './no_models'; +import { ReviewPipeline } from './review_pipeline'; +import { TestPipeline } from './test_pipeline'; interface AddMLInferencePipelineModalProps { onClose: () => void; @@ -64,15 +73,13 @@ export const AddMLInferencePipelineModal: React.FC { - const { pipelineName, modelID, sourceField } = configuration; - return pipelineName.trim().length === 0 || modelID.length === 0 || sourceField.length === 0; -}; - const AddProcessorContent: React.FC = ({ onClose }) => { - const { addInferencePipelineModal, createErrors, supportedMLModels, isLoading } = - useValues(MLInferenceLogic); - const { createPipeline } = useActions(MLInferenceLogic); + const { + createErrors, + supportedMLModels, + isLoading, + addInferencePipelineModal: { step }, + } = useValues(MLInferenceLogic); if (isLoading) { return ( @@ -103,37 +110,126 @@ const AddProcessorContent: React.FC = ({ onClo )} - + + {step === AddInferencePipelineSteps.Configuration && } + {step === AddInferencePipelineSteps.Test && } + {step === AddInferencePipelineSteps.Review && } - - - - - - {i18n.translate( - 'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.footer.cancel', - { - defaultMessage: 'Cancel', - } - )} + + + ); +}; + +const ModalSteps: React.FC = () => { + const { + addInferencePipelineModal: { step }, + isPipelineDataValid, + } = useValues(MLInferenceLogic); + const { setAddInferencePipelineStep } = useActions(MLInferenceLogic); + const navSteps: EuiStepsHorizontalProps['steps'] = [ + { + onClick: () => setAddInferencePipelineStep(AddInferencePipelineSteps.Configuration), + status: isPipelineDataValid ? 'complete' : 'disabled', + title: i18n.translate( + 'xpack.enterpriseSearch.content.indices.transforms.addInferencePipelineModal.steps.configure.title', + { + defaultMessage: 'Configure', + } + ), + }, + { + onClick: () => setAddInferencePipelineStep(AddInferencePipelineSteps.Test), + status: isPipelineDataValid ? 'incomplete' : 'disabled', + title: i18n.translate( + 'xpack.enterpriseSearch.content.indices.transforms.addInferencePipelineModal.steps.test.title', + { + defaultMessage: 'Test', + } + ), + }, + { + onClick: () => setAddInferencePipelineStep(AddInferencePipelineSteps.Review), + status: isPipelineDataValid ? 'incomplete' : 'disabled', + title: i18n.translate( + 'xpack.enterpriseSearch.content.indices.transforms.addInferencePipelineModal.steps.review.title', + { + defaultMessage: 'Review', + } + ), + }, + ]; + switch (step) { + case AddInferencePipelineSteps.Configuration: + navSteps[0].status = isPipelineDataValid ? 'complete' : 'current'; + break; + case AddInferencePipelineSteps.Test: + navSteps[1].status = 'current'; + break; + case AddInferencePipelineSteps.Review: + navSteps[2].status = 'current'; + break; + } + return ; +}; + +const ModalFooter: React.FC = ({ onClose }) => { + const { addInferencePipelineModal: modal, isPipelineDataValid } = useValues(MLInferenceLogic); + const { createPipeline, setAddInferencePipelineStep } = useActions(MLInferenceLogic); + + let nextStep: AddInferencePipelineSteps | undefined; + let previousStep: AddInferencePipelineSteps | undefined; + switch (modal.step) { + case AddInferencePipelineSteps.Test: + nextStep = AddInferencePipelineSteps.Review; + previousStep = AddInferencePipelineSteps.Configuration; + break; + case AddInferencePipelineSteps.Review: + previousStep = AddInferencePipelineSteps.Test; + break; + case AddInferencePipelineSteps.Configuration: + nextStep = AddInferencePipelineSteps.Test; + break; + } + return ( + + + + {previousStep !== undefined ? ( + setAddInferencePipelineStep(previousStep as AddInferencePipelineSteps)} + > + {BACK_BUTTON_LABEL} - - + ) : null} + + + + {CANCEL_BUTTON_LABEL} + + + {nextStep !== undefined ? ( setAddInferencePipelineStep(nextStep as AddInferencePipelineSteps)} + disabled={!isPipelineDataValid} > + {CONTINUE_BUTTON_LABEL} + + ) : ( + {i18n.translate( - 'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.footer.create', + 'xpack.enterpriseSearch.content.indices.transforms.addInferencePipelineModal.footer.create', { defaultMessage: 'Create', } )} - - - - + )} + + + ); }; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/configure_pipeline.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/configure_pipeline.tsx index 199d62f914f0..b1d8fd4d074a 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/configure_pipeline.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/configure_pipeline.tsx @@ -36,6 +36,7 @@ export const ConfigurePipeline: React.FC = () => { const { destinationField, modelID, pipelineName, sourceField } = configuration; const models = supportedMLModels ?? []; + const nameError = formErrors.pipelineName !== undefined && pipelineName.length > 0; return ( <> @@ -73,7 +74,7 @@ export const ConfigurePipeline: React.FC = () => { } )} helpText={ - formErrors.pipelineName === undefined && + !nameError && i18n.translate( 'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.steps.configure.name.helpText', { @@ -82,8 +83,8 @@ export const ConfigurePipeline: React.FC = () => { } ) } - error={formErrors.pipelineName} - isInvalid={formErrors.pipelineName !== undefined} + error={nameError && formErrors.pipelineName} + isInvalid={nameError} > void; createApiError: (error: HttpError) => HttpError; createApiSuccess: typeof CreateMlInferencePipelineApiLogic.actions.apiSuccess; createPipeline: () => void; @@ -49,10 +59,10 @@ interface MLInferenceProcessorsActions { makeMappingRequest: typeof MappingsApiLogic.actions.makeRequest; mappingsApiError(error: HttpError): HttpError; mlModelsApiError(error: HttpError): HttpError; - setCreateErrors(errors: string[]): { errors: string[] }; - setFormErrors: (inputErrors: AddInferencePipelineFormErrors) => { - inputErrors: AddInferencePipelineFormErrors; + setAddInferencePipelineStep: (step: AddInferencePipelineSteps) => { + step: AddInferencePipelineSteps; }; + setCreateErrors(errors: string[]): { errors: string[] }; setIndexName: (indexName: string) => { indexName: string }; setInferencePipelineConfiguration: (configuration: InferencePipelineConfiguration) => { configuration: InferencePipelineConfiguration; @@ -62,6 +72,7 @@ interface MLInferenceProcessorsActions { export interface AddInferencePipelineModal { configuration: InferencePipelineConfiguration; indexName: string; + step: AddInferencePipelineSteps; } interface MLInferenceProcessorsValues { @@ -69,8 +80,10 @@ interface MLInferenceProcessorsValues { createErrors: string[]; formErrors: AddInferencePipelineFormErrors; isLoading: boolean; + isPipelineDataValid: boolean; mappingData: typeof MappingsApiLogic.values.data; mappingStatus: Status; + mlInferencePipeline?: MlInferencePipeline; mlModelsData: typeof MLModelsApiLogic.values.data; mlModelsStatus: typeof MLModelsApiLogic.values.apiStatus; sourceFields: string[] | undefined; @@ -83,6 +96,7 @@ export const MLInferenceLogic = kea< actions: { clearFormErrors: true, createPipeline: true, + setAddInferencePipelineStep: (step: AddInferencePipelineSteps) => ({ step }), setCreateErrors: (errors: string[]) => ({ errors }), setFormErrors: (inputErrors: AddInferencePipelineFormErrors) => ({ inputErrors }), setIndexName: (indexName: string) => ({ indexName }), @@ -124,12 +138,6 @@ export const MLInferenceLogic = kea< const { addInferencePipelineModal: { configuration, indexName }, } = values; - const validationErrors = validateInferencePipelineConfiguration(configuration); - if (validationErrors !== undefined) { - actions.setFormErrors(validationErrors); - return; - } - actions.clearFormErrors(); actions.makeCreatePipelineRequest({ indexName, @@ -155,8 +163,10 @@ export const MLInferenceLogic = kea< ...EMPTY_PIPELINE_CONFIGURATION, }, indexName: '', + step: AddInferencePipelineSteps.Configuration, }, { + setAddInferencePipelineStep: (modal, { step }) => ({ ...modal, step }), setIndexName: (modal, { indexName }) => ({ ...modal, indexName }), setInferencePipelineConfiguration: (modal, { configuration }) => ({ ...modal, @@ -171,21 +181,47 @@ export const MLInferenceLogic = kea< setCreateErrors: (_, { errors }) => errors, }, ], - formErrors: [ - {}, - { - clearFormErrors: () => ({}), - setFormErrors: (_, { inputErrors }) => inputErrors, - }, - ], }, selectors: ({ selectors }) => ({ + formErrors: [ + () => [selectors.addInferencePipelineModal], + (modal: AddInferencePipelineModal) => + validateInferencePipelineConfiguration(modal.configuration), + ], isLoading: [ () => [selectors.mlModelsStatus, selectors.mappingStatus], (mlModelsStatus, mappingStatus) => !API_REQUEST_COMPLETE_STATUSES.includes(mlModelsStatus) || !API_REQUEST_COMPLETE_STATUSES.includes(mappingStatus), ], + isPipelineDataValid: [ + () => [selectors.formErrors], + (errors: AddInferencePipelineFormErrors) => Object.keys(errors).length === 0, + ], + mlInferencePipeline: [ + () => [ + selectors.isPipelineDataValid, + selectors.addInferencePipelineModal, + selectors.mlModelsData, + ], + ( + isPipelineDataValid: boolean, + { configuration }: AddInferencePipelineModal, + models: MLInferenceProcessorsValues['mlModelsData'] + ) => { + if (!isPipelineDataValid) return undefined; + const model = models?.find((mlModel) => mlModel.model_id === configuration.modelID); + if (!model) return undefined; + + return generateMlInferencePipelineBody({ + destinationField: + configuration.destinationField || formatPipelineName(configuration.pipelineName), + model, + pipelineName: configuration.pipelineName, + sourceField: configuration.sourceField, + }); + }, + ], sourceFields: [ () => [selectors.mappingStatus, selectors.mappingData], (status: Status, mapping: IndicesGetMappingIndexMappingRecord) => { diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/review_pipeline.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/review_pipeline.tsx new file mode 100644 index 000000000000..580a5acaac2c --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/review_pipeline.tsx @@ -0,0 +1,49 @@ +/* + * 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 React from 'react'; + +import { useValues } from 'kea'; + +import { EuiCodeBlock, EuiSpacer, EuiText } from '@elastic/eui'; + +import { i18n } from '@kbn/i18n'; + +import { MLInferenceLogic } from './ml_inference_logic'; + +export const ReviewPipeline: React.FC = () => { + const { mlInferencePipeline } = useValues(MLInferenceLogic); + return ( + <> + +

+ {i18n.translate( + 'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.steps.review.title', + { + defaultMessage: 'Pipeline configuration', + } + )} +

+
+ + {JSON.stringify(mlInferencePipeline ?? {}, null, 2)} + + + +

+ {i18n.translate( + 'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.steps.review.description', + { + defaultMessage: + "This pipeline will be created and injected as a processor into your default pipeline for this index. You'll be able to use this new pipeline independently as well.", + } + )} +

+
+ + ); +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/test_pipeline.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/test_pipeline.tsx new file mode 100644 index 000000000000..523973ad2d3d --- /dev/null +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/test_pipeline.tsx @@ -0,0 +1,12 @@ +/* + * 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 React from 'react'; + +export const TestPipeline: React.FC = () => { + return
Test Pipeline
; +}; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/types.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/types.ts index 9ada53d224c8..29ad5e9193fd 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/types.ts @@ -14,5 +14,7 @@ export interface InferencePipelineConfiguration { export interface AddInferencePipelineFormErrors { destinationField?: string; + modelID?: string; pipelineName?: string; + sourceField?: string; } diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/utils.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/utils.ts index b788a522d395..8e168586a481 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/utils.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/utils.ts @@ -41,17 +41,34 @@ export const isValidPipelineName = (input: string): boolean => { return input.length > 0 && VALID_PIPELINE_NAME_REGEX.test(input); }; +const INVALID_PIPELINE_NAME_ERROR = i18n.translate( + 'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.steps.configure.invalidPipelineName', + { + defaultMessage: 'Name must only contain letters, numbers, underscores, and hyphens.', + } +); +const FIELD_REQUIRED_ERROR = i18n.translate( + 'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.steps.configure.emptyValueError', + { + defaultMessage: 'Field is required.', + } +); + export const validateInferencePipelineConfiguration = ( config: InferencePipelineConfiguration -): AddInferencePipelineFormErrors | undefined => { +): AddInferencePipelineFormErrors => { const errors: AddInferencePipelineFormErrors = {}; - if (!isValidPipelineName(config.pipelineName)) { - errors.pipelineName = i18n.translate( - 'xpack.enterpriseSearch.content.indices.pipelines.addInferencePipelineModal.steps.configure.invalidPipelineName', - { - defaultMessage: 'Name must only contain letters, numbers, underscores, and hyphens.', - } - ); - return errors; + if (config.pipelineName.trim().length === 0) { + errors.pipelineName = FIELD_REQUIRED_ERROR; + } else if (!isValidPipelineName(config.pipelineName)) { + errors.pipelineName = INVALID_PIPELINE_NAME_ERROR; } + if (config.modelID.trim().length === 0) { + errors.modelID = FIELD_REQUIRED_ERROR; + } + if (config.sourceField.trim().length === 0) { + errors.sourceField = FIELD_REQUIRED_ERROR; + } + + return errors; }; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/settings/settings.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/settings/settings.tsx index eaab5d56b1b4..94c4c1fdbaad 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/settings/settings.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/settings/settings.tsx @@ -31,9 +31,6 @@ export const Settings: React.FC = () => { return ( { }); }); -describe('getMlModelTypesForModelConfig lib function', () => { - const mockModel: MlTrainedModelConfig = { - inference_config: { - ner: {}, - }, - input: { - field_names: [], - }, - model_id: 'test_id', - model_type: 'pytorch', - tags: ['test_tag'], - }; - const builtInMockModel: MlTrainedModelConfig = { - inference_config: { - text_classification: {}, - }, - input: { - field_names: [], - }, - model_id: 'test_id', - model_type: 'lang_ident', - tags: [BUILT_IN_MODEL_TAG], - }; - - it('should return the model type and inference config type', () => { - const expected = ['pytorch', 'ner']; - const response = getMlModelTypesForModelConfig(mockModel); - expect(response.sort()).toEqual(expected.sort()); - }); - - it('should include the built in type', () => { - const expected = ['lang_ident', 'text_classification', BUILT_IN_MODEL_TAG]; - const response = getMlModelTypesForModelConfig(builtInMockModel); - expect(response.sort()).toEqual(expected.sort()); - }); -}); - describe('getMlModelConfigsForModelIds lib function', () => { const mockClient = { ml: { diff --git a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_ml_inference_pipeline_processors.ts b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_ml_inference_pipeline_processors.ts index 95839a9b6ac2..72867ad71706 100644 --- a/x-pack/plugins/enterprise_search/server/lib/indices/fetch_ml_inference_pipeline_processors.ts +++ b/x-pack/plugins/enterprise_search/server/lib/indices/fetch_ml_inference_pipeline_processors.ts @@ -5,10 +5,9 @@ * 2.0. */ -import { MlTrainedModelConfig } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { ElasticsearchClient } from '@kbn/core/server'; -import { BUILT_IN_MODEL_TAG } from '@kbn/ml-plugin/common/constants/data_frame_analytics'; +import { getMlModelTypesForModelConfig } from '../../../common/ml_inference_pipeline'; import { InferencePipeline, TrainedModelState } from '../../../common/types/pipelines'; import { getInferencePipelineNameFromIndexName } from '../../utils/ml_inference_pipeline_utils'; @@ -70,18 +69,6 @@ export const fetchPipelineProcessorInferenceData = async ( ); }; -export const getMlModelTypesForModelConfig = (trainedModel: MlTrainedModelConfig): string[] => { - if (!trainedModel) return []; - - const isBuiltIn = trainedModel.tags?.includes(BUILT_IN_MODEL_TAG); - - return [ - trainedModel.model_type, - ...Object.keys(trainedModel.inference_config || {}), - ...(isBuiltIn ? [BUILT_IN_MODEL_TAG] : []), - ].filter((type): type is string => type !== undefined); -}; - export const getMlModelConfigsForModelIds = async ( client: ElasticsearchClient, trainedModelNames: string[] diff --git a/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts b/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts index bcb33f9f82b3..f32590fb516c 100644 --- a/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts +++ b/x-pack/plugins/enterprise_search/server/lib/pipelines/create_pipeline_definitions.ts @@ -5,20 +5,16 @@ * 2.0. */ -import { IngestPipeline } from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchClient } from '@kbn/core/server'; +import { generateMlInferencePipelineBody } from '../../../common/ml_inference_pipeline'; +import { MlInferencePipeline } from '../../../common/types/pipelines'; import { getInferencePipelineNameFromIndexName } from '../../utils/ml_inference_pipeline_utils'; -import { getMlModelTypesForModelConfig } from '../indices/fetch_ml_inference_pipeline_processors'; export interface CreatedPipelines { created: string[]; } -export interface MlInferencePipeline extends IngestPipeline { - version?: number; -} - /** * Used to create index-specific Ingest Pipelines to be used in conjunction with Enterprise Search * ingestion mechanisms. Three pipelines are created: @@ -237,43 +233,10 @@ export const formatMlPipelineBody = async ( // this will raise a 404 if model doesn't exist const models = await esClient.ml.getTrainedModels({ model_id: modelId }); const model = models.trained_model_configs[0]; - // if model returned no input field, insert a placeholder - const modelInputField = - model.input?.field_names?.length > 0 ? model.input.field_names[0] : 'MODEL_INPUT_FIELD'; - const modelTypes = getMlModelTypesForModelConfig(model); - const modelVersion = model.version; - return { - description: '', - processors: [ - { - remove: { - field: `ml.inference.${destinationField}`, - ignore_missing: true, - }, - }, - { - inference: { - field_map: { - [sourceField]: modelInputField, - }, - model_id: modelId, - target_field: `ml.inference.${destinationField}`, - }, - }, - { - append: { - field: '_source._ingest.processors', - value: [ - { - model_version: modelVersion, - pipeline: pipelineName, - processed_timestamp: '{{{ _ingest.timestamp }}}', - types: modelTypes, - }, - ], - }, - }, - ], - version: 1, - }; + return generateMlInferencePipelineBody({ + destinationField, + model, + pipelineName, + sourceField, + }); }; diff --git a/x-pack/plugins/enterprise_search/server/utils/create_ml_inference_pipeline.ts b/x-pack/plugins/enterprise_search/server/utils/create_ml_inference_pipeline.ts index dfcd8d488497..da4bce12d71e 100644 --- a/x-pack/plugins/enterprise_search/server/utils/create_ml_inference_pipeline.ts +++ b/x-pack/plugins/enterprise_search/server/utils/create_ml_inference_pipeline.ts @@ -8,6 +8,7 @@ import { IngestGetPipelineResponse, IngestPipeline } from '@elastic/elasticsearch/lib/api/types'; import { ElasticsearchClient } from '@kbn/core/server'; +import { formatPipelineName } from '../../common/ml_inference_pipeline'; import { ErrorCode } from '../../common/types/error_codes'; import { formatMlPipelineBody } from '../lib/pipelines/create_pipeline_definitions'; @@ -15,7 +16,6 @@ import { formatMlPipelineBody } from '../lib/pipelines/create_pipeline_definitio import { getInferencePipelineNameFromIndexName, getPrefixedInferencePipelineProcessorName, - formatPipelineName, } from './ml_inference_pipeline_utils'; /** diff --git a/x-pack/plugins/enterprise_search/server/utils/ml_inference_pipeline_utils.ts b/x-pack/plugins/enterprise_search/server/utils/ml_inference_pipeline_utils.ts index 6547034f2540..e92db3d263a6 100644 --- a/x-pack/plugins/enterprise_search/server/utils/ml_inference_pipeline_utils.ts +++ b/x-pack/plugins/enterprise_search/server/utils/ml_inference_pipeline_utils.ts @@ -5,6 +5,8 @@ * 2.0. */ +import { formatPipelineName } from '../../common/ml_inference_pipeline'; + export const getInferencePipelineNameFromIndexName = (indexName: string) => `${indexName}@ml-inference`; @@ -12,9 +14,3 @@ export const getPrefixedInferencePipelineProcessorName = (pipelineName: string) pipelineName.startsWith('ml-inference-') ? formatPipelineName(pipelineName) : `ml-inference-${formatPipelineName(pipelineName)}`; - -export const formatPipelineName = (rawName: string) => - rawName - .trim() - .replace(/\s+/g, '_') // Convert whitespaces to underscores - .toLowerCase(); diff --git a/x-pack/plugins/fleet/common/types/models/agent.ts b/x-pack/plugins/fleet/common/types/models/agent.ts index 5def12287b4f..fa54f8c943e2 100644 --- a/x-pack/plugins/fleet/common/types/models/agent.ts +++ b/x-pack/plugins/fleet/common/types/models/agent.ts @@ -84,6 +84,7 @@ interface AgentBase { policy_revision?: number | null; last_checkin?: string; last_checkin_status?: 'error' | 'online' | 'degraded' | 'updating'; + last_checkin_message?: string; user_provided_metadata: AgentMetadata; local_metadata: AgentMetadata; tags?: string[]; @@ -229,6 +230,10 @@ export interface FleetServerAgent { * Last checkin status */ last_checkin_status?: 'error' | 'online' | 'degraded' | 'updating'; + /** + * Last checkin message + */ + last_checkin_message?: string; /** * ID of the API key the Elastic Agent uses to authenticate with elasticsearch */ diff --git a/x-pack/plugins/fleet/cypress/plugins/index.ts b/x-pack/plugins/fleet/cypress/plugins/index.ts index d11dbb1e38ad..9fce88b6cd68 100644 --- a/x-pack/plugins/fleet/cypress/plugins/index.ts +++ b/x-pack/plugins/fleet/cypress/plugins/index.ts @@ -35,6 +35,7 @@ const plugin: Cypress.PluginConfig = (on, config) => { query, ignore_unavailable: ignoreUnavailable, refresh: true, + conflicts: 'proceed', }); }, }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx index 5799b130b6a4..11ddcef4c8ae 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_details_page/components/agent_details/agent_details_overview.tsx @@ -58,6 +58,12 @@ export const AgentDetailsOverviewSection: React.FunctionComponent<{ '-' ), }, + { + title: i18n.translate('xpack.fleet.agentDetails.lastCheckinMessageLabel', { + defaultMessage: 'Last checkin message', + }), + description: agent.last_checkin_message ? agent.last_checkin_message : '-', + }, { title: i18n.translate('xpack.fleet.agentDetails.hostIdLabel', { defaultMessage: 'Agent ID', diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/tags_add_remove.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/tags_add_remove.tsx index 70b4da44dad6..8307bc3467cc 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/tags_add_remove.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/tags_add_remove.tsx @@ -123,12 +123,22 @@ export const TagsAddRemove: React.FC = ({ // sending updated tags to add/remove, in case multiple actions are done quickly and the first one is not yet propagated const updatedTagsToAdd = tagsToAdd.concat( labels - .filter((tag) => tag.checked === 'on' && !selectedTags.includes(tag.label)) + .filter( + (tag) => + tag.checked === 'on' && + !selectedTags.includes(tag.label) && + !tagsToRemove.includes(tag.label) + ) .map((tag) => tag.label) ); const updatedTagsToRemove = tagsToRemove.concat( labels - .filter((tag) => tag.checked !== 'on' && selectedTags.includes(tag.label)) + .filter( + (tag) => + tag.checked !== 'on' && + selectedTags.includes(tag.label) && + !tagsToAdd.includes(tag.label) + ) .map((tag) => tag.label) ); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx index b2c03ba745d7..93091ff72625 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/components/agent_health.tsx @@ -74,8 +74,33 @@ export const AgentHealth: React.FunctionComponent = ({ agent, showOfflinePreviousStatus, }) => { - const { last_checkin: lastCheckIn } = agent; + const { last_checkin: lastCheckIn, last_checkin_message: lastCheckInMessage } = agent; const msLastCheckIn = new Date(lastCheckIn || 0).getTime(); + const lastCheckInMessageText = lastCheckInMessage ? ( + + ) : null; + const lastCheckinText = msLastCheckIn ? ( + <> + , + }} + /> + + ) : ( + + ); const previousToOfflineStatus = useMemo(() => { if (!showOfflinePreviousStatus || agent.status !== 'offline') { @@ -89,22 +114,10 @@ export const AgentHealth: React.FunctionComponent = ({ - , - }} - /> - - ) : ( - - ) + <> +

{lastCheckinText}

+

{lastCheckInMessageText}

+ } > <> diff --git a/x-pack/plugins/fleet/server/services/agents/action_status.ts b/x-pack/plugins/fleet/server/services/agents/action_status.ts index 8489c25e3fd8..a057af185a06 100644 --- a/x-pack/plugins/fleet/server/services/agents/action_status.ts +++ b/x-pack/plugins/fleet/server/services/agents/action_status.ts @@ -64,7 +64,10 @@ export async function getActionStatuses( const matchingBucket = (acks?.aggregations?.ack_counts as any)?.buckets?.find( (bucket: any) => bucket.key === action.actionId ); - const nbAgentsAck = (matchingBucket?.agent_count as any)?.value ?? 0; + const nbAgentsAck = Math.min( + matchingBucket?.doc_count ?? 0, + (matchingBucket?.agent_count as any)?.value ?? 0 + ); const completionTime = (matchingBucket?.max_timestamp as any)?.value_as_string; const nbAgentsActioned = action.nbAgentsActioned || action.nbAgentsActionCreated; const complete = nbAgentsAck >= nbAgentsActioned; diff --git a/x-pack/plugins/fleet/server/services/agents/actions.test.ts b/x-pack/plugins/fleet/server/services/agents/actions.test.ts index 97d7c73035e6..7c88b4885b84 100644 --- a/x-pack/plugins/fleet/server/services/agents/actions.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/actions.test.ts @@ -92,10 +92,14 @@ describe('Agent actions', () => { await cancelAgentAction(esClient, 'action1'); expect(mockedBulkUpdateAgents).toBeCalled(); - expect(mockedBulkUpdateAgents).toBeCalledWith(expect.anything(), [ - expect.objectContaining({ agentId: 'agent1' }), - expect.objectContaining({ agentId: 'agent2' }), - ]); + expect(mockedBulkUpdateAgents).toBeCalledWith( + expect.anything(), + [ + expect.objectContaining({ agentId: 'agent1' }), + expect.objectContaining({ agentId: 'agent2' }), + ], + {} + ); }); }); }); diff --git a/x-pack/plugins/fleet/server/services/agents/actions.ts b/x-pack/plugins/fleet/server/services/agents/actions.ts index 17c745bfd285..8f9302bd31ac 100644 --- a/x-pack/plugins/fleet/server/services/agents/actions.ts +++ b/x-pack/plugins/fleet/server/services/agents/actions.ts @@ -8,6 +8,7 @@ import uuid from 'uuid'; import type { ElasticsearchClient } from '@kbn/core/server'; +import { appContextService } from '../app_context'; import type { Agent, AgentAction, @@ -101,6 +102,32 @@ export async function bulkCreateAgentActions( return actions; } +export async function createErrorActionResults( + esClient: ElasticsearchClient, + actionId: string, + errors: Record, + errorMessage: string +) { + const errorCount = Object.keys(errors).length; + if (errorCount > 0) { + appContextService + .getLogger() + .info( + `Writing error action results of ${errorCount} agents. Possibly failed validation: ${errorMessage}.` + ); + + // writing out error result for those agents that have errors, so the action is not going to stay in progress forever + await bulkCreateAgentActionResults( + esClient, + Object.keys(errors).map((agentId) => ({ + agentId, + actionId, + error: errors[agentId].message, + })) + ); + } +} + export async function bulkCreateAgentActionResults( esClient: ElasticsearchClient, results: Array<{ @@ -227,16 +254,6 @@ export async function cancelAgentAction(esClient: ElasticsearchClient, actionId: if (!hit._source || !hit._source.agents || !hit._source.action_id) { continue; } - await createAgentAction(esClient, { - id: cancelActionId, - type: 'CANCEL', - agents: hit._source.agents, - data: { - target_id: hit._source.action_id, - }, - created_at: now, - expiration: hit._source.expiration, - }); if (hit._source.type === 'UPGRADE') { await bulkUpdateAgents( esClient, @@ -246,9 +263,20 @@ export async function cancelAgentAction(esClient: ElasticsearchClient, actionId: upgraded_at: null, upgrade_started_at: null, }, - })) + })), + {} ); } + await createAgentAction(esClient, { + id: cancelActionId, + type: 'CANCEL', + agents: hit._source.agents, + data: { + target_id: hit._source.action_id, + }, + created_at: now, + expiration: hit._source.expiration, + }); } return { diff --git a/x-pack/plugins/fleet/server/services/agents/crud.ts b/x-pack/plugins/fleet/server/services/agents/crud.ts index 55a244664238..d62bbf4c414b 100644 --- a/x-pack/plugins/fleet/server/services/agents/crud.ts +++ b/x-pack/plugins/fleet/server/services/agents/crud.ts @@ -11,7 +11,7 @@ import type { SavedObjectsClientContract, ElasticsearchClient } from '@kbn/core/ import type { KueryNode } from '@kbn/es-query'; import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; -import type { AgentSOAttributes, Agent, BulkActionResult, ListWithKuery } from '../../types'; +import type { AgentSOAttributes, Agent, ListWithKuery } from '../../types'; import { appContextService, agentPolicyService } from '..'; import type { FleetServerAgent } from '../../../common/types'; import { SO_SEARCH_LIMIT } from '../../../common/constants'; @@ -395,10 +395,11 @@ export async function bulkUpdateAgents( updateData: Array<{ agentId: string; data: Partial; - }> -): Promise<{ items: BulkActionResult[] }> { + }>, + errors: { [key: string]: Error } +): Promise { if (updateData.length === 0) { - return { items: [] }; + return; } const body = updateData.flatMap(({ agentId, data }) => [ @@ -419,14 +420,12 @@ export async function bulkUpdateAgents( refresh: 'wait_for', }); - return { - items: res.items.map((item) => ({ - id: item.update!._id as string, - success: !item.update!.error, + res.items + .filter((item) => item.update!.error) + .forEach((item) => { // @ts-expect-error it not assignable to ErrorCause - error: item.update!.error as Error, - })), - }; + errors[item.update!._id as string] = item.update!.error as Error; + }); } export async function deleteAgent(esClient: ElasticsearchClient, agentId: string) { diff --git a/x-pack/plugins/fleet/server/services/agents/reassign_action_runner.ts b/x-pack/plugins/fleet/server/services/agents/reassign_action_runner.ts index 96405e464b35..c15857bb4ae3 100644 --- a/x-pack/plugins/fleet/server/services/agents/reassign_action_runner.ts +++ b/x-pack/plugins/fleet/server/services/agents/reassign_action_runner.ts @@ -16,7 +16,7 @@ import { appContextService } from '../app_context'; import { ActionRunner } from './action_runner'; import { bulkUpdateAgents } from './crud'; -import { bulkCreateAgentActionResults, createAgentAction } from './actions'; +import { createErrorActionResults, createAgentAction } from './actions'; import { getHostedPolicies, isHostedAgent } from './hosted_agent'; import { BulkActionTaskType } from './bulk_actions_resolver'; @@ -72,7 +72,7 @@ export async function reassignBatch( throw new AgentReassignmentError('No agents to reassign, already assigned or hosted agents'); } - const res = await bulkUpdateAgents( + await bulkUpdateAgents( esClient, agentsToUpdate.map((agent) => ({ agentId: agent.id, @@ -80,18 +80,12 @@ export async function reassignBatch( policy_id: options.newAgentPolicyId, policy_revision: null, }, - })) + })), + errors ); - res.items - .filter((item) => !item.success) - .forEach((item) => { - errors[item.id] = item.error!; - }); - const actionId = options.actionId ?? uuid(); - const errorCount = Object.keys(errors).length; - const total = options.total ?? agentsToUpdate.length + errorCount; + const total = options.total ?? givenAgents.length; const now = new Date().toISOString(); await createAgentAction(esClient, { @@ -105,23 +99,12 @@ export async function reassignBatch( }, }); - if (errorCount > 0) { - appContextService - .getLogger() - .info( - `Skipping ${errorCount} agents, as failed validation (already assigned or assigned to hosted policy)` - ); - - // writing out error result for those agents that failed validation, so the action is not going to stay in progress forever - await bulkCreateAgentActionResults( - esClient, - Object.keys(errors).map((agentId) => ({ - agentId, - actionId, - error: errors[agentId].message, - })) - ); - } + await createErrorActionResults( + esClient, + actionId, + errors, + 'already assigned or assigned to hosted policy' + ); return { actionId }; } diff --git a/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts b/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts index 79612b0bcbf0..5beb5c0a9ac0 100644 --- a/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/unenroll.test.ts @@ -115,7 +115,7 @@ describe('unenrollAgents (plural)', () => { // calls ES update with correct values const onlyRegular = [agentInRegularDoc._id, agentInRegularDoc2._id]; - const calledWith = esClient.bulk.mock.calls[1][0]; + const calledWith = esClient.bulk.mock.calls[0][0]; const ids = (calledWith as estypes.BulkRequest)?.body ?.filter((i: any) => i.update !== undefined) .map((i: any) => i.update._id); @@ -128,7 +128,7 @@ describe('unenrollAgents (plural)', () => { } // hosted policy is updated in action results with error - const calledWithActionResults = esClient.bulk.mock.calls[0][0] as estypes.BulkRequest; + const calledWithActionResults = esClient.bulk.mock.calls[1][0] as estypes.BulkRequest; // bulk write two line per create expect(calledWithActionResults.body?.length).toBe(2); const expectedObject = expect.objectContaining({ @@ -170,7 +170,7 @@ describe('unenrollAgents (plural)', () => { }); expect(esClient.bulk.mock.calls.length).toEqual(3); - const bulkBody = (esClient.bulk.mock.calls[1][0] as estypes.BulkRequest)?.body?.[1] as any; + const bulkBody = (esClient.bulk.mock.calls[2][0] as estypes.BulkRequest)?.body?.[1] as any; expect(bulkBody.agent_id).toEqual(agentInRegularDoc._id); expect(bulkBody.action_id).toEqual('other-action'); }); @@ -227,7 +227,7 @@ describe('unenrollAgents (plural)', () => { // calls ES update with correct values const onlyRegular = [agentInRegularDoc._id, agentInRegularDoc2._id]; - const calledWith = esClient.bulk.mock.calls[2][0]; + const calledWith = esClient.bulk.mock.calls[0][0]; const ids = (calledWith as estypes.BulkRequest)?.body ?.filter((i: any) => i.update !== undefined) .map((i: any) => i.update._id); @@ -239,13 +239,13 @@ describe('unenrollAgents (plural)', () => { expect(doc).toHaveProperty('unenrolled_at'); } - const errorResults = esClient.bulk.mock.calls[1][0]; + const errorResults = esClient.bulk.mock.calls[2][0]; const errorIds = (errorResults as estypes.BulkRequest)?.body ?.filter((i: any) => i.agent_id) .map((i: any) => i.agent_id); expect(errorIds).toEqual([agentInHostedDoc._id]); - const actionResults = esClient.bulk.mock.calls[0][0]; + const actionResults = esClient.bulk.mock.calls[1][0]; const resultIds = (actionResults as estypes.BulkRequest)?.body ?.filter((i: any) => i.agent_id) .map((i: any) => i.agent_id); @@ -290,7 +290,7 @@ describe('unenrollAgents (plural)', () => { expect(unenrolledResponse.actionId).toBeDefined(); // calls ES update with correct values - const calledWith = esClient.bulk.mock.calls[1][0]; + const calledWith = esClient.bulk.mock.calls[0][0]; const ids = (calledWith as estypes.BulkRequest)?.body ?.filter((i: any) => i.update !== undefined) .map((i: any) => i.update._id); @@ -302,7 +302,7 @@ describe('unenrollAgents (plural)', () => { expect(doc).toHaveProperty('unenrolled_at'); } - const actionResults = esClient.bulk.mock.calls[0][0]; + const actionResults = esClient.bulk.mock.calls[1][0]; const resultIds = (actionResults as estypes.BulkRequest)?.body ?.filter((i: any) => i.agent_id) .map((i: any) => i.agent_id); diff --git a/x-pack/plugins/fleet/server/services/agents/unenroll_action_runner.ts b/x-pack/plugins/fleet/server/services/agents/unenroll_action_runner.ts index dd5b4e023c2a..c735254f1825 100644 --- a/x-pack/plugins/fleet/server/services/agents/unenroll_action_runner.ts +++ b/x-pack/plugins/fleet/server/services/agents/unenroll_action_runner.ts @@ -25,6 +25,7 @@ import { bulkUpdateAgents } from './crud'; import { bulkCreateAgentActionResults, createAgentAction, + createErrorActionResults, getUnenrollAgentActions, } from './actions'; import { getHostedPolicies, isHostedAgent } from './hosted_agent'; @@ -81,13 +82,24 @@ export async function unenrollBatch( return agents; }, []); + const now = new Date().toISOString(); + + // Update the necessary agents + const updateData = options.revoke + ? { unenrolled_at: now, active: false } + : { unenrollment_started_at: now }; + + await bulkUpdateAgents( + esClient, + agentsToUpdate.map(({ id }) => ({ agentId: id, data: updateData })), + outgoingErrors + ); + const actionId = options.actionId ?? uuid(); - const errorCount = Object.keys(outgoingErrors).length; const total = options.total ?? givenAgents.length; const agentIds = agentsToUpdate.map((agent) => agent.id); - const now = new Date().toISOString(); if (options.revoke) { // Get all API keys that need to be invalidated await invalidateAPIKeysForAgents(agentsToUpdate); @@ -104,32 +116,11 @@ export async function unenrollBatch( }); } - if (errorCount > 0) { - appContextService - .getLogger() - .info( - `Skipping ${errorCount} agents, as failed validation (cannot unenroll from a hosted policy or already unenrolled)` - ); - - // writing out error result for those agents that failed validation, so the action is not going to stay in progress forever - await bulkCreateAgentActionResults( - esClient, - Object.keys(outgoingErrors).map((agentId) => ({ - agentId, - actionId, - error: outgoingErrors[agentId].message, - })) - ); - } - - // Update the necessary agents - const updateData = options.revoke - ? { unenrolled_at: now, active: false } - : { unenrollment_started_at: now }; - - await bulkUpdateAgents( + await createErrorActionResults( esClient, - agentsToUpdate.map(({ id }) => ({ agentId: id, data: updateData })) + actionId, + outgoingErrors, + 'cannot unenroll from a hosted policy or already unenrolled' ); return { diff --git a/x-pack/plugins/fleet/server/services/agents/update_agent_tags_action_runner.ts b/x-pack/plugins/fleet/server/services/agents/update_agent_tags_action_runner.ts index 48f7b455d36b..11d42bc76e39 100644 --- a/x-pack/plugins/fleet/server/services/agents/update_agent_tags_action_runner.ts +++ b/x-pack/plugins/fleet/server/services/agents/update_agent_tags_action_runner.ts @@ -11,14 +11,16 @@ import { difference, uniq } from 'lodash'; import type { Agent } from '../../types'; -import { appContextService } from '../app_context'; - import { ActionRunner } from './action_runner'; import { bulkUpdateAgents } from './crud'; import { BulkActionTaskType } from './bulk_actions_resolver'; import { filterHostedPolicies } from './filter_hosted_agents'; -import { bulkCreateAgentActionResults, createAgentAction } from './actions'; +import { + createErrorActionResults, + bulkCreateAgentActionResults, + createAgentAction, +} from './actions'; export class UpdateAgentTagsActionRunner extends ActionRunner { protected async processAgents(agents: Agent[]): Promise<{ actionId: string }> { @@ -90,12 +92,12 @@ export async function updateTagsBatch( data: { tags: getNewTags(agent), }, - })) + })), + errors ); const actionId = options.actionId ?? uuid(); const total = options.total ?? givenAgents.length; - const errorCount = Object.keys(errors).length; // creating an action doc so that update tags shows up in activity await createAgentAction(esClient, { @@ -113,23 +115,12 @@ export async function updateTagsBatch( })) ); - if (errorCount > 0) { - appContextService - .getLogger() - .info( - `Skipping ${errorCount} agents, as failed validation (cannot modified tags on hosted agents)` - ); - - // writing out error result for those agents that failed validation, so the action is not going to stay in progress forever - await bulkCreateAgentActionResults( - esClient, - Object.keys(errors).map((agentId) => ({ - agentId, - actionId, - error: errors[agentId].message, - })) - ); - } + await createErrorActionResults( + esClient, + actionId, + errors, + 'cannot modified tags on hosted agents' + ); return { actionId }; } diff --git a/x-pack/plugins/fleet/server/services/agents/upgrade.test.ts b/x-pack/plugins/fleet/server/services/agents/upgrade.test.ts index db880f56ef47..8b888126ce11 100644 --- a/x-pack/plugins/fleet/server/services/agents/upgrade.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/upgrade.test.ts @@ -50,7 +50,7 @@ describe('sendUpgradeAgentsActions (plural)', () => { // calls ES update with correct values const onlyRegular = [agentInRegularDoc._id, agentInRegularDoc2._id]; - const calledWith = esClient.bulk.mock.calls[1][0]; + const calledWith = esClient.bulk.mock.calls[0][0]; const ids = (calledWith as estypes.BulkRequest)?.body ?.filter((i: any) => i.update !== undefined) .map((i: any) => i.update._id); @@ -64,7 +64,7 @@ describe('sendUpgradeAgentsActions (plural)', () => { } // hosted policy is updated in action results with error - const calledWithActionResults = esClient.bulk.mock.calls[0][0] as estypes.BulkRequest; + const calledWithActionResults = esClient.bulk.mock.calls[1][0] as estypes.BulkRequest; // bulk write two line per create expect(calledWithActionResults.body?.length).toBe(2); const expectedObject = expect.objectContaining({ diff --git a/x-pack/plugins/fleet/server/services/agents/upgrade_action_runner.ts b/x-pack/plugins/fleet/server/services/agents/upgrade_action_runner.ts index a34f189871a3..c6794de6e2dc 100644 --- a/x-pack/plugins/fleet/server/services/agents/upgrade_action_runner.ts +++ b/x-pack/plugins/fleet/server/services/agents/upgrade_action_runner.ts @@ -22,7 +22,7 @@ import { ActionRunner } from './action_runner'; import type { GetAgentsOptions } from './crud'; import { bulkUpdateAgents } from './crud'; -import { bulkCreateAgentActionResults, createAgentAction } from './actions'; +import { createErrorActionResults, createAgentAction } from './actions'; import { getHostedPolicies, isHostedAgent } from './hosted_agent'; import { BulkActionTaskType } from './bulk_actions_resolver'; @@ -108,9 +108,20 @@ export async function upgradeBatch( options.upgradeDurationSeconds ); + await bulkUpdateAgents( + esClient, + agentsToUpdate.map((agent) => ({ + agentId: agent.id, + data: { + upgraded_at: null, + upgrade_started_at: now, + }, + })), + errors + ); + const actionId = options.actionId ?? uuid(); - const errorCount = Object.keys(errors).length; - const total = options.total ?? agentsToUpdate.length + errorCount; + const total = options.total ?? givenAgents.length; await createAgentAction(esClient, { id: actionId, @@ -123,33 +134,11 @@ export async function upgradeBatch( ...rollingUpgradeOptions, }); - if (errorCount > 0) { - appContextService - .getLogger() - .info( - `Skipping ${errorCount} agents, as failed validation (cannot upgrade hosted agent or agent not upgradeable)` - ); - - // writing out error result for those agents that failed validation, so the action is not going to stay in progress forever - await bulkCreateAgentActionResults( - esClient, - Object.keys(errors).map((agentId) => ({ - agentId, - actionId, - error: errors[agentId].message, - })) - ); - } - - await bulkUpdateAgents( + await createErrorActionResults( esClient, - agentsToUpdate.map((agent) => ({ - agentId: agent.id, - data: { - upgraded_at: null, - upgrade_started_at: now, - }, - })) + actionId, + errors, + 'cannot upgrade hosted agent or agent not upgradeable' ); return { diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.test.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.test.ts index df1c87105bcf..bb2be99b868b 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.test.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.test.ts @@ -48,6 +48,11 @@ describe('buildDefaultSettings', () => { name: 'field5Wildcard', type: 'wildcard', }, + { + name: 'field6NotDefault', + type: 'keyword', + default_field: false, + }, ], }); diff --git a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.ts b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.ts index 5accf7b120f9..b15eb0111782 100644 --- a/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.ts +++ b/x-pack/plugins/fleet/server/services/epm/elasticsearch/template/default_settings.ts @@ -11,19 +11,20 @@ import type { Field, Fields } from '../../fields/field'; const QUERY_DEFAULT_FIELD_TYPES = ['keyword', 'text', 'match_only_text', 'wildcard']; const QUERY_DEFAULT_FIELD_LIMIT = 1024; -const flattenFieldsToNameAndType = ( +const flattenAndExtractFields = ( fields: Fields, path: string = '' -): Array> => { - let newFields: Array> = []; +): Array> => { + let newFields: Array> = []; fields.forEach((field) => { const fieldName = path ? `${path}.${field.name}` : field.name; newFields.push({ name: fieldName, type: field.type, + default_field: field.default_field, }); if (field.fields && field.fields.length) { - newFields = newFields.concat(flattenFieldsToNameAndType(field.fields, fieldName)); + newFields = newFields.concat(flattenAndExtractFields(field.fields, fieldName)); } }); return newFields; @@ -45,8 +46,9 @@ export function buildDefaultSettings({ const logger = appContextService.getLogger(); // Find all field names to set `index.query.default_field` to, which will be // the first 1024 keyword or text fields - const defaultFields = flattenFieldsToNameAndType(fields).filter( - (field) => field.type && QUERY_DEFAULT_FIELD_TYPES.includes(field.type) + const defaultFields = flattenAndExtractFields(fields).filter( + (field) => + field.type && QUERY_DEFAULT_FIELD_TYPES.includes(field.type) && field.default_field !== false ); if (defaultFields.length > QUERY_DEFAULT_FIELD_LIMIT) { logger.warn( diff --git a/x-pack/plugins/fleet/server/services/epm/fields/field.ts b/x-pack/plugins/fleet/server/services/epm/fields/field.ts index e970a2fea145..b8af56646389 100644 --- a/x-pack/plugins/fleet/server/services/epm/fields/field.ts +++ b/x-pack/plugins/fleet/server/services/epm/fields/field.ts @@ -37,6 +37,7 @@ export interface Field { include_in_root?: boolean; null_value?: string; dimension?: boolean; + default_field?: boolean; // Meta fields metric_type?: string; diff --git a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx index 8875d2d0f983..c381d519f366 100644 --- a/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx +++ b/x-pack/plugins/lens/public/app_plugin/lens_top_nav.tsx @@ -15,8 +15,8 @@ import { downloadMultipleAs } from '@kbn/share-plugin/public'; import { tableHasFormulas } from '@kbn/data-plugin/common'; import { exporters, getEsQueryConfig } from '@kbn/data-plugin/public'; import type { DataView } from '@kbn/data-views-plugin/public'; -import type { DataViewPickerProps } from '@kbn/unified-search-plugin/public'; import { useKibana } from '@kbn/kibana-react-plugin/public'; +import { DataViewPickerProps } from '@kbn/unified-search-plugin/public'; import { ENABLE_SQL } from '../../common'; import { LensAppServices, @@ -357,10 +357,14 @@ export const LensTopNavMenu = ({ ]); useEffect(() => { - if (indexPatterns.length > 0) { - setCurrentIndexPattern(indexPatterns[0]); + if (activeDatasourceId && datasourceStates[activeDatasourceId].state) { + const dataViewId = datasourceMap[activeDatasourceId].getUsedDataView( + datasourceStates[activeDatasourceId].state + ); + const dataView = dataViewsList.find((pattern) => pattern.id === dataViewId); + setCurrentIndexPattern(dataView ?? indexPatterns[0]); } - }, [indexPatterns]); + }, [activeDatasourceId, datasourceMap, datasourceStates, indexPatterns, dataViewsList]); useEffect(() => { const fetchDataViews = async () => { @@ -768,13 +772,15 @@ export const LensTopNavMenu = ({ closeDataViewEditor.current = dataViewEditor.openEditor({ onSave: async (dataView) => { if (dataView.id) { - dispatch( - switchAndCleanDatasource({ - newDatasourceId: 'indexpattern', - visualizationId: visualization?.activeId, - currentIndexPatternId: dataView?.id, - }) - ); + if (isOnTextBasedMode) { + dispatch( + switchAndCleanDatasource({ + newDatasourceId: 'indexpattern', + visualizationId: visualization?.activeId, + currentIndexPatternId: dataView?.id, + }) + ); + } dispatchChangeIndexPattern(dataView); setCurrentIndexPattern(dataView); } @@ -783,7 +789,43 @@ export const LensTopNavMenu = ({ }); } : undefined, - [canEditDataView, dataViewEditor, dispatch, dispatchChangeIndexPattern, visualization?.activeId] + [ + canEditDataView, + dataViewEditor, + dispatch, + dispatchChangeIndexPattern, + isOnTextBasedMode, + visualization?.activeId, + ] + ); + + const onCreateDefaultAdHocDataView = useCallback( + async (pattern: string) => { + const dataView = await dataViewsService.create({ + title: pattern, + }); + if (dataView.fields.getByName('@timestamp')?.type === 'date') { + dataView.timeFieldName = '@timestamp'; + } + if (isOnTextBasedMode) { + dispatch( + switchAndCleanDatasource({ + newDatasourceId: 'indexpattern', + visualizationId: visualization?.activeId, + currentIndexPatternId: dataView?.id, + }) + ); + } + dispatchChangeIndexPattern(dataView); + setCurrentIndexPattern(dataView); + }, + [ + dataViewsService, + dispatch, + dispatchChangeIndexPattern, + isOnTextBasedMode, + visualization?.activeId, + ] ); // setting that enables/disables SQL @@ -793,7 +835,7 @@ export const LensTopNavMenu = ({ supportedTextBasedLanguages.push('SQL'); } - const dataViewPickerProps = { + const dataViewPickerProps: DataViewPickerProps = { trigger: { label: currentIndexPattern?.getName?.() || '', 'data-test-subj': 'lns-dataView-switch-link', @@ -802,6 +844,7 @@ export const LensTopNavMenu = ({ currentDataViewId: currentIndexPattern?.id, onAddField: addField, onDataViewCreated: createNewDataView, + onCreateDefaultAdHocDataView, adHocDataViews: indexPatterns.filter((pattern) => !pattern.isPersisted()), onChangeDataView: (newIndexPatternId: string) => { const currentDataView = dataViewsList.find( diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/draggable_dimension_button.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/draggable_dimension_button.tsx index a118183c4906..6e3978a414ec 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/draggable_dimension_button.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/draggable_dimension_button.tsx @@ -6,6 +6,7 @@ */ import React, { useMemo, useCallback, useContext, ReactElement } from 'react'; +import { isDraggedField } from '../../../../utils'; import { DragDrop, DragDropIdentifier, DragContext } from '../../../../drag_drop'; import { Datasource, @@ -14,23 +15,20 @@ import { DropType, DatasourceLayers, IndexPatternMap, + DragDropOperation, + Visualization, } from '../../../../types'; import { getCustomDropTarget, getAdditionalClassesOnDroppable, getAdditionalClassesOnEnter, - getDropProps, } from './drop_targets_utils'; export function DraggableDimensionButton({ - layerId, - label, - accessorIndex, - groupIndex, - layerIndex, - columnId, + order, group, onDrop, + activeVisualization, onDragStart, onDragEnd, children, @@ -39,100 +37,82 @@ export function DraggableDimensionButton({ datasourceLayers, registerNewButtonRef, indexPatterns, + target, }: { - layerId: string; - groupIndex: number; - layerIndex: number; + target: DragDropOperation & { + id: string; + humanData: { + label: string; + groupLabel: string; + position: number; + layerNumber: number; + }; + }; + order: [2, number, number, number]; onDrop: (source: DragDropIdentifier, dropTarget: DragDropIdentifier, dropType?: DropType) => void; onDragStart: () => void; onDragEnd: () => void; + activeVisualization: Visualization; group: VisualizationDimensionGroupConfig; - label: string; children: ReactElement; layerDatasource?: Datasource; datasourceLayers: DatasourceLayers; state: unknown; - accessorIndex: number; - columnId: string; registerNewButtonRef: (id: string, instance: HTMLDivElement | null) => void; indexPatterns: IndexPatternMap; }) { const { dragging } = useContext(DragContext); - const sharedDatasource = - !isOperation(dragging) || - datasourceLayers?.[dragging.layerId]?.datasourceId === datasourceLayers?.[layerId]?.datasourceId - ? layerDatasource - : undefined; + let getDropProps; - const dropProps = getDropProps( - { - state, - source: dragging, - target: { - layerId, - columnId, - groupId: group.groupId, - filterOperations: group.filterOperations, - prioritizedOperation: group.prioritizedOperation, - }, - indexPatterns, - }, - sharedDatasource - ); + if (dragging) { + if (!layerDatasource) { + getDropProps = activeVisualization.getDropProps; + } else if ( + isDraggedField(dragging) || + (isOperation(dragging) && + layerDatasource && + datasourceLayers?.[dragging.layerId]?.datasourceId === + datasourceLayers?.[target.layerId]?.datasourceId) + ) { + getDropProps = layerDatasource.getDropProps; + } + } + + const { dropTypes, nextLabel } = getDropProps?.({ + state, + source: dragging, + target, + indexPatterns, + }) || { dropTypes: [], nextLabel: '' }; - const dropTypes = dropProps?.dropTypes; - const nextLabel = dropProps?.nextLabel; const canDuplicate = !!( - dropTypes && - (dropTypes.includes('replace_duplicate_incompatible') || - dropTypes.includes('replace_duplicate_compatible')) + dropTypes.includes('replace_duplicate_incompatible') || + dropTypes.includes('replace_duplicate_compatible') ); const canSwap = !!( - dropTypes && - (dropTypes.includes('swap_incompatible') || dropTypes.includes('swap_compatible')) + dropTypes.includes('swap_incompatible') || dropTypes.includes('swap_compatible') ); const canCombine = Boolean( - dropTypes && - (dropTypes.includes('combine_compatible') || - dropTypes.includes('field_combine') || - dropTypes.includes('combine_incompatible')) + dropTypes.includes('combine_compatible') || + dropTypes.includes('field_combine') || + dropTypes.includes('combine_incompatible') ); const value = useMemo( () => ({ - columnId, - groupId: group.groupId, - layerId, - id: columnId, - filterOperations: group.filterOperations, + ...target, humanData: { + ...target.humanData, canSwap, canDuplicate, canCombine, - label, - groupLabel: group.groupLabel, - position: accessorIndex + 1, nextLabel: nextLabel || '', - layerNumber: layerIndex + 1, }, }), - [ - columnId, - group.groupId, - accessorIndex, - layerId, - label, - group.groupLabel, - nextLabel, - group.filterOperations, - canDuplicate, - canSwap, - canCombine, - layerIndex, - ] + [target, nextLabel, canDuplicate, canSwap, canCombine] ); const reorderableGroup = useMemo( @@ -144,8 +124,8 @@ export function DraggableDimensionButton({ ); const registerNewButtonRefMemoized = useCallback( - (el) => registerNewButtonRef(columnId, el), - [registerNewButtonRef, columnId] + (el) => registerNewButtonRef(target.columnId, el), + [registerNewButtonRef, target.columnId] ); const handleOnDrop = useCallback( @@ -162,7 +142,7 @@ export function DraggableDimensionButton({ getCustomDropTarget={getCustomDropTarget} getAdditionalClassesOnEnter={getAdditionalClassesOnEnter} getAdditionalClassesOnDroppable={getAdditionalClassesOnDroppable} - order={[2, layerIndex, groupIndex, accessorIndex]} + order={order} draggable dragType={isOperation(dragging) ? 'move' : 'copy'} dropTypes={dropTypes} diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils.test.tsx deleted file mode 100644 index 17907ac19c4b..000000000000 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils.test.tsx +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { getDropProps } from './drop_targets_utils'; -import { createMockDatasource } from '../../../../mocks'; - -describe('getDropProps', () => { - it('should run datasource getDropProps if exists', () => { - const mockDatasource = createMockDatasource('testDatasource'); - getDropProps( - { - state: 'datasourceState', - target: { - columnId: 'col1', - groupId: 'x', - layerId: 'first', - filterOperations: () => true, - }, - source: { - columnId: 'col1', - groupId: 'x', - layerId: 'first', - id: 'annotationColumn2', - humanData: { label: 'Event' }, - }, - indexPatterns: {}, - }, - mockDatasource - ); - expect(mockDatasource.getDropProps).toHaveBeenCalled(); - }); - describe('no datasource', () => { - it('returns reorder for the same group existing columns', () => { - expect( - getDropProps({ - state: 'datasourceState', - target: { - columnId: 'annotationColumn', - groupId: 'xAnnotations', - layerId: 'second', - filterOperations: () => true, - }, - source: { - columnId: 'annotationColumn2', - groupId: 'xAnnotations', - layerId: 'second', - id: 'annotationColumn2', - humanData: { label: 'Event' }, - }, - indexPatterns: {}, - }) - ).toEqual({ dropTypes: ['reorder'] }); - }); - it('returns duplicate for the same group existing column and not existing column', () => { - expect( - getDropProps({ - state: 'datasourceState', - target: { - columnId: 'annotationColumn', - groupId: 'xAnnotations', - layerId: 'second', - isNewColumn: true, - filterOperations: () => true, - }, - source: { - columnId: 'annotationColumn2', - groupId: 'xAnnotations', - layerId: 'second', - id: 'annotationColumn2', - humanData: { label: 'Event' }, - }, - indexPatterns: {}, - }) - ).toEqual({ dropTypes: ['duplicate_compatible'] }); - }); - it('returns replace_duplicate and replace for replacing to different layer', () => { - expect( - getDropProps({ - state: 'datasourceState', - target: { - columnId: 'annotationColumn', - groupId: 'xAnnotations', - layerId: 'first', - filterOperations: () => true, - }, - source: { - columnId: 'annotationColumn2', - groupId: 'xAnnotations', - layerId: 'second', - id: 'annotationColumn2', - humanData: { label: 'Event' }, - }, - indexPatterns: {}, - }) - ).toEqual({ - dropTypes: ['replace_compatible', 'replace_duplicate_compatible', 'swap_compatible'], - }); - }); - it('returns duplicate and move for replacing to different layer for empty column', () => { - expect( - getDropProps({ - state: 'datasourceState', - target: { - columnId: 'annotationColumn', - groupId: 'xAnnotations', - layerId: 'first', - isNewColumn: true, - filterOperations: () => true, - }, - source: { - columnId: 'annotationColumn2', - groupId: 'xAnnotations', - layerId: 'second', - id: 'annotationColumn2', - humanData: { label: 'Event' }, - }, - indexPatterns: {}, - }) - ).toEqual({ - dropTypes: ['move_compatible', 'duplicate_compatible'], - }); - }); - }); -}); diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils.tsx index 5f3fd2d4a73b..3094a07cf329 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils.tsx @@ -9,12 +9,10 @@ import React from 'react'; import classNames from 'classnames'; import { EuiIcon, EuiFlexItem, EuiFlexGroup, EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { DragDropIdentifier, DraggingIdentifier } from '../../../../drag_drop'; +import { DragDropIdentifier } from '../../../../drag_drop'; import { - Datasource, DropType, FramePublicAPI, - GetDropPropsArgs, isOperation, Visualization, DragDropOperation, @@ -140,53 +138,6 @@ export const getAdditionalClassesOnDroppable = (dropType?: string) => { } }; -const isOperationFromCompatibleGroup = (op1?: DraggingIdentifier, op2?: DragDropOperation) => { - return ( - isOperation(op1) && - isOperation(op2) && - op1.columnId !== op2.columnId && - op1.groupId === op2.groupId && - op1.layerId !== op2.layerId - ); -}; - -export const isOperationFromTheSameGroup = (op1?: DraggingIdentifier, op2?: DragDropOperation) => { - return ( - isOperation(op1) && - isOperation(op2) && - op1.columnId !== op2.columnId && - op1.groupId === op2.groupId && - op1.layerId === op2.layerId - ); -}; - -export function getDropPropsForSameGroup( - isNewColumn?: boolean -): { dropTypes: DropType[]; nextLabel?: string } | undefined { - return !isNewColumn ? { dropTypes: ['reorder'] } : { dropTypes: ['duplicate_compatible'] }; -} - -export const getDropProps = ( - dropProps: GetDropPropsArgs, - sharedDatasource?: Datasource -): { dropTypes: DropType[]; nextLabel?: string } | undefined => { - if (sharedDatasource) { - return sharedDatasource?.getDropProps(dropProps); - } else { - if (isOperationFromTheSameGroup(dropProps.source, dropProps.target)) { - return getDropPropsForSameGroup(dropProps.target.isNewColumn); - } - if (isOperationFromCompatibleGroup(dropProps.source, dropProps.target)) { - return { - dropTypes: dropProps.target.isNewColumn - ? ['move_compatible', 'duplicate_compatible'] - : ['replace_compatible', 'replace_duplicate_compatible', 'swap_compatible'], - }; - } - } - return; -}; - export interface OnVisDropProps { prevState: T; target: DragDropOperation; @@ -215,7 +166,6 @@ export function onDropForVisualization( frame, }); - // remove source if ( isOperation(source) && (dropType === 'move_compatible' || diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/empty_dimension_button.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/empty_dimension_button.tsx index b6d7e58b0f7e..8b1fe4082b31 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/empty_dimension_button.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/empty_dimension_button.tsx @@ -9,6 +9,7 @@ import React, { useMemo, useState, useEffect, useContext } from 'react'; import { EuiButtonEmpty } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; +import { isDraggedField } from '../../../../utils'; import { generateId } from '../../../../id_generator'; import { DragDrop, DragDropIdentifier, DragContext } from '../../../../drag_drop'; @@ -19,16 +20,10 @@ import { DatasourceLayers, isOperation, IndexPatternMap, + DragDropOperation, + Visualization, } from '../../../../types'; -import { - getCustomDropTarget, - getAdditionalClassesOnDroppable, - getDropProps, -} from './drop_targets_utils'; - -const label = i18n.translate('xpack.lens.indexPattern.emptyDimensionButton', { - defaultMessage: 'Empty dimension', -}); +import { getCustomDropTarget, getAdditionalClassesOnDroppable } from './drop_targets_utils'; interface EmptyButtonProps { columnId: string; @@ -106,91 +101,81 @@ export function EmptyDimensionButton({ group, layerDatasource, state, - layerId, - groupIndex, - layerIndex, onClick, onDrop, datasourceLayers, indexPatterns, + activeVisualization, + order, + target, }: { - layerId: string; - groupIndex: number; - layerIndex: number; - onDrop: (source: DragDropIdentifier, dropTarget: DragDropIdentifier, dropType?: DropType) => void; - onClick: (id: string) => void; + order: [2, number, number, number]; group: VisualizationDimensionGroupConfig; layerDatasource?: Datasource; datasourceLayers: DatasourceLayers; state: unknown; + onDrop: (source: DragDropIdentifier, dropTarget: DragDropIdentifier, dropType?: DropType) => void; + onClick: (id: string) => void; indexPatterns: IndexPatternMap; + activeVisualization: Visualization; + target: Omit & { + humanData: { + groupLabel: string; + position: number; + layerNumber: number; + label: string; + }; + }; }) { const { dragging } = useContext(DragContext); - const sharedDatasource = - !isOperation(dragging) || - datasourceLayers?.[dragging.layerId]?.datasourceId === datasourceLayers?.[layerId]?.datasourceId - ? layerDatasource - : undefined; - const itemIndex = group.accessors.length; + let getDropProps; + + if (dragging) { + if (!layerDatasource) { + getDropProps = activeVisualization.getDropProps; + } else if ( + isDraggedField(dragging) || + (isOperation(dragging) && + layerDatasource && + datasourceLayers?.[dragging.layerId]?.datasourceId === + datasourceLayers?.[target.layerId]?.datasourceId) + ) { + getDropProps = layerDatasource.getDropProps; + } + } const [newColumnId, setNewColumnId] = useState(generateId()); useEffect(() => { setNewColumnId(generateId()); - }, [itemIndex]); - - const dropProps = getDropProps( - { - state, - source: dragging, - target: { - layerId, - columnId: newColumnId, - groupId: group.groupId, - filterOperations: group.filterOperations, - prioritizedOperation: group.prioritizedOperation, - isNewColumn: true, - }, - indexPatterns, - }, - sharedDatasource - ); + }, [group.accessors.length]); - const dropTypes = dropProps?.dropTypes; - const nextLabel = dropProps?.nextLabel; + const { dropTypes, nextLabel } = getDropProps?.({ + state, + source: dragging, + target: { + ...target, + columnId: newColumnId, + }, + indexPatterns, + }) || { dropTypes: [], nextLabel: '' }; const canDuplicate = !!( - dropTypes && - (dropTypes.includes('duplicate_compatible') || dropTypes.includes('duplicate_incompatible')) + dropTypes.includes('duplicate_compatible') || dropTypes.includes('duplicate_incompatible') ); const value = useMemo( () => ({ + ...target, columnId: newColumnId, - groupId: group.groupId, - layerId, - filterOperations: group.filterOperations, id: newColumnId, humanData: { - label, - groupLabel: group.groupLabel, - position: itemIndex + 1, + ...target.humanData, nextLabel: nextLabel || '', canDuplicate, - layerNumber: layerIndex + 1, }, }), - [ - newColumnId, - group.groupId, - layerId, - group.groupLabel, - group.filterOperations, - itemIndex, - nextLabel, - canDuplicate, - layerIndex, - ] + [newColumnId, target, nextLabel, canDuplicate] ); const handleOnDrop = React.useCallback( @@ -209,7 +194,7 @@ export function EmptyDimensionButton({ layerDatasource.getUsedDataView(layerDatasourceState, layer)), - defaultDataView: layerDatasource.getCurrentIndexPatternId(layerDatasourceState), + defaultDataView: layerDatasource.getUsedDataView(layerDatasourceState), } as ActionExecutionContext); } diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/clone_layer_action.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/clone_layer_action.tsx index 26d4c1f04f41..97d0cf73b80d 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/clone_layer_action.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/clone_layer_action.tsx @@ -6,8 +6,8 @@ */ import { i18n } from '@kbn/i18n'; -import { Visualization } from '../../../..'; -import { LayerAction } from './types'; +import type { LayerAction } from '../../../../types'; +import type { Visualization } from '../../../..'; interface CloneLayerAction { execute: () => void; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/layer_actions.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/layer_actions.tsx index b9ca695882ef..bc1c41caa650 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/layer_actions.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/layer_actions.tsx @@ -5,9 +5,8 @@ * 2.0. */ -import React, { useState, useCallback, useMemo } from 'react'; +import React, { useState, useCallback } from 'react'; import { i18n } from '@kbn/i18n'; -import type { CoreStart } from '@kbn/core/public'; import { EuiButtonIcon, EuiContextMenuPanel, @@ -18,13 +17,28 @@ import { EuiText, EuiOutsideClickDetector, } from '@elastic/eui'; -import type { LayerType, Visualization } from '../../../..'; -import type { LayerAction } from './types'; - +import type { CoreStart } from '@kbn/core/public'; +import type { LayerType } from '../../../..'; +import type { LayerAction, Visualization } from '../../../../types'; import { getCloneLayerAction } from './clone_layer_action'; import { getRemoveLayerAction } from './remove_layer_action'; export interface LayerActionsProps { + layerIndex: number; + actions: LayerAction[]; +} + +/** @internal **/ +export const getSharedActions = ({ + core, + layerIndex, + layerType, + activeVisualization, + isOnlyLayer, + isTextBasedLanguage, + onCloneLayer, + onRemoveLayer, +}: { onRemoveLayer: () => void; onCloneLayer: () => void; layerIndex: number; @@ -33,14 +47,25 @@ export interface LayerActionsProps { layerType?: LayerType; isTextBasedLanguage?: boolean; core: Pick; -} +}) => [ + getCloneLayerAction({ + execute: onCloneLayer, + layerIndex, + activeVisualization, + isTextBasedLanguage, + }), + getRemoveLayerAction({ + execute: onRemoveLayer, + layerIndex, + activeVisualization, + layerType, + isOnlyLayer, + core, + }), +]; /** @internal **/ -const InContextMenuActions = ( - props: LayerActionsProps & { - actions: LayerAction[]; - } -) => { +const InContextMenuActions = (props: LayerActionsProps) => { const dataTestSubject = `lnsLayerSplitButton--${props.layerIndex}`; const [isPopoverOpen, setPopover] = useState(false); const splitButtonPopoverId = useGeneratedHtmlId({ @@ -105,47 +130,24 @@ const InContextMenuActions = ( }; export const LayerActions = (props: LayerActionsProps) => { - const compatibleActions = useMemo( - () => - [ - getCloneLayerAction({ - execute: props.onCloneLayer, - layerIndex: props.layerIndex, - activeVisualization: props.activeVisualization, - isTextBasedLanguage: props.isTextBasedLanguage, - }), - getRemoveLayerAction({ - execute: props.onRemoveLayer, - layerIndex: props.layerIndex, - activeVisualization: props.activeVisualization, - layerType: props.layerType, - isOnlyLayer: props.isOnlyLayer, - core: props.core, - }), - ].filter((i) => i.isCompatible), - [props] - ); - - if (!compatibleActions.length) { + if (!props.actions.length) { return null; } - if (compatibleActions.length > 1) { - return ; - } else { - const [{ displayName, execute, icon, color, 'data-test-subj': dataTestSubj }] = - compatibleActions; - - return ( - - ); + if (props.actions.length > 1) { + return ; } + const [{ displayName, execute, icon, color, 'data-test-subj': dataTestSubj }] = props.actions; + + return ( + + ); }; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/remove_layer_action.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/remove_layer_action.tsx index 32a18d153569..58a4248b5185 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/remove_layer_action.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/remove_layer_action.tsx @@ -22,10 +22,9 @@ import { import { i18n } from '@kbn/i18n'; import { toMountPoint } from '@kbn/kibana-react-plugin/public'; import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { LayerAction } from './types'; -import { Visualization } from '../../../../types'; +import type { LayerAction, Visualization } from '../../../../types'; import { LOCAL_STORAGE_LENS_KEY } from '../../../../settings_storage'; -import { LayerType, layerTypes } from '../../../..'; +import { type LayerType, layerTypes } from '../../../..'; interface RemoveLayerAction { execute: () => void; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/types.ts b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/types.ts deleted file mode 100644 index 4614874777cc..000000000000 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_actions/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import type { IconType, EuiButtonIconColor } from '@elastic/eui'; - -/** @internal **/ -export interface LayerAction { - displayName: string; - execute: () => void | Promise; - icon: IconType; - color?: EuiButtonIconColor; - isCompatible: boolean; - 'data-test-subj'?: string; -} diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.tsx index cc748df7c3ec..3d1068ebd521 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.tsx @@ -43,6 +43,7 @@ import { selectDatasourceStates, } from '../../../state_management'; import { onDropForVisualization } from './buttons/drop_targets_utils'; +import { getSharedActions } from './layer_actions/layer_actions'; const initialActiveDimensionState = { isNew: false, @@ -310,6 +311,39 @@ export function LayerPanel( const [datasource] = Object.values(framePublicAPI.datasourceLayers); const isTextBasedLanguage = Boolean(datasource?.isTextBasedLanguage()); + const compatibleActions = useMemo( + () => + [ + ...(activeVisualization.getSupportedActionsForLayer?.( + layerId, + visualizationState, + updateVisualization + ) || []), + ...getSharedActions({ + activeVisualization, + core, + layerIndex, + layerType: activeVisualization.getLayerType(layerId, visualizationState), + isOnlyLayer, + isTextBasedLanguage, + onCloneLayer, + onRemoveLayer, + }), + ].filter((i) => i.isCompatible), + [ + activeVisualization, + core, + isOnlyLayer, + isTextBasedLanguage, + layerId, + layerIndex, + onCloneLayer, + onRemoveLayer, + updateVisualization, + visualizationState, + ] + ); + return ( <>
@@ -332,16 +366,7 @@ export function LayerPanel( /> - + {(layerDatasource || activeVisualization.renderLayerPanel) && } @@ -458,18 +483,34 @@ export function LayerPanel( const { columnId } = accessorConfig; return ( setHideTooltip(true)} onDragEnd={() => setHideTooltip(false)} onDrop={onDrop} @@ -567,10 +608,27 @@ export function LayerPanel( {group.supportsMoreColumns ? ( s.datasourceId === 'textBasedLanguages'); + } + } if (suggestions.length) { return suggestions.find((s) => s.visualizationId === activeVisualization?.id) || suggestions[0]; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.ts b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.ts index c311c2d4e9f2..a1f16006fd80 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/get_drop_props.ts @@ -18,16 +18,13 @@ import { getOperationDisplay, hasOperationSupportForMultipleFields, } from '../../operations'; -import { hasField, isDraggedField } from '../../pure_utils'; +import { isDraggedDataViewField, isOperationFromTheSameGroup } from '../../../utils'; +import { hasField } from '../../pure_utils'; import { DragContextState } from '../../../drag_drop/providers'; -import { OperationMetadata } from '../../../types'; +import { OperationMetadata, DraggedField } from '../../../types'; import { getOperationTypesForField } from '../../operations'; import { GenericIndexPatternColumn } from '../../indexpattern'; -import { IndexPatternPrivateState, DraggedField, DataViewDragDropOperation } from '../../types'; -import { - getDropPropsForSameGroup, - isOperationFromTheSameGroup, -} from '../../../editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils'; +import { IndexPatternPrivateState, DataViewDragDropOperation } from '../../types'; interface GetDropPropsArgs { state: IndexPatternPrivateState; @@ -72,7 +69,9 @@ export function getField(column: GenericIndexPatternColumn | undefined, dataView return field; } -export function getDropProps(props: GetDropPropsArgs) { +export function getDropProps( + props: GetDropPropsArgs +): { dropTypes: DropType[]; nextLabel?: string } | undefined { const { state, source, target, indexPatterns } = props; if (!source) { return; @@ -83,7 +82,7 @@ export function getDropProps(props: GetDropPropsArgs) { dataView: indexPatterns[state.layers[target.layerId].indexPatternId], }; - if (isDraggedField(source)) { + if (isDraggedDataViewField(source)) { return getDropPropsForField({ ...props, source, target: targetProps }); } @@ -98,7 +97,9 @@ export function getDropProps(props: GetDropPropsArgs) { } if (target.columnId !== source.columnId && targetProps.dataView === sourceProps.dataView) { if (isOperationFromTheSameGroup(source, target)) { - return getDropPropsForSameGroup(!targetProps.column); + return !targetProps.column + ? { dropTypes: ['duplicate_compatible'] } + : { dropTypes: ['reorder'] }; } if (targetProps.filterOperations?.(sourceProps?.column)) { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/mocks.ts b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/mocks.ts index 45987bb26cbb..93b63071d664 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/mocks.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/mocks.ts @@ -241,6 +241,7 @@ export const mockedDndOperations = { columnId: 'col1', id: 'col1', humanData: { label: 'Column 1' }, + indexPatternId: 'first', }, metric: { layerId: 'first', @@ -249,6 +250,7 @@ export const mockedDndOperations = { filterOperations: (op: OperationMetadata) => !op.isBucketed, id: 'col1', humanData: { label: 'Column 1' }, + indexPatternId: 'first', }, numericalOnly: { layerId: 'first', @@ -257,6 +259,7 @@ export const mockedDndOperations = { filterOperations: (op: OperationMetadata) => op.dataType === 'number', id: 'col1', humanData: { label: 'Column 1' }, + indexPatternId: 'first', }, bucket: { columnId: 'col2', @@ -265,6 +268,7 @@ export const mockedDndOperations = { id: 'col2', humanData: { label: 'Column 2' }, filterOperations: (op: OperationMetadata) => op.isBucketed, + indexPatternId: 'first', }, staticValue: { columnId: 'col1', @@ -273,6 +277,7 @@ export const mockedDndOperations = { id: 'col1', humanData: { label: 'Column 2' }, filterOperations: (op: OperationMetadata) => !!op.isStaticValue, + indexPatternId: 'first', }, bucket2: { columnId: 'col3', @@ -282,6 +287,7 @@ export const mockedDndOperations = { humanData: { label: '', }, + indexPatternId: 'first', }, metricC: { columnId: 'col4', @@ -292,5 +298,6 @@ export const mockedDndOperations = { label: '', }, filterOperations: (op: OperationMetadata) => !op.isBucketed, + indexPatternId: 'first', }, }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.test.ts b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.test.ts index 6156be357003..3b468181db6d 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.test.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.test.ts @@ -1562,12 +1562,14 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { groupId: 'x', layerId: 'first', filterOperations: (op: OperationMetadata) => op.isBucketed, + indexPatternId: 'indexPattern1', }, target: { filterOperations: (op: OperationMetadata) => op.isBucketed, columnId: 'newCol', groupId: 'x', layerId: 'second', + indexPatternId: 'indexPattern1', }, dimensionGroups: defaultDimensionGroups, dropType: 'move_compatible', @@ -2161,6 +2163,7 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { groupId: 'y', layerId: 'second', filterOperations: (op) => !op.isBucketed, + indexPatternId: 'test', }, }; @@ -2224,6 +2227,7 @@ describe('IndexPatternDimensionEditorPanel: onDrop', () => { groupId: 'y', layerId: 'second', filterOperations: (op) => !op.isBucketed, + indexPatternId: 'test', }, }) ).toEqual(true); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts index 8ea027a3da98..232c96610f04 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/droppable/on_drop_handler.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { isDraggedDataViewField } from '../../../utils'; import { DatasourceDimensionDropHandlerProps, DragDropOperation, @@ -12,6 +13,7 @@ import { isOperation, StateSetter, VisualizationDimensionGroupConfig, + DraggedField, } from '../../../types'; import { insertOrReplaceColumn, @@ -25,9 +27,8 @@ import { deleteColumnInLayers, } from '../../operations'; import { mergeLayer, mergeLayers } from '../../state_helpers'; -import { isDraggedField } from '../../pure_utils'; import { getNewOperation, getField } from './get_drop_props'; -import { IndexPatternPrivateState, DraggedField, DataViewDragDropOperation } from '../../types'; +import { IndexPatternPrivateState, DataViewDragDropOperation } from '../../types'; interface DropHandlerProps { state: IndexPatternPrivateState; @@ -48,7 +49,7 @@ interface DropHandlerProps { export function onDrop(props: DatasourceDimensionDropHandlerProps) { const { target, source, dropType, state, indexPatterns } = props; - if (isDraggedField(source) && isFieldDropType(dropType)) { + if (isDraggedDataViewField(source) && isFieldDropType(dropType)) { return onFieldDrop( { ...props, @@ -142,7 +143,7 @@ function onFieldDrop(props: DropHandlerProps, shouldAddField?: boo ); if ( - !isDraggedField(source) || + !isDraggedDataViewField(source) || !newOperation || (shouldAddField && !hasOperationSupportForMultipleFields(indexPattern, targetColumn, undefined, source.field)) diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx index 2404d53b8f02..64de29b0691c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx @@ -9,9 +9,11 @@ import React, { ReactElement } from 'react'; import { ReactWrapper } from 'enzyme'; import { act } from 'react-dom/test-utils'; import { EuiLoadingSpinner, EuiPopover } from '@elastic/eui'; +import type { DiscoverStart } from '@kbn/discover-plugin/public'; import { InnerFieldItem, FieldItemProps } from './field_item'; import { coreMock } from '@kbn/core/public/mocks'; import { mountWithIntl } from '@kbn/test-jest-helpers'; +import { findTestSubject } from '@elastic/eui/lib/test'; import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; import { IndexPattern } from '../types'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; @@ -47,6 +49,16 @@ const mockedServices = { fieldFormats: fieldFormatsServiceMock.createStartContract(), charts: chartPluginMock.createSetupContract(), uiSettings: coreMock.createStart().uiSettings, + discover: { + locator: { + getRedirectUrl: jest.fn(() => 'discover_url'), + }, + } as unknown as DiscoverStart, + application: { + capabilities: { + discover: { save: true, saveQuery: true, show: true }, + }, + }, }; const InnerFieldItemWrapper: React.FC = (props) => { @@ -414,4 +426,69 @@ describe('IndexPattern Field Item', () => { expect(wrapper.find(EuiLoadingSpinner)).toHaveLength(0); expect(wrapper.find(FieldStats).text()).toBe('Analysis is not available for this field.'); }); + + it('should display Explore in discover button', async () => { + const wrapper = await mountWithIntl(); + + await clickField(wrapper, 'bytes'); + + await wrapper.update(); + + const exploreInDiscoverBtn = findTestSubject( + wrapper, + 'lnsFieldListPanel-exploreInDiscover-bytes' + ); + expect(exploreInDiscoverBtn.length).toBe(1); + }); + + it('should not display Explore in discover button for a geo_point field', async () => { + const wrapper = await mountWithIntl( + + ); + + await clickField(wrapper, 'geo_point'); + + await wrapper.update(); + + const exploreInDiscoverBtn = findTestSubject( + wrapper, + 'lnsFieldListPanel-exploreInDiscover-geo_point' + ); + expect(exploreInDiscoverBtn.length).toBe(0); + }); + + it('should not display Explore in discover button if discover capabilities show is false', async () => { + const services = { + ...mockedServices, + application: { + capabilities: { + discover: { save: false, saveQuery: false, show: false }, + }, + }, + }; + const wrapper = await mountWithIntl( + + + + ); + + await clickField(wrapper, 'bytes'); + + await wrapper.update(); + + const exploreInDiscoverBtn = findTestSubject( + wrapper, + 'lnsFieldListPanel-exploreInDiscover-bytes' + ); + expect(exploreInDiscoverBtn.length).toBe(0); + }); }); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx index 29f666a4ff6e..6434af979028 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx @@ -19,6 +19,7 @@ import { EuiText, EuiTitle, EuiToolTip, + EuiButton, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { useKibana } from '@kbn/kibana-react-plugin/public'; @@ -30,17 +31,17 @@ import { DataViewField } from '@kbn/data-views-plugin/common'; import { ChartsPluginSetup } from '@kbn/charts-plugin/public'; import { UiActionsStart } from '@kbn/ui-actions-plugin/public'; import { AddFieldFilterHandler, FieldStats } from '@kbn/unified-field-list-plugin/public'; -import { generateFilters } from '@kbn/data-plugin/public'; +import { generateFilters, getEsQueryConfig } from '@kbn/data-plugin/public'; import { DragDrop, DragDropIdentifier } from '../drag_drop'; -import { DatasourceDataPanelProps, DataType } from '../types'; +import { DatasourceDataPanelProps, DataType, DraggedField } from '../types'; import { DOCUMENT_FIELD_NAME } from '../../common'; import type { IndexPattern, IndexPatternField } from '../types'; -import type { DraggedField } from './types'; import { LensFieldIcon } from '../shared_components/field_picker/lens_field_icon'; import { VisualizeGeoFieldButton } from './visualize_geo_field_button'; import type { LensAppServices } from '../app_plugin/types'; import { debouncedComponent } from '../debounced_component'; import { getFieldType } from './pure_utils'; +import { combineQueryAndFilters } from '../app_plugin/show_underlying_data'; export interface FieldItemProps { core: DatasourceDataPanelProps['core']; @@ -347,6 +348,40 @@ function FieldItemPopoverContents(props: FieldItemProps) { /> ); + const exploreInDiscover = useMemo(() => { + const meta = { + id: indexPattern.id, + columns: [field.name], + filters: { + enabled: { + lucene: [], + kuery: [], + }, + disabled: { + lucene: [], + kuery: [], + }, + }, + }; + const { filters: newFilters, query: newQuery } = combineQueryAndFilters( + query, + filters, + meta, + [indexPattern], + getEsQueryConfig(services.uiSettings) + ); + if (!services.discover || !services.application.capabilities.discover.show) { + return; + } + return services.discover.locator!.getRedirectUrl({ + dataViewSpec: indexPattern?.spec, + timeRange: services.data.query.timefilter.timefilter.getTime(), + filters: newFilters, + query: newQuery, + columns: meta.columns, + }); + }, [field.name, filters, indexPattern, query, services]); + if (hideDetails) { return panelHeader; } @@ -404,6 +439,21 @@ function FieldItemPopoverContents(props: FieldItemProps) { return params.element; }} /> + {exploreInDiscover && field.type !== 'geo_point' && field.type !== 'geo_shape' && ( + + + {i18n.translate('xpack.lens.indexPattern.fieldExploreInDiscover', { + defaultMessage: 'Explore values in Discover', + })} + + + )} ); } diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/index.ts b/x-pack/plugins/lens/public/indexpattern_datasource/index.ts index 4bf33013b328..6b1b052c90b1 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/index.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/index.ts @@ -8,6 +8,7 @@ import type { CoreSetup } from '@kbn/core/public'; import { createStartServicesGetter, Storage } from '@kbn/kibana-utils-plugin/public'; import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import type { DiscoverStart } from '@kbn/discover-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { ExpressionsSetup } from '@kbn/expressions-plugin/public'; import type { ChartsPluginSetup } from '@kbn/charts-plugin/public'; @@ -30,6 +31,7 @@ export interface IndexPatternDatasourceSetupPlugins { export interface IndexPatternDatasourceStartPlugins { data: DataPublicPluginStart; unifiedSearch: UnifiedSearchPublicPluginStart; + discover?: DiscoverStart; fieldFormats: FieldFormatsStart; dataViewFieldEditor: IndexPatternFieldEditorStart; dataViews: DataViewsPublicPluginStart; @@ -62,7 +64,7 @@ export class IndexPatternDatasource { const [ coreStart, - { dataViewFieldEditor, uiActions, data, fieldFormats, dataViews, unifiedSearch }, + { dataViewFieldEditor, uiActions, data, fieldFormats, dataViews, unifiedSearch, discover }, ] = await core.getStartServices(); return getIndexPatternDatasource({ @@ -71,6 +73,7 @@ export class IndexPatternDatasource { storage: new Storage(localStorage), data, unifiedSearch, + discover, dataViews, charts, dataViewFieldEditor, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx index 20d0df1358be..fb31c3c1a9a7 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern.tsx @@ -11,6 +11,7 @@ import { I18nProvider } from '@kbn/i18n-react'; import type { CoreStart, SavedObjectReference } from '@kbn/core/public'; import { i18n } from '@kbn/i18n'; import { TimeRange } from '@kbn/es-query'; +import type { DiscoverStart } from '@kbn/discover-plugin/public'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import { flatten, isEqual } from 'lodash'; @@ -68,7 +69,8 @@ import { isColumnInvalid, cloneLayer, } from './utils'; -import { normalizeOperationDataType, isDraggedField } from './pure_utils'; +import { isDraggedDataViewField } from '../utils'; +import { normalizeOperationDataType } from './pure_utils'; import { LayerPanel } from './layerpanel'; import { DateHistogramIndexPatternColumn, @@ -130,6 +132,7 @@ export function getIndexPatternDatasource({ storage, data, unifiedSearch, + discover, dataViews, fieldFormats, charts, @@ -140,6 +143,7 @@ export function getIndexPatternDatasource({ storage: IStorageWrapper; data: DataPublicPluginStart; unifiedSearch: UnifiedSearchPublicPluginStart; + discover?: DiscoverStart; dataViews: DataViewsPublicPluginStart; fieldFormats: FieldFormatsStart; charts: ChartsPluginSetup; @@ -176,10 +180,6 @@ export function getIndexPatternDatasource({ return extractReferences(state); }, - getCurrentIndexPatternId(state: IndexPatternPrivateState) { - return state.currentIndexPatternId; - }, - insertLayer(state: IndexPatternPrivateState, newLayerId: string) { return { ...state, @@ -282,6 +282,7 @@ export function getIndexPatternDatasource({ fieldFormats, charts, unifiedSearch, + discover, }} > { + getUsedDataView: (state: IndexPatternPrivateState, layerId?: string) => { + if (!layerId) { + return state.currentIndexPatternId; + } return state.layers[layerId].indexPatternId; }, getUsedDataViews: (state) => { diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx index 299896e5ffe6..2b227674c26e 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.test.tsx @@ -399,8 +399,8 @@ describe('filters', () => { ); instance - .find('[data-test-subj="lns-customBucketContainer-remove"]') - .at(2) + .find('[data-test-subj="lns-customBucketContainer-remove-1"]') + .at(0) .simulate('click'); expect(updateLayerSpy).toHaveBeenCalledWith({ ...layer, diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx index b972129109e1..434dbb092bdb 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/filters/filters.tsx @@ -235,13 +235,14 @@ export const FilterList = ({ droppableId="FILTERS_DROPPABLE_AREA" items={localFilters} > - {localFilters?.map((filter: FilterValue, idx: number) => { + {localFilters?.map((filter, idx, arrayRef) => { const isInvalid = !isQueryValid(filter.input, indexPattern); + const id = filter.id; return ( setIsHelpOpen(false)} - ownFocus={false} button={ { + const addNewRange = useCallback(() => { const newRangeId = generateId(); setLocalRanges([ @@ -228,13 +228,13 @@ export const AdvancedRangeEditor = ({ { id: newRangeId, from: localRanges[localRanges.length - 1].to, - to: Infinity, + to: Number.POSITIVE_INFINITY, label: '', }, ]); setActiveRangeId(newRangeId); - }; + }, [localRanges]); const changeActiveRange = (rangeId: string) => { let newActiveRangeId = rangeId; @@ -264,11 +264,10 @@ export const AdvancedRangeEditor = ({ <> {}} droppableId="RANGES_DROPPABLE_AREA" items={localRanges} > - {localRanges.map((range: LocalRangeType, idx: number) => ( + {localRanges.map((range, idx, arrayRef) => ( { - const newRanges = localRanges.filter((_, i) => i !== idx); + const newRanges = arrayRef.filter((_, i) => i !== idx); setLocalRanges(newRanges); }} removeTitle={i18n.translate('xpack.lens.indexPattern.ranges.deleteRange', { defaultMessage: 'Delete range', })} - isNotRemovable={localRanges.length === 1} + isNotRemovable={arrayRef.length === 1} + isNotDraggable={arrayRef.length < 2} > changeActiveRange('')} setRange={(newRange: LocalRangeType) => { - const newRanges = [...localRanges]; + const newRanges = [...arrayRef]; if (newRange.id === newRanges[idx].id) { newRanges[idx] = newRange; } else { @@ -320,9 +320,7 @@ export const AdvancedRangeEditor = ({ ))} { - addNewRange(); - }} + onClick={addNewRange} label={i18n.translate('xpack.lens.indexPattern.ranges.addRange', { defaultMessage: 'Add range', })} diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx index 907a9f685215..874559ae66c1 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.test.tsx @@ -797,8 +797,8 @@ describe('ranges', () => { // This series of act closures are made to make it work properly the update flush act(() => { instance - .find('[data-test-subj="lns-customBucketContainer-remove"]') - .last() + .find('[data-test-subj="lns-customBucketContainer-remove-1"]') + .at(0) .simulate('click'); }); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/field_inputs.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/field_inputs.tsx index f140fdb9807a..d22fc5392f2c 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/field_inputs.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/field_inputs.tsx @@ -5,24 +5,16 @@ * 2.0. */ -import React, { useCallback, useMemo, useState } from 'react'; -import { - EuiButtonIcon, - EuiDraggable, - EuiFlexGroup, - EuiFlexItem, - EuiIcon, - htmlIdGenerator, - EuiPanel, - useEuiTheme, -} from '@elastic/eui'; +import React, { useCallback, useMemo } from 'react'; +import { htmlIdGenerator } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { ExistingFieldsMap, IndexPattern } from '../../../../types'; import { DragDropBuckets, + FieldsBucketContainer, NewBucketButton, - TooltipWrapper, useDebouncedValue, + DraggableBucketContainer, } from '../../../../shared_components'; import { FieldSelect } from '../../../dimension_panel/field_select'; import type { TermsIndexPatternColumn } from './types'; @@ -61,9 +53,6 @@ export function FieldInputs({ operationSupportMatrix, invalidFields, }: FieldInputsProps) { - const { euiTheme } = useEuiTheme(); - const [isDragging, setIsDragging] = useState(false); - const onChangeWrapped = useCallback( (values: WrappedValue[]) => onChange(values.filter(removeNewEmptyField).map(({ value }) => value)), @@ -97,154 +86,90 @@ export function FieldInputs({ ); const disableActions = - (localValues.length === 2 && localValues.some(({ isNew }) => isNew)) || - localValues.length === 1; + localValues.length === 1 || localValues.filter(({ isNew }) => !isNew).length < 2; const localValuesFilled = localValues.filter(({ isNew }) => !isNew); return ( <> -
{ + handleInputChange(updatedValues); }} + droppableId="TOP_TERMS_DROPPABLE_AREA" + items={localValues} + bgColor="subdued" > - { - handleInputChange(updatedValues); - setIsDragging(false); - }} - className="lnsIndexPatternDimensionEditor__droppable" - onDragStart={() => { - setIsDragging(true); - }} - droppableId="TOP_TERMS_DROPPABLE_AREA" - items={localValues} - > - {localValues.map(({ id, value, isNew }, index) => { - // need to filter the available fields for multiple terms - // * a scripted field should be removed - // * a field of unsupported type should be removed - // * a field that has been used - // * a scripted field was used in a singular term, should be marked as invalid for multi-terms - const filteredOperationByField = Object.keys(operationSupportMatrix.operationByField) - .filter((key) => { - if (key === value) { - return true; - } - const field = indexPattern.getFieldByName(key); - if (index === 0) { - return !rawValuesLookup.has(key) && field && supportedTypes.has(field.type); - } else { - return ( - !rawValuesLookup.has(key) && - field && - !field.scripted && - supportedTypes.has(field.type) - ); - } - }) - .reduce((memo, key) => { - memo[key] = operationSupportMatrix.operationByField[key]; - return memo; - }, {}); + {localValues.map(({ id, value, isNew }, index, arrayRef) => { + // need to filter the available fields for multiple terms + // * a scripted field should be removed + // * a field of unsupported type should be removed + // * a field that has been used + // * a scripted field was used in a singular term, should be marked as invalid for multi-terms + const filteredOperationByField = Object.keys(operationSupportMatrix.operationByField) + .filter((key) => { + if (key === value) { + return true; + } + const field = indexPattern.getFieldByName(key); + if (index === 0) { + return !rawValuesLookup.has(key) && field && supportedTypes.has(field.type); + } else { + return ( + !rawValuesLookup.has(key) && + field && + !field.scripted && + supportedTypes.has(field.type) + ); + } + }) + .reduce((memo, key) => { + memo[key] = operationSupportMatrix.operationByField[key]; + return memo; + }, {}); - const shouldShowError = Boolean( - value && - ((indexPattern.getFieldByName(value)?.scripted && localValuesFilled.length > 1) || - invalidFields?.includes(value)) - ); - return ( - - {(provided) => ( - - - - - - - { - onFieldSelectChange(choice, index); - }} - isInvalid={shouldShowError} - data-test-subj={ - localValues.length !== 1 - ? `indexPattern-dimension-field-${index}` - : undefined - } - /> - - - - { - handleInputChange(localValues.filter((_, i) => i !== index)); - }} - data-test-subj={`indexPattern-terms-removeField-${index}`} - isDisabled={disableActions && !isNew} - /> - - - - - )} - - ); - })} - -
+ const shouldShowError = Boolean( + value && + ((indexPattern.getFieldByName(value)?.scripted && localValuesFilled.length > 1) || + invalidFields?.includes(value)) + ); + const itemId = (value ?? 'newField') + id; + + return ( + { + handleInputChange(arrayRef.filter((_, i) => i !== index)); + }} + removeTitle={i18n.translate('xpack.lens.indexPattern.terms.deleteButtonLabel', { + defaultMessage: 'Delete', + })} + isNotRemovable={disableActions && !isNew} + isNotDraggable={arrayRef.length < 2} + data-test-subj={`indexPattern-terms`} + Container={FieldsBucketContainer} + isInsidePanel={true} + > + { + onFieldSelectChange(choice, index); + }} + isInvalid={shouldShowError} + data-test-subj={ + localValues.length !== 1 ? `indexPattern-dimension-field-${index}` : undefined + } + /> + + ); + })} + { handleInputChange([...localValues, { id: generateId(), value: undefined, isNew: true }]); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts index 2df8300eb648..1a77cd253424 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.test.ts @@ -190,6 +190,7 @@ describe('state_helpers', () => { layerId: 'layer', dataView: indexPattern, filterOperations: () => true, + indexPatternId: '1', }, target: { columnId: 'copy', @@ -197,6 +198,7 @@ describe('state_helpers', () => { dataView: indexPattern, layerId: 'layer', filterOperations: () => true, + indexPatternId: '1', }, shouldDeleteSource: false, }).layer diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/pure_utils.ts b/x-pack/plugins/lens/public/indexpattern_datasource/pure_utils.ts index e1fd78e0b171..39b4bcdf4922 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/pure_utils.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/pure_utils.ts @@ -6,7 +6,7 @@ */ import type { DataType, IndexPattern, IndexPatternField } from '../types'; -import type { DraggedField, IndexPatternLayer } from './types'; +import type { IndexPatternLayer } from './types'; import type { BaseIndexPatternColumn, FieldBasedIndexPatternColumn, @@ -53,11 +53,3 @@ export function sortByField(columns: C[]) { return column1.operationType.localeCompare(column2.operationType); }); } - -export function isDraggedField(fieldCandidate: unknown): fieldCandidate is DraggedField { - return ( - typeof fieldCandidate === 'object' && - fieldCandidate !== null && - ['id', 'field', 'indexPatternId'].every((prop) => prop in fieldCandidate) - ); -} diff --git a/x-pack/plugins/lens/public/mocks/datasource_mock.ts b/x-pack/plugins/lens/public/mocks/datasource_mock.ts index 3d169b643c2c..65d001a726b8 100644 --- a/x-pack/plugins/lens/public/mocks/datasource_mock.ts +++ b/x-pack/plugins/lens/public/mocks/datasource_mock.ts @@ -41,7 +41,6 @@ export function createMockDatasource(id: string): DatasourceMock { initialize: jest.fn((_state?) => {}), renderDataPanel: jest.fn(), renderLayerPanel: jest.fn(), - getCurrentIndexPatternId: jest.fn(), toExpression: jest.fn((_frame, _state, _indexPatterns) => null), insertLayer: jest.fn((_state, _newLayerId) => ({})), removeLayer: jest.fn((_state, _layerId) => {}), diff --git a/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/buckets.test.tsx b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/buckets.test.tsx index aba0cbfc40a6..2336495c9a31 100644 --- a/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/buckets.test.tsx +++ b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/buckets.test.tsx @@ -63,14 +63,13 @@ describe('buckets shared components', () => { it('should render invalid component', () => { const instance = mount(); const iconProps = instance.find(EuiIcon).first().props(); - expect(iconProps.color).toEqual('danger'); + expect(iconProps.color).toEqual('#BD271E'); expect(iconProps.type).toEqual('alert'); - expect(iconProps.title).toEqual('invalid'); }); it('should call onRemoveClick when remove icon is clicked', () => { const instance = mount(); const removeIcon = instance - .find('[data-test-subj="lns-customBucketContainer-remove"]') + .find('[data-test-subj="lns-customBucketContainer-remove-0"]') .first(); removeIcon.simulate('click'); expect(defaultProps.onRemoveClick).toHaveBeenCalled(); diff --git a/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/buckets.tsx b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/buckets.tsx index 720d8c85ca48..7d0893cdd54e 100644 --- a/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/buckets.tsx +++ b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/buckets.tsx @@ -5,162 +5,110 @@ * 2.0. */ -import React from 'react'; -import { i18n } from '@kbn/i18n'; +import React, { useCallback, useState } from 'react'; +import type { Assign } from '@kbn/utility-types'; import { - EuiFlexGroup, - EuiFlexItem, EuiPanel, - EuiButtonIcon, - EuiIcon, - EuiDragDropContext, - euiDragDropReorder, EuiDraggable, EuiDroppable, - EuiButtonEmpty, + EuiPanelProps, + EuiDragDropContext, + DragDropContextProps, + euiDragDropReorder, + useEuiTheme, } from '@elastic/eui'; - -export const NewBucketButton = ({ - label, - onClick, - ['data-test-subj']: dataTestSubj, - isDisabled, - className, -}: { - label: string; - onClick: () => void; - 'data-test-subj'?: string; - isDisabled?: boolean; - className?: string; -}) => ( - - {label} - -); - -interface BucketContainerProps { - isInvalid?: boolean; - invalidMessage: string; - onRemoveClick: () => void; - removeTitle: string; - isNotRemovable?: boolean; - children: React.ReactNode; - dataTestSubj?: string; -} - -const BucketContainer = ({ - isInvalid, - invalidMessage, - onRemoveClick, - removeTitle, - children, - dataTestSubj, - isNotRemovable, -}: BucketContainerProps) => { - return ( - - - {/* Empty for spacing */} - - - - {children} - - - - - - ); -}; +import { DefaultBucketContainer } from './default_bucket_container'; +import type { BucketContainerProps } from './types'; export const DraggableBucketContainer = ({ id, - idx, children, + isInsidePanel, + Container = DefaultBucketContainer, ...bucketContainerProps -}: { - id: string; - idx: number; - children: React.ReactNode; -} & BucketContainerProps) => { +}: Assign< + Omit, + { + id: string; + children: React.ReactNode; + isInsidePanel?: boolean; + Container?: React.FunctionComponent; + } +>) => { + const { euiTheme } = useEuiTheme(); + return ( - {(provided) => {children}} + {(provided, state) => ( + + {children} + + )} ); }; -interface DraggableLocation { - droppableId: string; - index: number; -} - -export const DragDropBuckets = ({ +export function DragDropBuckets({ items, onDragStart, onDragEnd, droppableId, children, - className, + bgColor, }: { - items: any; // eslint-disable-line @typescript-eslint/no-explicit-any - onDragStart: () => void; - onDragEnd: (items: any) => void; // eslint-disable-line @typescript-eslint/no-explicit-any + items: T[]; droppableId: string; children: React.ReactElement[]; - className?: string; -}) => { - const handleDragEnd = ({ - source, - destination, - }: { - source?: DraggableLocation; - destination?: DraggableLocation; - }) => { - if (source && destination) { - const newItems = euiDragDropReorder(items, source.index, destination.index); - onDragEnd(newItems); - } - }; + onDragStart?: () => void; + onDragEnd?: (items: T[]) => void; + bgColor?: EuiPanelProps['color']; +}) { + const [isDragging, setIsDragging] = useState(false); + + const handleDragEnd: DragDropContextProps['onDragEnd'] = useCallback( + ({ source, destination }) => { + setIsDragging(false); + if (source && destination) { + onDragEnd?.(euiDragDropReorder(items, source.index, destination.index)); + } + }, + [items, onDragEnd] + ); + + const handleDragStart: DragDropContextProps['onDragStart'] = useCallback(() => { + setIsDragging(true); + onDragStart?.(); + }, [onDragStart]); + return ( - - - {children} - + + + + {children} + + ); -}; +} diff --git a/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/default_bucket_container.tsx b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/default_bucket_container.tsx new file mode 100644 index 000000000000..bfae243dc1ac --- /dev/null +++ b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/default_bucket_container.tsx @@ -0,0 +1,93 @@ +/* + * 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 React from 'react'; +import { i18n } from '@kbn/i18n'; +import { + EuiButtonIcon, + EuiFlexGroup, + EuiFlexItem, + EuiIcon, + EuiPanel, + useEuiTheme, +} from '@elastic/eui'; +import type { BucketContainerProps } from './types'; +import { TooltipWrapper } from '../tooltip_wrapper'; + +export const DefaultBucketContainer = ({ + idx, + isInvalid, + invalidMessage, + onRemoveClick, + removeTitle, + children, + draggableProvided, + isNotRemovable, + isNotDraggable, + 'data-test-subj': dataTestSubj = 'lns-customBucketContainer', +}: BucketContainerProps) => { + const { euiTheme } = useEuiTheme(); + + return ( + + + + + + + + {children} + + + + + + + + ); +}; diff --git a/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/fields_bucket_container.tsx b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/fields_bucket_container.tsx new file mode 100644 index 000000000000..eedcba3fee5e --- /dev/null +++ b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/fields_bucket_container.tsx @@ -0,0 +1,86 @@ +/* + * 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 React from 'react'; +import { i18n } from '@kbn/i18n'; +import { + EuiButtonIcon, + EuiFlexGroup, + EuiFlexItem, + EuiIcon, + EuiPanel, + useEuiTheme, +} from '@elastic/eui'; +import { TooltipWrapper } from '..'; +import type { BucketContainerProps } from './types'; + +export const FieldsBucketContainer = ({ + idx, + onRemoveClick, + removeTitle, + children, + draggableProvided, + isNotRemovable, + isNotDraggable, + isDragging, + 'data-test-subj': dataTestSubj = 'lns-fieldsBucketContainer', +}: BucketContainerProps) => { + const { euiTheme } = useEuiTheme(); + + return ( + + + + + + + + + {children} + + + + + + + + + ); +}; diff --git a/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/index.tsx b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/index.tsx new file mode 100644 index 000000000000..127471dc2cca --- /dev/null +++ b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/index.tsx @@ -0,0 +1,11 @@ +/* + * 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. + */ + +export { NewBucketButton } from './new_bucket_button'; +export { FieldsBucketContainer } from './fields_bucket_container'; + +export * from './buckets'; diff --git a/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/new_bucket_button.tsx b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/new_bucket_button.tsx new file mode 100644 index 000000000000..38b74ca7c83f --- /dev/null +++ b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/new_bucket_button.tsx @@ -0,0 +1,37 @@ +/* + * 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 React from 'react'; +import { EuiButtonEmpty } from '@elastic/eui'; + +interface NewBucketButtonProps { + label: string; + onClick: () => void; + isDisabled?: boolean; + className?: string; + 'data-test-subj'?: string; +} + +export const NewBucketButton = ({ + label, + onClick, + isDisabled, + className, + 'data-test-subj': dataTestSubj = 'lns-newBucket-add', +}: NewBucketButtonProps) => ( + + {label} + +); diff --git a/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/types.ts b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/types.ts new file mode 100644 index 000000000000..fe08048e875c --- /dev/null +++ b/x-pack/plugins/lens/public/shared_components/drag_drop_bucket/types.ts @@ -0,0 +1,23 @@ +/* + * 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 React from 'react'; +import type { DraggableProvided } from 'react-beautiful-dnd'; + +export interface BucketContainerProps { + children: React.ReactNode; + removeTitle: string; + idx: number; + onRemoveClick: () => void; + isDragging?: boolean; + draggableProvided?: DraggableProvided; + isInvalid?: boolean; + invalidMessage?: string; + isNotRemovable?: boolean; + isNotDraggable?: boolean; + 'data-test-subj'?: string; +} diff --git a/x-pack/plugins/lens/public/shared_components/index.ts b/x-pack/plugins/lens/public/shared_components/index.ts index 3f30eb64ff2c..a2fcc9c54882 100644 --- a/x-pack/plugins/lens/public/shared_components/index.ts +++ b/x-pack/plugins/lens/public/shared_components/index.ts @@ -17,7 +17,8 @@ export { NewBucketButton, DraggableBucketContainer, DragDropBuckets, -} from './drag_drop_bucket/buckets'; + FieldsBucketContainer, +} from './drag_drop_bucket'; export { RangeInputField } from './range_input_field'; export { BucketAxisBoundsControl, diff --git a/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts index dc2425917bad..5b942eff4a68 100644 --- a/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts +++ b/x-pack/plugins/lens/public/state_management/init_middleware/load_initial.ts @@ -115,6 +115,11 @@ export function loadInitial( defaultIndexPatternId: lensServices.uiSettings.get('defaultIndex'), }; + let activeDatasourceId: string | undefined; + if (initialContext && 'query' in initialContext) { + activeDatasourceId = 'textBasedLanguages'; + } + if ( !initialInput || (attributeService.inputIsRefType(initialInput) && @@ -141,6 +146,7 @@ export function loadInitial( ...emptyState, dataViews: getInitialDataViewsObject(indexPatterns, indexPatternRefs), searchSessionId: data.search.session.getSessionId() || data.search.session.start(), + ...(activeDatasourceId && { activeDatasourceId }), datasourceStates: Object.entries(datasourceStates).reduce( (state, [datasourceId, datasourceState]) => ({ ...state, diff --git a/x-pack/plugins/lens/public/state_management/lens_slice.test.ts b/x-pack/plugins/lens/public/state_management/lens_slice.test.ts index fc536b30ddac..f83786238f62 100644 --- a/x-pack/plugins/lens/public/state_management/lens_slice.test.ts +++ b/x-pack/plugins/lens/public/state_management/lens_slice.test.ts @@ -279,7 +279,7 @@ describe('lensSlice', () => { removeLayer: (layerIds: unknown, layerId: string) => (layerIds as string[]).filter((id: string) => id !== layerId), insertLayer: (layerIds: unknown, layerId: string) => [...(layerIds as string[]), layerId], - getCurrentIndexPatternId: jest.fn(() => 'indexPattern1'), + getUsedDataView: jest.fn(() => 'indexPattern1'), }; }; const datasourceStates = { diff --git a/x-pack/plugins/lens/public/state_management/lens_slice.ts b/x-pack/plugins/lens/public/state_management/lens_slice.ts index 725c60bfc22c..38aee718a536 100644 --- a/x-pack/plugins/lens/public/state_management/lens_slice.ts +++ b/x-pack/plugins/lens/public/state_management/lens_slice.ts @@ -377,7 +377,7 @@ export const makeLensReducer = (storeDeps: LensStoreDeps) => { ); state.stagedPreview = undefined; // reuse the activeDatasource current dataView id for the moment - const currentDataViewsId = activeDataSource.getCurrentIndexPatternId( + const currentDataViewsId = activeDataSource.getUsedDataView( state.datasourceStates[state.activeDatasourceId!].state ); state.visualization.state = @@ -928,7 +928,7 @@ export const makeLensReducer = (storeDeps: LensStoreDeps) => { const activeVisualization = visualizationMap[state.visualization.activeId]; const activeDatasource = datasourceMap[state.activeDatasourceId]; // reuse the active datasource dataView id for the new layer - const currentDataViewsId = activeDatasource.getCurrentIndexPatternId( + const currentDataViewsId = activeDatasource.getUsedDataView( state.datasourceStates[state.activeDatasourceId!].state ); const visualizationState = activeVisualization.appendLayer!( diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.test.ts b/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.test.ts index c2238bfd9fef..92a3ef01fdb7 100644 --- a/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.test.ts +++ b/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.test.ts @@ -12,6 +12,7 @@ import { TextBasedLanguagesPersistedState, TextBasedLanguagesPrivateState } from import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; import { getTextBasedLanguagesDatasource } from './text_based_languages'; +import { generateId } from '../id_generator'; import { DatasourcePublicAPI, Datasource } from '../types'; jest.mock('../id_generator'); @@ -272,6 +273,97 @@ describe('IndexPattern Data Source', () => { }); }); + describe('#getDatasourceSuggestionsForVisualizeField', () => { + (generateId as jest.Mock).mockReturnValue(`newid`); + it('should create the correct layers', () => { + const state = { + layers: {}, + initialContext: { + contextualFields: ['bytes', 'dest'], + query: { sql: 'SELECT * FROM "foo"' }, + dataViewSpec: { + title: 'foo', + id: '1', + name: 'Foo', + }, + }, + } as unknown as TextBasedLanguagesPrivateState; + const suggestions = textBasedLanguagesDatasource.getDatasourceSuggestionsForVisualizeField( + state, + '1', + '', + indexPatterns + ); + expect(suggestions[0].state).toEqual({ + ...state, + layers: { + newid: { + allColumns: [ + { + columnId: 'newid', + fieldName: 'bytes', + meta: { + type: 'number', + }, + }, + { + columnId: 'newid', + fieldName: 'dest', + meta: { + type: 'string', + }, + }, + ], + columns: [ + { + columnId: 'newid', + fieldName: 'bytes', + meta: { + type: 'number', + }, + }, + { + columnId: 'newid', + fieldName: 'dest', + meta: { + type: 'string', + }, + }, + ], + index: 'foo', + query: { + sql: 'SELECT * FROM "foo"', + }, + }, + }, + }); + + expect(suggestions[0].table).toEqual({ + changeType: 'initial', + columns: [ + { + columnId: 'newid', + operation: { + dataType: 'number', + isBucketed: false, + label: 'bytes', + }, + }, + { + columnId: 'newid', + operation: { + dataType: 'string', + isBucketed: true, + label: 'dest', + }, + }, + ], + isMultiRow: false, + layerId: 'newid', + }); + }); + }); + describe('#getErrorMessages', () => { it('should use the results of getErrorMessages directly when single layer', () => { const state = { diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.tsx b/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.tsx index 5a03500c76fb..e9ab24b8392c 100644 --- a/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.tsx +++ b/x-pack/plugins/lens/public/text_based_languages_datasource/text_based_languages.tsx @@ -14,7 +14,7 @@ import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { AggregateQuery } from '@kbn/es-query'; import type { SavedObjectReference } from '@kbn/core/public'; import { EuiButtonEmpty, EuiFormRow } from '@elastic/eui'; -import type { ExpressionsStart } from '@kbn/expressions-plugin/public'; +import type { ExpressionsStart, DatatableColumnType } from '@kbn/expressions-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { @@ -36,7 +36,7 @@ import type { TextBasedLanguageField, } from './types'; import { FieldSelect } from './field_select'; -import { Datasource } from '../types'; +import type { Datasource, IndexPatternMap } from '../types'; import { LayerPanel } from './layerpanel'; function getLayerReferenceName(layerId: string) { @@ -82,6 +82,77 @@ export function getTextBasedLanguagesDatasource({ }; }); }; + const getSuggestionsForVisualizeField = ( + state: TextBasedLanguagesPrivateState, + indexPatternId: string, + fieldName: string, + indexPatterns: IndexPatternMap + ) => { + const context = state.initialContext; + if (context && 'dataViewSpec' in context && context.dataViewSpec.title) { + const newLayerId = generateId(); + const indexPattern = indexPatterns[indexPatternId]; + + const contextualFields = context.contextualFields; + const newColumns = contextualFields?.map((c) => { + let field = indexPattern?.getFieldByName(c); + if (!field) { + field = indexPattern?.fields.find((f) => f.name.includes(c)); + } + const newId = generateId(); + const type = field?.type ?? 'number'; + return { + columnId: newId, + fieldName: c, + meta: { + type: type as DatatableColumnType, + }, + }; + }); + + const index = context.dataViewSpec.title; + const query = context.query; + const updatedState = { + ...state, + layers: { + ...state.layers, + [newLayerId]: { + index, + query, + columns: newColumns ?? [], + allColumns: newColumns ?? [], + }, + }, + }; + + return [ + { + state: { + ...updatedState, + }, + table: { + changeType: 'initial' as TableChangeType, + isMultiRow: false, + layerId: newLayerId, + columns: + newColumns?.map((f) => { + return { + columnId: f.columnId, + operation: { + dataType: f?.meta?.type as DataType, + label: f.fieldName, + isBucketed: Boolean(f?.meta?.type !== 'number'), + }, + }; + }) ?? [], + }, + keptLayerIds: [newLayerId], + }, + ]; + } + + return []; + }; const TextBasedLanguagesDatasource: Datasource< TextBasedLanguagesPrivateState, TextBasedLanguagesPersistedState @@ -137,6 +208,7 @@ export function getTextBasedLanguagesDatasource({ ...initState, fieldList: [], indexPatternRefs: refs, + initialContext: context, }; }, onRefreshIndexPattern() {}, @@ -224,10 +296,6 @@ export function getTextBasedLanguagesDatasource({ getLayers(state: TextBasedLanguagesPrivateState) { return state && state.layers ? Object.keys(state?.layers) : []; }, - getCurrentIndexPatternId(state: TextBasedLanguagesPrivateState) { - const layers = Object.values(state.layers); - return layers?.[0]?.index; - }, isTimeBased: (state, indexPatterns) => { if (!state) return false; const { layers } = state; @@ -238,7 +306,11 @@ export function getTextBasedLanguagesDatasource({ }) ); }, - getUsedDataView: (state: TextBasedLanguagesPrivateState, layerId: string) => { + getUsedDataView: (state: TextBasedLanguagesPrivateState, layerId?: string) => { + if (!layerId) { + const layers = Object.values(state.layers); + return layers?.[0]?.index; + } return state.layers[layerId].index; }, @@ -291,7 +363,11 @@ export function getTextBasedLanguagesDatasource({ const columnExists = props.state.fieldList.some((f) => f.name === selectedField?.fieldName); render( - {}}> + {}} + data-test-subj="lns-dimensionTrigger-textBased" + > {customLabel ?? i18n.translate('xpack.lens.textBasedLanguages.missingField', { defaultMessage: 'Missing field', @@ -564,7 +640,7 @@ export function getTextBasedLanguagesDatasource({ }); return []; }, - getDatasourceSuggestionsForVisualizeField: getSuggestionsForState, + getDatasourceSuggestionsForVisualizeField: getSuggestionsForVisualizeField, getDatasourceSuggestionsFromCurrentState: getSuggestionsForState, getDatasourceSuggestionsForVisualizeCharts: getSuggestionsForState, isEqual: () => true, diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/types.ts b/x-pack/plugins/lens/public/text_based_languages_datasource/types.ts index 2ea1692cf37c..11b9612624ef 100644 --- a/x-pack/plugins/lens/public/text_based_languages_datasource/types.ts +++ b/x-pack/plugins/lens/public/text_based_languages_datasource/types.ts @@ -6,6 +6,8 @@ */ import type { DatatableColumn } from '@kbn/expressions-plugin/public'; import type { AggregateQuery } from '@kbn/es-query'; +import type { VisualizeFieldContext } from '@kbn/ui-actions-plugin/public'; +import type { VisualizeEditorContext } from '../types'; export interface TextBasedLanguagesLayerColumn { columnId: string; @@ -34,6 +36,7 @@ export interface TextBasedLanguagesPersistedState { export type TextBasedLanguagesPrivateState = TextBasedLanguagesPersistedState & { indexPatternRefs: IndexPatternRef[]; fieldList: DatatableColumn[]; + initialContext?: VisualizeFieldContext | VisualizeEditorContext; }; export interface IndexPatternRef { diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/utils.test.ts b/x-pack/plugins/lens/public/text_based_languages_datasource/utils.test.ts index 1cbd830a92fc..bc511bb2b86c 100644 --- a/x-pack/plugins/lens/public/text_based_languages_datasource/utils.test.ts +++ b/x-pack/plugins/lens/public/text_based_languages_datasource/utils.test.ts @@ -84,6 +84,18 @@ describe('Text based languages utils', () => { index: '', }, }, + indexPatternRefs: [], + fieldList: [], + initialContext: { + contextualFields: ['bytes', 'dest'], + query: { sql: 'SELECT * FROM "foo"' }, + fieldName: '', + dataViewSpec: { + title: 'foo', + id: '1', + name: 'Foo', + }, + }, }; const dataViewsMock = dataViewPluginMocks.createStartContract(); const dataMock = dataPluginMock.createStartContract(); @@ -113,6 +125,16 @@ describe('Text based languages utils', () => { ); expect(updatedState).toStrictEqual({ + initialContext: { + contextualFields: ['bytes', 'dest'], + query: { sql: 'SELECT * FROM "foo"' }, + fieldName: '', + dataViewSpec: { + title: 'foo', + id: '1', + name: 'Foo', + }, + }, fieldList: [ { name: 'timestamp', diff --git a/x-pack/plugins/lens/public/text_based_languages_datasource/utils.ts b/x-pack/plugins/lens/public/text_based_languages_datasource/utils.ts index 6c17d5206efb..c4e41103f0fd 100644 --- a/x-pack/plugins/lens/public/text_based_languages_datasource/utils.ts +++ b/x-pack/plugins/lens/public/text_based_languages_datasource/utils.ts @@ -15,7 +15,7 @@ import { fetchDataFromAggregateQuery } from './fetch_data_from_aggregate_query'; import type { IndexPatternRef, - TextBasedLanguagesPersistedState, + TextBasedLanguagesPrivateState, TextBasedLanguagesLayerColumn, } from './types'; @@ -36,7 +36,7 @@ export async function loadIndexPatternRefs( } export async function getStateFromAggregateQuery( - state: TextBasedLanguagesPersistedState, + state: TextBasedLanguagesPrivateState, query: AggregateQuery, dataViews: DataViewsPublicPluginStart, data: DataPublicPluginStart, @@ -45,13 +45,14 @@ export async function getStateFromAggregateQuery( const indexPatternRefs: IndexPatternRef[] = await loadIndexPatternRefs(dataViews); const errors: Error[] = []; const layerIds = Object.keys(state.layers); + const context = state.initialContext; const newLayerId = layerIds.length > 0 ? layerIds[0] : generateId(); // fetch the pattern from the query const indexPattern = getIndexPatternFromTextBasedQuery(query); // get the id of the dataview const index = indexPatternRefs.find((r) => r.title === indexPattern)?.id ?? ''; let columnsFromQuery: DatatableColumn[] = []; - let columns: TextBasedLanguagesLayerColumn[] = []; + let allColumns: TextBasedLanguagesLayerColumn[] = []; let timeFieldName; try { const table = await fetchDataFromAggregateQuery(query, dataViews, data, expressions); @@ -59,7 +60,8 @@ export async function getStateFromAggregateQuery( timeFieldName = dataView.timeFieldName; columnsFromQuery = table?.columns ?? []; const existingColumns = state.layers[newLayerId].allColumns; - columns = [ + + allColumns = [ ...existingColumns, ...columnsFromQuery.map((c) => ({ columnId: c.id, fieldName: c.id, meta: c.meta })), ]; @@ -73,7 +75,7 @@ export async function getStateFromAggregateQuery( index, query, columns: state.layers[newLayerId].columns ?? [], - allColumns: columns, + allColumns, timeField: timeFieldName, errors, }, @@ -84,6 +86,7 @@ export async function getStateFromAggregateQuery( ...tempState, fieldList: columnsFromQuery ?? [], indexPatternRefs, + initialContext: context, }; } diff --git a/x-pack/plugins/lens/public/types.ts b/x-pack/plugins/lens/public/types.ts index 32fc21cc4a61..29aff3d42869 100644 --- a/x-pack/plugins/lens/public/types.ts +++ b/x-pack/plugins/lens/public/types.ts @@ -30,6 +30,7 @@ import type { IndexPatternAggRestrictions } from '@kbn/data-plugin/public'; import type { FieldSpec, DataViewSpec } from '@kbn/data-views-plugin/common'; import type { FieldFormatParams } from '@kbn/field-formats-plugin/common'; import { SearchResponseWarning } from '@kbn/data-plugin/public/search/types'; +import type { EuiButtonIconColor } from '@elastic/eui'; import type { DraggingIdentifier, DragDropIdentifier, DragContextState } from './drag_drop'; import type { DateRange, LayerType, SortingHint } from '../common'; import type { @@ -228,14 +229,7 @@ export type VisualizeEditorContext = { export interface GetDropPropsArgs { state: T; source?: DraggingIdentifier; - target: { - layerId: string; - groupId: string; - columnId: string; - filterOperations: (meta: OperationMetadata) => boolean; - prioritizedOperation?: string; - isNewColumn?: boolean; - }; + target: DragDropOperation; indexPatterns: IndexPatternMap; } @@ -258,7 +252,6 @@ export interface Datasource { // Given the current state, which parts should be saved? getPersistableState: (state: T) => { state: P; savedObjectReferences: SavedObjectReference[] }; - getCurrentIndexPatternId: (state: T) => string; getUnifiedSearchErrors?: (state: T) => Error[]; insertLayer: (state: T, newLayerId: string) => T; @@ -441,7 +434,7 @@ export interface Datasource { /** * Get the used DataView value from state */ - getUsedDataView: (state: T, layerId: string) => string; + getUsedDataView: (state: T, layerId?: string) => string; /** * Get all the used DataViews from state */ @@ -501,7 +494,10 @@ export interface DatasourceDataPanelProps { dragDropContext: DragContextState; setState: StateSetter; showNoDataPopover: () => void; - core: Pick; + core: Pick< + CoreStart, + 'http' | 'notifications' | 'uiSettings' | 'overlays' | 'theme' | 'application' + >; query: Query; dateRange: DateRange; filters: Filter[]; @@ -514,6 +510,17 @@ export interface DatasourceDataPanelProps { usedIndexPatterns?: string[]; } +/** @internal **/ +export interface LayerAction { + displayName: string; + description?: string; + execute: () => void | Promise; + icon: IconType; + color?: EuiButtonIconColor; + isCompatible: boolean; + 'data-test-subj'?: string; +} + interface SharedDimensionProps { /** Visualizations can restrict operations based on their own rules. * For example, limiting to only bucketed or only numeric operations. @@ -582,8 +589,16 @@ export interface DragDropOperation { groupId: string; columnId: string; filterOperations: (operation: OperationMetadata) => boolean; + indexPatternId?: string; + isNewColumn?: boolean; + prioritizedOperation?: string; } +export type DraggedField = DragDropIdentifier & { + field: IndexPatternField; + indexPatternId: string; +}; + export function isOperation(operationCandidate: unknown): operationCandidate is DragDropOperation { return ( typeof operationCandidate === 'object' && @@ -892,6 +907,7 @@ export interface Visualization { */ initialize: (addNewLayer: () => string, state?: T, mainPalette?: PaletteOutput) => T; + getUsedDataView?: (state: T, layerId: string) => string | undefined; /** * Retrieve the used DataViews in the visualization */ @@ -961,6 +977,16 @@ export interface Visualization { staticValue?: unknown; }>; }>; + /** + * returns a list of custom actions supported by the visualization layer. + * Default actions like delete/clear are not included in this list and are managed by the editor frame + * */ + getSupportedActionsForLayer?: ( + layerId: string, + state: T, + setState: StateSetter + ) => LayerAction[]; + /** returns the type string of the given layer */ getLayerType: (layerId: string, state?: T) => LayerType | undefined; /* returns the type of removal operation to perform for the specific layer in the current state */ getRemoveOperation?: (state: T, layerId: string) => 'remove' | 'clear'; @@ -1022,6 +1048,10 @@ export interface Visualization { group?: VisualizationDimensionGroupConfig; }) => T; + getDropProps?: ( + dropProps: GetDropPropsArgs + ) => { dropTypes: DropType[]; nextLabel?: string } | undefined; + /** * Additional editor that gets rendered inside the dimension popover. * This can be used to configure dimension-specific options diff --git a/x-pack/plugins/lens/public/utils.ts b/x-pack/plugins/lens/public/utils.ts index 8f25379c0e21..c40403cfd092 100644 --- a/x-pack/plugins/lens/public/utils.ts +++ b/x-pack/plugins/lens/public/utils.ts @@ -15,15 +15,19 @@ import type { DataView, DataViewsContract } from '@kbn/data-views-plugin/public' import type { DatatableUtilitiesService } from '@kbn/data-plugin/common'; import { BrushTriggerEvent, ClickTriggerEvent } from '@kbn/charts-plugin/public'; import type { Document } from './persistence/saved_object_store'; -import type { +import { Datasource, DatasourceMap, Visualization, IndexPatternMap, IndexPatternRef, + DraggedField, + DragDropOperation, + isOperation, } from './types'; import type { DatasourceStates, VisualizationState } from './state_management'; import { IndexPatternServiceAPI } from './data_views_service/service'; +import { DraggingIdentifier } from './drag_drop'; export function getVisualizeGeoFieldMessage(fieldType: string) { return i18n.translate('xpack.lens.visualizeGeoFieldMessage', { @@ -126,7 +130,7 @@ export function getIndexPatternsIds({ const references: SavedObjectReference[] = []; Object.entries(activeDatasources).forEach(([id, datasource]) => { const { savedObjectReferences } = datasource.getPersistableState(datasourceStates[id].state); - const indexPatternId = datasource.getCurrentIndexPatternId(datasourceStates[id].state); + const indexPatternId = datasource.getUsedDataView(datasourceStates[id].state); currentIndexPatternId = indexPatternId; references.push(...savedObjectReferences); }); @@ -242,3 +246,42 @@ export function renewIDs( */ export const DONT_CLOSE_DIMENSION_CONTAINER_ON_CLICK_CLASS = 'lensDontCloseDimensionContainerOnClick'; + +export function isDraggedField(fieldCandidate: unknown): fieldCandidate is DraggedField { + return ( + typeof fieldCandidate === 'object' && + fieldCandidate !== null && + ['id', 'field'].every((prop) => prop in fieldCandidate) + ); +} + +export function isDraggedDataViewField(fieldCandidate: unknown): fieldCandidate is DraggedField { + return ( + typeof fieldCandidate === 'object' && + fieldCandidate !== null && + ['id', 'field', 'indexPatternId'].every((prop) => prop in fieldCandidate) + ); +} + +export const isOperationFromCompatibleGroup = ( + op1?: DraggingIdentifier, + op2?: DragDropOperation +) => { + return ( + isOperation(op1) && + isOperation(op2) && + op1.columnId !== op2.columnId && + op1.groupId === op2.groupId && + op1.layerId !== op2.layerId + ); +}; + +export const isOperationFromTheSameGroup = (op1?: DraggingIdentifier, op2?: DragDropOperation) => { + return ( + isOperation(op1) && + isOperation(op2) && + op1.columnId !== op2.columnId && + op1.groupId === op2.groupId && + op1.layerId === op2.layerId + ); +}; diff --git a/x-pack/plugins/lens/public/visualizations/xy/annotations/actions.ts b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions.ts new file mode 100644 index 000000000000..d7d3c9ca8a56 --- /dev/null +++ b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions.ts @@ -0,0 +1,54 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import type { LayerAction, StateSetter } from '../../../types'; +import type { XYState, XYAnnotationLayerConfig } from '../types'; + +export const createAnnotationActions = ({ + state, + layer, + layerIndex, + setState, +}: { + state: XYState; + layer: XYAnnotationLayerConfig; + layerIndex: number; + setState: StateSetter; +}): LayerAction[] => { + const label = !layer.ignoreGlobalFilters + ? i18n.translate('xpack.lens.xyChart.annotations.ignoreGlobalFiltersLabel', { + defaultMessage: 'Ignore global filters', + }) + : i18n.translate('xpack.lens.xyChart.annotations.keepGlobalFiltersLabel', { + defaultMessage: 'Keep global filters', + }); + return [ + { + displayName: label, + description: !layer.ignoreGlobalFilters + ? i18n.translate('xpack.lens.xyChart.annotations.ignoreGlobalFiltersDescription', { + defaultMessage: + 'All the dimensions configured in this layer ignore filters defined at kibana level.', + }) + : i18n.translate('xpack.lens.xyChart.annotations.keepGlobalFiltersDescription', { + defaultMessage: + 'All the dimensions configured in this layer respect filters defined at kibana level.', + }), + execute: () => { + const newLayers = [...state.layers]; + newLayers[layerIndex] = { ...layer, ignoreGlobalFilters: !layer.ignoreGlobalFilters }; + return setState({ ...state, layers: newLayers }); + }, + icon: !layer.ignoreGlobalFilters ? 'eyeClosed' : 'eye', + isCompatible: true, + 'data-test-subj': !layer.ignoreGlobalFilters + ? 'lnsXY_annotationLayer_ignoreFilters' + : 'lnsXY_annotationLayer_keepFilters', + }, + ]; +}; diff --git a/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx b/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx index baaed78ec023..990d0dd8f94d 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx @@ -10,10 +10,12 @@ import moment from 'moment'; import { defaultAnnotationColor, defaultAnnotationRangeColor, + isQueryAnnotationConfig, isRangeAnnotationConfig, } from '@kbn/event-annotation-plugin/public'; import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; import { IconChartBarAnnotations } from '@kbn/chart-icons'; +import { isDraggedDataViewField } from '../../../utils'; import { layerTypes } from '../../../../common'; import type { FramePublicAPI, Visualization } from '../../../types'; import { isHorizontalChart } from '../state_helpers'; @@ -125,7 +127,7 @@ export const getAnnotationsSupportedLayer = ( }; }; -const getDefaultAnnotationConfig = (id: string, timestamp: string): EventAnnotationConfig => ({ +const getDefaultManualAnnotation = (id: string, timestamp: string): EventAnnotationConfig => ({ label: defaultAnnotationLabel, type: 'manual', key: { @@ -136,13 +138,32 @@ const getDefaultAnnotationConfig = (id: string, timestamp: string): EventAnnotat id, }); +const getDefaultQueryAnnotation = ( + id: string, + fieldName: string, + timeField: string +): EventAnnotationConfig => ({ + filter: { + type: 'kibana_query', + query: `${fieldName}: *`, + language: 'kuery', + }, + timeField, + type: 'query', + key: { + type: 'point_in_time', + }, + id, + label: `${fieldName}: *`, +}); + const createCopiedAnnotation = ( newId: string, timestamp: string, source?: EventAnnotationConfig ): EventAnnotationConfig => { if (!source) { - return getDefaultAnnotationConfig(newId, timestamp); + return getDefaultManualAnnotation(newId, timestamp); } return { ...source, @@ -158,17 +179,78 @@ export const onAnnotationDrop: Visualization['onDrop'] = ({ dropType, }) => { const targetLayer = prevState.layers.find((l) => l.layerId === target.layerId); - const sourceLayer = prevState.layers.find((l) => l.layerId === source.layerId); - if ( - !targetLayer || - !isAnnotationsLayer(targetLayer) || - !sourceLayer || - !isAnnotationsLayer(sourceLayer) - ) { + if (!targetLayer || !isAnnotationsLayer(targetLayer)) { return prevState; } const targetAnnotation = targetLayer.annotations.find(({ id }) => id === target.columnId); + const targetDataView = frame.dataViews.indexPatterns[targetLayer.indexPatternId]; + + if (isDraggedDataViewField(source)) { + const timeField = targetDataView.timeFieldName; + switch (dropType) { + case 'field_add': + if (targetAnnotation || !timeField) { + return prevState; + } + return { + ...prevState, + layers: prevState.layers.map( + (l): XYLayerConfig => + l.layerId === target.layerId + ? { + ...targetLayer, + annotations: [ + ...targetLayer.annotations, + getDefaultQueryAnnotation(target.columnId, source.field.name, timeField), + ], + } + : l + ), + }; + case 'field_replace': + if (!targetAnnotation || !timeField) { + return prevState; + } + + return { + ...prevState, + layers: prevState.layers.map( + (l): XYLayerConfig => + l.layerId === target.layerId + ? { + ...targetLayer, + annotations: [ + ...targetLayer.annotations.map((a) => + a === targetAnnotation + ? { + ...targetAnnotation, + ...getDefaultQueryAnnotation( + target.columnId, + source.field.name, + timeField + ), + } + : a + ), + ], + } + : l + ), + }; + } + + return prevState; + } + + const sourceLayer = prevState.layers.find((l) => l.layerId === source.layerId); + if (!sourceLayer || !isAnnotationsLayer(sourceLayer)) { + return prevState; + } const sourceAnnotation = sourceLayer.annotations.find(({ id }) => id === source.columnId); + const sourceDataView = frame.dataViews.indexPatterns[sourceLayer.indexPatternId]; + if (sourceDataView !== targetDataView && isQueryAnnotationConfig(sourceAnnotation)) { + return prevState; + } switch (dropType) { case 'reorder': if (!targetAnnotation || !sourceAnnotation || source.layerId !== target.layerId) { diff --git a/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts b/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts index 345e8ffcb5b1..bf75018f111e 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts @@ -190,7 +190,10 @@ export const buildExpression = ( annotations: layer.annotations.map((c) => ({ ...c, label: uniqueLabels[c.id], - ignoreGlobalFilters: layer.ignoreGlobalFilters, + ...(c.type === 'query' + ? // Move the ignore flag at the event level + { ignoreGlobalFilters: layer.ignoreGlobalFilters } + : {}), })), }; }); diff --git a/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts index 556a89c9a855..e76633b34992 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.ts @@ -338,7 +338,11 @@ describe('xy_visualization', () => { let frame: ReturnType; beforeEach(() => { - frame = createMockFramePublicAPI(); + frame = createMockFramePublicAPI({ + dataViews: createMockDataViewsState({ + indexPatterns: { indexPattern1: createMockedIndexPattern() }, + }), + }); mockDatasource = createMockDatasource('testDatasource'); mockDatasource.publicAPIMock.getTableSpec.mockReturnValue([ @@ -494,309 +498,650 @@ describe('xy_visualization', () => { ], }); }); - it('should copy previous column if passed and assign a new id', () => { - expect( - xyVisualization.onDrop!({ - frame, - prevState: { - ...exampleState(), - layers: [ - { - layerId: 'annotation', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation2], - ignoreGlobalFilters: true, + + describe('getDropProps', () => { + it('dragging operation: returns reorder for the same group existing columns', () => { + expect( + xyVisualization.getDropProps?.({ + state: 'datasourceState', + target: { + columnId: 'annotationColumn', + groupId: 'xAnnotations', + layerId: 'second', + filterOperations: () => true, + indexPatternId: '1', + }, + source: { + columnId: 'annotationColumn2', + groupId: 'xAnnotations', + layerId: 'second', + id: 'annotationColumn2', + humanData: { label: 'Event' }, + indexPatternId: '1', + }, + indexPatterns: {}, + }) + ).toEqual({ dropTypes: ['reorder'] }); + }); + it('dragging operation: returns duplicate for the same group existing column and not existing column', () => { + expect( + xyVisualization.getDropProps?.({ + state: 'datasourceState', + target: { + columnId: 'annotationColumn', + groupId: 'xAnnotations', + layerId: 'second', + isNewColumn: true, + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + source: { + columnId: 'annotationColumn2', + groupId: 'xAnnotations', + layerId: 'second', + id: 'annotationColumn2', + humanData: { label: 'Event' }, + indexPatternId: 'indexPattern1', + }, + indexPatterns: {}, + }) + ).toEqual({ dropTypes: ['duplicate_compatible'] }); + }); + it('dragging operation: returns replace_duplicate and replace for replacing to different layer', () => { + expect( + xyVisualization.getDropProps?.({ + state: 'datasourceState', + target: { + columnId: 'annotationColumn', + groupId: 'xAnnotations', + layerId: 'first', + filterOperations: () => true, + indexPatternId: '1', + }, + source: { + columnId: 'annotationColumn2', + groupId: 'xAnnotations', + layerId: 'second', + id: 'annotationColumn2', + humanData: { label: 'Event' }, + indexPatternId: '1', + }, + indexPatterns: {}, + }) + ).toEqual({ + dropTypes: ['replace_compatible', 'replace_duplicate_compatible', 'swap_compatible'], + }); + }); + it('dragging operation: returns duplicate and move for replacing to different layer for empty column', () => { + expect( + xyVisualization.getDropProps?.({ + state: 'datasourceState', + target: { + columnId: 'annotationColumn', + groupId: 'xAnnotations', + layerId: 'first', + isNewColumn: true, + indexPatternId: 'indexPattern1', + filterOperations: () => true, + }, + source: { + columnId: 'annotationColumn2', + groupId: 'xAnnotations', + layerId: 'second', + id: 'annotationColumn2', + humanData: { label: 'Event' }, + indexPatternId: 'indexPattern1', + }, + indexPatterns: {}, + }) + ).toEqual({ + dropTypes: ['move_compatible', 'duplicate_compatible'], + }); + }); + it('dragging operation: does not allow to drop for different operations on different data views', () => { + expect( + xyVisualization.getDropProps?.({ + state: 'datasourceState', + target: { + columnId: 'annotationColumn', + groupId: 'xAnnotations', + layerId: 'first', + isNewColumn: true, + indexPatternId: 'indexPattern1', + filterOperations: () => true, + }, + source: { + columnId: 'annotationColumn2', + groupId: 'xAnnotations', + layerId: 'second', + id: 'annotationColumn2', + humanData: { label: 'Event' }, + indexPatternId: 'indexPattern2', + }, + indexPatterns: {}, + }) + ).toEqual(undefined); + }); + it('dragging field: should add a new dimension when dragged to a new dimension', () => { + expect( + xyVisualization.getDropProps?.({ + state: 'datasourceState', + target: { + columnId: 'annotationColumn', + groupId: 'xAnnotations', + layerId: 'first', + isNewColumn: true, + indexPatternId: 'indexPattern1', + filterOperations: () => true, + }, + source: { + field: { + name: 'agent.keyword', + displayName: 'agent.keyword', }, - ], - }, - dropType: 'duplicate_compatible', - source: { - layerId: 'annotation', - groupId: 'xAnnotation', - columnId: 'an2', - id: 'an2', - humanData: { label: 'an2' }, - }, - target: { - layerId: 'annotation', - groupId: 'xAnnotation', - columnId: 'newColId', - filterOperations: Boolean, - }, - }).layers[0] - ).toEqual({ - layerId: 'annotation', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation2, { ...exampleAnnotation2, id: 'newColId' }], - ignoreGlobalFilters: true, + indexPatternId: 'indexPattern1', + id: 'agent.keyword', + humanData: { + label: 'agent.keyword', + position: 2, + }, + }, + indexPatterns: {}, + }) + ).toEqual({ dropTypes: ['field_add'] }); }); - }); - it('should reorder a dimension to a annotation layer', () => { - expect( - xyVisualization.onDrop!({ - frame, - prevState: { - ...exampleState(), - layers: [ - { - layerId: 'annotation', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation, exampleAnnotation2], - ignoreGlobalFilters: true, + it('dragging field: should replace an existing dimension when dragged to a dimension', () => { + expect( + xyVisualization.getDropProps?.({ + state: 'datasourceState', + target: { + columnId: 'annotationColumn', + groupId: 'xAnnotations', + layerId: 'first', + indexPatternId: 'indexPattern1', + filterOperations: () => true, + }, + source: { + field: { + name: 'agent.keyword', + displayName: 'agent.keyword', }, - ], - }, - source: { - layerId: 'annotation', - groupId: 'xAnnotation', - columnId: 'an2', - id: 'an2', - humanData: { label: 'label' }, - filterOperations: () => true, - }, - target: { - layerId: 'annotation', - groupId: 'xAnnotation', - columnId: 'an1', - filterOperations: () => true, - }, - dropType: 'reorder', - }).layers[0] - ).toEqual({ - layerId: 'annotation', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation2, exampleAnnotation], - ignoreGlobalFilters: true, + indexPatternId: 'indexPattern1', + id: 'agent.keyword', + humanData: { + label: 'agent.keyword', + position: 2, + }, + }, + indexPatterns: {}, + }) + ).toEqual({ dropTypes: ['field_replace'] }); + }); + it('dragging field: should not allow to drop when data view conflict', () => { + expect( + xyVisualization.getDropProps?.({ + state: 'datasourceState', + target: { + columnId: 'annotationColumn', + groupId: 'xAnnotations', + layerId: 'first', + indexPatternId: 'indexPattern1', + filterOperations: () => true, + }, + source: { + field: { + name: 'agent.keyword', + displayName: 'agent.keyword', + }, + indexPatternId: 'indexPattern2', + id: 'agent.keyword', + humanData: { + label: 'agent.keyword', + position: 2, + }, + }, + indexPatterns: {}, + }) + ).toEqual(undefined); }); }); - it('should duplicate the annotations and replace the target in another annotation layer', () => { - expect( - xyVisualization.onDrop!({ - frame, - prevState: { - ...exampleState(), - layers: [ - { - layerId: 'first', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation], - ignoreGlobalFilters: true, + describe('onDrop', () => { + it('dragging field: should add a new dimension when dragged to a new dimension', () => { + expect( + xyVisualization.onDrop!({ + frame, + prevState: { + ...exampleState(), + layers: [ + { + layerId: 'annotation', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation2], + ignoreGlobalFilters: true, + }, + ], + }, + dropType: 'field_add', + source: { + field: { + name: 'agent.keyword', }, - { - layerId: 'second', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation2], - ignoreGlobalFilters: true, + indexPatternId: 'indexPattern1', + id: 'agent.keyword', + humanData: { + label: 'agent.keyword', + position: 2, }, - ], - }, - source: { - layerId: 'first', - groupId: 'xAnnotation', - columnId: 'an1', - id: 'an1', - humanData: { label: 'label' }, - filterOperations: () => true, - }, - target: { - layerId: 'second', - groupId: 'xAnnotation', - columnId: 'an2', - filterOperations: () => true, - }, - dropType: 'replace_duplicate_compatible', - }).layers - ).toEqual([ - { - layerId: 'first', + }, + target: { + layerId: 'annotation', + groupId: 'xAnnotation', + columnId: 'newColId', + filterOperations: Boolean, + indexPatternId: 'indexPattern1', + }, + }).layers[0] + ).toEqual({ + layerId: 'annotation', layerType: layerTypes.ANNOTATIONS, indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation], + annotations: [ + exampleAnnotation2, + { + filter: { + language: 'kuery', + query: 'agent.keyword: *', + type: 'kibana_query', + }, + id: 'newColId', + key: { + type: 'point_in_time', + }, + label: 'agent.keyword: *', + timeField: 'timestamp', + type: 'query', + }, + ], ignoreGlobalFilters: true, - }, - { - layerId: 'second', + }); + }); + it('dragging field: should replace an existing dimension when dragged to a dimension', () => { + expect( + xyVisualization.onDrop!({ + frame, + prevState: { + ...exampleState(), + layers: [ + { + layerId: 'annotation', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation], + ignoreGlobalFilters: true, + }, + ], + }, + dropType: 'field_replace', + source: { + field: { + name: 'agent.keyword', + }, + indexPatternId: 'indexPattern1', + id: 'agent.keyword', + humanData: { + label: 'agent.keyword', + position: 2, + }, + }, + target: { + layerId: 'annotation', + groupId: 'xAnnotation', + columnId: 'an1', + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + }).layers[0] + ).toEqual({ + layerId: 'annotation', layerType: layerTypes.ANNOTATIONS, indexPatternId: 'indexPattern1', - annotations: [{ ...exampleAnnotation, id: 'an2' }], - ignoreGlobalFilters: true, - }, - ]); - }); - it('should swap the annotations between layers', () => { - expect( - xyVisualization.onDrop!({ - frame, - prevState: { - ...exampleState(), - layers: [ - { - layerId: 'first', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation], - ignoreGlobalFilters: true, + annotations: [ + { + filter: { + language: 'kuery', + query: 'agent.keyword: *', + type: 'kibana_query', }, - { - layerId: 'second', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation2], - ignoreGlobalFilters: true, + icon: 'circle', + id: 'an1', + key: { + type: 'point_in_time', }, - ], - }, - source: { - layerId: 'first', - groupId: 'xAnnotation', - columnId: 'an1', - id: 'an1', - humanData: { label: 'label' }, - filterOperations: () => true, - }, - target: { - layerId: 'second', - groupId: 'xAnnotation', - columnId: 'an2', - filterOperations: () => true, - }, - dropType: 'swap_compatible', - }).layers - ).toEqual([ - { - layerId: 'first', + label: 'agent.keyword: *', + timeField: 'timestamp', + type: 'query', + }, + ], + ignoreGlobalFilters: true, + }); + }); + it('dragging operation: should copy previous column if passed and assign a new id', () => { + expect( + xyVisualization.onDrop!({ + frame, + prevState: { + ...exampleState(), + layers: [ + { + layerId: 'annotation', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation2], + ignoreGlobalFilters: true, + }, + ], + }, + dropType: 'duplicate_compatible', + source: { + layerId: 'annotation', + groupId: 'xAnnotation', + columnId: 'an2', + id: 'an2', + humanData: { label: 'an2' }, + indexPatternId: 'indexPattern1', + }, + target: { + layerId: 'annotation', + groupId: 'xAnnotation', + columnId: 'newColId', + filterOperations: Boolean, + indexPatternId: 'indexPattern1', + }, + }).layers[0] + ).toEqual({ + layerId: 'annotation', layerType: layerTypes.ANNOTATIONS, indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation2], + annotations: [exampleAnnotation2, { ...exampleAnnotation2, id: 'newColId' }], ignoreGlobalFilters: true, - }, - { - layerId: 'second', + }); + }); + it('dragging operation: should reorder a dimension to a annotation layer', () => { + expect( + xyVisualization.onDrop!({ + frame, + prevState: { + ...exampleState(), + layers: [ + { + layerId: 'annotation', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation, exampleAnnotation2], + ignoreGlobalFilters: true, + }, + ], + }, + source: { + layerId: 'annotation', + groupId: 'xAnnotation', + columnId: 'an2', + id: 'an2', + humanData: { label: 'label' }, + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + target: { + layerId: 'annotation', + groupId: 'xAnnotation', + columnId: 'an1', + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + dropType: 'reorder', + }).layers[0] + ).toEqual({ + layerId: 'annotation', layerType: layerTypes.ANNOTATIONS, indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation], + annotations: [exampleAnnotation2, exampleAnnotation], ignoreGlobalFilters: true, - }, - ]); - }); - it('should replace the target in another annotation layer', () => { - expect( - xyVisualization.onDrop!({ - frame, - prevState: { - ...exampleState(), - layers: [ - { - layerId: 'first', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation], - ignoreGlobalFilters: true, - }, - { - layerId: 'second', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation2], - ignoreGlobalFilters: true, - }, - ], + }); + }); + + it('dragging operation: should duplicate the annotations and replace the target in another annotation layer', () => { + expect( + xyVisualization.onDrop!({ + frame, + prevState: { + ...exampleState(), + layers: [ + { + layerId: 'first', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation], + ignoreGlobalFilters: true, + }, + { + layerId: 'second', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation2], + ignoreGlobalFilters: true, + }, + ], + }, + source: { + layerId: 'first', + groupId: 'xAnnotation', + columnId: 'an1', + id: 'an1', + humanData: { label: 'label' }, + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + target: { + layerId: 'second', + groupId: 'xAnnotation', + columnId: 'an2', + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + dropType: 'replace_duplicate_compatible', + }).layers + ).toEqual([ + { + layerId: 'first', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation], + ignoreGlobalFilters: true, }, - source: { + { + layerId: 'second', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [{ ...exampleAnnotation, id: 'an2' }], + ignoreGlobalFilters: true, + }, + ]); + }); + it('dragging operation: should swap the annotations between layers', () => { + expect( + xyVisualization.onDrop!({ + frame, + prevState: { + ...exampleState(), + layers: [ + { + layerId: 'first', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation], + ignoreGlobalFilters: true, + }, + { + layerId: 'second', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation2], + ignoreGlobalFilters: true, + }, + ], + }, + source: { + layerId: 'first', + groupId: 'xAnnotation', + columnId: 'an1', + id: 'an1', + humanData: { label: 'label' }, + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + target: { + layerId: 'second', + groupId: 'xAnnotation', + columnId: 'an2', + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + dropType: 'swap_compatible', + }).layers + ).toEqual([ + { layerId: 'first', - groupId: 'xAnnotation', - columnId: 'an1', - id: 'an1', - humanData: { label: 'label' }, - filterOperations: () => true, + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation2], + ignoreGlobalFilters: true, }, - target: { + { layerId: 'second', - groupId: 'xAnnotation', - columnId: 'an2', - filterOperations: () => true, + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation], + ignoreGlobalFilters: true, }, - dropType: 'replace_compatible', - }).layers - ).toEqual([ - { - layerId: 'first', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [], - ignoreGlobalFilters: true, - }, - { - layerId: 'second', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation], - ignoreGlobalFilters: true, - }, - ]); - }); - it('should move compatible to another annotation layer', () => { - expect( - xyVisualization.onDrop!({ - frame, - prevState: { - ...exampleState(), - layers: [ - { - layerId: 'first', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation], - ignoreGlobalFilters: true, - }, - { - layerId: 'second', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [], - ignoreGlobalFilters: true, - }, - ], + ]); + }); + it('dragging operation: should replace the target in another annotation layer', () => { + expect( + xyVisualization.onDrop!({ + frame, + prevState: { + ...exampleState(), + layers: [ + { + layerId: 'first', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation], + ignoreGlobalFilters: true, + }, + { + layerId: 'second', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation2], + ignoreGlobalFilters: true, + }, + ], + }, + source: { + layerId: 'first', + groupId: 'xAnnotation', + columnId: 'an1', + id: 'an1', + humanData: { label: 'label' }, + filterOperations: () => true, + }, + target: { + layerId: 'second', + groupId: 'xAnnotation', + columnId: 'an2', + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + dropType: 'replace_compatible', + }).layers + ).toEqual([ + { + layerId: 'first', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [], + ignoreGlobalFilters: true, + }, + { + layerId: 'second', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation], + ignoreGlobalFilters: true, }, - source: { + ]); + }); + it('dragging operation: should move compatible to another annotation layer', () => { + expect( + xyVisualization.onDrop!({ + frame, + prevState: { + ...exampleState(), + layers: [ + { + layerId: 'first', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation], + ignoreGlobalFilters: true, + }, + { + layerId: 'second', + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [], + ignoreGlobalFilters: true, + }, + ], + }, + source: { + layerId: 'first', + groupId: 'xAnnotation', + columnId: 'an1', + id: 'an1', + humanData: { label: 'label' }, + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + target: { + layerId: 'second', + groupId: 'xAnnotation', + columnId: 'an2', + filterOperations: () => true, + indexPatternId: 'indexPattern1', + }, + dropType: 'move_compatible', + }).layers + ).toEqual([ + { layerId: 'first', - groupId: 'xAnnotation', - columnId: 'an1', - id: 'an1', - humanData: { label: 'label' }, - filterOperations: () => true, + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [], + ignoreGlobalFilters: true, }, - target: { + { layerId: 'second', - groupId: 'xAnnotation', - columnId: 'an2', - filterOperations: () => true, + layerType: layerTypes.ANNOTATIONS, + indexPatternId: 'indexPattern1', + annotations: [exampleAnnotation], + ignoreGlobalFilters: true, }, - dropType: 'move_compatible', - }).layers - ).toEqual([ - { - layerId: 'first', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [], - ignoreGlobalFilters: true, - }, - { - layerId: 'second', - layerType: layerTypes.ANNOTATIONS, - indexPatternId: 'indexPattern1', - annotations: [exampleAnnotation], - ignoreGlobalFilters: true, - }, - ]); + ]); + }); }); }); }); @@ -2512,4 +2857,81 @@ describe('xy_visualization', () => { }); }); }); + + describe('getSupportedActionsForLayer', () => { + it('should return no actions for a data layer', () => { + expect( + xyVisualization.getSupportedActionsForLayer?.('first', exampleState(), jest.fn()) + ).toHaveLength(0); + }); + + it('should return one action for an annotation layer', () => { + const baseState = exampleState(); + expect( + xyVisualization.getSupportedActionsForLayer?.( + 'annotation', + { + ...baseState, + layers: [ + ...baseState.layers, + { + layerId: 'annotation', + layerType: layerTypes.ANNOTATIONS, + annotations: [exampleAnnotation2], + ignoreGlobalFilters: true, + indexPatternId: 'myIndexPattern', + }, + ], + }, + jest.fn() + ) + ).toEqual([ + expect.objectContaining({ + displayName: 'Keep global filters', + description: + 'All the dimensions configured in this layer respect filters defined at kibana level.', + icon: 'eye', + isCompatible: true, + 'data-test-subj': 'lnsXY_annotationLayer_keepFilters', + }), + ]); + }); + + it('should return an action that performs a state update on click', () => { + const baseState = exampleState(); + const setState = jest.fn(); + const [action] = xyVisualization.getSupportedActionsForLayer?.( + 'annotation', + { + ...baseState, + layers: [ + ...baseState.layers, + { + layerId: 'annotation', + layerType: layerTypes.ANNOTATIONS, + annotations: [exampleAnnotation2], + ignoreGlobalFilters: true, + indexPatternId: 'myIndexPattern', + }, + ], + }, + setState + )!; + action.execute(); + + expect(setState).toHaveBeenCalledWith( + expect.objectContaining({ + layers: expect.arrayContaining([ + { + layerId: 'annotation', + layerType: layerTypes.ANNOTATIONS, + annotations: [exampleAnnotation2], + ignoreGlobalFilters: false, + indexPatternId: 'myIndexPattern', + }, + ]), + }) + ); + }); + }); }); diff --git a/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx b/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx index 34ab6c88ffa1..c013f0cd1d07 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx @@ -20,20 +20,25 @@ import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { generateId } from '../../id_generator'; -import { renewIDs } from '../../utils'; +import { + isDraggedDataViewField, + isOperationFromCompatibleGroup, + isOperationFromTheSameGroup, + renewIDs, +} from '../../utils'; import { getSuggestions } from './xy_suggestions'; import { XyToolbar } from './xy_config_panel'; import { DimensionEditor } from './xy_config_panel/dimension_editor'; import { LayerHeader, LayerHeaderContent } from './xy_config_panel/layer_header'; -import type { Visualization, AccessorConfig, FramePublicAPI } from '../../types'; +import { Visualization, AccessorConfig, FramePublicAPI } from '../../types'; import { - State, + type State, + type XYLayerConfig, + type XYDataLayerConfig, + type SeriesType, + type XYSuggestion, + type PersistedState, visualizationTypes, - XYLayerConfig, - XYDataLayerConfig, - SeriesType, - XYSuggestion, - PersistedState, } from './types'; import { layerTypes } from '../../../common'; import { @@ -79,12 +84,13 @@ import { validateLayersForDimension, } from './visualization_helpers'; import { groupAxesByType } from './axes_configuration'; -import { XYState } from './types'; +import type { XYState } from './types'; import { ReferenceLinePanel } from './xy_config_panel/reference_line_config_panel'; import { AnnotationsPanel } from './xy_config_panel/annotations_config_panel'; import { DimensionTrigger } from '../../shared_components/dimension_trigger'; import { defaultAnnotationLabel } from './annotations/helpers'; import { onDropForVisualization } from '../../editor_frame_service/editor_frame/config_panel/buttons/drop_targets_utils'; +import { createAnnotationActions } from './annotations/actions'; const XY_ID = 'lnsXY'; export const getXyVisualization = ({ @@ -235,6 +241,16 @@ export const getXyVisualization = ({ ]; }, + getSupportedActionsForLayer(layerId, state, setState) { + const layerIndex = state.layers.findIndex((l) => l.layerId === layerId); + const layer = state.layers[layerIndex]; + const actions = []; + if (isAnnotationsLayer(layer)) { + actions.push(...createAnnotationActions({ state, layerIndex, layer, setState })); + } + return actions; + }, + onIndexPatternChange(state, indexPatternId, layerId) { const layerIndex = state.layers.findIndex((l) => l.layerId === layerId); const layer = state.layers[layerIndex]; @@ -366,6 +382,39 @@ export const getXyVisualization = ({ return getFirstDataLayer(state.layers)?.palette; }, + getDropProps(dropProps) { + if (!dropProps.source) { + return; + } + const srcDataView = dropProps.source.indexPatternId; + const targetDataView = dropProps.target.indexPatternId; + if (!targetDataView || srcDataView !== targetDataView) { + return; + } + + if (isDraggedDataViewField(dropProps.source)) { + if (dropProps.source.field.type === 'document') { + return; + } + return dropProps.target.isNewColumn + ? { dropTypes: ['field_add'] } + : { dropTypes: ['field_replace'] }; + } + + if (isOperationFromTheSameGroup(dropProps.source, dropProps.target)) { + return dropProps.target.isNewColumn + ? { dropTypes: ['duplicate_compatible'] } + : { dropTypes: ['reorder'] }; + } + if (isOperationFromCompatibleGroup(dropProps.source, dropProps.target)) { + return { + dropTypes: dropProps.target.isNewColumn + ? ['move_compatible', 'duplicate_compatible'] + : ['replace_compatible', 'replace_duplicate_compatible', 'swap_compatible'], + }; + } + }, + onDrop(props) { const targetLayer: XYLayerConfig | undefined = props.prevState.layers.find( (l) => l.layerId === props.target.layerId @@ -724,6 +773,9 @@ export const getXyVisualization = ({ getUniqueLabels(state) { return getUniqueLabels(state.layers); }, + getUsedDataView(state, layerId) { + return getAnnotationsLayers(state.layers).find((l) => l.layerId === layerId)?.indexPatternId; + }, getUsedDataViews(state) { return ( state?.layers.filter(isAnnotationsLayer).map(({ indexPatternId }) => indexPatternId) ?? [] diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx index a6e1cd6b2ac3..480c0773f452 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx @@ -352,7 +352,11 @@ export const AnnotationsPanel = ( defaultMessage: 'Color', })} /> - setAnnotations({ isHidden: ev.target.checked })} /> @@ -384,31 +388,25 @@ export const AnnotationsPanel = ( ); }; -const ConfigPanelHideSwitch = ({ +const ConfigPanelGenericSwitch = ({ + label, + ['data-test-subj']: dataTestSubj, value, onChange, }: { + label: string; + 'data-test-subj': string; value: boolean; onChange: (event: EuiSwitchEvent) => void; -}) => { - return ( - - - - ); -}; +}) => ( + + + +); diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/helpers.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/helpers.ts index 2ca0f9530bbe..89fbdfd38fcf 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/helpers.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/helpers.ts @@ -97,6 +97,7 @@ export const sanitizeProperties = (annotation: EventAnnotationConfig) => { 'textField', 'filter', 'extraFields', + 'ignoreGlobalFilters', ]); return lineAnnotation; } diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.scss b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.scss index 2b59be0b044f..93bf0e2c7266 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.scss +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/index.scss @@ -14,11 +14,6 @@ margin-top: $euiSizeXS; } -.lnsConfigPanelAnnotations__droppable { - padding: $euiSizeXS; - border-radius: $euiBorderRadiusSmall; -} - .lnsConfigPanelAnnotations__fieldPicker { cursor: pointer; -} \ No newline at end of file +} diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/tooltip_annotation_panel.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/tooltip_annotation_panel.tsx index c44f76427e0a..20a99e8458fc 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/tooltip_annotation_panel.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/tooltip_annotation_panel.tsx @@ -5,19 +5,9 @@ * 2.0. */ -import { - htmlIdGenerator, - EuiButtonIcon, - EuiDraggable, - EuiFlexGroup, - EuiFlexItem, - EuiIcon, - EuiPanel, - useEuiTheme, - EuiText, -} from '@elastic/eui'; +import { htmlIdGenerator, EuiFlexItem, EuiPanel, EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React, { useCallback, useMemo, useState } from 'react'; +import React, { useCallback, useMemo } from 'react'; import { QueryPointEventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; import type { ExistingFieldsMap, IndexPattern } from '../../../../types'; import { @@ -28,8 +18,12 @@ import { useDebouncedValue, NewBucketButton, DragDropBuckets, + DraggableBucketContainer, + FieldsBucketContainer, } from '../../../../shared_components'; +export const MAX_TOOLTIP_FIELDS_SIZE = 2; + const generateId = htmlIdGenerator(); const supportedTypes = new Set(['string', 'boolean', 'number', 'ip', 'date']); @@ -60,8 +54,6 @@ export function TooltipSection({ existingFields, invalidFields, }: FieldInputsProps) { - const { euiTheme } = useEuiTheme(); - const [isDragging, setIsDragging] = useState(false); const onChangeWrapped = useCallback( (values: WrappedValue[]) => { setConfig({ @@ -108,6 +100,7 @@ export function TooltipSection({ label={i18n.translate('xpack.lens.xyChart.annotation.tooltip.addField', { defaultMessage: 'Add field', })} + isDisabled={localValues.length > MAX_TOOLTIP_FIELDS_SIZE} /> ); @@ -132,7 +125,7 @@ export function TooltipSection({ ); } const currentExistingField = existingFields[indexPattern.title]; - const disableActions = localValues.length === 2 && localValues.some(({ isNew }) => isNew); + const options = indexPattern.fields .filter( ({ displayName, type }) => @@ -154,107 +147,62 @@ export function TooltipSection({ ) .sort((a, b) => a.label.localeCompare(b.label)); - const isDragDisabled = localValues.length < 2; - return ( <> -
{ + handleInputChange(updatedValues); }} + droppableId="ANNOTATION_TOOLTIP_DROPPABLE_AREA" + items={localValues} + bgColor="subdued" > - { - handleInputChange(updatedValues); - setIsDragging(false); - }} - onDragStart={() => { - setIsDragging(true); - }} - droppableId="ANNOTATION_TOOLTIP_DROPPABLE_AREA" - items={localValues} - className="lnsConfigPanelAnnotations__droppable" - > - {localValues.map(({ id, value, isNew }, index) => { - const fieldIsValid = value ? Boolean(indexPattern.getFieldByName(value)) : true; - return ( - - {(provided) => ( - - - {/* Empty for spacing */} - - - - - - - - { - handleInputChange(localValues.filter((_, i) => i !== index)); - }} - data-test-subj={`lnsXY-annotation-tooltip-removeField-${index}`} - isDisabled={disableActions && !isNew} - /> - - - - )} - - ); - })} - -
+ {localValues.map(({ id, value, isNew }, index, arrayRef) => { + const fieldIsValid = value ? Boolean(indexPattern.getFieldByName(value)) : true; + + return ( + { + handleInputChange(arrayRef.filter((_, i) => i !== index)); + }} + removeTitle={i18n.translate( + 'xpack.lens.xyChart.annotation.tooltip.deleteButtonLabel', + { + defaultMessage: 'Delete', + } + )} + isNotDraggable={arrayRef.length < 2} + Container={FieldsBucketContainer} + isInsidePanel={true} + data-test-subj={`lnsXY-annotation-tooltip-${index}`} + > + { + onFieldSelectChange(choice, index); + }} + fieldIsInvalid={!fieldIsValid} + className="lnsConfigPanelAnnotations__fieldPicker" + data-test-subj={`lnsXY-annotation-tooltip-field-picker--${index}`} + autoFocus={isNew && value == null} + /> + + ); + })} + {newBucketButton} ); diff --git a/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.test.ts b/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.test.ts index 963a12e9f737..c42b338032f0 100644 --- a/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.test.ts +++ b/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.test.ts @@ -7,10 +7,12 @@ import { RasterTileLayer } from './raster_tile_layer'; import { SOURCE_TYPES } from '../../../../common/constants'; -import { XYZTMSSourceDescriptor } from '../../../../common/descriptor_types'; +import { DataRequestMeta, XYZTMSSourceDescriptor } from '../../../../common/descriptor_types'; import { AbstractSource } from '../../sources/source'; -import { ITMSSource } from '../../sources/tms_source'; import { ILayer } from '../layer'; +import { RasterTileSource } from 'maplibre-gl'; +import { DataRequest } from '../../util/data_request'; +import { IRasterSource, RasterTileSourceData } from '../../sources/raster_source'; const sourceDescriptor: XYZTMSSourceDescriptor = { type: SOURCE_TYPES.EMS_XYZ, @@ -18,12 +20,21 @@ const sourceDescriptor: XYZTMSSourceDescriptor = { id: 'foobar', }; -class MockTileSource extends AbstractSource implements ITMSSource { +class MockTileSource extends AbstractSource implements IRasterSource { readonly _descriptor: XYZTMSSourceDescriptor; constructor(descriptor: XYZTMSSourceDescriptor) { super(descriptor); this._descriptor = descriptor; } + async canSkipSourceUpdate( + dataRequest: DataRequest, + nextRequestMeta: DataRequestMeta + ): Promise { + return true; + } + isSourceStale(mbSource: RasterTileSource, sourceData: RasterTileSourceData): boolean { + return false; + } async getDisplayName(): Promise { return this._descriptor.urlTemplate; diff --git a/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.ts b/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.ts index fc471375e1d3..cc13b70d0106 100644 --- a/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.ts +++ b/x-pack/plugins/maps/public/classes/layers/raster_tile_layer/raster_tile_layer.ts @@ -9,15 +9,11 @@ import type { Map as MbMap, RasterTileSource } from '@kbn/mapbox-gl'; import _ from 'lodash'; import { AbstractLayer } from '../layer'; import { SOURCE_DATA_REQUEST_ID, LAYER_TYPE, LAYER_STYLE_TYPE } from '../../../../common/constants'; -import { LayerDescriptor, Timeslice } from '../../../../common/descriptor_types'; +import { LayerDescriptor } from '../../../../common/descriptor_types'; import { TileStyle } from '../../styles/tile/tile_style'; -import { ITMSSource } from '../../sources/tms_source'; import { DataRequestContext } from '../../../actions'; -import { canSkipSourceUpdate } from '../../util/can_skip_fetch'; -interface RasterTileSourceData { - url: string; -} +import { IRasterSource, RasterTileSourceData } from '../../sources/raster_source'; export class RasterTileLayer extends AbstractLayer { static createDescriptor(options: Partial) { @@ -34,15 +30,15 @@ export class RasterTileLayer extends AbstractLayer { source, layerDescriptor, }: { - source: ITMSSource; + source: IRasterSource; layerDescriptor: LayerDescriptor; }) { super({ source, layerDescriptor }); this._style = new TileStyle(); } - getSource(): ITMSSource { - return super.getSource() as ITMSSource; + getSource(): IRasterSource { + return super.getSource() as IRasterSource; } getStyleForEditing() { @@ -65,17 +61,7 @@ export class RasterTileLayer extends AbstractLayer { }; const prevDataRequest = this.getSourceDataRequest(); if (prevDataRequest) { - const prevMeta = prevDataRequest?.getMeta(); - const canSkip = await canSkipSourceUpdate({ - extentAware: false, - source, - prevDataRequest, - nextRequestMeta: nextMeta, - getUpdateDueToTimeslice: (timeslice?: Timeslice) => { - if (!prevMeta) return true; - return source.getUpdateDueToTimeslice(prevMeta, timeslice); - }, - }); + const canSkip = await source.canSkipSourceUpdate(prevDataRequest, nextMeta); if (canSkip) return; } const requestToken = Symbol(`layer-source-refresh:${this.getId()} - source`); @@ -107,21 +93,20 @@ export class RasterTileLayer extends AbstractLayer { } _requiresPrevSourceCleanup(mbMap: MbMap): boolean { + const source = this.getSource(); const mbSource = mbMap.getSource(this.getMbSourceId()) as RasterTileSource; if (!mbSource) { return false; } const sourceDataRequest = this.getSourceDataRequest(); - if (!sourceDataRequest) { - return false; - } - const sourceData = sourceDataRequest.getData() as RasterTileSourceData | undefined; - if (!sourceData) { - return false; + if (sourceDataRequest) { + const data = sourceDataRequest.getData(); + if (data) { + return source.isSourceStale(mbSource, data as RasterTileSourceData); + } } - - return mbSource.tiles?.[0] !== sourceData.url; + return false; } syncLayerWithMB(mbMap: MbMap) { @@ -138,7 +123,7 @@ export class RasterTileLayer extends AbstractLayer { return; } - const tmsSourceData = sourceDataRequest.getData() as { url?: string }; + const tmsSourceData = sourceDataRequest.getData() as RasterTileSourceData; if (!tmsSourceData || !tmsSourceData.url) { return; } diff --git a/x-pack/plugins/maps/public/classes/sources/kibana_tilemap_source/kibana_tilemap_source.js b/x-pack/plugins/maps/public/classes/sources/kibana_tilemap_source/kibana_tilemap_source.js index db0b5359ca56..19a7ec294110 100644 --- a/x-pack/plugins/maps/public/classes/sources/kibana_tilemap_source/kibana_tilemap_source.js +++ b/x-pack/plugins/maps/public/classes/sources/kibana_tilemap_source/kibana_tilemap_source.js @@ -41,7 +41,15 @@ export class KibanaTilemapSource extends AbstractSource { }, ]; } - + isSourceStale(mbSource, sourceData) { + if (!sourceData.url) { + return false; + } + return mbSource.tiles?.[0] !== sourceData.url; + } + async canSkipSourceUpdate() { + return false; + } async getUrlTemplate() { const tilemap = getKibanaTileMap(); if (!tilemap.url) { diff --git a/x-pack/plugins/maps/public/classes/sources/raster_source/index.ts b/x-pack/plugins/maps/public/classes/sources/raster_source/index.ts new file mode 100644 index 000000000000..53f1b75003ea --- /dev/null +++ b/x-pack/plugins/maps/public/classes/sources/raster_source/index.ts @@ -0,0 +1,18 @@ +/* + * 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 { RasterTileSource } from '@kbn/mapbox-gl'; +import { DataRequest } from '../../util/data_request'; +import { ITMSSource } from '../tms_source'; +import { DataRequestMeta } from '../../../../common/descriptor_types'; +export interface RasterTileSourceData { + url: string; +} +export interface IRasterSource extends ITMSSource { + canSkipSourceUpdate(dataRequest: DataRequest, nextRequestMeta: DataRequestMeta): Promise; + isSourceStale(mbSource: RasterTileSource, sourceData: RasterTileSourceData): boolean; +} diff --git a/x-pack/plugins/maps/public/classes/sources/tms_source/index.ts b/x-pack/plugins/maps/public/classes/sources/tms_source/index.ts index 05207acf7329..d18a00df34f0 100644 --- a/x-pack/plugins/maps/public/classes/sources/tms_source/index.ts +++ b/x-pack/plugins/maps/public/classes/sources/tms_source/index.ts @@ -7,7 +7,6 @@ import { DataFilters } from '../../../../common/descriptor_types'; import { ISource } from '../source'; - export interface ITMSSource extends ISource { getUrlTemplate(dataFilters: DataFilters): Promise; } diff --git a/x-pack/plugins/maps/public/classes/sources/wms_source/wms_source.js b/x-pack/plugins/maps/public/classes/sources/wms_source/wms_source.js index b884785d348a..a1c1c60d7556 100644 --- a/x-pack/plugins/maps/public/classes/sources/wms_source/wms_source.js +++ b/x-pack/plugins/maps/public/classes/sources/wms_source/wms_source.js @@ -27,7 +27,15 @@ export class WMSSource extends AbstractSource { styles, }; } - + isSourceStale(mbSource, sourceData) { + if (!sourceData.url) { + return false; + } + return mbSource.tiles?.[0] !== sourceData.url; + } + async canSkipSourceUpdate() { + return false; + } async getImmutableProperties() { return [ { label: getDataSourceLabel(), value: sourceTitle }, diff --git a/x-pack/plugins/maps/public/classes/sources/xyz_tms_source/xyz_tms_source.ts b/x-pack/plugins/maps/public/classes/sources/xyz_tms_source/xyz_tms_source.ts index 01f77e4a45c3..c2c5e6404c8f 100644 --- a/x-pack/plugins/maps/public/classes/sources/xyz_tms_source/xyz_tms_source.ts +++ b/x-pack/plugins/maps/public/classes/sources/xyz_tms_source/xyz_tms_source.ts @@ -6,19 +6,26 @@ */ import { i18n } from '@kbn/i18n'; +import { RasterTileSource } from 'maplibre-gl'; import { getDataSourceLabel, getUrlLabel } from '../../../../common/i18n_getters'; import { SOURCE_TYPES } from '../../../../common/constants'; import { registerSource } from '../source_registry'; -import { ITMSSource } from '../tms_source'; -import { XYZTMSSourceDescriptor } from '../../../../common/descriptor_types'; +import { + XYZTMSSourceDescriptor, + DataRequestMeta, + Timeslice, +} from '../../../../common/descriptor_types'; import { AbstractSource, ImmutableSourceProperty } from '../source'; import { XYZTMSSourceConfig } from './xyz_tms_editor'; +import { canSkipSourceUpdate } from '../../util/can_skip_fetch'; +import { DataRequest } from '../../util/data_request'; +import { IRasterSource, RasterTileSourceData } from '../raster_source'; export const sourceTitle = i18n.translate('xpack.maps.source.ems_xyzTitle', { defaultMessage: 'Tile Map Service', }); -export class XYZTMSSource extends AbstractSource implements ITMSSource { +export class XYZTMSSource extends AbstractSource implements IRasterSource { static type = SOURCE_TYPES.EMS_XYZ; readonly _descriptor: XYZTMSSourceDescriptor; @@ -49,6 +56,31 @@ export class XYZTMSSource extends AbstractSource implements ITMSSource { async getUrlTemplate(): Promise { return this._descriptor.urlTemplate; } + + isSourceStale(mbSource: RasterTileSource, sourceData: RasterTileSourceData): boolean { + if (!sourceData.url) { + return false; + } + return mbSource.tiles?.[0] !== sourceData.url; + } + + async canSkipSourceUpdate( + prevDataRequest: DataRequest, + nextMeta: DataRequestMeta + ): Promise { + const prevMeta = prevDataRequest?.getMeta(); + const canSkip = await canSkipSourceUpdate({ + extentAware: false, + source: this, + prevDataRequest, + nextRequestMeta: nextMeta, + getUpdateDueToTimeslice: (timeslice?: Timeslice) => { + if (!prevMeta) return true; + return this.getUpdateDueToTimeslice(prevMeta, timeslice); + }, + }); + return canSkip; + } } registerSource({ diff --git a/x-pack/plugins/maps/public/selectors/map_selectors.ts b/x-pack/plugins/maps/public/selectors/map_selectors.ts index 8adb3f8f927a..6ee55bd72e49 100644 --- a/x-pack/plugins/maps/public/selectors/map_selectors.ts +++ b/x-pack/plugins/maps/public/selectors/map_selectors.ts @@ -54,10 +54,10 @@ import { VectorLayerDescriptor, } from '../../common/descriptor_types'; import { ISource } from '../classes/sources/source'; -import { ITMSSource } from '../classes/sources/tms_source'; import { IVectorSource } from '../classes/sources/vector_source'; import { ESGeoGridSource } from '../classes/sources/es_geo_grid_source'; import { EMSTMSSource } from '../classes/sources/ems_tms_source'; +import { IRasterSource } from '../classes/sources/raster_source'; import { ILayer } from '../classes/layers/layer'; import { getIsReadOnly } from './ui_selectors'; @@ -78,7 +78,7 @@ export function createLayerInstance( switch (layerDescriptor.type) { case LAYER_TYPE.RASTER_TILE: - return new RasterTileLayer({ layerDescriptor, source: source as ITMSSource }); + return new RasterTileLayer({ layerDescriptor, source: source as IRasterSource }); case LAYER_TYPE.EMS_VECTOR_TILE: return new EmsVectorTileLayer({ layerDescriptor: layerDescriptor as EMSVectorTileLayerDescriptor, diff --git a/x-pack/plugins/ml/public/application/aiops/explain_log_rate_spikes.tsx b/x-pack/plugins/ml/public/application/aiops/explain_log_rate_spikes.tsx index 2a8ce6e04144..9cfa17fe7194 100644 --- a/x-pack/plugins/ml/public/application/aiops/explain_log_rate_spikes.tsx +++ b/x-pack/plugins/ml/public/application/aiops/explain_log_rate_spikes.tsx @@ -57,6 +57,7 @@ export const ExplainLogRateSpikesPage: FC = () => { 'storage', 'uiSettings', 'unifiedSearch', + 'theme', ])} /> )} diff --git a/x-pack/plugins/ml/public/application/aiops/log_categorization.tsx b/x-pack/plugins/ml/public/application/aiops/log_categorization.tsx index 899006b5918d..3f70e0c58324 100644 --- a/x-pack/plugins/ml/public/application/aiops/log_categorization.tsx +++ b/x-pack/plugins/ml/public/application/aiops/log_categorization.tsx @@ -57,6 +57,7 @@ export const LogCategorizationPage: FC = () => { 'storage', 'uiSettings', 'unifiedSearch', + 'theme', ])} /> )} diff --git a/x-pack/plugins/ml/public/application/app.tsx b/x-pack/plugins/ml/public/application/app.tsx index 8d5958c2f557..1014b4e3a08b 100644 --- a/x-pack/plugins/ml/public/application/app.tsx +++ b/x-pack/plugins/ml/public/application/app.tsx @@ -15,6 +15,7 @@ import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import { Storage } from '@kbn/kibana-utils-plugin/public'; import { KibanaContextProvider, KibanaThemeProvider } from '@kbn/kibana-react-plugin/public'; +import { MlStorageContextProvider } from './contexts/storage'; import { setDependencyCache, clearCache } from './util/dependency_cache'; import { setLicenseCache } from './license'; import type { MlSetupDependencies, MlStartDependencies } from '../plugin'; @@ -109,7 +110,9 @@ const App: FC = ({ coreStart, deps, appMountParams }) => { mlServices: getMlGlobalServices(coreStart.http, deps.usageCollection), }} > - + + + diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/get_filters_for_datafeed_query.test.ts b/x-pack/plugins/ml/public/application/components/anomalies_table/get_filters_for_datafeed_query.test.ts new file mode 100644 index 000000000000..20b52a773d03 --- /dev/null +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/get_filters_for_datafeed_query.test.ts @@ -0,0 +1,94 @@ +/* + * 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 { getFiltersForDSLQuery } from './get_filters_for_datafeed_query'; + +describe('getFiltersForDSLQuery', () => { + describe('when DSL query contains match_all', () => { + test('returns empty array when query contains a must clause that contains match_all', () => { + const actual = getFiltersForDSLQuery( + { bool: { must: [{ match_all: {} }] } }, + 'dataview-id', + 'test-alias' + ); + expect(actual).toEqual([]); + }); + + test('returns empty array when query contains match_all', () => { + const actual = getFiltersForDSLQuery({ match_all: {} }, 'dataview-id', 'test-alias'); + expect(actual).toEqual([]); + }); + }); + + describe('when DSL query is valid', () => { + const query = { + bool: { + must: [], + filter: [ + { + range: { + '@timestamp': { + format: 'strict_date_optional_time', + gte: '2007-09-29T15:05:14.509Z', + lte: '2022-09-29T15:05:14.509Z', + }, + }, + }, + { + match_phrase: { + response_code: '200', + }, + }, + ], + should: [], + must_not: [], + }, + }; + + test('returns filters with alias', () => { + const actual = getFiltersForDSLQuery(query, 'dataview-id', 'test-alias'); + expect(actual).toEqual([ + { + $state: { store: 'appState' }, + meta: { + alias: 'test-alias', + disabled: false, + index: 'dataview-id', + negate: false, + type: 'custom', + value: + '{"bool":{"must":[],"filter":[{"range":{"@timestamp":{"format":"strict_date_optional_time","gte":"2007-09-29T15:05:14.509Z","lte":"2022-09-29T15:05:14.509Z"}}},{"match_phrase":{"response_code":"200"}}],"should":[],"must_not":[]}}', + }, + query, + }, + ]); + }); + + test('returns empty array when dataViewId is invalid', () => { + const actual = getFiltersForDSLQuery(query, null, 'test-alias'); + expect(actual).toEqual([]); + }); + + test('returns filter with no alias if alias is not provided', () => { + const actual = getFiltersForDSLQuery(query, 'dataview-id'); + expect(actual).toEqual([ + { + $state: { store: 'appState' }, + meta: { + disabled: false, + index: 'dataview-id', + negate: false, + type: 'custom', + value: + '{"bool":{"must":[],"filter":[{"range":{"@timestamp":{"format":"strict_date_optional_time","gte":"2007-09-29T15:05:14.509Z","lte":"2022-09-29T15:05:14.509Z"}}},{"match_phrase":{"response_code":"200"}}],"should":[],"must_not":[]}}', + }, + query, + }, + ]); + }); + }); +}); diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/get_filters_for_datafeed_query.ts b/x-pack/plugins/ml/public/application/components/anomalies_table/get_filters_for_datafeed_query.ts new file mode 100644 index 000000000000..08ff962449d2 --- /dev/null +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/get_filters_for_datafeed_query.ts @@ -0,0 +1,45 @@ +/* + * 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 { isPopulatedObject } from '@kbn/ml-is-populated-object'; +import type { SerializableRecord } from '@kbn/utility-types'; +import { FilterStateStore } from '@kbn/es-query'; +import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { isEqual } from 'lodash'; + +const defaultEmptyQuery = { bool: { must: [{ match_all: {} }] } }; + +export const getFiltersForDSLQuery = ( + datafeedQuery: QueryDslQueryContainer, + dataViewId: string | null, + alias?: string +) => { + if ( + datafeedQuery && + !isPopulatedObject(datafeedQuery, ['match_all']) && + !isEqual(datafeedQuery, defaultEmptyQuery) && + dataViewId !== null + ) { + return [ + { + meta: { + index: dataViewId, + ...(!!alias ? { alias } : {}), + negate: false, + disabled: false, + type: 'custom', + value: JSON.stringify(datafeedQuery), + }, + query: datafeedQuery as SerializableRecord, + $state: { + store: FilterStateStore.APP_STATE, + }, + }, + ]; + } + return []; +}; diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.tsx b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.tsx index aa6c80ee5b92..6ad828bc3966 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.tsx +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.tsx @@ -53,6 +53,7 @@ import { useMlKibana } from '../../contexts/kibana'; import { getFieldTypeFromMapping } from '../../services/mapping_service'; import type { AnomaliesTableRecord } from '../../../../common/types/anomalies'; import { getQueryStringForInfluencers } from './get_query_string_for_influencers'; +import { getFiltersForDSLQuery } from './get_filters_for_datafeed_query'; interface LinksMenuProps { anomaly: AnomaliesTableRecord; bounds: TimeRangeBounds; @@ -78,7 +79,14 @@ export const LinksMenuUI = (props: LinksMenuProps) => { services: { data, share, application }, } = kibana; + const job = useMemo(() => { + return mlJobService.getJob(props.anomaly.jobId); + }, [props.anomaly.jobId]); + const getAnomaliesMapsLink = async (anomaly: AnomaliesTableRecord) => { + const index = job.datafeed_config.indices[0]; + const dataViewId = await getDataViewIdFromName(index); + const initialLayers = getInitialAnomaliesLayers(anomaly.jobId); const anomalyBucketStartMoment = moment(anomaly.source.timestamp).tz(getDateFormatTz()); const anomalyBucketStart = anomalyBucketStartMoment.toISOString(); @@ -104,6 +112,7 @@ export const LinksMenuUI = (props: LinksMenuProps) => { }, } : {}), + filters: getFiltersForDSLQuery(job.datafeed_config.query, dataViewId, job.job_id), }); return location; }; @@ -112,6 +121,9 @@ export const LinksMenuUI = (props: LinksMenuProps) => { anomaly: AnomaliesTableRecord, sourceIndicesWithGeoFields: SourceIndicesWithGeoFields ) => { + const index = job.datafeed_config.indices[0]; + const dataViewId = await getDataViewIdFromName(index); + // Create a layer for each of the geoFields const initialLayers = getInitialSourceIndexFieldLayers( sourceIndicesWithGeoFields[anomaly.jobId] @@ -138,10 +150,18 @@ export const LinksMenuUI = (props: LinksMenuProps) => { ); const locator = share.url.locators.get(MAPS_APP_LOCATOR); + const filtersFromDatafeedQuery = getFiltersForDSLQuery( + job.datafeed_config.query, + dataViewId, + job.job_id + ); const location = await locator?.getLocation({ initialLayers, timeRange, - filters: data.query.filterManager.getFilters(), + filters: + filtersFromDatafeedQuery.length > 0 + ? filtersFromDatafeedQuery + : data.query.filterManager.getFilters(), ...(anomaly.entityName && anomaly.entityValue ? { query: { @@ -175,7 +195,6 @@ export const LinksMenuUI = (props: LinksMenuProps) => { } const getDataViewId = async () => { - const job = mlJobService.getJob(props.anomaly.jobId); const index = job.datafeed_config.indices[0]; const dataViewId = await getDataViewIdFromName(index); @@ -246,6 +265,7 @@ export const LinksMenuUI = (props: LinksMenuProps) => { language: 'kuery', query: kqlQuery, }, + filters: getFiltersForDSLQuery(job.datafeed_config.query, dataViewId, job.job_id), sort: [['timestamp, asc']], }); @@ -440,7 +460,6 @@ export const LinksMenuUI = (props: LinksMenuProps) => { const categoryId = props.anomaly.entityValue; const record = props.anomaly.source; - const job = mlJobService.getJob(props.anomaly.jobId); if (job === undefined) { // eslint-disable-next-line no-console console.log(`viewExamples(): no job found with ID: ${props.anomaly.jobId}`); @@ -545,7 +564,7 @@ export const LinksMenuUI = (props: LinksMenuProps) => { const appStateProps: RisonValue = { index: dataViewId, - filters: [], + filters: getFiltersForDSLQuery(job.datafeed_config.query, dataViewId, job.job_id), }; if (query !== null) { appStateProps.query = query; diff --git a/x-pack/plugins/ml/public/application/components/ml_page/notifications_indicator.tsx b/x-pack/plugins/ml/public/application/components/ml_page/notifications_indicator.tsx index d0e3516af3db..2d95f0c97169 100644 --- a/x-pack/plugins/ml/public/application/components/ml_page/notifications_indicator.tsx +++ b/x-pack/plugins/ml/public/application/components/ml_page/notifications_indicator.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import React, { FC, useEffect, useState } from 'react'; +import React, { FC } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { @@ -15,60 +15,14 @@ import { EuiNotificationBadge, EuiToolTip, } from '@elastic/eui'; -import { combineLatest, of, timer } from 'rxjs'; -import { catchError, switchMap } from 'rxjs/operators'; -import moment from 'moment'; import { FIELD_FORMAT_IDS } from '@kbn/field-formats-plugin/common'; import { useFieldFormatter } from '../../contexts/kibana/use_field_formatter'; -import { useAsObservable } from '../../hooks'; -import { NotificationsCountResponse } from '../../../../common/types/notifications'; -import { useMlKibana } from '../../contexts/kibana'; -import { useStorage } from '../../contexts/storage'; -import { ML_NOTIFICATIONS_LAST_CHECKED_AT } from '../../../../common/types/storage'; - -const NOTIFICATIONS_CHECK_INTERVAL = 60000; +import { useMlNotifications } from '../../contexts/ml/ml_notifications_context'; export const NotificationsIndicator: FC = () => { - const { - services: { - mlServices: { mlApiServices }, - }, - } = useMlKibana(); + const { notificationsCounts, latestRequestedAt } = useMlNotifications(); const dateFormatter = useFieldFormatter(FIELD_FORMAT_IDS.DATE); - const [lastCheckedAt] = useStorage(ML_NOTIFICATIONS_LAST_CHECKED_AT); - const lastCheckedAt$ = useAsObservable(lastCheckedAt); - - /** Holds the value used for the actual request */ - const [lastCheckRequested, setLastCheckRequested] = useState(); - const [notificationsCounts, setNotificationsCounts] = useState(); - - useEffect(function startPollingNotifications() { - const subscription = combineLatest([lastCheckedAt$, timer(0, NOTIFICATIONS_CHECK_INTERVAL)]) - .pipe( - switchMap(([lastChecked]) => { - const lastCheckedAtQuery = lastChecked ?? moment().subtract(7, 'd').valueOf(); - setLastCheckRequested(lastCheckedAtQuery); - // Use the latest check time or 7 days ago by default. - return mlApiServices.notifications.countMessages$({ - lastCheckedAt: lastCheckedAtQuery, - }); - }), - catchError((error) => { - // Fail silently for now - return of({} as NotificationsCountResponse); - }) - ) - .subscribe((response) => { - setNotificationsCounts(response); - }); - - return () => { - subscription.unsubscribe(); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - const errorsAndWarningCount = (notificationsCounts?.error ?? 0) + (notificationsCounts?.warning ?? 0); const hasUnread = notificationsCounts && Object.values(notificationsCounts).some((v) => v > 0); @@ -91,7 +45,7 @@ export const NotificationsIndicator: FC = () => { defaultMessage="There {count, plural, one {is # notification} other {are # notifications}} with error or warning level since {lastCheckedAt}" values={{ count: errorsAndWarningCount, - lastCheckedAt: dateFormatter(lastCheckRequested), + lastCheckedAt: dateFormatter(latestRequestedAt), }} /> } @@ -115,7 +69,7 @@ export const NotificationsIndicator: FC = () => { } > diff --git a/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.test.tsx b/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.test.tsx index 5f263b51364e..536cc26888a9 100644 --- a/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.test.tsx +++ b/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.test.tsx @@ -123,7 +123,7 @@ describe('Navigation Menu: ', () => { refreshSubscription.unsubscribe(); }); - test('should not allow disabled pause with 0 refresh interval', () => { + test('should set interval to default of 5s when pause is disabled and refresh interval is 0', () => { // arrange (useUrlState as jest.Mock).mockReturnValue([{ refreshInterval: { pause: false, value: 0 } }]); @@ -137,9 +137,10 @@ describe('Navigation Menu: ', () => { render(); // assert - expect(displayWarningSpy).not.toHaveBeenCalled(); + // Show warning that the interval set is too short + expect(displayWarningSpy).toHaveBeenCalled(); const calledWith = MockedEuiSuperDatePicker.mock.calls[0][0]; - expect(calledWith.isPaused).toBe(true); + expect(calledWith.isPaused).toBe(false); expect(calledWith.refreshInterval).toBe(5000); }); diff --git a/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.tsx b/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.tsx index 75cb787abadc..75c503a13949 100644 --- a/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.tsx +++ b/x-pack/plugins/ml/public/application/components/navigation_menu/date_picker_wrapper/date_picker_wrapper.tsx @@ -126,18 +126,11 @@ export const DatePickerWrapper: FC = () => { timefilter.isTimeRangeSelectorEnabled() ); - const refreshInterval = useMemo((): RefreshInterval => { - const resultInterval = globalState?.refreshInterval ?? timeFilterRefreshInterval; - - /** - * Enforce pause when it's set to false with 0 refresh interval. - */ - const pause = resultInterval.pause || (!resultInterval.pause && resultInterval.value <= 0); - const value = resultInterval.value; - - return { value, pause }; + const refreshInterval = useMemo( + (): RefreshInterval => globalState?.refreshInterval ?? timeFilterRefreshInterval, // eslint-disable-next-line react-hooks/exhaustive-deps - }, [JSON.stringify(globalState?.refreshInterval), timeFilterRefreshInterval]); + [JSON.stringify(globalState?.refreshInterval), timeFilterRefreshInterval] + ); useEffect( function warnAboutShortRefreshInterval() { @@ -251,6 +244,9 @@ export const DatePickerWrapper: FC = () => { isPaused: boolean; refreshInterval: number; }) { + if (pause === false && value <= 0) { + setRefreshInterval({ pause, value: 5000 }); + } setRefreshInterval({ pause, value }); } diff --git a/x-pack/plugins/ml/public/application/contexts/ml/ml_notifications_context.test.tsx b/x-pack/plugins/ml/public/application/contexts/ml/ml_notifications_context.test.tsx new file mode 100644 index 000000000000..4076966942cd --- /dev/null +++ b/x-pack/plugins/ml/public/application/contexts/ml/ml_notifications_context.test.tsx @@ -0,0 +1,140 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { renderHook, act } from '@testing-library/react-hooks'; +import { of } from 'rxjs'; +import { useMlNotifications, MlNotificationsContextProvider } from './ml_notifications_context'; +import { useStorage } from '../storage'; + +const mockCountMessages = jest.fn(() => { + return of({ info: 1, error: 0, warning: 0 }); +}); + +jest.mock('../kibana', () => ({ + useMlKibana: () => { + return { + services: { + mlServices: { + mlApiServices: { + notifications: { + countMessages$: mockCountMessages, + }, + }, + }, + }, + }; + }, +})); + +const mockSetStorageValue = jest.fn(); +jest.mock('../storage', () => ({ + useStorage: jest.fn(() => { + return [undefined, mockSetStorageValue]; + }), +})); + +describe('useMlNotifications', () => { + beforeEach(() => { + jest.useFakeTimers('modern'); + jest.setSystemTime(1663945337063); + }); + + afterEach(() => { + jest.clearAllMocks(); + jest.clearAllTimers(); + jest.useRealTimers(); + }); + + test('returns the default values', () => { + const { result } = renderHook(useMlNotifications, { wrapper: MlNotificationsContextProvider }); + expect(result.current.notificationsCounts).toEqual({ info: 0, error: 0, warning: 0 }); + expect(result.current.latestRequestedAt).toEqual(null); + expect(result.current.lastCheckedAt).toEqual(undefined); + }); + + test('starts polling for notifications with a 1 minute interval during the last week by default ', () => { + const { result } = renderHook(useMlNotifications, { + wrapper: MlNotificationsContextProvider, + }); + + act(() => { + jest.advanceTimersByTime(0); + }); + + expect(mockCountMessages).toHaveBeenCalledTimes(1); + expect(mockCountMessages).toHaveBeenCalledWith({ lastCheckedAt: 1663340537063 }); + expect(result.current.notificationsCounts).toEqual({ info: 1, error: 0, warning: 0 }); + expect(result.current.latestRequestedAt).toEqual(1663340537063); + expect(result.current.lastCheckedAt).toEqual(undefined); + + act(() => { + mockCountMessages.mockReturnValueOnce(of({ info: 1, error: 2, warning: 0 })); + jest.advanceTimersByTime(60000); + }); + + expect(mockCountMessages).toHaveBeenCalledTimes(2); + expect(mockCountMessages).toHaveBeenCalledWith({ lastCheckedAt: 1663340537063 + 60000 }); + expect(result.current.notificationsCounts).toEqual({ info: 1, error: 2, warning: 0 }); + expect(result.current.latestRequestedAt).toEqual(1663340537063 + 60000); + expect(result.current.lastCheckedAt).toEqual(undefined); + }); + + test('starts polling for notifications with a 1 minute interval using the lastCheckedAt from storage', () => { + (useStorage as jest.MockedFunction).mockReturnValue([ + 1664551009292, + mockSetStorageValue, + ]); + const { result } = renderHook(useMlNotifications, { + wrapper: MlNotificationsContextProvider, + }); + + act(() => { + jest.advanceTimersByTime(0); + }); + + expect(mockCountMessages).toHaveBeenCalledTimes(1); + expect(mockCountMessages).toHaveBeenCalledWith({ lastCheckedAt: 1664551009292 }); + expect(result.current.notificationsCounts).toEqual({ info: 1, error: 0, warning: 0 }); + expect(result.current.latestRequestedAt).toEqual(1664551009292); + expect(result.current.lastCheckedAt).toEqual(1664551009292); + }); + + test('switches to polling with the lastCheckedAt from storage when available', () => { + (useStorage as jest.MockedFunction).mockReturnValue([ + undefined, + mockSetStorageValue, + ]); + const { result, rerender } = renderHook(useMlNotifications, { + wrapper: MlNotificationsContextProvider, + }); + + act(() => { + jest.advanceTimersByTime(0); + }); + + expect(mockCountMessages).toHaveBeenCalledTimes(1); + expect(mockCountMessages).toHaveBeenCalledWith({ lastCheckedAt: 1663340537063 }); + expect(result.current.notificationsCounts).toEqual({ info: 1, error: 0, warning: 0 }); + expect(result.current.latestRequestedAt).toEqual(1663340537063); + expect(result.current.lastCheckedAt).toEqual(undefined); + + act(() => { + (useStorage as jest.MockedFunction).mockReturnValue([ + 1664551009292, + mockSetStorageValue, + ]); + }); + + rerender(); + + expect(mockCountMessages).toHaveBeenCalledTimes(2); + expect(mockCountMessages).toHaveBeenCalledWith({ lastCheckedAt: 1664551009292 }); + expect(result.current.notificationsCounts).toEqual({ info: 1, error: 0, warning: 0 }); + expect(result.current.latestRequestedAt).toEqual(1664551009292); + expect(result.current.lastCheckedAt).toEqual(1664551009292); + }); +}); diff --git a/x-pack/plugins/ml/public/application/contexts/ml/ml_notifications_context.tsx b/x-pack/plugins/ml/public/application/contexts/ml/ml_notifications_context.tsx new file mode 100644 index 000000000000..fef04e936667 --- /dev/null +++ b/x-pack/plugins/ml/public/application/contexts/ml/ml_notifications_context.tsx @@ -0,0 +1,91 @@ +/* + * 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 React, { FC, useContext, useEffect, useState } from 'react'; +import { combineLatest, of, timer } from 'rxjs'; +import { catchError, switchMap, map, tap } from 'rxjs/operators'; +import moment from 'moment'; +import { useMlKibana } from '../kibana'; +import { useStorage } from '../storage'; +import { ML_NOTIFICATIONS_LAST_CHECKED_AT } from '../../../../common/types/storage'; +import { useAsObservable } from '../../hooks'; +import type { NotificationsCountResponse } from '../../../../common/types/notifications'; + +const NOTIFICATIONS_CHECK_INTERVAL = 60000; + +export const MlNotificationsContext = React.createContext<{ + notificationsCounts: NotificationsCountResponse; + /** Timestamp of the latest notification checked by the user */ + lastCheckedAt: number | null; + /** Holds the value used for the actual request */ + latestRequestedAt: number | null; + setLastCheckedAt: (v: number) => void; +}>({ + notificationsCounts: { info: 0, error: 0, warning: 0 }, + lastCheckedAt: null, + latestRequestedAt: null, + setLastCheckedAt: () => {}, +}); + +export const MlNotificationsContextProvider: FC = ({ children }) => { + const { + services: { + mlServices: { mlApiServices }, + }, + } = useMlKibana(); + + const [lastCheckedAt, setLastCheckedAt] = useStorage(ML_NOTIFICATIONS_LAST_CHECKED_AT); + const lastCheckedAt$ = useAsObservable(lastCheckedAt); + + /** Holds the value used for the actual request */ + const [latestRequestedAt, setLatestRequestedAt] = useState(null); + const [notificationsCounts, setNotificationsCounts] = useState({ + info: 0, + error: 0, + warning: 0, + }); + + useEffect(function startPollingNotifications() { + const subscription = combineLatest([lastCheckedAt$, timer(0, NOTIFICATIONS_CHECK_INTERVAL)]) + .pipe( + // Use the latest check time or 7 days ago by default. + map(([lastChecked]) => lastChecked ?? moment().subtract(7, 'd').valueOf()), + tap((lastCheckedAtQuery) => { + setLatestRequestedAt(lastCheckedAtQuery); + }), + switchMap((lastCheckedAtQuery) => + mlApiServices.notifications.countMessages$({ + lastCheckedAt: lastCheckedAtQuery, + }) + ), + catchError((error) => { + // Fail silently for now + return of({} as NotificationsCountResponse); + }) + ) + .subscribe((response) => { + setNotificationsCounts(response); + }); + + return () => { + subscription.unsubscribe(); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return ( + + {children} + + ); +}; + +export function useMlNotifications() { + return useContext(MlNotificationsContext); +} diff --git a/x-pack/plugins/ml/public/application/contexts/storage/storage_context.tsx b/x-pack/plugins/ml/public/application/contexts/storage/storage_context.tsx index c2b00a176c08..65e2a64ee318 100644 --- a/x-pack/plugins/ml/public/application/contexts/storage/storage_context.tsx +++ b/x-pack/plugins/ml/public/application/contexts/storage/storage_context.tsx @@ -33,10 +33,12 @@ export const MlStorageContextProvider: FC = ({ children }) => { services: { storage }, } = useMlKibana(); - const initialValue = ML_STORAGE_KEYS.reduce((acc, curr) => { - acc[curr as MlStorageKey] = storage.get(curr); - return acc; - }, {} as Exclude); + const initialValue = useMemo(() => { + return ML_STORAGE_KEYS.reduce((acc, curr) => { + acc[curr as MlStorageKey] = storage.get(curr); + return acc; + }, {} as Exclude); + }, [storage]); const [state, setState] = useState(initialValue); @@ -44,21 +46,20 @@ export const MlStorageContextProvider: FC = ({ children }) => { >(key: K, value: T) => { storage.set(key, value); - const update = { - ...state, + setState((prevState) => ({ + ...prevState, [key]: value, - }; - setState(update); + })); }, - [state, storage] + [storage] ); const removeStorageValue = useCallback( (key: MlStorageKey) => { storage.remove(key); - setState(omit(state, key)); + setState((prevState) => omit(prevState, key)); }, - [state, storage] + [storage] ); useEffect(function updateStorageOnExternalChange() { diff --git a/x-pack/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js b/x-pack/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js index 1824d8e91e74..9c2fa8383b7a 100644 --- a/x-pack/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js +++ b/x-pack/plugins/ml/public/application/jobs/components/custom_url_editor/utils.js @@ -20,6 +20,7 @@ import { getSavedObjectsClient, getDashboard } from '../../../util/dependency_ca import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/public'; import { cleanEmptyKeys } from '@kbn/dashboard-plugin/public'; import { isFilterPinned } from '@kbn/es-query'; +import { getFiltersForDSLQuery } from '../../../components/anomalies_table/get_filters_for_datafeed_query'; export function getNewCustomUrlDefaults(job, dashboards, dataViews) { // Returns the settings object in the format used by the custom URL editor @@ -50,6 +51,11 @@ export function getNewCustomUrlDefaults(job, dashboards, dataViews) { const indicesName = datafeedConfig.indices.join(); const defaultDataViewId = dataViews.find((dv) => dv.title === indicesName)?.id; kibanaSettings.discoverIndexPatternId = defaultDataViewId; + kibanaSettings.filters = getFiltersForDSLQuery( + job.datafeed_config.query, + defaultDataViewId, + job.job_id + ); } return { @@ -133,16 +139,18 @@ async function buildDashboardUrlFromSettings(settings) { const response = await savedObjectsClient.get('dashboard', dashboardId); - // Use the filters from the saved dashboard if there are any. - let filters = []; + // Query from the datafeed config will be saved as custom filters + // Use them if there are set. + let filters = settings.kibanaSettings.filters; // Use the query from the dashboard only if no job entities are selected. let query = undefined; + // Override with filters and queries from saved dashboard if they are available. const searchSourceJSON = response.get('kibanaSavedObjectMeta.searchSourceJSON'); if (searchSourceJSON !== undefined) { const searchSourceData = JSON.parse(searchSourceJSON); - if (searchSourceData.filter !== undefined) { + if (Array.isArray(searchSourceData.filter) && searchSourceData.filter.length > 0) { filters = searchSourceData.filter; } query = searchSourceData.query; @@ -196,7 +204,7 @@ async function buildDashboardUrlFromSettings(settings) { } function buildDiscoverUrlFromSettings(settings) { - const { discoverIndexPatternId, queryFieldNames } = settings.kibanaSettings; + const { discoverIndexPatternId, queryFieldNames, filters } = settings.kibanaSettings; // Add time settings to the global state URL parameter with $earliest$ and // $latest$ tokens which get substituted for times around the time of the @@ -212,6 +220,7 @@ function buildDiscoverUrlFromSettings(settings) { // Add the index pattern and query to the appState part of the URL. const appState = { index: discoverIndexPatternId, + filters, }; // If partitioning field entities have been configured add tokens diff --git a/x-pack/plugins/ml/public/application/notifications/components/notifications_list.tsx b/x-pack/plugins/ml/public/application/notifications/components/notifications_list.tsx index 9ea6aa1b70f0..cd68f366b57a 100644 --- a/x-pack/plugins/ml/public/application/notifications/components/notifications_list.tsx +++ b/x-pack/plugins/ml/public/application/notifications/components/notifications_list.tsx @@ -22,9 +22,8 @@ import { import { EuiBasicTableColumn } from '@elastic/eui/src/components/basic_table/basic_table'; import { FIELD_FORMAT_IDS } from '@kbn/field-formats-plugin/common'; import useDebounce from 'react-use/lib/useDebounce'; +import { useMlNotifications } from '../../contexts/ml/ml_notifications_context'; import { ML_NOTIFICATIONS_MESSAGE_LEVEL } from '../../../../common/constants/notifications'; -import { ML_NOTIFICATIONS_LAST_CHECKED_AT } from '../../../../common/types/storage'; -import { useStorage } from '../../contexts/storage'; import { SavedObjectsWarning } from '../../components/saved_objects_warning'; import { useTimefilter, useTimeRangeUpdates } from '../../contexts/kibana/use_timefilter'; import { useToastNotificationService } from '../../services/toast_notification_service'; @@ -61,7 +60,8 @@ export const NotificationsList: FC = () => { } = useMlKibana(); const { displayErrorToast } = useToastNotificationService(); - const [lastCheckedAt, setLastCheckedAt] = useStorage(ML_NOTIFICATIONS_LAST_CHECKED_AT); + const { lastCheckedAt, setLastCheckedAt, notificationsCounts, latestRequestedAt } = + useMlNotifications(); const timeFilter = useTimefilter(); const timeRange = useTimeRangeUpdates(); @@ -280,10 +280,29 @@ export const NotificationsList: FC = () => { ]; }, []); + const newNotificationsCount = Object.values(notificationsCounts).reduce((a, b) => a + b); + return ( <> + {newNotificationsCount ? ( + <> + + } + iconType="bell" + /> + + + ) : null} + = ({ pageDeps }) => ( - - + + - - + + ); diff --git a/x-pack/plugins/observability/public/config/register_alerts_table_configuration.tsx b/x-pack/plugins/observability/public/config/register_alerts_table_configuration.tsx index b9600088af3b..bc41b8d80328 100644 --- a/x-pack/plugins/observability/public/config/register_alerts_table_configuration.tsx +++ b/x-pack/plugins/observability/public/config/register_alerts_table_configuration.tsx @@ -16,9 +16,11 @@ import { addDisplayNames } from '../pages/alerts/containers/alerts_table_t_grid/ import { columns as alertO11yColumns } from '../pages/alerts/containers/alerts_table_t_grid/alerts_table_t_grid'; import { getRowActions } from '../pages/alerts/containers/alerts_table_t_grid/get_row_actions'; import type { ObservabilityRuleTypeRegistry } from '../rules/create_observability_rule_type_registry'; +import type { ConfigSchema } from '../plugin'; const getO11yAlertsTableConfiguration = ( - observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry + observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry, + config: ConfigSchema ) => ({ id: observabilityFeatureId, casesFeatureId, @@ -33,7 +35,7 @@ const getO11yAlertsTableConfiguration = ( }, }, ], - useActionsColumn: getRowActions(observabilityRuleTypeRegistry), + useActionsColumn: getRowActions(observabilityRuleTypeRegistry, config), useBulkActions: useBulkAddToCaseActions, useInternalFlyout: () => { const { header, body, footer } = useToGetInternalFlyout(observabilityRuleTypeRegistry); diff --git a/x-pack/plugins/observability/public/pages/alerts/components/alerts_flyout/alerts_flyout_footer.tsx b/x-pack/plugins/observability/public/pages/alerts/components/alerts_flyout/alerts_flyout_footer.tsx index 3a6bcb8d28f2..eecadba66b61 100644 --- a/x-pack/plugins/observability/public/pages/alerts/components/alerts_flyout/alerts_flyout_footer.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/components/alerts_flyout/alerts_flyout_footer.tsx @@ -18,7 +18,7 @@ export default function AlertsFlyoutFooter({ alert, isInApp }: FlyoutProps & { i const { http } = services; const prepend = http?.basePath.prepend; const getAlertDetailsButton = () => { - if (!config.unsafe.alertDetails.enabled || !alert) return <>; + if (!config?.unsafe?.alertDetails.enabled || !alert) return <>; return ( ({ describe('ObservabilityActions component', () => { const setup = async (pageId: string) => { const props: ObservabilityActionsProps = { + config, eventId: '6d4c6d74-d51a-495c-897d-88ced3b95e30', ecsData: { _id: '6d4c6d74-d51a-495c-897d-88ced3b95e30', diff --git a/x-pack/plugins/observability/public/pages/alerts/components/observability_actions.tsx b/x-pack/plugins/observability/public/pages/alerts/components/observability_actions.tsx index eddead1fa90d..2ebb4629ba7b 100644 --- a/x-pack/plugins/observability/public/pages/alerts/components/observability_actions.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/components/observability_actions.tsx @@ -19,7 +19,6 @@ import React, { useMemo, useState, useCallback } from 'react'; import { CaseAttachmentsWithoutOwner } from '@kbn/cases-plugin/public'; import { CommentType } from '@kbn/cases-plugin/common'; import type { ActionProps } from '@kbn/timelines-plugin/common'; -import { usePluginContext } from '../../../hooks/use_plugin_context'; import { useKibana } from '../../../utils/kibana_react'; import { useGetUserCasesPermissions } from '../../../hooks/use_get_user_cases_permissions'; import { parseAlert } from './parse_alert'; @@ -33,6 +32,7 @@ import { RULE_DETAILS_PAGE_ID } from '../../rule_details/types'; import type { TopAlert } from '../containers/alerts_page/types'; import { ObservabilityRuleTypeRegistry } from '../../..'; import { ALERT_DETAILS_PAGE_ID } from '../../alert_details/types'; +import { ConfigSchema } from '../../../plugin'; export type ObservabilityActionsProps = Pick< ActionProps, @@ -41,6 +41,7 @@ export type ObservabilityActionsProps = Pick< setFlyoutAlert: React.Dispatch>; observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry; id?: string; + config: ConfigSchema; }; export function ObservabilityActions({ @@ -49,12 +50,12 @@ export function ObservabilityActions({ ecsData, id: pageId, observabilityRuleTypeRegistry, + config, setFlyoutAlert, }: ObservabilityActionsProps) { const dataFieldEs = data.reduce((acc, d) => ({ ...acc, [d.field]: d.value }), {}); const [openActionsPopoverId, setActionsPopover] = useState(null); const { cases, http } = useKibana().services; - const { config } = usePluginContext(); const parseObservabilityAlert = useMemo( () => parseAlert(observabilityRuleTypeRegistry), @@ -108,7 +109,6 @@ export function ObservabilityActions({ selectCaseModal.open({ attachments: caseAttachments }); closeActionsPopover(); }, [caseAttachments, closeActionsPopover, selectCaseModal]); - const actionsMenuItems = useMemo(() => { return [ ...(userCasesPermissions.create && userCasesPermissions.read @@ -143,7 +143,7 @@ export function ObservabilityActions({ : []), ...[ - config.unsafe.alertDetails.enabled && linkToAlert ? ( + config?.unsafe?.alertDetails.enabled && linkToAlert ? ( ().services; - const { observabilityRuleTypeRegistry } = usePluginContext(); + const { observabilityRuleTypeRegistry, config } = usePluginContext(); const [flyoutAlert, setFlyoutAlert] = useState(undefined); const [tGridState, setTGridState] = useState | null>( @@ -210,13 +210,14 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) { setEventsDeleted={setEventsDeleted} setFlyoutAlert={setFlyoutAlert} observabilityRuleTypeRegistry={observabilityRuleTypeRegistry} + config={config} /> ); }, }, ]; - }, [setEventsDeleted, observabilityRuleTypeRegistry]); + }, [setEventsDeleted, observabilityRuleTypeRegistry, config]); const onStateChange = useCallback( (state: TGridState) => { diff --git a/x-pack/plugins/observability/public/pages/alerts/containers/alerts_table_t_grid/get_row_actions.tsx b/x-pack/plugins/observability/public/pages/alerts/containers/alerts_table_t_grid/get_row_actions.tsx index 26af88484057..0cf6c092dc70 100644 --- a/x-pack/plugins/observability/public/pages/alerts/containers/alerts_table_t_grid/get_row_actions.tsx +++ b/x-pack/plugins/observability/public/pages/alerts/containers/alerts_table_t_grid/get_row_actions.tsx @@ -9,6 +9,7 @@ import { EcsFieldsResponse } from '@kbn/rule-registry-plugin/common/search_strat import { ObservabilityRuleTypeRegistry } from '../../../../rules/create_observability_rule_type_registry'; import { ObservabilityActions } from '../../components/observability_actions'; import type { ObservabilityActionsProps } from '../../components/observability_actions'; +import type { ConfigSchema } from '../../../../plugin'; const buildData = (alerts: EcsFieldsResponse): ObservabilityActionsProps['data'] => { return Object.entries(alerts).reduce( @@ -17,7 +18,10 @@ const buildData = (alerts: EcsFieldsResponse): ObservabilityActionsProps['data'] ); }; const fakeSetEventsDeleted = () => []; -export const getRowActions = (observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry) => { +export const getRowActions = ( + observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry, + config: ConfigSchema +) => { return () => ({ renderCustomActionsRow: ( alert: EcsFieldsResponse, @@ -33,6 +37,7 @@ export const getRowActions = (observabilityRuleTypeRegistry: ObservabilityRuleTy observabilityRuleTypeRegistry={observabilityRuleTypeRegistry} setEventsDeleted={fakeSetEventsDeleted} setFlyoutAlert={setFlyoutAlert} + config={config} /> ); }, diff --git a/x-pack/plugins/observability/public/plugin.ts b/x-pack/plugins/observability/public/plugin.ts index 6c84eb2588a0..161fe2851ae3 100644 --- a/x-pack/plugins/observability/public/plugin.ts +++ b/x-pack/plugins/observability/public/plugin.ts @@ -294,7 +294,10 @@ export class Plugin const { getO11yAlertsTableConfiguration } = await import( './config/register_alerts_table_configuration' ); - return getO11yAlertsTableConfiguration(this.observabilityRuleTypeRegistry); + return getO11yAlertsTableConfiguration( + this.observabilityRuleTypeRegistry, + this.initContext.config.get() + ); }; const { alertsTableConfigurationRegistry } = pluginsStart.triggersActionsUi; diff --git a/x-pack/plugins/security/server/authentication/unauthenticated_page.test.tsx b/x-pack/plugins/security/server/authentication/unauthenticated_page.test.tsx index 708ca11ca8f7..aca2a5dd77e6 100644 --- a/x-pack/plugins/security/server/authentication/unauthenticated_page.test.tsx +++ b/x-pack/plugins/security/server/authentication/unauthenticated_page.test.tsx @@ -12,7 +12,7 @@ import { coreMock } from '@kbn/core/server/mocks'; import { UnauthenticatedPage } from './unauthenticated_page'; -jest.mock('@kbn/core/server/rendering/views/fonts', () => ({ +jest.mock('@kbn/core-rendering-server-internal', () => ({ Fonts: () => <>MockedFonts, })); diff --git a/x-pack/plugins/security/server/authorization/reset_session_page.test.tsx b/x-pack/plugins/security/server/authorization/reset_session_page.test.tsx index d5bce1e146eb..8111246f0776 100644 --- a/x-pack/plugins/security/server/authorization/reset_session_page.test.tsx +++ b/x-pack/plugins/security/server/authorization/reset_session_page.test.tsx @@ -12,7 +12,7 @@ import { coreMock } from '@kbn/core/server/mocks'; import { ResetSessionPage } from './reset_session_page'; -jest.mock('@kbn/core/server/rendering/views/fonts', () => ({ +jest.mock('@kbn/core-rendering-server-internal', () => ({ Fonts: () => <>MockedFonts, })); diff --git a/x-pack/plugins/security/server/prompt_page.test.tsx b/x-pack/plugins/security/server/prompt_page.test.tsx index 11b45f62f05d..ef59cacd31bf 100644 --- a/x-pack/plugins/security/server/prompt_page.test.tsx +++ b/x-pack/plugins/security/server/prompt_page.test.tsx @@ -12,7 +12,7 @@ import { coreMock } from '@kbn/core/server/mocks'; import { PromptPage } from './prompt_page'; -jest.mock('@kbn/core/server/rendering/views/fonts', () => ({ +jest.mock('@kbn/core-rendering-server-internal', () => ({ Fonts: () => <>MockedFonts, })); diff --git a/x-pack/plugins/security/server/prompt_page.tsx b/x-pack/plugins/security/server/prompt_page.tsx index e15574d5af4e..14f59df15db3 100644 --- a/x-pack/plugins/security/server/prompt_page.tsx +++ b/x-pack/plugins/security/server/prompt_page.tsx @@ -20,8 +20,8 @@ import createCache from '@emotion/cache'; import type { ReactNode } from 'react'; import React from 'react'; +import { Fonts } from '@kbn/core-rendering-server-internal'; import type { IBasePath } from '@kbn/core/server'; -import { Fonts } from '@kbn/core/server/rendering/views/fonts'; import { i18n } from '@kbn/i18n'; import { I18nProvider } from '@kbn/i18n-react'; import UiSharedDepsNpm from '@kbn/ui-shared-deps-npm'; diff --git a/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.test.ts b/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.test.ts index b9c0dcff2054..e5b2f78c2547 100644 --- a/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.test.ts +++ b/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.test.ts @@ -108,37 +108,64 @@ describe('Endpoint Authz service', () => { }); }); - describe('endpoint rbac is enabled', () => { - describe('canIsolateHost', () => { - it('should be true if packagePrivilege.writeHostIsolation is true', () => { - fleetAuthz.packagePrivileges!.endpoint.actions.writeHostIsolation.executePackageAction = - true; - const authz = calculateEndpointAuthz(licenseService, fleetAuthz, userRoles, true); - expect(authz.canIsolateHost).toBe(true); - }); - - it('should be false if packagePrivilege.writeHostIsolation is false', () => { - fleetAuthz.packagePrivileges!.endpoint.actions.writeHostIsolation.executePackageAction = - false; - const authz = calculateEndpointAuthz(licenseService, fleetAuthz, userRoles, true); - expect(authz.canIsolateHost).toBe(false); - }); + describe('and endpoint rbac is enabled', () => { + it.each<[EndpointAuthzKeyList[number], string]>([ + ['canWriteEndpointList', 'writeEndpointList'], + ['canReadEndpointList', 'readEndpointList'], + ['canWritePolicyManagement', 'writePolicyManagement'], + ['canReadPolicyManagement', 'readPolicyManagement'], + ['canWriteActionsLogManagement', 'writeActionsLogManagement'], + ['canReadActionsLogManagement', 'readActionsLogManagement'], + ['canIsolateHost', 'writeHostIsolation'], + ['canUnIsolateHost', 'writeHostIsolation'], + ['canKillProcess', 'writeProcessOperations'], + ['canSuspendProcess', 'writeProcessOperations'], + ['canGetRunningProcesses', 'writeProcessOperations'], + ['canWriteFileOperations', 'writeFileOperations'], + ['canWriteTrustedApplications', 'writeTrustedApplications'], + ['canReadTrustedApplications', 'readTrustedApplications'], + ['canWriteHostIsolationExceptions', 'writeHostIsolationExceptions'], + ['canReadHostIsolationExceptions', 'readHostIsolationExceptions'], + ['canWriteBlocklist', 'writeBlocklist'], + ['canReadBlocklist', 'readBlocklist'], + ['canWriteEventFilters', 'writeEventFilters'], + ['canReadEventFilters', 'readEventFilters'], + ])('%s should be true if `packagePrivilege.%s` is `true`', (auth) => { + const authz = calculateEndpointAuthz(licenseService, fleetAuthz, userRoles, true); + expect(authz[auth]).toBe(true); }); - describe('canUnIsolateHost', () => { - it('should be true if packagePrivilege.writeHostIsolation is true', () => { - fleetAuthz.packagePrivileges!.endpoint.actions.writeHostIsolation.executePackageAction = - true; - const authz = calculateEndpointAuthz(licenseService, fleetAuthz, userRoles, true); - expect(authz.canUnIsolateHost).toBe(true); - }); - - it('should be false if packagePrivilege.writeHostIsolation is false', () => { - fleetAuthz.packagePrivileges!.endpoint.actions.writeHostIsolation.executePackageAction = - false; - const authz = calculateEndpointAuthz(licenseService, fleetAuthz, userRoles, true); - expect(authz.canUnIsolateHost).toBe(false); + it.each<[EndpointAuthzKeyList[number], string[]]>([ + ['canWriteEndpointList', ['writeEndpointList']], + ['canReadEndpointList', ['writeEndpointList', 'readEndpointList']], + ['canWritePolicyManagement', ['writePolicyManagement']], + ['canReadPolicyManagement', ['writePolicyManagement', 'readPolicyManagement']], + ['canWriteActionsLogManagement', ['writeActionsLogManagement']], + ['canReadActionsLogManagement', ['writeActionsLogManagement', 'readActionsLogManagement']], + ['canIsolateHost', ['writeHostIsolation']], + ['canUnIsolateHost', ['writeHostIsolation']], + ['canKillProcess', ['writeProcessOperations']], + ['canSuspendProcess', ['writeProcessOperations']], + ['canGetRunningProcesses', ['writeProcessOperations']], + ['canWriteFileOperations', ['writeFileOperations']], + ['canWriteTrustedApplications', ['writeTrustedApplications']], + ['canReadTrustedApplications', ['writeTrustedApplications', 'readTrustedApplications']], + ['canWriteHostIsolationExceptions', ['writeHostIsolationExceptions']], + [ + 'canReadHostIsolationExceptions', + ['writeHostIsolationExceptions', 'readHostIsolationExceptions'], + ], + ['canWriteBlocklist', ['writeBlocklist']], + ['canReadBlocklist', ['writeBlocklist', 'readBlocklist']], + ['canWriteEventFilters', ['writeEventFilters']], + ['canReadEventFilters', ['writeEventFilters', 'readEventFilters']], + ])('%s should be false if `packagePrivilege.%s` is `false`', (auth, privileges) => { + // read permission checks for write || read so we need to set both to false + privileges.forEach((privilege) => { + fleetAuthz.packagePrivileges!.endpoint.actions[privilege].executePackageAction = false; }); + const authz = calculateEndpointAuthz(licenseService, fleetAuthz, userRoles, true); + expect(authz[auth]).toBe(false); }); }); }); @@ -148,13 +175,28 @@ describe('Endpoint Authz service', () => { expect(getEndpointAuthzInitialState()).toEqual({ canAccessFleet: false, canAccessEndpointManagement: false, + canCreateArtifactsByPolicy: false, + canWriteEndpointList: false, + canReadEndpointList: false, + canWritePolicyManagement: false, + canReadPolicyManagement: false, + canWriteActionsLogManagement: false, + canReadActionsLogManagement: false, canIsolateHost: false, canUnIsolateHost: true, - canCreateArtifactsByPolicy: false, canKillProcess: false, canSuspendProcess: false, canGetRunningProcesses: false, canAccessResponseConsole: false, + canWriteFileOperations: false, + canWriteTrustedApplications: false, + canReadTrustedApplications: false, + canWriteHostIsolationExceptions: false, + canReadHostIsolationExceptions: false, + canWriteBlocklist: false, + canReadBlocklist: false, + canWriteEventFilters: false, + canReadEventFilters: false, }); }); }); diff --git a/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.ts b/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.ts index bc40bd11f5d7..dde2a7f92b1e 100644 --- a/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.ts +++ b/x-pack/plugins/security_solution/common/endpoint/service/authz/authz.ts @@ -5,11 +5,23 @@ * 2.0. */ -import type { FleetAuthz } from '@kbn/fleet-plugin/common'; +import type { ENDPOINT_PRIVILEGES } from '@kbn/fleet-plugin/common'; +import { type FleetAuthz } from '@kbn/fleet-plugin/common'; import type { LicenseService } from '../../../license'; import type { EndpointAuthz } from '../../types/authz'; import type { MaybeImmutable } from '../../types'; +function hasPermission( + fleetAuthz: FleetAuthz, + isEndpointRbacEnabled: boolean, + hasEndpointManagementAccess: boolean, + privilege: typeof ENDPOINT_PRIVILEGES[number] +) { + return isEndpointRbacEnabled + ? fleetAuthz.packagePrivileges?.endpoint?.actions[privilege].executePackageAction ?? false + : hasEndpointManagementAccess; +} + /** * Used by both the server and the UI to generate the Authorization for access to Endpoint related * functionality @@ -22,28 +34,150 @@ export const calculateEndpointAuthz = ( licenseService: LicenseService, fleetAuthz: FleetAuthz, userRoles: MaybeImmutable, - // to be used in follow-up PRs isEndpointRbacEnabled: boolean = false ): EndpointAuthz => { const isPlatinumPlusLicense = licenseService.isPlatinumPlus(); const isEnterpriseLicense = licenseService.isEnterprise(); const hasEndpointManagementAccess = userRoles.includes('superuser'); - const canIsolateHost = isEndpointRbacEnabled - ? fleetAuthz.packagePrivileges?.endpoint?.actions?.writeHostIsolation?.executePackageAction || - false - : hasEndpointManagementAccess; + const canWriteEndpointList = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writeEndpointList' + ); + const canReadEndpointList = + canWriteEndpointList || + hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'readEndpointList' + ); + const canWritePolicyManagement = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writePolicyManagement' + ); + const canReadPolicyManagement = + canWritePolicyManagement || + hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'readPolicyManagement' + ); + const canWriteActionsLogManagement = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writeActionsLogManagement' + ); + const canReadActionsLogManagement = + canWriteActionsLogManagement || + hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'readActionsLogManagement' + ); + const canIsolateHost = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writeHostIsolation' + ); + const canWriteProcessOperations = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writeProcessOperations' + ); + const canWriteTrustedApplications = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writeTrustedApplications' + ); + const canReadTrustedApplications = + canWriteTrustedApplications || + hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'readTrustedApplications' + ); + const canWriteHostIsolationExceptions = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writeHostIsolationExceptions' + ); + const canReadHostIsolationExceptions = + canWriteHostIsolationExceptions || + hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'readHostIsolationExceptions' + ); + const canWriteBlocklist = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writeBlocklist' + ); + const canReadBlocklist = + canWriteBlocklist || + hasPermission(fleetAuthz, isEndpointRbacEnabled, hasEndpointManagementAccess, 'readBlocklist'); + const canWriteEventFilters = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writeEventFilters' + ); + const canReadEventFilters = + canWriteEventFilters || + hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'readEventFilters' + ); + const canWriteFileOperations = hasPermission( + fleetAuthz, + isEndpointRbacEnabled, + hasEndpointManagementAccess, + 'writeFileOperations' + ); return { canAccessFleet: fleetAuthz?.fleet.all ?? userRoles.includes('superuser'), canAccessEndpointManagement: hasEndpointManagementAccess, canCreateArtifactsByPolicy: hasEndpointManagementAccess && isPlatinumPlusLicense, + canWriteEndpointList, + canReadEndpointList, + canWritePolicyManagement, + canReadPolicyManagement, + canWriteActionsLogManagement, + canReadActionsLogManagement, // Response Actions - canIsolateHost: isPlatinumPlusLicense && canIsolateHost, + canIsolateHost: canIsolateHost && isPlatinumPlusLicense, canUnIsolateHost: canIsolateHost, - canKillProcess: hasEndpointManagementAccess && isEnterpriseLicense, - canSuspendProcess: hasEndpointManagementAccess && isEnterpriseLicense, - canGetRunningProcesses: hasEndpointManagementAccess && isEnterpriseLicense, + canKillProcess: canWriteProcessOperations && isEnterpriseLicense, + canSuspendProcess: canWriteProcessOperations && isEnterpriseLicense, + canGetRunningProcesses: canWriteProcessOperations && isEnterpriseLicense, canAccessResponseConsole: hasEndpointManagementAccess && isEnterpriseLicense, + canWriteFileOperations: canWriteFileOperations && isEnterpriseLicense, + // artifacts + canWriteTrustedApplications, + canReadTrustedApplications, + canWriteHostIsolationExceptions: canWriteHostIsolationExceptions && isPlatinumPlusLicense, + canReadHostIsolationExceptions, + canWriteBlocklist, + canReadBlocklist, + canWriteEventFilters, + canReadEventFilters, }; }; @@ -52,11 +186,26 @@ export const getEndpointAuthzInitialState = (): EndpointAuthz => { canAccessFleet: false, canAccessEndpointManagement: false, canCreateArtifactsByPolicy: false, + canWriteEndpointList: false, + canReadEndpointList: false, + canWritePolicyManagement: false, + canReadPolicyManagement: false, + canWriteActionsLogManagement: false, + canReadActionsLogManagement: false, canIsolateHost: false, canUnIsolateHost: true, canKillProcess: false, canSuspendProcess: false, canGetRunningProcesses: false, canAccessResponseConsole: false, + canWriteFileOperations: false, + canWriteTrustedApplications: false, + canReadTrustedApplications: false, + canWriteHostIsolationExceptions: false, + canReadHostIsolationExceptions: false, + canWriteBlocklist: false, + canReadBlocklist: false, + canWriteEventFilters: false, + canReadEventFilters: false, }; }; diff --git a/x-pack/plugins/security_solution/common/endpoint/types/authz.ts b/x-pack/plugins/security_solution/common/endpoint/types/authz.ts index e237e4ba1fe9..b8ca15d69d1a 100644 --- a/x-pack/plugins/security_solution/common/endpoint/types/authz.ts +++ b/x-pack/plugins/security_solution/common/endpoint/types/authz.ts @@ -16,6 +16,18 @@ export interface EndpointAuthz { canAccessEndpointManagement: boolean; /** if user has permissions to create Artifacts by Policy */ canCreateArtifactsByPolicy: boolean; + /** if user has write permissions to endpoint list */ + canWriteEndpointList: boolean; + /** if user has read permissions to endpoint list */ + canReadEndpointList: boolean; + /** if user has write permissions for policy management */ + canWritePolicyManagement: boolean; + /** if user has read permissions for policy management */ + canReadPolicyManagement: boolean; + /** if user has write permissions for actions log management */ + canWriteActionsLogManagement: boolean; + /** if user has read permissions for actions log management */ + canReadActionsLogManagement: boolean; /** If user has permissions to isolate hosts */ canIsolateHost: boolean; /** If user has permissions to un-isolate (release) hosts */ @@ -28,6 +40,24 @@ export interface EndpointAuthz { canGetRunningProcesses: boolean; /** If user has permissions to use the Response Actions Console */ canAccessResponseConsole: boolean; + /** If user has write permissions to use file operations */ + canWriteFileOperations: boolean; + /** if user has write permissions for trusted applications */ + canWriteTrustedApplications: boolean; + /** if user has read permissions for trusted applications */ + canReadTrustedApplications: boolean; + /** if user has write permissions for host isolation exceptions */ + canWriteHostIsolationExceptions: boolean; + /** if user has read permissions for host isolation exceptions */ + canReadHostIsolationExceptions: boolean; + /** if user has write permissions for blocklist entries */ + canWriteBlocklist: boolean; + /** if user has read permissions for blocklist entries */ + canReadBlocklist: boolean; + /** if user has write permissions for event filters */ + canWriteEventFilters: boolean; + /** if user has read permissions for event filters */ + canReadEventFilters: boolean; } export type EndpointAuthzKeyList = Array; diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/all/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/all/index.ts index 5a773d49134d..cefd43fe5f99 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/all/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/all/index.ts @@ -105,3 +105,11 @@ export const EMPTY_SEVERITY_COUNT = { [RiskSeverity.moderate]: 0, [RiskSeverity.unknown]: 0, }; + +export const SEVERITY_UI_SORT_ORDER = [ + RiskSeverity.unknown, + RiskSeverity.low, + RiskSeverity.moderate, + RiskSeverity.high, + RiskSeverity.critical, +]; diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule.cy.ts index bdc76cc5f0a5..a594d7f3ffc2 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule.cy.ts @@ -6,6 +6,7 @@ */ import { formatMitreAttackDescription } from '../../helpers/rules'; +import type { Mitre } from '../../objects/rule'; import { getNewRule, getExistingRule, @@ -13,6 +14,7 @@ import { getEditedRule, getNewOverrideRule, } from '../../objects/rule'; +import type { CompleteTimeline } from '../../objects/timeline'; import { ALERT_GRID_CELL, NUMBER_OF_ALERTS } from '../../screens/alerts'; import { @@ -46,6 +48,7 @@ import { FROM_VALIDATION_ERROR, EMAIL_ACTION_TO_INPUT, EMAIL_ACTION_SUBJECT_INPUT, + SCHEDULE_CONTINUE_BUTTON, } from '../../screens/create_new_rule'; import { ADDITIONAL_LOOK_BACK_DETAILS, @@ -87,7 +90,7 @@ import { createAndEnableRule, fillAboutRule, fillAboutRuleAndContinue, - fillDefineCustomRuleWithImportedQueryAndContinue, + fillDefineCustomRuleAndContinue, fillEmailConnectorForm, fillScheduleRuleAndContinue, goToAboutStepTab, @@ -108,19 +111,21 @@ describe('Custom query rules', () => { login(); }); describe('Custom detection rules creation', () => { - const expectedUrls = getNewRule().referenceUrls.join(''); - const expectedFalsePositives = getNewRule().falsePositivesExamples.join(''); - const expectedTags = getNewRule().tags.join(''); - const expectedMitre = formatMitreAttackDescription(getNewRule().mitre); + const expectedUrls = getNewRule().referenceUrls?.join(''); + const expectedFalsePositives = getNewRule().falsePositivesExamples?.join(''); + const expectedTags = getNewRule().tags?.join(''); + const mitreAttack = getNewRule().mitre as Mitre[]; + const expectedMitre = formatMitreAttackDescription(mitreAttack); const expectedNumberOfRules = 1; beforeEach(() => { + const timeline = getNewRule().timeline as CompleteTimeline; deleteAlertsAndRules(); - createTimeline(getNewRule().timeline).then((response) => { + createTimeline(timeline).then((response) => { cy.wrap({ ...getNewRule(), timeline: { - ...getNewRule().timeline, + ...timeline, id: response.body.data.persistTimeline.timeline.savedObjectId, }, }).as('rule'); @@ -129,7 +134,7 @@ describe('Custom query rules', () => { it('Creates and enables a new rule', function () { visit(RULE_CREATION); - fillDefineCustomRuleWithImportedQueryAndContinue(this.rule); + fillDefineCustomRuleAndContinue(this.rule); fillAboutRuleAndContinue(this.rule); fillScheduleRuleAndContinue(this.rule); @@ -144,6 +149,7 @@ describe('Custom query rules', () => { cy.get(RULE_NAME_INPUT).invoke('val').should('eql', this.rule.name); cy.get(ABOUT_CONTINUE_BTN).should('exist').click({ force: true }); cy.get(ABOUT_CONTINUE_BTN).should('not.exist'); + cy.get(SCHEDULE_CONTINUE_BUTTON).click({ force: true }); createAndEnableRule(); @@ -182,11 +188,11 @@ describe('Custom query rules', () => { cy.get(SCHEDULE_DETAILS).within(() => { getDetails(RUNS_EVERY_DETAILS).should( 'have.text', - `${getNewRule().runsEvery.interval}${getNewRule().runsEvery.type}` + `${getNewRule().runsEvery?.interval}${getNewRule().runsEvery?.type}` ); getDetails(ADDITIONAL_LOOK_BACK_DETAILS).should( 'have.text', - `${getNewRule().lookBack.interval}${getNewRule().lookBack.type}` + `${getNewRule().lookBack?.interval}${getNewRule().lookBack?.type}` ); }); @@ -299,7 +305,7 @@ describe('Custom query rules', () => { context('Edition', () => { const rule = getEditedRule(); - const expectedEditedtags = rule.tags.join(''); + const expectedEditedtags = rule.tags?.join(''); const expectedEditedIndexPatterns = rule.dataSource.type === 'indexPatterns' && rule.dataSource.index && @@ -349,7 +355,7 @@ describe('Custom query rules', () => { // expect about step to populate cy.get(RULE_NAME_INPUT).invoke('val').should('eql', existingRule.name); cy.get(RULE_DESCRIPTION_INPUT).should('have.text', existingRule.description); - cy.get(TAGS_FIELD).should('have.text', existingRule.tags.join('')); + cy.get(TAGS_FIELD).should('have.text', existingRule.tags?.join('')); cy.get(SEVERITY_DROPDOWN).should('have.text', existingRule.severity); cy.get(DEFAULT_RISK_SCORE_INPUT).invoke('val').should('eql', existingRule.riskScore); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule_data_view.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule_data_view.cy.ts index 77a4ae274e6e..727c7257b668 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule_data_view.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_query_rule_data_view.cy.ts @@ -6,7 +6,9 @@ */ import { formatMitreAttackDescription } from '../../helpers/rules'; +import type { Mitre } from '../../objects/rule'; import { getDataViewRule } from '../../objects/rule'; +import type { CompleteTimeline } from '../../objects/timeline'; import { ALERT_GRID_CELL, NUMBER_OF_ALERTS } from '../../screens/alerts'; import { @@ -50,7 +52,7 @@ import { postDataView } from '../../tasks/common'; import { createAndEnableRule, fillAboutRuleAndContinue, - fillDefineCustomRuleWithImportedQueryAndContinue, + fillDefineCustomRuleAndContinue, fillScheduleRuleAndContinue, waitForAlertsToPopulate, waitForTheRuleToBeExecuted, @@ -69,10 +71,11 @@ describe('Custom query rules', () => { describe('Custom detection rules creation with data views', () => { const rule = getDataViewRule(); - const expectedUrls = rule.referenceUrls.join(''); - const expectedFalsePositives = rule.falsePositivesExamples.join(''); - const expectedTags = rule.tags.join(''); - const expectedMitre = formatMitreAttackDescription(rule.mitre); + const expectedUrls = rule.referenceUrls?.join(''); + const expectedFalsePositives = rule.falsePositivesExamples?.join(''); + const expectedTags = rule.tags?.join(''); + const mitreAttack = rule.mitre as Mitre[]; + const expectedMitre = formatMitreAttackDescription(mitreAttack); const expectedNumberOfRules = 1; beforeEach(() => { @@ -80,12 +83,13 @@ describe('Custom query rules', () => { are creating a data view we'll use after and cleanKibana does not delete all the data views created, esArchiverReseKibana does. We don't use esArchiverReseKibana in all the tests because is a time-consuming method and we don't need to perform an exhaustive cleaning in all the other tests. */ + const timeline = rule.timeline as CompleteTimeline; esArchiverResetKibana(); - createTimeline(rule.timeline).then((response) => { + createTimeline(timeline).then((response) => { cy.wrap({ ...rule, timeline: { - ...rule.timeline, + ...timeline, id: response.body.data.persistTimeline.timeline.savedObjectId, }, }).as('rule'); @@ -97,7 +101,7 @@ describe('Custom query rules', () => { it('Creates and enables a new rule', function () { visit(RULE_CREATION); - fillDefineCustomRuleWithImportedQueryAndContinue(this.rule); + fillDefineCustomRuleAndContinue(this.rule); fillAboutRuleAndContinue(this.rule); fillScheduleRuleAndContinue(this.rule); createAndEnableRule(); @@ -138,11 +142,11 @@ describe('Custom query rules', () => { cy.get(SCHEDULE_DETAILS).within(() => { getDetails(RUNS_EVERY_DETAILS).should( 'have.text', - `${getDataViewRule().runsEvery.interval}${getDataViewRule().runsEvery.type}` + `${getDataViewRule().runsEvery?.interval}${getDataViewRule().runsEvery?.type}` ); getDetails(ADDITIONAL_LOOK_BACK_DETAILS).should( 'have.text', - `${getDataViewRule().lookBack.interval}${getDataViewRule().lookBack.type}` + `${getDataViewRule().lookBack?.interval}${getDataViewRule().lookBack?.type}` ); }); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_saved_query_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_saved_query_rule.cy.ts index 5027fe09a8d3..7a4117f0d58a 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_saved_query_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/custom_saved_query_rule.cy.ts @@ -42,6 +42,7 @@ import { getDetails } from '../../tasks/rule_details'; import { createSavedQueryRule, createCustomRule } from '../../tasks/api_calls/rules'; import { RULE_CREATION, SECURITY_DETECTIONS_RULES_URL } from '../../urls/navigation'; +import type { CompleteTimeline } from '../../objects/timeline'; const savedQueryName = 'custom saved query'; const savedQueryQuery = 'process.name: test'; @@ -56,11 +57,12 @@ describe('Custom saved_query rules', () => { beforeEach(() => { deleteAlertsAndRules(); deleteSavedQueries(); - createTimeline(getNewRule().timeline).then((response) => { + const timeline = getNewRule().timeline as CompleteTimeline; + createTimeline(timeline).then((response) => { cy.wrap({ ...getNewRule(), timeline: { - ...getNewRule().timeline, + ...timeline, id: response.body.data.persistTimeline.timeline.savedObjectId, }, }).as('rule'); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/event_correlation_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/event_correlation_rule.cy.ts index 310efde996da..4812dcc2a626 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/event_correlation_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/event_correlation_rule.cy.ts @@ -6,6 +6,7 @@ */ import { formatMitreAttackDescription } from '../../helpers/rules'; +import type { Mitre } from '../../objects/rule'; import { getEqlRule, getEqlSequenceRule, getIndexPatterns } from '../../objects/rule'; import { ALERT_DATA_GRID, NUMBER_OF_ALERTS } from '../../screens/alerts'; @@ -59,6 +60,7 @@ import { login, visit } from '../../tasks/login'; import { RULE_CREATION } from '../../urls/navigation'; import { esArchiverLoad, esArchiverUnload } from '../../tasks/es_archiver'; +import type { CompleteTimeline } from '../../objects/timeline'; describe('EQL rules', () => { before(() => { @@ -67,19 +69,21 @@ describe('EQL rules', () => { deleteAlertsAndRules(); }); describe('Detection rules, EQL', () => { - const expectedUrls = getEqlRule().referenceUrls.join(''); - const expectedFalsePositives = getEqlRule().falsePositivesExamples.join(''); - const expectedTags = getEqlRule().tags.join(''); - const expectedMitre = formatMitreAttackDescription(getEqlRule().mitre); + const expectedUrls = getEqlRule().referenceUrls?.join(''); + const expectedFalsePositives = getEqlRule().falsePositivesExamples?.join(''); + const expectedTags = getEqlRule().tags?.join(''); + const mitreAttack = getEqlRule().mitre as Mitre[]; + const expectedMitre = formatMitreAttackDescription(mitreAttack); const expectedNumberOfRules = 1; const expectedNumberOfAlerts = '2 alerts'; beforeEach(() => { - createTimeline(getEqlRule().timeline).then((response) => { + const timeline = getEqlRule().timeline as CompleteTimeline; + createTimeline(timeline).then((response) => { cy.wrap({ ...getEqlRule(), timeline: { - ...getEqlRule().timeline, + ...timeline, id: response.body.data.persistTimeline.timeline.savedObjectId, }, }).as('rule'); @@ -161,11 +165,12 @@ describe('EQL rules', () => { esArchiverLoad('auditbeat_big'); }); beforeEach(() => { - createTimeline(getEqlSequenceRule().timeline).then((response) => { + const timeline = getEqlSequenceRule().timeline as CompleteTimeline; + createTimeline(timeline).then((response) => { cy.wrap({ ...getEqlSequenceRule(), timeline: { - ...getEqlSequenceRule().timeline, + ...timeline, id: response.body.data.persistTimeline.timeline.savedObjectId, }, }).as('rule'); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/indicator_match_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/indicator_match_rule.cy.ts index 7c3ba64536fa..4ffab681d4aa 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/indicator_match_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/indicator_match_rule.cy.ts @@ -6,6 +6,7 @@ */ import { formatMitreAttackDescription } from '../../helpers/rules'; +import type { Mitre } from '../../objects/rule'; import { getIndexPatterns, getNewThreatIndicatorRule, @@ -109,10 +110,11 @@ const DEFAULT_THREAT_MATCH_QUERY = '@timestamp >= "now-30d/d"'; describe('indicator match', () => { describe('Detection rules, Indicator Match', () => { - const expectedUrls = getNewThreatIndicatorRule().referenceUrls.join(''); - const expectedFalsePositives = getNewThreatIndicatorRule().falsePositivesExamples.join(''); - const expectedTags = getNewThreatIndicatorRule().tags.join(''); - const expectedMitre = formatMitreAttackDescription(getNewThreatIndicatorRule().mitre); + const expectedUrls = getNewThreatIndicatorRule().referenceUrls?.join(''); + const expectedFalsePositives = getNewThreatIndicatorRule().falsePositivesExamples?.join(''); + const expectedTags = getNewThreatIndicatorRule().tags?.join(''); + const mitreAttack = getNewThreatIndicatorRule().mitre as Mitre[]; + const expectedMitre = formatMitreAttackDescription(mitreAttack); const expectedNumberOfRules = 1; const expectedNumberOfAlerts = '1 alert'; @@ -479,11 +481,11 @@ describe('indicator match', () => { cy.get(SCHEDULE_DETAILS).within(() => { getDetails(RUNS_EVERY_DETAILS).should( 'have.text', - `${rule.runsEvery.interval}${rule.runsEvery.type}` + `${rule.runsEvery?.interval}${rule.runsEvery?.type}` ); getDetails(ADDITIONAL_LOOK_BACK_DETAILS).should( 'have.text', - `${rule.lookBack.interval}${rule.lookBack.type}` + `${rule.lookBack?.interval}${rule.lookBack?.type}` ); }); @@ -492,7 +494,7 @@ describe('indicator match', () => { cy.get(NUMBER_OF_ALERTS).should('have.text', expectedNumberOfAlerts); cy.get(ALERT_RULE_NAME).first().should('have.text', rule.name); - cy.get(ALERT_SEVERITY).first().should('have.text', rule.severity.toLowerCase()); + cy.get(ALERT_SEVERITY).first().should('have.text', rule.severity?.toLowerCase()); cy.get(ALERT_RISK_SCORE).first().should('have.text', rule.riskScore); }); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/new_terms_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/new_terms_rule.cy.ts index 764d8d0b688a..2c0507ca3815 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/new_terms_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/new_terms_rule.cy.ts @@ -6,6 +6,7 @@ */ import { formatMitreAttackDescription } from '../../helpers/rules'; +import type { Mitre } from '../../objects/rule'; import { getNewTermsRule, getIndexPatterns } from '../../objects/rule'; import { ALERT_DATA_GRID } from '../../screens/alerts'; @@ -60,6 +61,7 @@ import { import { login, visit } from '../../tasks/login'; import { RULE_CREATION } from '../../urls/navigation'; +import type { CompleteTimeline } from '../../objects/timeline'; describe('New Terms rules', () => { before(() => { @@ -67,19 +69,21 @@ describe('New Terms rules', () => { login(); }); describe('Detection rules, New Terms', () => { - const expectedUrls = getNewTermsRule().referenceUrls.join(''); - const expectedFalsePositives = getNewTermsRule().falsePositivesExamples.join(''); - const expectedTags = getNewTermsRule().tags.join(''); - const expectedMitre = formatMitreAttackDescription(getNewTermsRule().mitre); + const expectedUrls = getNewTermsRule().referenceUrls?.join(''); + const expectedFalsePositives = getNewTermsRule().falsePositivesExamples?.join(''); + const expectedTags = getNewTermsRule().tags?.join(''); + const mitreAttack = getNewTermsRule().mitre as Mitre[]; + const expectedMitre = formatMitreAttackDescription(mitreAttack); const expectedNumberOfRules = 1; beforeEach(() => { + const timeline = getNewTermsRule().timeline as CompleteTimeline; deleteAlertsAndRules(); - createTimeline(getNewTermsRule().timeline).then((response) => { + createTimeline(timeline).then((response) => { cy.wrap({ ...getNewTermsRule(), timeline: { - ...getNewTermsRule().timeline, + ...timeline, id: response.body.data.persistTimeline.timeline.savedObjectId, }, }).as('rule'); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/override.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/override.cy.ts index 701efb2706bf..68973fdc5694 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/override.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/override.cy.ts @@ -6,8 +6,9 @@ */ import { formatMitreAttackDescription } from '../../helpers/rules'; -import type { OverrideRule } from '../../objects/rule'; +import type { Mitre, OverrideRule } from '../../objects/rule'; import { getIndexPatterns, getNewOverrideRule, getSeveritiesOverride } from '../../objects/rule'; +import type { CompleteTimeline } from '../../objects/timeline'; import { NUMBER_OF_ALERTS, ALERT_GRID_CELL } from '../../screens/alerts'; @@ -55,7 +56,7 @@ import { cleanKibana } from '../../tasks/common'; import { createAndEnableRule, fillAboutRuleWithOverrideAndContinue, - fillDefineCustomRuleWithImportedQueryAndContinue, + fillDefineCustomRuleAndContinue, fillScheduleRuleAndContinue, waitForAlertsToPopulate, waitForTheRuleToBeExecuted, @@ -66,21 +67,23 @@ import { getDetails } from '../../tasks/rule_details'; import { RULE_CREATION } from '../../urls/navigation'; describe('Detection rules, override', () => { - const expectedUrls = getNewOverrideRule().referenceUrls.join(''); - const expectedFalsePositives = getNewOverrideRule().falsePositivesExamples.join(''); - const expectedTags = getNewOverrideRule().tags.join(''); - const expectedMitre = formatMitreAttackDescription(getNewOverrideRule().mitre); + const expectedUrls = getNewOverrideRule().referenceUrls?.join(''); + const expectedFalsePositives = getNewOverrideRule().falsePositivesExamples?.join(''); + const expectedTags = getNewOverrideRule().tags?.join(''); + const mitreAttack = getNewOverrideRule().mitre as Mitre[]; + const expectedMitre = formatMitreAttackDescription(mitreAttack); before(() => { cleanKibana(); login(); }); beforeEach(() => { - createTimeline(getNewOverrideRule().timeline).then((response) => { + const timeline = getNewOverrideRule().timeline as CompleteTimeline; + createTimeline(timeline).then((response) => { cy.wrap({ ...getNewOverrideRule(), timeline: { - ...getNewOverrideRule().timeline, + ...timeline, id: response.body.data.persistTimeline.timeline.savedObjectId, }, }).as('rule'); @@ -89,7 +92,7 @@ describe('Detection rules, override', () => { it('Creates and enables a new custom rule with override option', function () { visitWithoutDateRange(RULE_CREATION); - fillDefineCustomRuleWithImportedQueryAndContinue(this.rule); + fillDefineCustomRuleAndContinue(this.rule); fillAboutRuleWithOverrideAndContinue(this.rule); fillScheduleRuleAndContinue(this.rule); createAndEnableRule(); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/related_integrations.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/related_integrations.cy.ts index 02ccff0c265d..f6a80a8a15f4 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/related_integrations.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/related_integrations.cy.ts @@ -5,47 +5,52 @@ * 2.0. */ +import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation'; + +import { FIELD } from '../../screens/alerts_details'; +import { INTEGRATIONS, INTEGRATIONS_STATUS } from '../../screens/rule_details'; import { INTEGRATIONS_POPOVER, INTEGRATIONS_POPOVER_TITLE, RULE_NAME, } from '../../screens/alerts_detection_rules'; -import { INTEGRATIONS, INTEGRATIONS_STATUS } from '../../screens/rule_details'; + +import { cleanFleet } from '../../tasks/api_calls/fleet'; +import { importRule } from '../../tasks/api_calls/rules'; +import { + disableRelatedIntegrations, + enableRelatedIntegrations, +} from '../../tasks/api_calls/kibana_advanced_settings'; + +import { cleanKibana } from '../../tasks/common'; +import { login, visit } from '../../tasks/login'; +import { expandFirstAlert } from '../../tasks/alerts'; +import { filterBy, openTable } from '../../tasks/alerts_details'; +import { waitForAlertsToPopulate } from '../../tasks/create_new_rule'; +import { installAwsCloudFrontWithPolicy } from '../../tasks/integrations'; import { enableRule, goToTheRuleDetailsOf, openIntegrationsPopover, + waitForRulesTableToShow, waitForRuleToChangeStatus, } from '../../tasks/alerts_detection_rules'; -import { importRule } from '../../tasks/api_calls/rules'; -import { cleanKibana, cleanPackages } from '../../tasks/common'; -import { login, visit } from '../../tasks/login'; -import { DETECTIONS_RULE_MANAGEMENT_URL } from '../../urls/navigation'; -import { installAwsCloudFrontWithPolicy } from '../../tasks/integrations'; -import { expandFirstAlert } from '../../tasks/alerts'; -import { waitForAlertsToPopulate } from '../../tasks/create_new_rule'; -import { filterBy, openTable } from '../../tasks/alerts_details'; -import { FIELD } from '../../screens/alerts_details'; -import { - disableRelatedIntegrations, - enableRelatedIntegrations, -} from '../../tasks/api_calls/kibana_advanced_settings'; /* - Note that the rule we are using for testing purposes has the following characteristics, changing that may affect the coverage. - - - Single-integration - - Package: system - - Multi-integration package - - Package: aws - - Integration: cloudtrail - - Integration: cloudfront - - Not existing package: - - Package: unknown - - Not existing integration & existing package: - - Package: aws - - Integration: unknown - */ +Note that the rule we are using for testing purposes has the following characteristics, changing that may affect the coverage. + +- Single-integration + - Package: system +- Multi-integration package + - Package: aws + - Integration: cloudtrail + - Integration: cloudfront +- Not existing package: + - Package: unknown +- Not existing integration & existing package: + - Package: aws + - Integration: unknown +*/ describe('Related integrations', () => { before(() => { @@ -62,8 +67,12 @@ describe('Related integrations', () => { }; before(() => { - cleanPackages(); + cleanFleet(); + }); + + beforeEach(() => { visit(DETECTIONS_RULE_MANAGEMENT_URL); + waitForRulesTableToShow(); }); it('should display a badge with the installed integrations on the rule management page', () => { @@ -117,19 +126,24 @@ describe('Related integrations', () => { }; before(() => { - cleanPackages(); - installAwsCloudFrontWithPolicy(); + cleanFleet().then(() => { + installAwsCloudFrontWithPolicy(); + }); + }); + + beforeEach(() => { visit(DETECTIONS_RULE_MANAGEMENT_URL); + waitForRulesTableToShow(); }); - it.skip('should display a badge with the installed integrations on the rule management page', () => { + it('should display a badge with the installed integrations on the rule management page', () => { cy.get(INTEGRATIONS_POPOVER).should( 'have.text', `${rule.enabledIntegrations}/${rule.integrations.length} integrations` ); }); - it.skip('should display a popover when clicking the badge with the installed integrations on the rule management page', () => { + it('should display a popover when clicking the badge with the installed integrations on the rule management page', () => { openIntegrationsPopover(); cy.get(INTEGRATIONS_POPOVER_TITLE).should( @@ -148,7 +162,7 @@ describe('Related integrations', () => { }); }); - it.skip('should display the integrations on the definition section', () => { + it('should display the integrations on the definition section', () => { goToTheRuleDetailsOf(rule.name); cy.get(INTEGRATIONS).should('have.length', rule.integrations.length); @@ -169,7 +183,6 @@ describe('Related integrations', () => { const expectedRelatedIntegrationsText = '{"package":"system","version":"1.17.0"}{"package":"aws","integration":"cloudtrail","version":"1.17.0"}{"package":"aws","integration":"cloudfront","version":"1.17.0"}{"package":"aws","integration":"unknown","version":"1.17.0"}'; - visit(DETECTIONS_RULE_MANAGEMENT_URL); enableRule(firstRule); waitForRuleToChangeStatus(); goToTheRuleDetailsOf(rule.name); @@ -193,15 +206,20 @@ describe('Related integrations', () => { }; before(() => { - cleanPackages(); - disableRelatedIntegrations(); - visit(DETECTIONS_RULE_MANAGEMENT_URL); + cleanFleet().then(() => { + disableRelatedIntegrations(); + }); }); after(() => { enableRelatedIntegrations(); }); + beforeEach(() => { + visit(DETECTIONS_RULE_MANAGEMENT_URL); + waitForRulesTableToShow(); + }); + it('should not display a badge with the installed integrations on the rule management page', () => { cy.get(RULE_NAME).should('have.text', rule.name); cy.get(INTEGRATIONS).should('not.exist'); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/rule_actions.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/rule_actions.cy.ts new file mode 100644 index 000000000000..b0f78cc76881 --- /dev/null +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/rule_actions.cy.ts @@ -0,0 +1,74 @@ +/* + * 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 { getIndexConnector } from '../../objects/connector'; +import { getSimpleCustomQueryRule } from '../../objects/rule'; + +import { goToRuleDetails } from '../../tasks/alerts_detection_rules'; +import { deleteIndex, waitForNewDocumentToBeIndexed } from '../../tasks/api_calls/elasticsearch'; +import { + cleanKibana, + deleteAlertsAndRules, + deleteConnectors, + deleteDataView, +} from '../../tasks/common'; +import { + createAndEnableRule, + fillAboutRuleAndContinue, + fillDefineCustomRuleAndContinue, + fillRuleAction, + fillScheduleRuleAndContinue, +} from '../../tasks/create_new_rule'; +import { login, visit } from '../../tasks/login'; + +import { RULE_CREATION } from '../../urls/navigation'; + +describe('Rule actions during detection rule creation', () => { + const indexConnector = getIndexConnector(); + + before(() => { + cleanKibana(); + login(); + }); + + beforeEach(() => { + deleteAlertsAndRules(); + deleteConnectors(); + deleteIndex(indexConnector.index); + deleteDataView(indexConnector.index); + }); + + const rule = { + ...getSimpleCustomQueryRule(), + actions: { throttle: 'rule', connectors: [indexConnector] }, + }; + const index = rule.actions.connectors[0].index; + const initialNumberOfDocuments = 0; + const expectedJson = JSON.parse(rule.actions.connectors[0].document); + + it('Indexes a new document after the index action is triggered ', function () { + visit(RULE_CREATION); + fillDefineCustomRuleAndContinue(rule); + fillAboutRuleAndContinue(rule); + fillScheduleRuleAndContinue(rule); + fillRuleAction(rule); + createAndEnableRule(); + goToRuleDetails(); + + /* When the rule is executed, the action is triggered. We wait for the new document to be indexed */ + waitForNewDocumentToBeIndexed(index, initialNumberOfDocuments); + + /* We assert that the new indexed document is the one set on the index action */ + cy.request({ + method: 'GET', + url: `${Cypress.env('ELASTICSEARCH_URL')}/${index}/_search`, + headers: { 'kbn-xsrf': 'cypress-creds' }, + }).then((response) => { + expect(response.body.hits.hits[0]._source).to.deep.equal(expectedJson); + }); + }); +}); diff --git a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/threshold_rule.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/threshold_rule.cy.ts index 4e2b42c7b7ee..59efa1cced40 100644 --- a/x-pack/plugins/security_solution/cypress/e2e/detection_rules/threshold_rule.cy.ts +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/threshold_rule.cy.ts @@ -6,6 +6,7 @@ */ import { formatMitreAttackDescription } from '../../helpers/rules'; +import type { Mitre } from '../../objects/rule'; import { getIndexPatterns, getNewThresholdRule } from '../../objects/rule'; import { ALERT_GRID_CELL, NUMBER_OF_ALERTS } from '../../screens/alerts'; @@ -60,13 +61,15 @@ import { import { login, visitWithoutDateRange } from '../../tasks/login'; import { RULE_CREATION } from '../../urls/navigation'; +import type { CompleteTimeline } from '../../objects/timeline'; describe('Detection rules, threshold', () => { let rule = getNewThresholdRule(); - const expectedUrls = getNewThresholdRule().referenceUrls.join(''); - const expectedFalsePositives = getNewThresholdRule().falsePositivesExamples.join(''); - const expectedTags = getNewThresholdRule().tags.join(''); - const expectedMitre = formatMitreAttackDescription(getNewThresholdRule().mitre); + const expectedUrls = getNewThresholdRule().referenceUrls?.join(''); + const expectedFalsePositives = getNewThresholdRule().falsePositivesExamples?.join(''); + const expectedTags = getNewThresholdRule().tags?.join(''); + const mitreAttack = getNewThresholdRule().mitre as Mitre[]; + const expectedMitre = formatMitreAttackDescription(mitreAttack); before(() => { cleanKibana(); @@ -75,9 +78,10 @@ describe('Detection rules, threshold', () => { beforeEach(() => { rule = getNewThresholdRule(); + const timeline = rule.timeline as CompleteTimeline; deleteAlertsAndRules(); - createTimeline(getNewThresholdRule().timeline).then((response) => { - rule.timeline.id = response.body.data.persistTimeline.timeline.savedObjectId; + createTimeline(timeline).then((response) => { + timeline.id = response.body.data.persistTimeline.timeline.savedObjectId; }); visitWithoutDateRange(RULE_CREATION); }); @@ -132,11 +136,11 @@ describe('Detection rules, threshold', () => { cy.get(SCHEDULE_DETAILS).within(() => { getDetails(RUNS_EVERY_DETAILS).should( 'have.text', - `${rule.runsEvery.interval}${rule.runsEvery.type}` + `${rule.runsEvery?.interval}${rule.runsEvery?.type}` ); getDetails(ADDITIONAL_LOOK_BACK_DETAILS).should( 'have.text', - `${rule.lookBack.interval}${rule.lookBack.type}` + `${rule.lookBack?.interval}${rule.lookBack?.type}` ); }); diff --git a/x-pack/plugins/security_solution/cypress/objects/connector.ts b/x-pack/plugins/security_solution/cypress/objects/connector.ts index 5c2abeab0602..39c93e6f8038 100644 --- a/x-pack/plugins/security_solution/cypress/objects/connector.ts +++ b/x-pack/plugins/security_solution/cypress/objects/connector.ts @@ -5,22 +5,42 @@ * 2.0. */ -export interface EmailConnector { +interface Connector { name: string; +} + +export interface EmailConnector extends Connector { from: string; host: string; port: string; user: string; password: string; service: string; + type: 'email'; +} + +export interface IndexConnector extends Connector { + index: string; + document: string; + type: 'index'; } +export type Connectors = IndexConnector | EmailConnector; + export const getEmailConnector = (): EmailConnector => ({ - name: 'Test connector', + name: 'Test email connector', from: 'test@example.com', host: 'example.com', port: '80', user: 'username', password: 'password', service: 'Other', + type: 'email', +}); + +export const getIndexConnector = (): IndexConnector => ({ + name: 'Test index connector', + index: 'my-index-000001', + document: '{"test": "123"}', + type: 'index', }); diff --git a/x-pack/plugins/security_solution/cypress/objects/rule.ts b/x-pack/plugins/security_solution/cypress/objects/rule.ts index 7b9d543e480e..245e220c340c 100644 --- a/x-pack/plugins/security_solution/cypress/objects/rule.ts +++ b/x-pack/plugins/security_solution/cypress/objects/rule.ts @@ -5,11 +5,13 @@ * 2.0. */ +import type { Throttle } from '@kbn/securitysolution-io-ts-alerting-types'; import { rawRules } from '../../server/lib/detection_engine/rules/prepackaged_rules'; import { getMockThreatData } from '../../public/detections/mitre/mitre_tactics_techniques'; import type { CompleteTimeline } from './timeline'; import { getTimeline, getIndicatorMatchTimelineTemplate } from './timeline'; import type { FullResponseSchema } from '../../common/detection_engine/schemas/request'; +import type { Connectors } from './connector'; export const totalNumberOfPrebuiltRules = rawRules.length; @@ -36,6 +38,11 @@ interface Interval { type: string; } +export interface Actions { + throttle: Throttle; + connectors: Connectors[]; +} + export type RuleDataSource = | { type: 'indexPatterns'; index: string[] } | { type: 'dataView'; dataView: string }; @@ -46,20 +53,21 @@ export interface CustomRule { description: string; dataSource: RuleDataSource; interval?: string; - severity: string; - riskScore: string; - tags: string[]; + severity?: string; + riskScore?: string; + tags?: string[]; timelineTemplate?: string; - referenceUrls: string[]; - falsePositivesExamples: string[]; - mitre: Mitre[]; - note: string; - runsEvery: Interval; - lookBack: Interval; - timeline: CompleteTimeline; - maxSignals: number; + referenceUrls?: string[]; + falsePositivesExamples?: string[]; + mitre?: Mitre[]; + note?: string; + runsEvery?: Interval; + lookBack?: Interval; + timeline?: CompleteTimeline; + maxSignals?: number; buildingBlockType?: string; exceptionLists?: Array<{ id: string; list_id: string; type: string; namespace_type: string }>; + actions?: Actions; } export interface ThresholdRule extends CustomRule { @@ -231,6 +239,15 @@ export const getNewRule = (): CustomRule => ({ maxSignals: 100, }); +export const getSimpleCustomQueryRule = (): CustomRule => ({ + customQuery: 'host.name: *', + dataSource: { index: getIndexPatterns(), type: 'indexPatterns' }, + name: 'New Rule Test', + description: 'The new rule description.', + runsEvery: getRunsEvery(), + lookBack: getLookBack(), +}); + export const getBuildingBlockRule = (): CustomRule => ({ customQuery: 'host.name: *', dataSource: { index: getIndexPatterns(), type: 'indexPatterns' }, @@ -489,7 +506,7 @@ export const getEditedRule = (): CustomRule => ({ ...getExistingRule(), severity: 'Medium', description: 'Edited Rule description', - tags: [...getExistingRule().tags, 'edited'], + tags: [...(getExistingRule().tags || []), 'edited'], }); export const expectedExportedRule = ( diff --git a/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts b/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts index e46e8a75a434..96928ff49da4 100644 --- a/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts +++ b/x-pack/plugins/security_solution/cypress/screens/create_new_rule.ts @@ -42,6 +42,8 @@ export const EMAIL_CONNECTOR_PASSWORD_INPUT = '[data-test-subj="emailPasswordInp export const EMAIL_CONNECTOR_SERVICE_SELECTOR = '[data-test-subj="emailServiceSelectInput"]'; +export const JSON_EDITOR = "[data-test-subj='actionJsonEditor']"; + export const ADD_FALSE_POSITIVE_BTN = '[data-test-subj="detectionEngineStepAboutRuleFalsePositives"] .euiButtonEmpty__text'; @@ -58,6 +60,8 @@ export const COMBO_BOX_CLEAR_BTN = '[data-test-subj="comboBoxClearButton"]'; export const COMBO_BOX_INPUT = '[data-test-subj="comboBoxInput"]'; +export const COMBO_BOX_SELECTION = '.euiMark'; + export const CREATE_AND_ENABLE_BTN = '[data-test-subj="create-enable"]'; export const CUSTOM_QUERY_INPUT = '[data-test-subj="queryInput"]'; @@ -256,3 +260,7 @@ export const savedQueryByName = (savedQueryName: string) => export const APPLY_SELECTED_SAVED_QUERY_BUTTON = '[data-test-subj="saved-query-management-apply-changes-button"]'; + +export const INDEX_SELECTOR = "[data-test-subj='.index-siem-ActionTypeSelectOption']"; + +export const CREATE_CONNECTOR_BTN = "[data-test-subj='createActionConnectorButton-0']"; diff --git a/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts b/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts index 4432059c7f20..b8e38d3e11e0 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/alerts_detection_rules.ts @@ -253,9 +253,37 @@ export const sortByEnabledRules = () => { cy.get(SORT_RULES_BTN).contains('Enabled').click({ force: true }); }; +/** + * Because the Rule Management page is relatively slow, in order to avoid timeouts and flakiness, + * we almost always want to wait until the Rules table is "loaded" before we do anything with it. + * + * This task should be sufficient for the vast majority of the tests. It waits for the table + * to show up on the page, but doesn't wait until it is fully loaded and filled with rows. + * + * @example + * beforeEach(() => { + * visit(DETECTIONS_RULE_MANAGEMENT_URL); // returns on "load" event, still lots of work to do + * waitForRulesTableToShow(); // a lot has done in React and the table shows up on the page + * }); + */ +export const waitForRulesTableToShow = () => { + // Wait up to 5 minutes for the table to show up as in CI containers this can be very slow + cy.get(RULES_TABLE, { timeout: 300000 }).should('exist'); +}; + +/** + * Because the Rule Management page is relatively slow, in order to avoid timeouts and flakiness, + * we almost always want to wait until the Rules table is "loaded" before we do anything with it. + * + * This task can be needed for some tests that e.g. check the table load/refetch/pagination logic. + * It waits for the table's own loading indicator to show up and disappear. + * + * NOTE: Normally, we should not rely on loading indicators in tests, because due to their + * dynamic nature it's possible to introduce race conditions and flakiness. + */ export const waitForRulesTableToBeLoaded = () => { - cy.get(RULES_TABLE_INITIAL_LOADING_INDICATOR).should('exist'); // Wait up to 5 minutes for the rules to load as in CI containers this can be very slow + cy.get(RULES_TABLE_INITIAL_LOADING_INDICATOR, { timeout: 300000 }).should('exist'); cy.get(RULES_TABLE_INITIAL_LOADING_INDICATOR, { timeout: 300000 }).should('not.exist'); }; diff --git a/x-pack/plugins/security_solution/cypress/tasks/api_calls/elasticsearch.ts b/x-pack/plugins/security_solution/cypress/tasks/api_calls/elasticsearch.ts new file mode 100644 index 000000000000..7e2cef665403 --- /dev/null +++ b/x-pack/plugins/security_solution/cypress/tasks/api_calls/elasticsearch.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +export const createIndex = (index: string) => { + cy.request({ + method: 'PUT', + url: `${Cypress.env('ELASTICSEARCH_URL')}/${index}`, + headers: { 'kbn-xsrf': 'cypress-creds' }, + failOnStatusCode: false, + }); +}; + +export const createDocument = (index: string, document: string) => { + cy.request({ + method: 'POST', + url: `${Cypress.env('ELASTICSEARCH_URL')}/${index}/_doc`, + headers: { 'kbn-xsrf': 'cypress-creds' }, + body: JSON.parse(document), + }); +}; + +export const deleteIndex = (index: string) => { + cy.request({ + method: 'DELETE', + url: `${Cypress.env('ELASTICSEARCH_URL')}/${index}`, + headers: { 'kbn-xsrf': 'cypress-creds' }, + failOnStatusCode: false, + }); +}; + +export const waitForNewDocumentToBeIndexed = (index: string, initialNumberOfDocuments: number) => { + cy.waitUntil( + () => { + return cy + .request({ + method: 'GET', + url: `${Cypress.env('ELASTICSEARCH_URL')}/${index}/_search`, + headers: { 'kbn-xsrf': 'cypress-creds' }, + failOnStatusCode: false, + }) + .then((response) => { + if (response.status !== 200) { + return false; + } else { + return response.body.hits.hits.length > initialNumberOfDocuments; + } + }); + }, + { interval: 500, timeout: 12000 } + ); +}; diff --git a/x-pack/plugins/security_solution/cypress/tasks/api_calls/fleet.ts b/x-pack/plugins/security_solution/cypress/tasks/api_calls/fleet.ts new file mode 100644 index 000000000000..da5ab6ba488d --- /dev/null +++ b/x-pack/plugins/security_solution/cypress/tasks/api_calls/fleet.ts @@ -0,0 +1,80 @@ +/* + * 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. + */ + +/** + * Deletes all existing Fleet packages, package policies and agent policies. + */ +export const cleanFleet = () => { + // NOTE: order does matter. + return deletePackagePolicies() + .then(() => { + deletePackages(); + }) + .then(() => { + deleteAgentPolicies(); + }); +}; + +const deleteAgentPolicies = () => { + return cy + .request({ + method: 'GET', + url: 'api/fleet/agent_policies', + headers: { 'kbn-xsrf': 'cypress-creds' }, + }) + .then((response) => { + response.body.items.forEach((item: { id: string }) => { + cy.request({ + method: 'POST', + url: `api/fleet/agent_policies/delete`, + headers: { 'kbn-xsrf': 'cypress-creds' }, + body: { + agentPolicyId: item.id, + }, + }); + }); + }); +}; + +const deletePackagePolicies = () => { + return cy + .request({ + method: 'GET', + url: 'api/fleet/package_policies', + headers: { 'kbn-xsrf': 'cypress-creds' }, + }) + .then((response) => { + cy.request({ + method: 'POST', + url: `api/fleet/package_policies/delete`, + headers: { 'kbn-xsrf': 'cypress-creds' }, + body: { + packagePolicyIds: response.body.items.map((item: { id: string }) => item.id), + }, + }); + }); +}; + +const deletePackages = () => { + return cy + .request({ + method: 'GET', + url: 'api/fleet/epm/packages', + headers: { 'kbn-xsrf': 'cypress-creds' }, + }) + .then((response) => { + response.body.items.forEach((item: { status: string; name: string; version: string }) => { + if (item.status === 'installed') { + cy.request({ + method: 'DELETE', + url: `api/fleet/epm/packages/${item.name}/${item.version}`, + headers: { 'kbn-xsrf': 'cypress-creds' }, + }); + } + }); + }); +}; diff --git a/x-pack/plugins/security_solution/cypress/tasks/api_calls/rules.ts b/x-pack/plugins/security_solution/cypress/tasks/api_calls/rules.ts index 80fb77013acb..1909030b726d 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/api_calls/rules.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/api_calls/rules.ts @@ -40,17 +40,21 @@ export const createCustomRule = ( rule: CustomRule, ruleId = 'rule_testing', interval = '100m' -): Cypress.Chainable> => - cy.request({ +): Cypress.Chainable> => { + const riskScore = rule.riskScore != null ? parseInt(rule.riskScore, 10) : undefined; + const severity = rule.severity != null ? rule.severity.toLocaleLowerCase() : undefined; + const timeline = rule.timeline != null ? rule.timeline : undefined; + + return cy.request({ method: 'POST', url: 'api/detection_engine/rules', body: { rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), + risk_score: riskScore, description: rule.description, interval, name: rule.name, - severity: rule.severity.toLocaleLowerCase(), + severity, type: 'query', from: 'now-50000h', index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, @@ -60,29 +64,33 @@ export const createCustomRule = ( enabled: false, exceptions_list: rule.exceptionLists ?? [], tags: rule.tags, - ...(rule.timeline.id ?? rule.timeline.templateTimelineId + ...(timeline?.id ?? timeline?.templateTimelineId ? { - timeline_id: rule.timeline.id ?? rule.timeline.templateTimelineId, - timeline_title: rule.timeline.title, + timeline_id: timeline.id ?? timeline.templateTimelineId, + timeline_title: timeline.title, } : {}), }, headers: { 'kbn-xsrf': 'cypress-creds' }, failOnStatusCode: false, }); +}; export const createEventCorrelationRule = (rule: CustomRule, ruleId = 'rule_testing') => { + const riskScore = rule.riskScore != null ? parseInt(rule.riskScore, 10) : undefined; + const severity = rule.severity != null ? rule.severity.toLowerCase() : undefined; + cy.request({ method: 'POST', url: 'api/detection_engine/rules', body: { rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), + risk_score: riskScore, description: rule.description, - interval: `${rule.runsEvery.interval}${rule.runsEvery.type}`, - from: `now-${rule.lookBack.interval}${rule.lookBack.type}`, + interval: `${rule.runsEvery?.interval}${rule.runsEvery?.type}`, + from: `now-${rule.lookBack?.interval}${rule.lookBack?.type}`, name: rule.name, - severity: rule.severity.toLocaleLowerCase(), + severity, type: 'eql', index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, data_view_id: rule.dataSource.type === 'dataView' ? rule.dataSource.dataView : undefined, @@ -96,17 +104,20 @@ export const createEventCorrelationRule = (rule: CustomRule, ruleId = 'rule_test }; export const createThresholdRule = (rule: ThresholdRule, ruleId = 'rule_testing') => { + const riskScore = rule.riskScore != null ? parseInt(rule.riskScore, 10) : undefined; + const severity = rule.severity != null ? rule.severity.toLocaleLowerCase() : undefined; + cy.request({ method: 'POST', url: 'api/detection_engine/rules', body: { rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), + risk_score: riskScore, description: rule.description, - interval: `${rule.runsEvery.interval}${rule.runsEvery.type}`, - from: `now-${rule.lookBack.interval}${rule.lookBack.type}`, + interval: `${rule.runsEvery?.interval}${rule.runsEvery?.type}`, + from: `now-${rule.lookBack?.interval}${rule.lookBack?.type}`, name: rule.name, - severity: rule.severity.toLocaleLowerCase(), + severity, type: 'threshold', index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, data_view_id: rule.dataSource.type === 'dataView' ? rule.dataSource.dataView : undefined, @@ -124,17 +135,20 @@ export const createThresholdRule = (rule: ThresholdRule, ruleId = 'rule_testing' }; export const createNewTermsRule = (rule: NewTermsRule, ruleId = 'rule_testing') => { + const riskScore = rule.riskScore != null ? parseInt(rule.riskScore, 10) : undefined; + const severity = rule.severity != null ? rule.severity.toLocaleLowerCase() : undefined; + cy.request({ method: 'POST', url: 'api/detection_engine/rules', body: { rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), + risk_score: riskScore, description: rule.description, - interval: `${rule.runsEvery.interval}${rule.runsEvery.type}`, - from: `now-${rule.lookBack.interval}${rule.lookBack.type}`, + interval: `${rule.runsEvery?.interval}${rule.runsEvery?.type}`, + from: `now-${rule.lookBack?.interval}${rule.lookBack?.type}`, name: rule.name, - severity: rule.severity.toLocaleLowerCase(), + severity, type: 'new_terms', index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, data_view_id: rule.dataSource.type === 'dataView' ? rule.dataSource.dataView : undefined, @@ -151,17 +165,21 @@ export const createNewTermsRule = (rule: NewTermsRule, ruleId = 'rule_testing') export const createSavedQueryRule = ( rule: SavedQueryRule, ruleId = 'saved_query_rule_testing' -): Cypress.Chainable> => - cy.request({ +): Cypress.Chainable> => { + const riskScore = rule.riskScore != null ? parseInt(rule.riskScore, 10) : undefined; + const severity = rule.severity != null ? rule.severity.toLocaleLowerCase() : undefined; + const timeline = rule.timeline != null ? rule.timeline : undefined; + + return cy.request({ method: 'POST', url: 'api/detection_engine/rules', body: { rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), + risk_score: riskScore, description: rule.description, interval: rule.interval, name: rule.name, - severity: rule.severity.toLocaleLowerCase(), + severity, type: 'saved_query', from: 'now-50000h', index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, @@ -171,33 +189,38 @@ export const createSavedQueryRule = ( enabled: false, exceptions_list: rule.exceptionLists ?? [], tags: rule.tags, - ...(rule.timeline.id ?? rule.timeline.templateTimelineId + ...(timeline?.id ?? timeline?.templateTimelineId ? { - timeline_id: rule.timeline.id ?? rule.timeline.templateTimelineId, - timeline_title: rule.timeline.title, + timeline_id: timeline.id ?? timeline.templateTimelineId, + timeline_title: timeline.title, } : {}), }, headers: { 'kbn-xsrf': 'cypress-creds' }, failOnStatusCode: false, }); +}; export const createCustomIndicatorRule = (rule: ThreatIndicatorRule, ruleId = 'rule_testing') => { + const riskScore = rule.riskScore != null ? parseInt(rule.riskScore, 10) : undefined; + const severity = rule.severity != null ? rule.severity.toLocaleLowerCase() : undefined; + const timeline = rule.timeline != null ? rule.timeline : undefined; + cy.request({ method: 'POST', url: 'api/detection_engine/rules', body: { rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), + risk_score: riskScore, description: rule.description, // Default interval is 1m, our tests config overwrite this to 1s // See https://github.com/elastic/kibana/pull/125396 for details interval: '10s', name: rule.name, - severity: rule.severity.toLocaleLowerCase(), + severity, type: 'threat_match', - timeline_id: rule.timeline.templateTimelineId, - timeline_title: rule.timeline.title, + timeline_id: timeline?.templateTimelineId, + timeline_title: timeline?.title, threat_mapping: [ { entries: [ @@ -233,17 +256,20 @@ export const createCustomRuleEnabled = ( interval = '100m', maxSignals = 500 ) => { + const riskScore = rule.riskScore != null ? parseInt(rule.riskScore, 10) : undefined; + const severity = rule.severity != null ? rule.severity.toLocaleLowerCase() : undefined; + if (rule.dataSource.type === 'indexPatterns') { cy.request({ method: 'POST', url: 'api/detection_engine/rules', body: { rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), + risk_score: riskScore, description: rule.description, interval, name: rule.name, - severity: rule.severity.toLocaleLowerCase(), + severity, type: 'query', from: 'now-50000h', index: rule.dataSource.index, @@ -264,11 +290,11 @@ export const createCustomRuleEnabled = ( url: 'api/detection_engine/rules', body: { rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), + risk_score: riskScore, description: rule.description, interval, name: rule.name, - severity: rule.severity.toLocaleLowerCase(), + severity, type: 'query', from: 'now-50000h', index: [], diff --git a/x-pack/plugins/security_solution/cypress/tasks/common.ts b/x-pack/plugins/security_solution/cypress/tasks/common.ts index cd9525e95b0b..e576c25cc256 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/common.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/common.ts @@ -62,48 +62,6 @@ export const cleanKibana = () => { deleteTimelines(); }; -export const cleanPackages = () => { - deletePolicies(); - deletePackages(); -}; - -export const deletePolicies = () => { - cy.request({ - method: 'GET', - url: 'api/fleet/agent_policies', - headers: { 'kbn-xsrf': 'cypress-creds' }, - }).then((response) => { - response.body.items.forEach((item: { id: string }) => { - cy.request({ - method: 'POST', - url: `api/fleet/agent_policies/delete`, - headers: { 'kbn-xsrf': 'cypress-creds' }, - body: { - agentPolicyId: item.id, - }, - }); - }); - }); -}; - -export const deletePackages = () => { - cy.request({ - method: 'GET', - url: 'api/fleet/epm/packages', - headers: { 'kbn-xsrf': 'cypress-creds' }, - }).then((response) => { - response.body.items.forEach((item: { status: string; name: string; version: string }) => { - if (item.status === 'installed') { - cy.request({ - method: 'DELETE', - url: `api/fleet/epm/packages/${item.name}/${item.version}`, - headers: { 'kbn-xsrf': 'cypress-creds' }, - }); - } - }); - }); -}; - export const deleteAlertsAndRules = () => { const kibanaIndexUrl = `${Cypress.env('ELASTICSEARCH_URL')}/.kibana_\*`; @@ -179,6 +137,40 @@ export const deleteCases = () => { }); }; +export const deleteConnectors = () => { + const kibanaIndexUrl = `${Cypress.env('ELASTICSEARCH_URL')}/.kibana_\*`; + cy.request('POST', `${kibanaIndexUrl}/_delete_by_query?conflicts=proceed`, { + query: { + bool: { + filter: [ + { + match: { + type: 'action', + }, + }, + ], + }, + }, + }); +}; + +export const deleteSavedQueries = () => { + const kibanaIndexUrl = `${Cypress.env('ELASTICSEARCH_URL')}/.kibana_\*`; + cy.request('POST', `${kibanaIndexUrl}/_delete_by_query?conflicts=proceed`, { + query: { + bool: { + filter: [ + { + match: { + type: 'query', + }, + }, + ], + }, + }, + }); +}; + export const postDataView = (dataSource: string) => { cy.request({ method: 'POST', @@ -196,6 +188,15 @@ export const postDataView = (dataSource: string) => { }); }; +export const deleteDataView = (dataSource: string) => { + cy.request({ + method: 'DELETE', + url: `api/data_views/data_view/${dataSource}`, + headers: { 'kbn-xsrf': 'cypress-creds' }, + failOnStatusCode: false, + }); +}; + export const scrollToBottom = () => cy.scrollTo('bottom'); export const waitForPageToBeLoaded = () => { diff --git a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts index 2b7e8e0b3375..8f5917222071 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/create_new_rule.ts @@ -5,8 +5,8 @@ * 2.0. */ -import type { EmailConnector } from '../objects/connector'; -import { getEmailConnector } from '../objects/connector'; +import type { EmailConnector, IndexConnector } from '../objects/connector'; +import { getIndexConnector, getEmailConnector } from '../objects/connector'; import type { CustomRule, MachineLearningRule, @@ -14,6 +14,7 @@ import type { ThreatIndicatorRule, ThresholdRule, NewTermsRule, + Mitre, } from '../objects/rule'; import { getMachineLearningRule } from '../objects/rule'; import { @@ -106,6 +107,14 @@ import { NEW_TERMS_HISTORY_SIZE, NEW_TERMS_HISTORY_TIME_TYPE, NEW_TERMS_INPUT_AREA, + ACTIONS_THROTTLE_INPUT, + INDEX_SELECTOR, + CREATE_CONNECTOR_BTN, + SAVE_ACTION_CONNECTOR_BTN, + JSON_EDITOR, + CREATE_ACTION_CONNECTOR_BTN, + EMAIL_ACTION_BTN, + COMBO_BOX_SELECTION, } from '../screens/create_new_rule'; import { TOAST_ERROR } from '../screens/shared'; import { SERVER_SIDE_EVENT_COUNT } from '../screens/timeline'; @@ -114,7 +123,6 @@ import { refreshPage } from './security_header'; import { EUI_FILTER_SELECT_ITEM } from '../screens/common/controls'; export const createAndEnableRule = () => { - cy.get(SCHEDULE_CONTINUE_BUTTON).click({ force: true }); cy.get(CREATE_AND_ENABLE_BTN).click({ force: true }); cy.get(CREATE_AND_ENABLE_BTN).should('not.exist'); cy.get(BACK_TO_ALL_RULES_LINK).click({ force: true }); @@ -126,34 +134,41 @@ export const fillAboutRule = ( ) => { cy.get(RULE_NAME_INPUT).clear({ force: true }).type(rule.name, { force: true }); cy.get(RULE_DESCRIPTION_INPUT).clear({ force: true }).type(rule.description, { force: true }); + if (rule.severity) { + fillSeverity(rule.severity); + } + if (rule.riskScore) { + fillRiskScore(rule.riskScore); + } + if (rule.tags) { + fillRuleTags(rule.tags); + } + cy.get(ADVANCED_SETTINGS_BTN).click({ force: true }); - cy.get(SEVERITY_DROPDOWN).click({ force: true }); - cy.get(`#${rule.severity.toLowerCase()}`).click(); - - cy.get(DEFAULT_RISK_SCORE_INPUT).type(`{selectall}${rule.riskScore}`, { force: true }); - - rule.tags.forEach((tag) => { - cy.get(TAGS_INPUT).type(`${tag}{enter}`, { force: true }); - }); + if (rule.referenceUrls) { + fillReferenceUrls(rule.referenceUrls); + } - cy.get(ADVANCED_SETTINGS_BTN).click({ force: true }); + if (rule.falsePositivesExamples) { + fillFalsePositiveExamples(rule.falsePositivesExamples); + } - rule.referenceUrls.forEach((url, index) => { - cy.get(REFERENCE_URLS_INPUT).eq(index).clear({ force: true }).type(url, { force: true }); - cy.get(ADD_REFERENCE_URL_BTN).click({ force: true }); - }); + if (rule.mitre) { + fillMitre(rule.mitre); + } + if (rule.note) { + fillNote(rule.note); + } +}; - rule.falsePositivesExamples.forEach((falsePositive, index) => { - cy.get(FALSE_POSITIVES_INPUT) - .eq(index) - .clear({ force: true }) - .type(falsePositive, { force: true }); - cy.get(ADD_FALSE_POSITIVE_BTN).click({ force: true }); - }); +export const fillNote = (note: string) => { + cy.get(INVESTIGATION_NOTES_TEXTAREA).clear({ force: true }).type(note, { force: true }); +}; +export const fillMitre = (mitreAttacks: Mitre[]) => { let techniqueIndex = 0; let subtechniqueInputIndex = 0; - rule.mitre.forEach((mitre, tacticIndex) => { + mitreAttacks.forEach((mitre, tacticIndex) => { cy.get(MITRE_ATTACK_TACTIC_DROPDOWN).eq(tacticIndex).click({ force: true }); cy.contains(MITRE_TACTIC, mitre.tactic).click(); @@ -175,8 +190,38 @@ export const fillAboutRule = ( cy.get(MITRE_ATTACK_ADD_TACTIC_BUTTON).click({ force: true }); }); +}; - cy.get(INVESTIGATION_NOTES_TEXTAREA).clear({ force: true }).type(rule.note, { force: true }); +export const fillFalsePositiveExamples = (falsePositives: string[]) => { + falsePositives.forEach((falsePositive, index) => { + cy.get(FALSE_POSITIVES_INPUT) + .eq(index) + .clear({ force: true }) + .type(falsePositive, { force: true }); + cy.get(ADD_FALSE_POSITIVE_BTN).click({ force: true }); + }); +}; + +export const fillSeverity = (severity: string) => { + cy.get(SEVERITY_DROPDOWN).click({ force: true }); + cy.get(`#${severity.toLowerCase()}`).click(); +}; + +export const fillRiskScore = (riskScore: string) => { + cy.get(DEFAULT_RISK_SCORE_INPUT).type(`{selectall}${riskScore}`, { force: true }); +}; + +export const fillRuleTags = (tags: string[]) => { + tags.forEach((tag) => { + cy.get(TAGS_INPUT).type(`${tag}{enter}`, { force: true }); + }); +}; + +export const fillReferenceUrls = (referenceUrls: string[]) => { + referenceUrls.forEach((url, index) => { + cy.get(REFERENCE_URLS_INPUT).eq(index).clear({ force: true }).type(url, { force: true }); + cy.get(ADD_REFERENCE_URL_BTN).click({ force: true }); + }); }; export const fillAboutRuleAndContinue = ( @@ -200,8 +245,9 @@ export const fillAboutRuleWithOverrideAndContinue = (rule: OverrideRule) => { }); }); - cy.get(SEVERITY_DROPDOWN).click({ force: true }); - cy.get(`#${rule.severity.toLowerCase()}`).click(); + if (rule.severity) { + fillSeverity(rule.severity); + } cy.get(RISK_MAPPING_OVERRIDE_OPTION).click(); cy.get(RISK_OVERRIDE).within(() => { @@ -210,48 +256,24 @@ export const fillAboutRuleWithOverrideAndContinue = (rule: OverrideRule) => { cy.get(DEFAULT_RISK_SCORE_INPUT).type(`{selectall}${rule.riskScore}`, { force: true }); - rule.tags.forEach((tag) => { - cy.get(TAGS_INPUT).type(`${tag}{enter}`, { force: true }); - }); + if (rule.tags) { + fillRuleTags(rule.tags); + } cy.get(ADVANCED_SETTINGS_BTN).click({ force: true }); - rule.referenceUrls.forEach((url, index) => { - cy.get(REFERENCE_URLS_INPUT).eq(index).type(url, { force: true }); - cy.get(ADD_REFERENCE_URL_BTN).click({ force: true }); - }); - - rule.falsePositivesExamples.forEach((falsePositive, index) => { - cy.get(FALSE_POSITIVES_INPUT).eq(index).type(falsePositive, { force: true }); - cy.get(ADD_FALSE_POSITIVE_BTN).click({ force: true }); - }); - - let techniqueIndex = 0; - let subtechniqueInputIndex = 0; - rule.mitre.forEach((mitre, tacticIndex) => { - cy.get(MITRE_ATTACK_TACTIC_DROPDOWN).eq(tacticIndex).click({ force: true }); - cy.contains(MITRE_TACTIC, mitre.tactic).click(); - - mitre.techniques.forEach((technique) => { - cy.get(MITRE_ATTACK_ADD_TECHNIQUE_BUTTON).eq(tacticIndex).click({ force: true }); - cy.get(MITRE_ATTACK_TECHNIQUE_DROPDOWN).eq(techniqueIndex).click({ force: true }); - cy.contains(MITRE_TACTIC, technique.name).click(); - - technique.subtechniques.forEach((subtechnique) => { - cy.get(MITRE_ATTACK_ADD_SUBTECHNIQUE_BUTTON).eq(techniqueIndex).click({ force: true }); - cy.get(MITRE_ATTACK_SUBTECHNIQUE_DROPDOWN) - .eq(subtechniqueInputIndex) - .click({ force: true }); - cy.contains(MITRE_TACTIC, subtechnique).click(); - subtechniqueInputIndex++; - }); - techniqueIndex++; - }); - - cy.get(MITRE_ATTACK_ADD_TACTIC_BUTTON).click({ force: true }); - }); - - cy.get(INVESTIGATION_NOTES_TEXTAREA).type(rule.note, { force: true }); + if (rule.referenceUrls) { + fillReferenceUrls(rule.referenceUrls); + } + if (rule.falsePositivesExamples) { + fillFalsePositiveExamples(rule.falsePositivesExamples); + } + if (rule.mitre) { + fillMitre(rule.mitre); + } + if (rule.note) { + fillNote(rule.note); + } cy.get(RULE_NAME_OVERRIDE).within(() => { cy.get(COMBO_BOX_INPUT).type(`${rule.nameOverride}{enter}`); @@ -264,35 +286,65 @@ export const fillAboutRuleWithOverrideAndContinue = (rule: OverrideRule) => { getAboutContinueButton().should('exist').click({ force: true }); }; -export const fillDefineCustomRuleWithImportedQueryAndContinue = ( - rule: CustomRule | OverrideRule -) => { +export const fillCustomQuery = (rule: CustomRule | OverrideRule) => { + if (rule.timeline?.id) { + cy.get(IMPORT_QUERY_FROM_SAVED_TIMELINE_LINK).click(); + cy.get(TIMELINE(rule.timeline.id)).click(); + cy.get(CUSTOM_QUERY_INPUT).should('have.value', rule.customQuery); + } else { + cy.get(CUSTOM_QUERY_INPUT) + .first() + .type(rule.customQuery || ''); + } +}; + +export const fillDefineCustomRuleAndContinue = (rule: CustomRule | OverrideRule) => { if (rule.dataSource.type === 'dataView') { cy.get(DATA_VIEW_OPTION).click(); cy.get(DATA_VIEW_COMBO_BOX).type(`${rule.dataSource.dataView}{enter}`); } - cy.get(IMPORT_QUERY_FROM_SAVED_TIMELINE_LINK).click(); - cy.get(TIMELINE(rule.timeline.id)).click(); - cy.get(CUSTOM_QUERY_INPUT).should('have.value', rule.customQuery); - + fillCustomQuery(rule); cy.get(DEFINE_CONTINUE_BUTTON).should('exist').click({ force: true }); - cy.get(CUSTOM_QUERY_INPUT).should('not.exist'); }; export const fillScheduleRuleAndContinue = (rule: CustomRule | MachineLearningRule) => { - cy.get(RUNS_EVERY_INTERVAL).type('{selectall}').type(rule.runsEvery.interval); - cy.get(RUNS_EVERY_TIME_TYPE).select(rule.runsEvery.timeType); - cy.get(LOOK_BACK_INTERVAL).type('{selectAll}').type(rule.lookBack.interval); - cy.get(LOOK_BACK_TIME_TYPE).select(rule.lookBack.timeType); + if (rule.runsEvery) { + cy.get(RUNS_EVERY_INTERVAL).type('{selectall}').type(rule.runsEvery.interval); + cy.get(RUNS_EVERY_TIME_TYPE).select(rule.runsEvery.timeType); + } + if (rule.lookBack) { + cy.get(LOOK_BACK_INTERVAL).type('{selectAll}').type(rule.lookBack.interval); + cy.get(LOOK_BACK_TIME_TYPE).select(rule.lookBack.timeType); + } + cy.get(SCHEDULE_CONTINUE_BUTTON).click({ force: true }); +}; + +export const fillRuleAction = (rule: CustomRule) => { + if (rule.actions) { + cy.get(ACTIONS_THROTTLE_INPUT).select(rule.actions.throttle); + rule.actions?.connectors.forEach((connector) => { + switch (connector.type) { + case 'index': + cy.get(INDEX_SELECTOR).click(); + cy.get(CREATE_CONNECTOR_BTN).click(); + fillIndexConnectorForm(connector); + break; + case 'email': + cy.get(EMAIL_ACTION_BTN).click(); + cy.get(CREATE_ACTION_CONNECTOR_BTN).click(); + fillEmailConnectorForm(connector); + break; + } + }); + } }; export const fillDefineThresholdRule = (rule: ThresholdRule) => { const thresholdField = 0; const threshold = 1; - cy.get(IMPORT_QUERY_FROM_SAVED_TIMELINE_LINK).click(); - cy.get(TIMELINE(rule.timeline.id)).click(); + fillCustomQuery(rule); cy.get(COMBO_BOX_CLEAR_BTN).first().click(); if (rule.dataSource.type === 'indexPatterns') { @@ -318,9 +370,7 @@ export const fillDefineThresholdRuleAndContinue = (rule: ThresholdRule) => { const typeThresholdField = ($el: Cypress.ObjectLike) => cy.wrap($el).type(rule.thresholdField, { delay: 35 }); - cy.get(IMPORT_QUERY_FROM_SAVED_TIMELINE_LINK).click(); - cy.get(TIMELINE(rule.timeline.id)).click(); - cy.get(CUSTOM_QUERY_INPUT).should('have.value', rule.customQuery); + fillCustomQuery(rule); cy.get(THRESHOLD_INPUT_AREA) .find(INPUT) .then((inputs) => { @@ -360,9 +410,7 @@ export const fillDefineEqlRuleAndContinue = (rule: CustomRule) => { }; export const fillDefineNewTermsRuleAndContinue = (rule: NewTermsRule) => { - cy.get(IMPORT_QUERY_FROM_SAVED_TIMELINE_LINK).click(); - cy.get(TIMELINE(rule.timeline.id)).click(); - cy.get(CUSTOM_QUERY_INPUT).should('have.value', rule.customQuery); + fillCustomQuery(rule); cy.get(NEW_TERMS_INPUT_AREA).find(INPUT).click().type(rule.newTermsFields[0], { delay: 35 }); cy.get(EUI_FILTER_SELECT_ITEM).click({ force: true }); cy.focused().type('{esc}'); // Close combobox dropdown so next inputs can be interacted with @@ -449,6 +497,21 @@ export const fillEmailConnectorForm = (connector: EmailConnector = getEmailConne cy.get(EMAIL_CONNECTOR_PASSWORD_INPUT).type(connector.password); }; +export const fillIndexConnectorForm = (connector: IndexConnector = getIndexConnector()) => { + cy.get(CONNECTOR_NAME_INPUT).type(connector.name); + cy.get(COMBO_BOX_INPUT).type(connector.index); + + cy.get(COMBO_BOX_SELECTION).click({ force: true }); + + cy.get(SAVE_ACTION_CONNECTOR_BTN).click(); + cy.get(SAVE_ACTION_CONNECTOR_BTN).should('not.exist'); + cy.get(JSON_EDITOR).should('be.visible'); + cy.get(JSON_EDITOR).click(); + cy.get(JSON_EDITOR).type(connector.document, { + parseSpecialCharSequences: false, + }); +}; + /** Returns the indicator index drop down field. Pass in row number, default is 1 */ export const getIndicatorIndexComboField = (row = 1) => cy.get(THREAT_COMBO_BOX_INPUT).eq(row * 2 - 2); diff --git a/x-pack/plugins/security_solution/cypress/tasks/integrations.ts b/x-pack/plugins/security_solution/cypress/tasks/integrations.ts index 1da83a591aa1..0150d0c83c3d 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/integrations.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/integrations.ts @@ -18,6 +18,8 @@ export const installAwsCloudFrontWithPolicy = () => { visit('app/integrations/detail/aws-1.17.0/overview?integration=cloudfront'); cy.get(ADD_INTEGRATION_BTN).click(); cy.get(QUEUE_URL).type('http://www.example.com'); + + // Fleet installs an integration very slowly, so we have to increase the timeout here. cy.get(SAVE_AND_CONTINUE_BTN).click(); - cy.get(INTEGRATION_ADDED_POP_UP).should('exist'); + cy.get(INTEGRATION_ADDED_POP_UP, { timeout: 120000 }).should('exist'); }; diff --git a/x-pack/plugins/security_solution/jest.integration.config.js b/x-pack/plugins/security_solution/jest.integration.config.js new file mode 100644 index 000000000000..046faf5e6198 --- /dev/null +++ b/x-pack/plugins/security_solution/jest.integration.config.js @@ -0,0 +1,12 @@ +/* + * 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. + */ + +module.exports = { + preset: '@kbn/test/jest_integration', + rootDir: '../../..', + roots: ['/x-pack/plugins/security_solution'], +}; diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/host_risk_summary.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/host_risk_summary.test.tsx deleted file mode 100644 index 2320b85113c3..000000000000 --- a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/host_risk_summary.test.tsx +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; - -import { render } from '@testing-library/react'; -import { TestProviders } from '../../../mock'; -import { HostRiskSummary } from './host_risk_summary'; -import { RiskSeverity } from '../../../../../common/search_strategy'; -import { getEmptyValue } from '../../empty_value'; - -describe('HostRiskSummary', () => { - it('renders host risk data', () => { - const riskSeverity = RiskSeverity.low; - const hostRisk = { - loading: false, - isModuleEnabled: true, - result: [ - { - '@timestamp': '1641902481', - host: { - name: 'test-host-name', - risk: { - multipliers: [], - calculated_score_norm: 9999, - calculated_level: riskSeverity, - rule_risks: [], - }, - }, - }, - ], - }; - - const { getByText } = render( - - - - ); - - expect(getByText(riskSeverity)).toBeInTheDocument(); - }); - - it('renders spinner when loading', () => { - const hostRisk = { - loading: true, - isModuleEnabled: true, - result: [], - }; - - const { getByTestId } = render( - - - - ); - - expect(getByTestId('loading')).toBeInTheDocument(); - }); - - it('renders empty value when there is no host data', () => { - const hostRisk = { - loading: false, - isModuleEnabled: true, - result: [], - }; - - const { getByText } = render( - - - - ); - - expect(getByText(getEmptyValue())).toBeInTheDocument(); - }); -}); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.test.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.test.tsx new file mode 100644 index 000000000000..a02c7729f4e0 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.test.tsx @@ -0,0 +1,96 @@ +/* + * 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 React from 'react'; + +import { render } from '@testing-library/react'; +import { TestProviders } from '../../../mock'; +import type { RiskEntity } from './risk_summary'; +import * as i18n from './translations'; +import { RiskSummary } from './risk_summary'; +import { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy'; +import { getEmptyValue } from '../../empty_value'; + +describe.each([RiskScoreEntity.host, RiskScoreEntity.user])( + 'RiskSummary entityType: %s', + (riskEntity) => { + it(`renders ${riskEntity} risk data`, () => { + const riskSeverity = RiskSeverity.low; + const risk = { + loading: false, + isModuleEnabled: true, + result: [ + { + '@timestamp': '1641902481', + [riskEntity === RiskScoreEntity.host ? 'host' : 'user']: { + name: 'test-host-name', + risk: { + multipliers: [], + calculated_score_norm: 9999, + calculated_level: riskSeverity, + rule_risks: [], + }, + }, + }, + ], // as unknown as HostRiskScore[] | UserRiskScore[], + } as unknown as RiskEntity['risk']; + + const props = { + riskEntity, + risk, + } as RiskEntity; + + const { getByText } = render( + + + + ); + + expect(getByText(riskSeverity)).toBeInTheDocument(); + expect(getByText(i18n.RISK_DATA_TITLE(riskEntity))).toBeInTheDocument(); + }); + + it('renders spinner when loading', () => { + const risk = { + loading: true, + isModuleEnabled: true, + result: [], + }; + + const props = { + riskEntity, + risk, + } as RiskEntity; + const { getByTestId } = render( + + + + ); + + expect(getByTestId('loading')).toBeInTheDocument(); + }); + + it(`renders empty value when there is no ${riskEntity} data`, () => { + const risk = { + loading: false, + isModuleEnabled: true, + result: [], + }; + const props = { + riskEntity, + risk, + } as RiskEntity; + const { getByText } = render( + + + + ); + + expect(getByText(getEmptyValue())).toBeInTheDocument(); + }); + } +); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/host_risk_summary.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.tsx similarity index 50% rename from x-pack/plugins/security_solution/public/common/components/event_details/cti_details/host_risk_summary.tsx rename to x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.tsx index 68d2d9a65157..6f24803165ac 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/host_risk_summary.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/risk_summary.tsx @@ -12,42 +12,52 @@ import * as i18n from './translations'; import { EnrichedDataRow, ThreatSummaryPanelHeader } from './threat_summary_view'; import { RiskScore } from '../../severity/common'; import type { RiskSeverity } from '../../../../../common/search_strategy'; -import type { HostRisk } from '../../../../risk_score/containers'; +import { RiskScoreEntity } from '../../../../../common/search_strategy'; +import type { HostRisk, UserRisk } from '../../../../risk_score/containers'; import { getEmptyValue } from '../../empty_value'; import { RiskScoreDocLink } from '../../risk_score/risk_score_onboarding/risk_score_doc_link'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; import { RiskScoreHeaderTitle } from '../../risk_score/risk_score_onboarding/risk_score_header_title'; -const HostRiskSummaryComponent: React.FC<{ - hostRisk: HostRisk; - originalHostRisk?: RiskSeverity | undefined; -}> = ({ hostRisk, originalHostRisk }) => { - const currentHostRiskScore = hostRisk?.result?.[0]?.host?.risk?.calculated_level; +interface HostRiskEntity { + originalRisk?: RiskSeverity | undefined; + risk: HostRisk; + riskEntity: RiskScoreEntity.host; +} + +interface UserRiskEntity { + originalRisk?: RiskSeverity | undefined; + risk: UserRisk; + riskEntity: RiskScoreEntity.user; +} + +export type RiskEntity = HostRiskEntity | UserRiskEntity; + +const RiskSummaryComponent: React.FC = ({ risk, riskEntity, originalRisk }) => { + const currentRiskScore = + riskEntity === RiskScoreEntity.host + ? risk?.result?.[0]?.host?.risk?.calculated_level + : risk?.result?.[0]?.user?.risk?.calculated_level; + return ( <> } toolTipContent={ - } + riskScoreEntity={riskEntity} + title={i18n.RISK_SCORE_TITLE(riskEntity)} /> ), }} @@ -55,26 +65,26 @@ const HostRiskSummaryComponent: React.FC<{ } /> - {hostRisk.loading && } + {risk.loading && } - {!hostRisk.loading && ( + {!risk.loading && ( <> + currentRiskScore ? ( + ) : ( getEmptyValue() ) } /> - {originalHostRisk && currentHostRiskScore !== originalHostRisk && ( + {originalRisk && currentRiskScore !== originalRisk && ( <> } + field={i18n.ORIGINAL_RISK_CLASSIFICATION(riskEntity)} + value={} /> )} @@ -84,4 +94,4 @@ const HostRiskSummaryComponent: React.FC<{ ); }; -export const HostRiskSummary = React.memo(HostRiskSummaryComponent); +export const RiskSummary = React.memo(RiskSummaryComponent); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/threat_summary_view.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/threat_summary_view.tsx index 485f36b0416a..b3ba2febe5d7 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/threat_summary_view.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/threat_summary_view.tsx @@ -26,10 +26,10 @@ import type { TimelineEventsDetailsItem, RiskSeverity, } from '../../../../../common/search_strategy'; -import { HostRiskSummary } from './host_risk_summary'; -import { UserRiskSummary } from './user_risk_summary'; +import { RiskSummary } from './risk_summary'; import { EnrichmentSummary } from './enrichment_summary'; import type { HostRisk, UserRisk } from '../../../../risk_score/containers'; +import { RiskScoreEntity } from '../../../../../common/search_strategy'; const UppercaseEuiTitle = styled(EuiTitle)` text-transform: uppercase; @@ -161,11 +161,19 @@ const ThreatSummaryViewComponent: React.FC<{ - + - + + i18n.translate('xpack.securitySolution.alertDetails.overview.hostRiskClassification', { + defaultMessage: 'Current {riskEntity} risk classification', + values: { + riskEntity: getRiskEntityTranslation(riskEntity, true), + }, + }); + +export const ORIGINAL_RISK_CLASSIFICATION = (riskEntity: RiskScoreEntity) => + i18n.translate('xpack.securitySolution.alertDetails.overview.originalHostRiskClassification', { + defaultMessage: 'Original {riskEntity} risk classification', + values: { + riskEntity: getRiskEntityTranslation(riskEntity, true), + }, + }); + +export const RISK_DATA_TITLE = (riskEntity: RiskScoreEntity) => + i18n.translate('xpack.securitySolution.alertDetails.overview.hostRiskDataTitle', { + defaultMessage: '{riskEntity} Risk Data', + values: { + riskEntity: getRiskEntityTranslation(riskEntity), + }, + }); diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/user_risk_summary.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/user_risk_summary.tsx deleted file mode 100644 index c97878cf6f5e..000000000000 --- a/x-pack/plugins/security_solution/public/common/components/event_details/cti_details/user_risk_summary.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { EuiLoadingSpinner, EuiPanel } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n-react'; -import * as i18n from './translations'; -import { EnrichedDataRow, ThreatSummaryPanelHeader } from './threat_summary_view'; -import { RiskScore } from '../../severity/common'; -import type { RiskSeverity } from '../../../../../common/search_strategy'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import type { UserRisk } from '../../../../risk_score/containers'; -import { getEmptyValue } from '../../empty_value'; -import { RiskScoreDocLink } from '../../risk_score/risk_score_onboarding/risk_score_doc_link'; -import { RiskScoreHeaderTitle } from '../../risk_score/risk_score_onboarding/risk_score_header_title'; - -const UserRiskSummaryComponent: React.FC<{ - userRisk: UserRisk; - originalUserRisk?: RiskSeverity | undefined; -}> = ({ userRisk, originalUserRisk }) => { - const currentUserRiskScore = userRisk?.result?.[0]?.user?.risk?.calculated_level; - return ( - <> - - - } - toolTipContent={ - - } - /> - ), - }} - /> - } - /> - - {userRisk.loading && } - - {!userRisk.loading && ( - <> - - ) : ( - getEmptyValue() - ) - } - /> - {originalUserRisk && currentUserRiskScore !== originalUserRisk && ( - <> - } - /> - - )} - - )} - - - ); -}; -export const UserRiskSummary = React.memo(UserRiskSummaryComponent); diff --git a/x-pack/plugins/security_solution/public/common/components/paywall/index.tsx b/x-pack/plugins/security_solution/public/common/components/paywall/index.tsx index 53c21172f031..ee93861db2d7 100644 --- a/x-pack/plugins/security_solution/public/common/components/paywall/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/paywall/index.tsx @@ -14,13 +14,15 @@ import { EuiText, EuiButton, EuiTextColor, + EuiImage, } from '@elastic/eui'; import styled from 'styled-components'; import { useNavigation } from '../../lib/kibana'; import * as i18n from './translations'; +import paywallPng from '../../images/entity_paywall.png'; const PaywallDiv = styled.div` - max-width: 85%; + max-width: 75%; margin: 0 auto; .euiCard__betaBadgeWrapper { .euiCard__betaBadge { @@ -31,8 +33,15 @@ const PaywallDiv = styled.div` padding: 0 15%; } `; +const StyledEuiCard = styled(EuiCard)` + span.euiTitle { + max-width: 540px; + display: block; + margin: 0 auto; + } +`; -export const Paywall = memo(({ featureDescription }: { featureDescription?: string }) => { +export const Paywall = memo(({ heading }: { heading?: string }) => { const { getAppUrl, navigateTo } = useNavigation(); const subscriptionUrl = getAppUrl({ appId: 'management', @@ -43,25 +52,24 @@ export const Paywall = memo(({ featureDescription }: { featureDescription?: stri }, [navigateTo, subscriptionUrl]); return ( - } display="subdued" title={

- {i18n.UPGRADE_CTA} + {heading}

} description={false} + paddingSize="xl" >

- - {i18n.UPGRADE_MESSAGE(featureDescription)} - + {i18n.UPGRADE_MESSAGE}

@@ -73,7 +81,12 @@ export const Paywall = memo(({ featureDescription }: { featureDescription?: stri
-
+ + + + + +
); }); diff --git a/x-pack/plugins/security_solution/public/common/components/paywall/translations.ts b/x-pack/plugins/security_solution/public/common/components/paywall/translations.ts index 0062e7baa411..a78fda1e90fa 100644 --- a/x-pack/plugins/security_solution/public/common/components/paywall/translations.ts +++ b/x-pack/plugins/security_solution/public/common/components/paywall/translations.ts @@ -11,17 +11,10 @@ export const PLATINUM = i18n.translate('xpack.securitySolution.paywall.platinum' defaultMessage: 'Platinum', }); -export const UPGRADE_CTA = i18n.translate('xpack.securitySolution.paywall.upgradeButton', { - defaultMessage: 'Available from Platinum', +export const UPGRADE_MESSAGE = i18n.translate('xpack.securitySolution.paywall.upgradeMessage', { + defaultMessage: 'This feature is available with Platinum or higher subscription', }); -export const UPGRADE_MESSAGE = (description?: string) => - i18n.translate('xpack.securitySolution.paywall.upgradeMessage', { - values: { description: description ? description : 'this feature' }, - defaultMessage: - 'To turn use {description}, you must upgrade your license to Platinum, start a free 30-days trial, or spin up a cloud deployment on AWS, GCP, or Azure.', - }); - -export const UPGRADE_BUTTON = i18n.translate('xpack.securitySolution.paywall.upgradeCta', { +export const UPGRADE_BUTTON = i18n.translate('xpack.securitySolution.paywall.upgradeButton', { defaultMessage: 'Upgrade to Platinum', }); diff --git a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_deprecated/index.tsx b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_deprecated/index.tsx index 13ec1df29ae0..f4391f13fd21 100644 --- a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_deprecated/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_deprecated/index.tsx @@ -13,6 +13,7 @@ import { useCheckSignalIndex } from '../../../../detections/containers/detection import type { inputsModel } from '../../../store'; import { HeaderSection } from '../../header_section'; import * as i18n from './translations'; +import * as overviewI18n from '../../../../overview/components/entity_analytics/common/translations'; import { RiskScoreHeaderTitle } from '../risk_score_onboarding/risk_score_header_title'; export const RiskScoresDeprecated = ({ @@ -46,7 +47,15 @@ export const RiskScoresDeprecated = ({ return ( - } titleSize="s" /> + } + titleSize="s" + tooltip={ + entityType === RiskScoreEntity.user + ? overviewI18n.USER_RISK_TABLE_TOOLTIP + : overviewI18n.HOST_RISK_TABLE_TOOLTIP + } + /> {translations.cta}} body={translations.body} diff --git a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_doc_link.tsx b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_doc_link.tsx index 340f63e71bc7..3a74d4614d99 100644 --- a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_doc_link.tsx +++ b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_doc_link.tsx @@ -9,7 +9,7 @@ import { EuiLink } from '@elastic/eui'; import React from 'react'; import { RISKY_HOSTS_DOC_LINK, RISKY_USERS_DOC_LINK } from '../../../../../common/constants'; import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { LEARN_MORE } from '../../../../overview/components/entity_analytics/host_risk_score/translations'; +import { LEARN_MORE } from '../../../../overview/components/entity_analytics/risk_score/translations'; const RiskScoreDocLinkComponent = ({ riskScoreEntity, diff --git a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_header_title.tsx b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_header_title.tsx index dffb9c646d7c..47eb0d9cb61d 100644 --- a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_header_title.tsx +++ b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_header_title.tsx @@ -5,46 +5,23 @@ * 2.0. */ import React from 'react'; -import styled from 'styled-components'; -import { EuiIconTip } from '@elastic/eui'; import { RiskScoreEntity } from '../../../../../common/search_strategy'; import { NavItemBetaBadge } from '../../navigation/nav_item_beta_badge'; import * as i18n from '../../../../overview/components/entity_analytics/common/translations'; import { TECHNICAL_PREVIEW } from './translations'; -const IconWrapper = styled.span` - margin-left: ${({ theme }) => theme.eui.euiSizeS}; -`; - const RiskScoreHeaderTitleComponent = ({ riskScoreEntity, - showTooltip = true, title, }: { riskScoreEntity: RiskScoreEntity; - showTooltip?: boolean; title?: string; }) => { return ( <> {title ?? (riskScoreEntity === RiskScoreEntity.user ? i18n.USER_RISK_TITLE : i18n.HOST_RISK_TITLE)} - {showTooltip && ( - - - - )} ); diff --git a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_no_data_detected.tsx b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_no_data_detected.tsx index b492ee51e42a..1baafecd663d 100644 --- a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_no_data_detected.tsx +++ b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_no_data_detected.tsx @@ -14,6 +14,7 @@ import * as i18n from './translations'; import { RiskScoreHeaderTitle } from './risk_score_header_title'; import { RiskScoreRestartButton } from './risk_score_restart_button'; import type { inputsModel } from '../../../store'; +import * as overviewI18n from '../../../../overview/components/entity_analytics/common/translations'; const RiskScoresNoDataDetectedComponent = ({ entityType, @@ -33,7 +34,15 @@ const RiskScoresNoDataDetectedComponent = ({ return ( - } titleSize="s" /> + } + titleSize="s" + tooltip={ + entityType === RiskScoreEntity.user + ? overviewI18n.USER_RISK_TABLE_TOOLTIP + : overviewI18n.HOST_RISK_TABLE_TOOLTIP + } + /> {translations.title}} body={translations.body} diff --git a/x-pack/plugins/security_solution/public/common/components/risk_score/translations.ts b/x-pack/plugins/security_solution/public/common/components/risk_score/translations.ts new file mode 100644 index 000000000000..f1df3145fd97 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/risk_score/translations.ts @@ -0,0 +1,48 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { RiskScoreEntity } from '../../../../common/search_strategy'; + +export const HOST = i18n.translate('xpack.securitySolution.riskScore.overview.hostTitle', { + defaultMessage: 'Host', +}); + +export const HOST_LOWERCASE = i18n.translate( + 'xpack.securitySolution.riskScore.overview.hostLowercase', + { + defaultMessage: 'host', + } +); + +export const USER = i18n.translate('xpack.securitySolution.riskScore.overview.userTitle', { + defaultMessage: 'User', +}); + +export const USER_LOWERCASE = i18n.translate( + 'xpack.securitySolution.riskScore.overview.userLowercase', + { + defaultMessage: 'user', + } +); + +export const RISK_SCORE_TITLE = (riskEntity: RiskScoreEntity) => + i18n.translate('xpack.securitySolution.riskScore.overview.riskScoreTitle', { + defaultMessage: '{riskEntity} Risk Score', + values: { + riskEntity: getRiskEntityTranslation(riskEntity), + }, + }); + +export const getRiskEntityTranslation = (riskEntity: RiskScoreEntity, lowercase = false) => + lowercase + ? riskEntity === RiskScoreEntity.host + ? HOST_LOWERCASE + : USER_LOWERCASE + : riskEntity === RiskScoreEntity.host + ? HOST + : USER; diff --git a/x-pack/plugins/security_solution/public/common/components/severity/severity_filter_group.test.tsx b/x-pack/plugins/security_solution/public/common/components/severity/severity_filter_group.test.tsx new file mode 100644 index 000000000000..187f743f0b46 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/severity/severity_filter_group.test.tsx @@ -0,0 +1,42 @@ +/* + * 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 React from 'react'; +import { render, fireEvent } from '@testing-library/react'; +import { SeverityFilterGroup } from './severity_filter_group'; +import { RiskSeverity } from '../../../../common/search_strategy'; +import { TestProviders } from '../../mock'; + +describe('SeverityFilterGroup', () => { + it('preserves sort order when severityCount is out of order', () => { + const { getByTestId, getAllByTestId } = render( + + + + ); + + fireEvent.click(getByTestId('risk-filter-button')); + + expect(getAllByTestId('risk-score').map((ele) => ele.textContent)).toEqual([ + 'Unknown', + 'Low', + 'Moderate', + 'High', + 'Critical', + ]); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/severity/severity_filter_group.tsx b/x-pack/plugins/security_solution/public/common/components/severity/severity_filter_group.tsx index 126f3e3870ab..ea05c31d6f48 100644 --- a/x-pack/plugins/security_solution/public/common/components/severity/severity_filter_group.tsx +++ b/x-pack/plugins/security_solution/public/common/components/severity/severity_filter_group.tsx @@ -16,6 +16,7 @@ import { } from '@elastic/eui'; import type { RiskSeverity } from '../../../../common/search_strategy'; +import { SEVERITY_UI_SORT_ORDER } from '../../../../common/search_strategy'; import type { SeverityCount } from './types'; import { RiskScore } from './common'; @@ -46,10 +47,10 @@ export const SeverityFilterGroup: React.FC<{ const items: SeverityItems[] = useMemo(() => { const checked: FilterChecked = 'on'; - return (Object.keys(severityCount) as RiskSeverity[]).map((k) => ({ - risk: k, - count: severityCount[k], - checked: selectedSeverities.includes(k) ? checked : undefined, + return SEVERITY_UI_SORT_ORDER.map((severity) => ({ + risk: severity, + count: severityCount[severity], + checked: selectedSeverities.includes(severity) ? checked : undefined, })); }, [severityCount, selectedSeverities]); diff --git a/x-pack/plugins/security_solution/public/common/images/entity_paywall.png b/x-pack/plugins/security_solution/public/common/images/entity_paywall.png new file mode 100644 index 000000000000..9c88f4670db4 Binary files /dev/null and b/x-pack/plugins/security_solution/public/common/images/entity_paywall.png differ diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/components/all_exception_items_table/index.test.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/components/all_exception_items_table/index.test.tsx index d34cf07aa914..139d171088ec 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/components/all_exception_items_table/index.test.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/components/all_exception_items_table/index.test.tsx @@ -109,6 +109,7 @@ describe('ExceptionsViewer', () => { ], }} listType={ExceptionListTypeEnum.DETECTION} + isViewReadOnly={false} /> ); @@ -146,6 +147,7 @@ describe('ExceptionsViewer', () => { ], }} listType={ExceptionListTypeEnum.DETECTION} + isViewReadOnly={false} /> ); @@ -183,6 +185,7 @@ describe('ExceptionsViewer', () => { ], }} listType={ExceptionListTypeEnum.ENDPOINT} + isViewReadOnly={false} /> ); @@ -226,6 +229,7 @@ describe('ExceptionsViewer', () => { ], }} listType={ExceptionListTypeEnum.DETECTION} + isViewReadOnly={false} /> ); @@ -268,6 +272,7 @@ describe('ExceptionsViewer', () => { ], }} listType={ExceptionListTypeEnum.DETECTION} + isViewReadOnly={false} /> ); @@ -301,6 +306,7 @@ describe('ExceptionsViewer', () => { ], }} listType={ExceptionListTypeEnum.DETECTION} + isViewReadOnly={false} /> ); diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/components/all_exception_items_table/index.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/components/all_exception_items_table/index.tsx index 9ba216b80f14..ffe07bb2c5df 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/components/all_exception_items_table/index.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/components/all_exception_items_table/index.tsx @@ -6,20 +6,21 @@ */ import React, { useCallback, useMemo, useEffect, useReducer } from 'react'; -import { EuiPanel, EuiSpacer } from '@elastic/eui'; +import { EuiPanel, EuiSpacer, EuiText } from '@elastic/eui'; import type { ExceptionListItemSchema, UseExceptionListItemsSuccess, Pagination, - ExceptionListTypeEnum, } from '@kbn/securitysolution-io-ts-list-types'; +import { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; import { transformInput } from '@kbn/securitysolution-list-hooks'; import { deleteExceptionListItemById, fetchExceptionListsItemsByListIds, } from '@kbn/securitysolution-list-api'; +import styled from 'styled-components'; import { DEFAULT_INDEX_PATTERN } from '../../../../../common/constants'; import { useUserData } from '../../../../detections/components/user_info'; import { useKibana, useToasts } from '../../../../common/lib/kibana'; @@ -37,6 +38,10 @@ import * as i18n from './translations'; import { useFindExceptionListReferences } from '../../logic/use_find_references'; import type { Rule } from '../../../../detections/containers/detection_engine/rules/types'; +const StyledText = styled(EuiText)` + font-style: italic; +`; + const STATES_SEARCH_HIDDEN: ViewerState[] = ['error', 'empty']; const STATES_PAGINATION_UTILITY_HIDDEN: ViewerState[] = [ 'loading', @@ -51,7 +56,7 @@ const initialState: State = { pageIndex: 0, pageSize: 25, totalItemCount: 0, - pageSizeOptions: [1, 5, 10, 25, 50, 100, 200, 300], + pageSizeOptions: [5, 10, 25, 50, 100, 200, 300], }, exceptions: [], exceptionToEdit: null, @@ -70,12 +75,15 @@ export interface GetExceptionItemProps { interface ExceptionsViewerProps { rule: Rule | null; listType: ExceptionListTypeEnum; + /* Used for when displaying exceptions for a rule that has since been deleted, forcing read only view */ + isViewReadOnly: boolean; onRuleChange?: () => void; } const ExceptionsViewerComponent = ({ rule, listType, + isViewReadOnly, onRuleChange, }: ExceptionsViewerProps): JSX.Element => { const { services } = useKibana(); @@ -154,7 +162,18 @@ const ExceptionsViewerComponent = ({ [dispatch] ); - const [_, allReferences] = useFindExceptionListReferences(exceptionListsToQuery); + const [isLoadingReferences, isFetchReferencesError, allReferences] = + useFindExceptionListReferences(exceptionListsToQuery); + + useEffect(() => { + if (isFetchReferencesError) { + setViewerState('error'); + } else if (viewerState == null && isLoadingReferences) { + setViewerState('loading'); + } else if (viewerState === 'loading' && !isLoadingReferences) { + setViewerState(null); + } + }, [isLoadingReferences, isFetchReferencesError, setViewerState, viewerState]); const handleFetchItems = useCallback( async (options?: GetExceptionItemProps) => { @@ -212,12 +231,8 @@ const ExceptionsViewerComponent = ({ const handleGetExceptionListItems = useCallback( async (options?: GetExceptionItemProps) => { try { - setViewerState('loading'); - const { pageIndex, itemsPerPage, total, data } = await handleFetchItems(options); - setViewerState(total > 0 ? null : 'empty'); - setExceptions({ exceptions: data, pagination: { @@ -226,6 +241,8 @@ const ExceptionsViewerComponent = ({ total, }, }); + + setViewerState(total > 0 ? null : 'empty'); } catch (e) { setViewerState('error'); @@ -323,8 +340,8 @@ const ExceptionsViewerComponent = ({ // User privileges checks useEffect((): void => { - setReadOnly(!canUserCRUD || !hasIndexWrite); - }, [setReadOnly, canUserCRUD, hasIndexWrite]); + setReadOnly(isViewReadOnly || !canUserCRUD || !hasIndexWrite); + }, [setReadOnly, isViewReadOnly, canUserCRUD, hasIndexWrite]); useEffect(() => { if (exceptionListsToQuery.length > 0) { @@ -367,6 +384,12 @@ const ExceptionsViewerComponent = ({ <> + + {listType === ExceptionListTypeEnum.ENDPOINT + ? i18n.ENDPOINT_EXCEPTIONS_TAB_ABOUT + : i18n.EXCEPTIONS_TAB_ABOUT} + + {!STATES_SEARCH_HIDDEN.includes(viewerState) && ( { return listType === ExceptionListTypeEnum.ENDPOINT - ? i18n.ADD_TO_ENDPOINT_LIST - : i18n.ADD_TO_DETECTIONS_LIST; + ? sharedI18n.ADD_TO_ENDPOINT_LIST + : sharedI18n.ADD_TO_DETECTIONS_LIST; }, [listType]); return ( @@ -84,7 +85,7 @@ const ExceptionsViewerSearchBarComponent = ({ values: { itemName }, defaultMessage: '"{itemName}" deleted successfully.', }); + +export const ENDPOINT_EXCEPTIONS_TAB_ABOUT = i18n.translate( + 'xpack.securitySolution.exceptions.allExceptionItems.exceptionEndpointDetailsDescription', + { + defaultMessage: + 'Endpoint exceptions are added to both the detection rule and the Elastic Endpoint agent on your hosts.', + } +); + +export const EXCEPTIONS_TAB_ABOUT = i18n.translate( + 'xpack.securitySolution.exceptions.allExceptionItems.exceptionDetectionDetailsDescription', + { + defaultMessage: 'Rule exceptions are added to the detection rule.', + } +); + +export const SEARCH_PLACEHOLDER = i18n.translate( + 'xpack.securitySolution.exceptions.allExceptionItems.searchPlaceholder', + { + defaultMessage: 'Filter exceptions using simple query syntax, for example, name:"my list"', + } +); diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/logic/use_find_references.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/logic/use_find_references.tsx index f30d5aeb598a..f7628f0014d2 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/logic/use_find_references.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_exceptions/logic/use_find_references.tsx @@ -14,7 +14,7 @@ import { useToasts } from '../../../common/lib/kibana'; import type { FindRulesReferencedByExceptionsListProp } from '../../../detections/containers/detection_engine/rules/types'; import * as i18n from '../utils/translations'; -export type ReturnUseFindExceptionListReferences = [boolean, RuleReferences | null]; +export type ReturnUseFindExceptionListReferences = [boolean, boolean, RuleReferences | null]; export interface RuleReferences { [key: string]: RuleReferenceSchema[]; @@ -28,6 +28,7 @@ export const useFindExceptionListReferences = ( ): ReturnUseFindExceptionListReferences => { const toasts = useToasts(); const [isLoading, setIsLoading] = useState(false); + const [errorExists, setErrorExists] = useState(false); const [references, setReferences] = useState(null); const listRefs = useMemo((): FindRulesReferencedByExceptionsListProp[] => { return ruleExceptionLists.map((list) => { @@ -61,11 +62,13 @@ export const useFindExceptionListReferences = ( }, {}); if (isSubscribed) { + setErrorExists(false); setIsLoading(false); setReferences(results); } } catch (error) { if (isSubscribed) { + setErrorExists(true); setIsLoading(false); toasts.addError(error, { title: i18n.ERROR_FETCHING_REFERENCES_TITLE }); } @@ -73,6 +76,7 @@ export const useFindExceptionListReferences = ( }; if (listRefs.length === 0 && isSubscribed) { + setErrorExists(false); setIsLoading(false); setReferences(null); } else { @@ -85,5 +89,5 @@ export const useFindExceptionListReferences = ( }; }, [ruleExceptionLists, listRefs, toasts]); - return [isLoading, references]; + return [isLoading, errorExists, references]; }; diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_field/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_field/index.tsx index 0babfc8de387..4cc5aed8aab6 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_field/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/rule_actions_field/index.tsx @@ -86,8 +86,7 @@ export const RuleActionsField: React.FC = ({ field, messageVariables }) = updatedActions[index] = deepMerge(updatedActions[index], { id }); field.setValue(updatedActions); }, - // eslint-disable-next-line react-hooks/exhaustive-deps - [field.setValue, actions] + [field, actions] ); const setAlertActionsProperty = useCallback( @@ -98,20 +97,26 @@ export const RuleActionsField: React.FC = ({ field, messageVariables }) = const setActionParamsProperty = useCallback( // eslint-disable-next-line @typescript-eslint/no-explicit-any (key: string, value: any, index: number) => { - field.setValue((prevValue: RuleAction[]) => { - const updatedActions = [...prevValue]; - updatedActions[index] = { - ...updatedActions[index], - params: { - ...updatedActions[index].params, - [key]: value, - }, - }; - return updatedActions; - }); + // validation is not triggered correctly when actions params updated (more details in https://github.com/elastic/kibana/issues/142217) + // wrapping field.setValue in setTimeout fixes the issue above + // and triggers validation after params have been updated + setTimeout( + () => + field.setValue((prevValue: RuleAction[]) => { + const updatedActions = [...prevValue]; + updatedActions[index] = { + ...updatedActions[index], + params: { + ...updatedActions[index].params, + [key]: value, + }, + }; + return updatedActions; + }), + 0 + ); }, - // eslint-disable-next-line react-hooks/exhaustive-deps - [field.setValue] + [field] ); const actionForm = useMemo( diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/translations.ts b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/translations.ts index b22d4030384a..3d817adb2605 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/translations.ts +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/all/exceptions/translations.ts @@ -155,9 +155,9 @@ export const referenceErrorMessage = (referenceCount: number) => }); export const EXCEPTION_LIST_SEARCH_PLACEHOLDER = i18n.translate( - 'xpack.securitySolution.exceptions.searchPlaceholder', + 'xpack.securitySolution.detectionEngine.rules.all.exceptions.searchPlaceholder', { - defaultMessage: 'e.g. Example List Name', + defaultMessage: 'Search by name or list id', } ); diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx index 5149269c57d9..0393fcf239f7 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx @@ -871,6 +871,7 @@ const RuleDetailsPageComponent: React.FC = ({ rule={rule} listType={ExceptionListTypeEnum.DETECTION} onRuleChange={refreshRule} + isViewReadOnly={!isExistingRule} data-test-subj="exceptionTab" /> @@ -881,6 +882,7 @@ const RuleDetailsPageComponent: React.FC = ({ rule={rule} listType={ExceptionListTypeEnum.ENDPOINT} onRuleChange={refreshRule} + isViewReadOnly={!isExistingRule} data-test-subj="endpointExceptionsTab" /> diff --git a/x-pack/plugins/security_solution/public/hosts/components/host_risk_score_table/index.tsx b/x-pack/plugins/security_solution/public/hosts/components/host_risk_score_table/index.tsx index 9a2138786b3a..dd2aacef77f6 100644 --- a/x-pack/plugins/security_solution/public/hosts/components/host_risk_score_table/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/components/host_risk_score_table/index.tsx @@ -8,8 +8,7 @@ import React, { useMemo, useCallback } from 'react'; import { useDispatch } from 'react-redux'; -import { EuiFlexGroup, EuiFlexItem, EuiIconTip } from '@elastic/eui'; -import styled from 'styled-components'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import type { Columns, Criteria, ItemsPerRow } from '../../../common/components/paginated_table'; import { PaginatedTable } from '../../../common/components/paginated_table'; import { useDeepEqualSelector } from '../../../common/hooks/use_selector'; @@ -43,10 +42,6 @@ export const rowItems: ItemsPerRow[] = [ }, ]; -const IconWrapper = styled.span` - margin-left: ${({ theme }) => theme.eui.euiSizeS}; -`; - const tableType = hostsModel.HostsTableType.risk; interface HostRiskScoreTableProps { @@ -150,21 +145,6 @@ const HostRiskScoreTableComponent: React.FC = ({
); - const headerTitle = ( - <> - {i18nHosts.HOST_RISK_TITLE} - - - - - ); - const getHostRiskScoreFilterQuerySelector = useMemo( () => hostsSelectors.hostRiskScoreSeverityFilterSelector(), [] @@ -200,8 +180,9 @@ const HostRiskScoreTableComponent: React.FC = ({ /> } headerSupplement={risk} - headerTitle={headerTitle} + headerTitle={i18nHosts.HOST_RISK_TITLE} headerUnit={i18n.UNIT(totalCount)} + headerTooltip={i18nHosts.HOST_RISK_TABLE_TOOLTIP} id={id} isInspect={isInspect} itemsPerRow={rowItems} diff --git a/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.tsx b/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.tsx index 5d1b0f58da6a..3a732072f2be 100644 --- a/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.tsx +++ b/x-pack/plugins/security_solution/public/hosts/components/kpi_hosts/index.tsx @@ -14,7 +14,7 @@ import type { HostsKpiProps } from './types'; import { CallOutSwitcher } from '../../../common/components/callouts'; import * as i18n from './translations'; import { RiskScoreDocLink } from '../../../common/components/risk_score/risk_score_onboarding/risk_score_doc_link'; -import { getHostRiskIndex, RiskQueries, RiskScoreEntity } from '../../../../common/search_strategy'; +import { getHostRiskIndex, RiskScoreEntity } from '../../../../common/search_strategy'; import { useRiskScoreFeatureStatus } from '../../../risk_score/containers/feature_status'; import { useSpaceId } from '../../../common/hooks/use_space_id'; @@ -23,7 +23,7 @@ export const HostsKpiComponent = React.memo( const spaceId = useSpaceId(); const defaultIndex = spaceId ? getHostRiskIndex(spaceId) : undefined; const { isEnabled, isLicenseValid, isLoading } = useRiskScoreFeatureStatus( - RiskQueries.hostsRiskScore, + RiskScoreEntity.host, defaultIndex ); diff --git a/x-pack/plugins/security_solution/public/management/components/console/components/command_usage.tsx b/x-pack/plugins/security_solution/public/management/components/console/components/command_usage.tsx index e70383d8251c..a79cc3cd7ad5 100644 --- a/x-pack/plugins/security_solution/public/management/components/console/components/command_usage.tsx +++ b/x-pack/plugins/security_solution/public/management/components/console/components/command_usage.tsx @@ -22,10 +22,10 @@ export const CommandInputUsage = memo>(({ const usageHelp = useMemo(() => { return getArgumentsForCommand(commandDef).map((usage, index) => { return ( - <> + {index > 0 && } {`${commandDef.name} ${usage}`} - + ); }); }, [commandDef]); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_processes_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/get_processes_action.test.tsx similarity index 88% rename from x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_processes_action.test.tsx rename to x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/get_processes_action.test.tsx index 97689a790afa..3b46967c33ab 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/get_processes_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/get_processes_action.test.tsx @@ -5,19 +5,19 @@ * 2.0. */ -import type { AppContextTestRender } from '../../../common/mock/endpoint'; -import { createAppRootMockRenderer } from '../../../common/mock/endpoint'; +import type { AppContextTestRender } from '../../../../common/mock/endpoint'; +import { createAppRootMockRenderer } from '../../../../common/mock/endpoint'; import { ConsoleManagerTestComponent, getConsoleManagerMockRenderResultQueriesAndActions, -} from '../console/components/console_manager/mocks'; +} from '../../console/components/console_manager/mocks'; import React from 'react'; -import { getEndpointResponseActionsConsoleCommands } from './endpoint_response_actions_console_commands'; -import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mocks'; -import { enterConsoleCommand } from '../console/mocks'; +import { getEndpointResponseActionsConsoleCommands } from '../endpoint_response_actions_console_commands'; +import { responseActionsHttpMocks } from '../../../mocks/response_actions_http_mocks'; +import { enterConsoleCommand } from '../../console/mocks'; import { waitFor } from '@testing-library/react'; -import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; -import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; +import type { ResponderCapabilities } from '../../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../../common/endpoint/constants'; describe('When using processes action from response actions console', () => { let render: ( @@ -161,6 +161,7 @@ describe('When using processes action from response actions console', () => { await waitFor(() => { expect(apiMocks.responseProvider.processes).toHaveBeenCalledTimes(1); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); }); // Hide the console @@ -182,20 +183,20 @@ describe('When using processes action from response actions console', () => { path: '/api/endpoint/action/1.2.3', }); pendingDetailResponse.data.isCompleted = false; + apiMocks.responseProvider.actionDetails.mockClear(); apiMocks.responseProvider.actionDetails.mockReturnValue(pendingDetailResponse); await render(); - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); await consoleManagerMockAccess.openRunningConsole(); await waitFor(() => { - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(3); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); }); }); - // FLAKY: https://github.com/elastic/kibana/issues/139707 - it.skip('should display completion output if done (no additional API calls)', async () => { + it('should display completion output if done (no additional API calls)', async () => { await render(); expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/isolate_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/isolate_action.test.tsx similarity index 87% rename from x-pack/plugins/security_solution/public/management/components/endpoint_responder/isolate_action.test.tsx rename to x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/isolate_action.test.tsx index 110ddbb53b1b..10dde22e6083 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/isolate_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/isolate_action.test.tsx @@ -5,20 +5,20 @@ * 2.0. */ -import type { AppContextTestRender } from '../../../common/mock/endpoint'; -import { createAppRootMockRenderer } from '../../../common/mock/endpoint'; +import type { AppContextTestRender } from '../../../../common/mock/endpoint'; +import { createAppRootMockRenderer } from '../../../../common/mock/endpoint'; import { ConsoleManagerTestComponent, getConsoleManagerMockRenderResultQueriesAndActions, -} from '../console/components/console_manager/mocks'; +} from '../../console/components/console_manager/mocks'; import React from 'react'; -import { getEndpointResponseActionsConsoleCommands } from './endpoint_response_actions_console_commands'; -import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mocks'; -import { enterConsoleCommand } from '../console/mocks'; +import { getEndpointResponseActionsConsoleCommands } from '../endpoint_response_actions_console_commands'; +import { responseActionsHttpMocks } from '../../../mocks/response_actions_http_mocks'; +import { enterConsoleCommand } from '../../console/mocks'; import { waitFor } from '@testing-library/react'; -import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; -import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; -import { getDeferred } from '../../mocks/utils'; +import type { ResponderCapabilities } from '../../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../../common/endpoint/constants'; +import { getDeferred } from '../../../mocks/utils'; describe('When using isolate action from response actions console', () => { let render: ( @@ -170,6 +170,7 @@ describe('When using isolate action from response actions console', () => { await waitFor(() => { expect(apiMocks.responseProvider.isolateHost).toHaveBeenCalledTimes(1); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); }); // Hide the console @@ -191,20 +192,20 @@ describe('When using isolate action from response actions console', () => { path: '/api/endpoint/action/1.2.3', }); pendingDetailResponse.data.isCompleted = false; + apiMocks.responseProvider.actionDetails.mockClear(); apiMocks.responseProvider.actionDetails.mockReturnValue(pendingDetailResponse); await render(); - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); await consoleManagerMockAccess.openRunningConsole(); await waitFor(() => { - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(3); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); }); }); - // SKIP: https://github.com/elastic/kibana/issues/139586 - it.skip('should display completion output if done (no additional API calls)', async () => { + it('should display completion output if done (no additional API calls)', async () => { await render(); expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/kill_process_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/kill_process_action.test.tsx similarity index 91% rename from x-pack/plugins/security_solution/public/management/components/endpoint_responder/kill_process_action.test.tsx rename to x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/kill_process_action.test.tsx index f888df2099b1..12cec2dd613b 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/kill_process_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/kill_process_action.test.tsx @@ -5,19 +5,19 @@ * 2.0. */ -import type { AppContextTestRender } from '../../../common/mock/endpoint'; -import { createAppRootMockRenderer } from '../../../common/mock/endpoint'; +import type { AppContextTestRender } from '../../../../common/mock/endpoint'; +import { createAppRootMockRenderer } from '../../../../common/mock/endpoint'; import { ConsoleManagerTestComponent, getConsoleManagerMockRenderResultQueriesAndActions, -} from '../console/components/console_manager/mocks'; +} from '../../console/components/console_manager/mocks'; import React from 'react'; -import { getEndpointResponseActionsConsoleCommands } from './endpoint_response_actions_console_commands'; -import { enterConsoleCommand } from '../console/mocks'; +import { getEndpointResponseActionsConsoleCommands } from '../endpoint_response_actions_console_commands'; +import { enterConsoleCommand } from '../../console/mocks'; import { waitFor } from '@testing-library/react'; -import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mocks'; -import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; -import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; +import { responseActionsHttpMocks } from '../../../mocks/response_actions_http_mocks'; +import type { ResponderCapabilities } from '../../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../../common/endpoint/constants'; describe('When using the kill-process action from response actions console', () => { let render: ( @@ -250,6 +250,7 @@ describe('When using the kill-process action from response actions console', () await waitFor(() => { expect(apiMocks.responseProvider.killProcess).toHaveBeenCalledTimes(1); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); }); // Hide the console @@ -270,21 +271,23 @@ describe('When using the kill-process action from response actions console', () const pendingDetailResponse = apiMocks.responseProvider.actionDetails({ path: '/api/endpoint/action/1.2.3', }); + pendingDetailResponse.data.isCompleted = false; + apiMocks.responseProvider.actionDetails.mockClear(); apiMocks.responseProvider.actionDetails.mockReturnValue(pendingDetailResponse); + await render(); - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); await consoleManagerMockAccess.openRunningConsole(); await waitFor(() => { - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(3); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); }); }); - // FLAKY: https://github.com/elastic/kibana/issues/139962 - it.skip('should display completion output if done (no additional API calls)', async () => { + it('should display completion output if done (no additional API calls)', async () => { await render(); expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/release_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/release_action.test.tsx similarity index 88% rename from x-pack/plugins/security_solution/public/management/components/endpoint_responder/release_action.test.tsx rename to x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/release_action.test.tsx index d1c1ea264f86..c2052a4e6401 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/release_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/release_action.test.tsx @@ -5,20 +5,20 @@ * 2.0. */ -import type { AppContextTestRender } from '../../../common/mock/endpoint'; -import { createAppRootMockRenderer } from '../../../common/mock/endpoint'; +import type { AppContextTestRender } from '../../../../common/mock/endpoint'; +import { createAppRootMockRenderer } from '../../../../common/mock/endpoint'; import { ConsoleManagerTestComponent, getConsoleManagerMockRenderResultQueriesAndActions, -} from '../console/components/console_manager/mocks'; +} from '../../console/components/console_manager/mocks'; import React from 'react'; -import { getEndpointResponseActionsConsoleCommands } from './endpoint_response_actions_console_commands'; -import { enterConsoleCommand } from '../console/mocks'; +import { getEndpointResponseActionsConsoleCommands } from '../endpoint_response_actions_console_commands'; +import { enterConsoleCommand } from '../../console/mocks'; import { waitFor } from '@testing-library/react'; -import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mocks'; -import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; -import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; -import { getDeferred } from '../../mocks/utils'; +import { responseActionsHttpMocks } from '../../../mocks/response_actions_http_mocks'; +import type { ResponderCapabilities } from '../../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../../common/endpoint/constants'; +import { getDeferred } from '../../../mocks/utils'; describe('When using the release action from response actions console', () => { let render: ( @@ -171,6 +171,7 @@ describe('When using the release action from response actions console', () => { await waitFor(() => { expect(apiMocks.responseProvider.releaseHost).toHaveBeenCalledTimes(1); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); }); // Hide the console @@ -192,20 +193,20 @@ describe('When using the release action from response actions console', () => { path: '/api/endpoint/action/1.2.3', }); pendingDetailResponse.data.isCompleted = false; + apiMocks.responseProvider.actionDetails.mockClear(); apiMocks.responseProvider.actionDetails.mockReturnValue(pendingDetailResponse); await render(); - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); await consoleManagerMockAccess.openRunningConsole(); await waitFor(() => { - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(3); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); }); }); - // FLAKY: https://github.com/elastic/kibana/issues/139641 - it.skip('should display completion output if done (no additional API calls)', async () => { + it('should display completion output if done (no additional API calls)', async () => { await render(); expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/suspend_process_action.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/suspend_process_action.test.tsx similarity index 91% rename from x-pack/plugins/security_solution/public/management/components/endpoint_responder/suspend_process_action.test.tsx rename to x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/suspend_process_action.test.tsx index 7479e52edfb0..28fe91999662 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_responder/suspend_process_action.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_responder/integration_tests/suspend_process_action.test.tsx @@ -5,19 +5,19 @@ * 2.0. */ -import type { AppContextTestRender } from '../../../common/mock/endpoint'; -import { createAppRootMockRenderer } from '../../../common/mock/endpoint'; +import type { AppContextTestRender } from '../../../../common/mock/endpoint'; +import { createAppRootMockRenderer } from '../../../../common/mock/endpoint'; import { ConsoleManagerTestComponent, getConsoleManagerMockRenderResultQueriesAndActions, -} from '../console/components/console_manager/mocks'; +} from '../../console/components/console_manager/mocks'; import React from 'react'; -import { getEndpointResponseActionsConsoleCommands } from './endpoint_response_actions_console_commands'; -import { enterConsoleCommand } from '../console/mocks'; +import { getEndpointResponseActionsConsoleCommands } from '../endpoint_response_actions_console_commands'; +import { enterConsoleCommand } from '../../console/mocks'; import { waitFor } from '@testing-library/react'; -import { responseActionsHttpMocks } from '../../mocks/response_actions_http_mocks'; -import type { ResponderCapabilities } from '../../../../common/endpoint/constants'; -import { RESPONDER_CAPABILITIES } from '../../../../common/endpoint/constants'; +import { responseActionsHttpMocks } from '../../../mocks/response_actions_http_mocks'; +import type { ResponderCapabilities } from '../../../../../common/endpoint/constants'; +import { RESPONDER_CAPABILITIES } from '../../../../../common/endpoint/constants'; describe('When using the suspend-process action from response actions console', () => { let render: ( @@ -241,6 +241,7 @@ describe('When using the suspend-process action from response actions console', await waitFor(() => { expect(apiMocks.responseProvider.suspendProcess).toHaveBeenCalledTimes(1); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); }); // Hide the console @@ -262,20 +263,20 @@ describe('When using the suspend-process action from response actions console', path: '/api/endpoint/action/1.2.3', }); pendingDetailResponse.data.isCompleted = false; + apiMocks.responseProvider.actionDetails.mockClear(); apiMocks.responseProvider.actionDetails.mockReturnValue(pendingDetailResponse); await render(); - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); await consoleManagerMockAccess.openRunningConsole(); await waitFor(() => { - expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(3); + expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(2); }); }); - // FLAKY: https://github.com/elastic/kibana/issues/140119 - it.skip('should display completion output if done (no additional API calls)', async () => { + it('should display completion output if done (no additional API calls)', async () => { await render(); expect(apiMocks.responseProvider.actionDetails).toHaveBeenCalledTimes(1); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/response_actions_log.test.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/response_actions_log.test.tsx index 556c76529633..0133e09ac720 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/response_actions_log.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/response_actions_log.test.tsx @@ -344,26 +344,20 @@ describe('Response actions history', () => { ); // should have 4 pages each of size 10. - expect(renderResult.getByTestId('pagination-button-0')).toHaveAttribute( - 'aria-label', - 'Page 1 of 4' - ); + expect(getByTestId('pagination-button-0')).toHaveAttribute('aria-label', 'Page 1 of 4'); // toggle page size popover - userEvent.click(renderResult.getByTestId('tablePaginationPopoverButton')); + userEvent.click(getByTestId('tablePaginationPopoverButton')); await waitForEuiPopoverOpen(); // click size 20 - userEvent.click(renderResult.getByTestId('tablePagination-20-rows')); + userEvent.click(getByTestId('tablePagination-20-rows')); - expect(renderResult.getByTestId(`${testPrefix}-endpointListTableTotal`)).toHaveTextContent( + expect(getByTestId(`${testPrefix}-endpointListTableTotal`)).toHaveTextContent( 'Showing 1-20 of 33 response actions' ); // should have only 2 pages each of size 20 - expect(renderResult.getByTestId('pagination-button-0')).toHaveAttribute( - 'aria-label', - 'Page 1 of 2' - ); + expect(getByTestId('pagination-button-0')).toHaveAttribute('aria-label', 'Page 1 of 2'); }); it('should show 1-1 record label when only 1 record', async () => { @@ -408,6 +402,7 @@ describe('Response actions history', () => { 'Execution completed', 'Input', 'Parameters', + 'Comment', 'Output:', ] ); @@ -544,8 +539,10 @@ describe('Response actions history', () => { it('should have a search bar', () => { render(); - userEvent.click(renderResult.getByTestId(`${testPrefix}-${filterPrefix}-popoverButton`)); - const searchBar = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`); + + const { getByTestId } = renderResult; + userEvent.click(getByTestId(`${testPrefix}-${filterPrefix}-popoverButton`)); + const searchBar = getByTestId(`${testPrefix}-${filterPrefix}-search`); expect(searchBar).toBeTruthy(); expect(searchBar.querySelector('input')?.getAttribute('placeholder')).toEqual( 'Search actions' @@ -594,10 +591,10 @@ describe('Response actions history', () => { it('should have `clear all` button `disabled` when no selected values', () => { render(); - userEvent.click(renderResult.getByTestId(`${testPrefix}-${filterPrefix}-popoverButton`)); - const clearAllButton = renderResult.getByTestId( - `${testPrefix}-${filterPrefix}-clearAllButton` - ); + const { getByTestId } = renderResult; + + userEvent.click(getByTestId(`${testPrefix}-${filterPrefix}-popoverButton`)); + const clearAllButton = getByTestId(`${testPrefix}-${filterPrefix}-clearAllButton`); expect(clearAllButton.hasAttribute('disabled')).toBeTruthy(); }); }); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/translations.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/translations.tsx index a90f12bc2d24..36dfc76dc1d9 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/translations.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/translations.tsx @@ -65,6 +65,12 @@ export const OUTPUT_MESSAGES = Object.freeze({ defaultMessage: 'Execution completed', } ), + comment: i18n.translate( + 'xpack.securitySolution.responseActionsList.list.item.expandSection.comment', + { + defaultMessage: 'Comment', + } + ), }, }); diff --git a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/use_response_actions_log_table.tsx b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/use_response_actions_log_table.tsx index e4dd30b46812..443eac84c6b1 100644 --- a/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/use_response_actions_log_table.tsx +++ b/x-pack/plugins/security_solution/public/management/components/endpoint_response_actions_list/use_response_actions_log_table.tsx @@ -126,6 +126,7 @@ export const useResponseActionsLogTable = ({ wasSuccessful, isExpired, command: _command, + comment, parameters, } = item; @@ -157,6 +158,10 @@ export const useResponseActionsLogTable = ({ title: OUTPUT_MESSAGES.expandSection.parameters, description: parametersList ? parametersList : emptyValue, }, + { + title: OUTPUT_MESSAGES.expandSection.comment, + description: comment ? comment : emptyValue, + }, ].map(({ title, description }) => { return { title: {title}, diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.test.tsx index c7e7eb411d4f..b60264b39eae 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/header/index.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { act, fireEvent, render } from '@testing-library/react'; +import { act, fireEvent, render, waitFor } from '@testing-library/react'; import React from 'react'; import { EntityAnalyticsHeader } from '.'; import { Direction, RiskScoreFields, RiskSeverity } from '../../../../../common/search_strategy'; @@ -44,28 +44,31 @@ jest.mock('react-redux', () => { }; }); -describe('RiskScoreDonutChart', () => { - it('renders critical hosts', () => { +describe('Entity analytics header', () => { + it('renders critical hosts', async () => { const { getByTestId } = render( ); - - expect(getByTestId('critical_hosts_quantity')).toHaveTextContent('99'); + await waitFor(() => { + expect(getByTestId('critical_hosts_quantity')).toHaveTextContent('99'); + }); }); - it('renders critical users', () => { + it('renders critical users', async () => { const { getByTestId } = render( ); - expect(getByTestId('critical_users_quantity')).toHaveTextContent('99'); + await waitFor(() => { + expect(getByTestId('critical_users_quantity')).toHaveTextContent('99'); + }); }); - it('dispatches user risk tab filters actions', () => { + it('dispatches user risk tab filters actions', async () => { const { getByTestId } = render( @@ -76,21 +79,23 @@ describe('RiskScoreDonutChart', () => { fireEvent.click(getByTestId('critical_users_link')); }); - expect(mockDispatch).toHaveBeenCalledWith( - usersActions.updateUserRiskScoreSeverityFilter({ - severitySelection: [RiskSeverity.critical], - }) - ); - - expect(mockDispatch).toHaveBeenCalledWith( - usersActions.updateTableSorting({ - sort: { field: RiskScoreFields.userRiskScore, direction: Direction.desc }, - tableType: UsersTableType.risk, - }) - ); + await waitFor(() => { + expect(mockDispatch).toHaveBeenCalledWith( + usersActions.updateUserRiskScoreSeverityFilter({ + severitySelection: [RiskSeverity.critical], + }) + ); + + expect(mockDispatch).toHaveBeenCalledWith( + usersActions.updateTableSorting({ + sort: { field: RiskScoreFields.userRiskScore, direction: Direction.desc }, + tableType: UsersTableType.risk, + }) + ); + }); }); - it('dispatches host risk tab filters actions', () => { + it('dispatches host risk tab filters actions', async () => { const { getByTestId } = render( @@ -101,18 +106,20 @@ describe('RiskScoreDonutChart', () => { fireEvent.click(getByTestId('critical_hosts_link')); }); - expect(mockDispatch).toHaveBeenCalledWith( - hostsActions.updateHostRiskScoreSeverityFilter({ - severitySelection: [RiskSeverity.critical], - hostsType: HostsType.page, - }) - ); - - expect(mockDispatch).toHaveBeenCalledWith( - hostsActions.updateHostRiskScoreSort({ - sort: { field: RiskScoreFields.hostRiskScore, direction: Direction.desc }, - hostsType: HostsType.page, - }) - ); + await waitFor(() => { + expect(mockDispatch).toHaveBeenCalledWith( + hostsActions.updateHostRiskScoreSeverityFilter({ + severitySelection: [RiskSeverity.critical], + hostsType: HostsType.page, + }) + ); + + expect(mockDispatch).toHaveBeenCalledWith( + hostsActions.updateHostRiskScoreSort({ + sort: { field: RiskScoreFields.hostRiskScore, direction: Direction.desc }, + hostsType: HostsType.page, + }) + ); + }); }); }); diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/index.test.tsx deleted file mode 100644 index 4f4edd279a56..000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/index.test.tsx +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { render } from '@testing-library/react'; -import React from 'react'; -import { TestProviders } from '../../../../common/mock'; -import { EntityAnalyticsHostRiskScores } from '.'; -import { RiskSeverity } from '../../../../../common/search_strategy'; -import type { SeverityCount } from '../../../../common/components/severity/types'; -import { useHostRiskScore, useHostRiskScoreKpi } from '../../../../risk_score/containers'; - -const mockSeverityCount: SeverityCount = { - [RiskSeverity.low]: 1, - [RiskSeverity.high]: 1, - [RiskSeverity.moderate]: 1, - [RiskSeverity.unknown]: 1, - [RiskSeverity.critical]: 1, -}; - -const mockUseQueryToggle = jest - .fn() - .mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); -jest.mock('../../../../common/containers/query_toggle', () => { - return { - useQueryToggle: () => mockUseQueryToggle(), - }; -}); -const defaultProps = { - data: undefined, - inspect: null, - refetch: () => {}, - isModuleEnabled: true, - isLicenseValid: true, -}; -const mockUseHostRiskScore = useHostRiskScore as jest.Mock; -const mockUseHostRiskScoreKpi = useHostRiskScoreKpi as jest.Mock; -jest.mock('../../../../risk_score/containers'); - -describe('EntityAnalyticsHostRiskScores', () => { - beforeEach(() => { - jest.clearAllMocks(); - mockUseHostRiskScoreKpi.mockReturnValue({ severityCount: mockSeverityCount, loading: false }); - mockUseHostRiskScore.mockReturnValue([false, defaultProps]); - }); - - it('renders enable button when module is disable', () => { - mockUseHostRiskScore.mockReturnValue([false, { ...defaultProps, isModuleEnabled: false }]); - const { getByTestId } = render( - - - - ); - - expect(getByTestId('enable_host_risk_score')).toBeInTheDocument(); - }); - - it("doesn't render enable button when module is enable", () => { - const { queryByTestId } = render( - - - - ); - - expect(queryByTestId('enable_host_risk_score')).not.toBeInTheDocument(); - }); - - it('queries when toggleStatus is true', () => { - mockUseQueryToggle.mockReturnValue({ toggleStatus: true, setToggleStatus: jest.fn() }); - render( - - - - ); - - expect(mockUseHostRiskScore.mock.calls[0][0].skip).toEqual(false); - }); - - it('skips query when toggleStatus is false', () => { - mockUseQueryToggle.mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); - render( - - - - ); - expect(mockUseHostRiskScore.mock.calls[0][0].skip).toEqual(true); - }); - - it('renders components when toggleStatus is true', () => { - mockUseQueryToggle.mockReturnValue({ toggleStatus: true, setToggleStatus: jest.fn() }); - const { queryByTestId } = render( - - - - ); - - expect(queryByTestId('entity_analytics_content')).toBeInTheDocument(); - }); - - it('does not render components when toggleStatus is false', () => { - mockUseQueryToggle.mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); - const { queryByTestId } = render( - - - - ); - - expect(queryByTestId('entity_analytics_content')).not.toBeInTheDocument(); - }); -}); diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/translations.ts b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/translations.ts deleted file mode 100644 index a53ad8d55866..000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/translations.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; - -export const HOST_RISK_TOOLTIP = i18n.translate( - 'xpack.securitySolution.entityAnalytics.hostsRiskDashboard.hostRiskToolTip', - { - defaultMessage: - 'Host risk classification is determined by host risk score. Hosts classified as Critical or High are indicated as risky.', - } -); - -export const HOST_RISK = i18n.translate( - 'xpack.securitySolution.entityAnalytics.hostsRiskDashboard.hostRiskClassificationTitle', - { - defaultMessage: 'Host risk classification', - } -); - -export const HOST_RISK_SCORE = i18n.translate( - 'xpack.securitySolution.entityAnalytics.hostsRiskDashboard.hostRiskScoreTitle', - { - defaultMessage: 'Host risk score', - } -); - -export const HOST_NAME = i18n.translate( - 'xpack.securitySolution.entityAnalytics.hostsRiskDashboard.hostNameTitle', - { - defaultMessage: 'Host Name', - } -); - -export const TOTAL_LABEL = i18n.translate( - 'xpack.securitySolution.entityAnalytics.hostsRiskDashboard.totalLabel', - { - defaultMessage: 'Total', - } -); - -export const VIEW_ALL = i18n.translate( - 'xpack.securitySolution.entityAnalytics.hostsRiskDashboard.viewAllLabel', - { - defaultMessage: 'View all', - } -); - -export const LEARN_MORE = i18n.translate( - 'xpack.securitySolution.entityAnalytics.hostsRiskDashboard.learnMore', - { - defaultMessage: 'Learn more', - } -); - -export const ENABLE_VIA_DEV_TOOLS = i18n.translate( - 'xpack.securitySolution.entityAnalytics.hostsRiskDashboard.enableViaDevToolsButtonTitle', - { - defaultMessage: 'Enable via Dev Tools', - } -); diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/columns.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/columns.tsx similarity index 58% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/columns.tsx rename to x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/columns.tsx index 998a356bf4f7..055a172e54b7 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/columns.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/columns.tsx @@ -8,32 +8,40 @@ import React from 'react'; import type { EuiBasicTableColumn } from '@elastic/eui'; import { EuiIcon, EuiToolTip } from '@elastic/eui'; +import { UsersTableType } from '../../../../users/store/model'; import { getEmptyTagValue } from '../../../../common/components/empty_value'; -import { HostDetailsLink } from '../../../../common/components/links'; +import { HostDetailsLink, UserDetailsLink } from '../../../../common/components/links'; import { HostsTableType } from '../../../../hosts/store/model'; import { RiskScore } from '../../../../common/components/severity/common'; import type { HostRiskScore, RiskSeverity } from '../../../../../common/search_strategy'; -import { RiskScoreFields } from '../../../../../common/search_strategy'; +import { RiskScoreEntity, RiskScoreFields } from '../../../../../common/search_strategy'; import * as i18n from './translations'; type HostRiskScoreColumns = Array>; -export const getHostRiskScoreColumns = (): HostRiskScoreColumns => [ +export const getRiskScoreColumns = (riskEntity: RiskScoreEntity): HostRiskScoreColumns => [ { - field: 'host.name', - name: i18n.HOST_NAME, + field: riskEntity === RiskScoreEntity.host ? 'host.name' : 'user.name', + name: i18n.ENTITY_NAME(riskEntity), truncateText: false, mobileOptions: { show: true }, - render: (hostName: string) => { - if (hostName != null && hostName.length > 0) { - return ; + render: (entityName: string) => { + if (entityName != null && entityName.length > 0) { + return riskEntity === RiskScoreEntity.host ? ( + + ) : ( + + ); } return getEmptyTagValue(); }, }, { - field: RiskScoreFields.hostRiskScore, - name: i18n.HOST_RISK_SCORE, + field: + riskEntity === RiskScoreEntity.host + ? RiskScoreFields.hostRiskScore + : RiskScoreFields.userRiskScore, + name: i18n.RISK_SCORE_TITLE(riskEntity), truncateText: true, mobileOptions: { show: true }, render: (riskScore: number) => { @@ -48,11 +56,12 @@ export const getHostRiskScoreColumns = (): HostRiskScoreColumns => [ }, }, { - field: RiskScoreFields.hostRisk, + field: + riskEntity === RiskScoreEntity.host ? RiskScoreFields.hostRisk : RiskScoreFields.userRisk, name: ( - + <> - {i18n.HOST_RISK} + {i18n.ENTITY_RISK(riskEntity)} diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.test.tsx new file mode 100644 index 000000000000..f5b9d0fcafc2 --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.test.tsx @@ -0,0 +1,131 @@ +/* + * 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 { render } from '@testing-library/react'; +import React from 'react'; +import { TestProviders } from '../../../../common/mock'; +import { EntityAnalyticsRiskScores } from '.'; +import { RiskScoreEntity, RiskSeverity } from '../../../../../common/search_strategy'; +import type { SeverityCount } from '../../../../common/components/severity/types'; +import { + useHostRiskScore, + useHostRiskScoreKpi, + useUserRiskScore, + useUserRiskScoreKpi, +} from '../../../../risk_score/containers'; + +const mockSeverityCount: SeverityCount = { + [RiskSeverity.low]: 1, + [RiskSeverity.high]: 1, + [RiskSeverity.moderate]: 1, + [RiskSeverity.unknown]: 1, + [RiskSeverity.critical]: 1, +}; + +const mockUseQueryToggle = jest + .fn() + .mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); +jest.mock('../../../../common/containers/query_toggle', () => { + return { + useQueryToggle: () => mockUseQueryToggle(), + }; +}); +const defaultProps = { + data: undefined, + inspect: null, + refetch: () => {}, + isModuleEnabled: true, + isLicenseValid: true, +}; +const mockUseHostRiskScore = useHostRiskScore as jest.Mock; +const mockUseHostRiskScoreKpi = useHostRiskScoreKpi as jest.Mock; +const mockUseUserRiskScore = useUserRiskScore as jest.Mock; +const mockUseUserRiskScoreKpi = useUserRiskScoreKpi as jest.Mock; +jest.mock('../../../../risk_score/containers'); + +describe.each([RiskScoreEntity.host, RiskScoreEntity.user])( + 'EntityAnalyticsRiskScores entityType: %s', + (riskEntity) => { + const entity = + riskEntity === RiskScoreEntity.host + ? { mockUseRiskScoreKpi: mockUseHostRiskScoreKpi, mockUseRiskScore: mockUseHostRiskScore } + : { mockUseRiskScoreKpi: mockUseUserRiskScoreKpi, mockUseRiskScore: mockUseUserRiskScore }; + + beforeEach(() => { + jest.clearAllMocks(); + entity.mockUseRiskScoreKpi.mockReturnValue({ + severityCount: mockSeverityCount, + loading: false, + }); + entity.mockUseRiskScore.mockReturnValue([false, defaultProps]); + }); + + it('renders enable button when module is disable', () => { + entity.mockUseRiskScore.mockReturnValue([false, { ...defaultProps, isModuleEnabled: false }]); + const { getByTestId } = render( + + + + ); + + expect(getByTestId(`enable_${riskEntity}_risk_score`)).toBeInTheDocument(); + }); + + it("doesn't render enable button when module is enable", () => { + const { queryByTestId } = render( + + + + ); + + expect(queryByTestId(`enable_${riskEntity}_risk_score`)).not.toBeInTheDocument(); + }); + + it('queries when toggleStatus is true', () => { + mockUseQueryToggle.mockReturnValue({ toggleStatus: true, setToggleStatus: jest.fn() }); + render( + + + + ); + + expect(entity.mockUseRiskScore.mock.calls[0][0].skip).toEqual(false); + }); + + it('skips query when toggleStatus is false', () => { + mockUseQueryToggle.mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); + render( + + + + ); + expect(entity.mockUseRiskScore.mock.calls[0][0].skip).toEqual(true); + }); + + it('renders components when toggleStatus is true', () => { + mockUseQueryToggle.mockReturnValue({ toggleStatus: true, setToggleStatus: jest.fn() }); + const { queryByTestId } = render( + + + + ); + + expect(queryByTestId('entity_analytics_content')).toBeInTheDocument(); + }); + + it('does not render components when toggleStatus is false', () => { + mockUseQueryToggle.mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); + const { queryByTestId } = render( + + + + ); + + expect(queryByTestId('entity_analytics_content')).not.toBeInTheDocument(); + }); + } +); diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/index.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx similarity index 61% rename from x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/index.tsx rename to x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx index 49df0b1b0e45..b7796d442569 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/host_risk_score/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx @@ -8,15 +8,23 @@ import React, { useEffect, useMemo, useState } from 'react'; import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { useDispatch } from 'react-redux'; +import { EntityAnalyticsUserRiskScoreDisable } from '../../../../common/components/risk_score/risk_score_disabled/user_risk_score.disabled'; +import { getTabsOnUsersUrl } from '../../../../common/components/link_to/redirect_to_users'; +import { UsersTableType } from '../../../../users/store/model'; import { RiskScoresDeprecated } from '../../../../common/components/risk_score/risk_score_deprecated'; import { SeverityFilterGroup } from '../../../../common/components/severity/severity_filter_group'; import { LinkButton, useGetSecuritySolutionLinkProps } from '../../../../common/components/links'; import { getTabsOnHostsUrl } from '../../../../common/components/link_to/redirect_to_hosts'; import { HostsTableType, HostsType } from '../../../../hosts/store/model'; -import { getHostRiskScoreColumns } from './columns'; +import { getRiskScoreColumns } from './columns'; import { LastUpdatedAt } from '../../../../common/components/last_updated_at'; import { HeaderSection } from '../../../../common/components/header_section'; -import { useHostRiskScore, useHostRiskScoreKpi } from '../../../../risk_score/containers'; +import { + useHostRiskScore, + useHostRiskScoreKpi, + useUserRiskScore, + useUserRiskScoreKpi, +} from '../../../../risk_score/containers'; import type { RiskSeverity } from '../../../../../common/search_strategy'; import { EMPTY_SEVERITY_COUNT, RiskScoreEntity } from '../../../../../common/search_strategy'; @@ -30,31 +38,77 @@ import { useQueryToggle } from '../../../../common/containers/query_toggle'; import { hostsActions } from '../../../../hosts/store'; import { RiskScoreDonutChart } from '../common/risk_score_donut_chart'; import { BasicTableWithoutBorderBottom } from '../common/basic_table_without_border_bottom'; -import { RISKY_HOSTS_DOC_LINK } from '../../../../../common/constants'; +import { RISKY_HOSTS_DOC_LINK, RISKY_USERS_DOC_LINK } from '../../../../../common/constants'; import { EntityAnalyticsHostRiskScoreDisable } from '../../../../common/components/risk_score/risk_score_disabled/host_risk_score_disabled'; import { RiskScoreHeaderTitle } from '../../../../common/components/risk_score/risk_score_onboarding/risk_score_header_title'; import { RiskScoresNoDataDetected } from '../../../../common/components/risk_score/risk_score_onboarding/risk_score_no_data_detected'; import { useRefetchQueries } from '../../../../common/hooks/use_refetch_queries'; import { Loader } from '../../../../common/components/loader'; import { Panel } from '../../../../common/components/panel'; +import * as commonI18n from '../common/translations'; +import { usersActions } from '../../../../users/store'; -const TABLE_QUERY_ID = 'hostRiskDashboardTable'; -const HOST_RISK_KPI_QUERY_ID = 'headerHostRiskScoreKpiQuery'; +const TABLE_QUERY_ID = (riskEntity: RiskScoreEntity) => + riskEntity === RiskScoreEntity.host ? 'hostRiskDashboardTable' : 'userRiskDashboardTable'; +const RISK_KPI_QUERY_ID = (riskEntity: RiskScoreEntity) => + riskEntity === RiskScoreEntity.host + ? 'headerHostRiskScoreKpiQuery' + : 'headerUserRiskScoreKpiQuery'; -const EntityAnalyticsHostRiskScoresComponent = () => { +const EntityAnalyticsRiskScoresComponent = ({ riskEntity }: { riskEntity: RiskScoreEntity }) => { const { deleteQuery, setQuery, from, to } = useGlobalTime(); const [updatedAt, setUpdatedAt] = useState(Date.now()); - const { toggleStatus, setToggleStatus } = useQueryToggle(TABLE_QUERY_ID); - const columns = useMemo(() => getHostRiskScoreColumns(), []); + const dispatch = useDispatch(); + + const entity = useMemo( + () => + riskEntity === RiskScoreEntity.host + ? { + docLink: RISKY_HOSTS_DOC_LINK, + kpiHook: useHostRiskScoreKpi, + riskScoreHook: useHostRiskScore, + linkProps: { + deepLinkId: SecurityPageName.hosts, + path: getTabsOnHostsUrl(HostsTableType.risk), + onClick: () => { + dispatch( + hostsActions.updateHostRiskScoreSeverityFilter({ + severitySelection: [], + hostsType: HostsType.page, + }) + ); + }, + }, + } + : { + docLink: RISKY_USERS_DOC_LINK, + kpiHook: useUserRiskScoreKpi, + riskScoreHook: useUserRiskScore, + linkProps: { + deepLinkId: SecurityPageName.users, + path: getTabsOnUsersUrl(UsersTableType.risk), + onClick: () => { + dispatch( + usersActions.updateUserRiskScoreSeverityFilter({ + severitySelection: [], + }) + ); + }, + }, + }, + [dispatch, riskEntity] + ); + + const { toggleStatus, setToggleStatus } = useQueryToggle(TABLE_QUERY_ID(riskEntity)); + const columns = useMemo(() => getRiskScoreColumns(riskEntity), [riskEntity]); const [selectedSeverity, setSelectedSeverity] = useState([]); const getSecuritySolutionLinkProps = useGetSecuritySolutionLinkProps(); - const dispatch = useDispatch(); const severityFilter = useMemo(() => { - const [filter] = generateSeverityFilter(selectedSeverity, RiskScoreEntity.host); + const [filter] = generateSeverityFilter(selectedSeverity, riskEntity); return filter ? JSON.stringify(filter.query) : undefined; - }, [selectedSeverity]); + }, [riskEntity, selectedSeverity]); const timerange = useMemo( () => ({ @@ -69,14 +123,14 @@ const EntityAnalyticsHostRiskScoresComponent = () => { loading: isKpiLoading, refetch: refetchKpi, inspect: inspectKpi, - } = useHostRiskScoreKpi({ + } = entity.kpiHook({ filterQuery: severityFilter, skip: !toggleStatus, timerange, }); useQueryInspector({ - queryId: HOST_RISK_KPI_QUERY_ID, + queryId: RISK_KPI_QUERY_ID(riskEntity), loading: isKpiLoading, refetch: refetchKpi, setQuery, @@ -86,7 +140,7 @@ const EntityAnalyticsHostRiskScoresComponent = () => { const [ isTableLoading, { data, inspect, refetch, isDeprecated, isLicenseValid, isModuleEnabled }, - ] = useHostRiskScore({ + ] = entity.riskScoreHook({ filterQuery: severityFilter, skip: !toggleStatus, pagination: { @@ -97,7 +151,7 @@ const EntityAnalyticsHostRiskScoresComponent = () => { }); useQueryInspector({ - queryId: TABLE_QUERY_ID, + queryId: TABLE_QUERY_ID(riskEntity), loading: isTableLoading, refetch, setQuery, @@ -109,21 +163,10 @@ const EntityAnalyticsHostRiskScoresComponent = () => { setUpdatedAt(Date.now()); }, [isTableLoading, isKpiLoading]); // Update the time when data loads - const [goToHostRiskTab, hostRiskTabUrl] = useMemo(() => { - const { onClick, href } = getSecuritySolutionLinkProps({ - deepLinkId: SecurityPageName.hosts, - path: getTabsOnHostsUrl(HostsTableType.risk), - onClick: () => { - dispatch( - hostsActions.updateHostRiskScoreSeverityFilter({ - severitySelection: [], - hostsType: HostsType.page, - }) - ); - }, - }); + const [goToEntityRiskTab, entityRiskTabUrl] = useMemo(() => { + const { onClick, href } = getSecuritySolutionLinkProps(entity.linkProps); return [onClick, href]; - }, [dispatch, getSecuritySolutionLinkProps]); + }, [entity.linkProps, getSecuritySolutionLinkProps]); const refreshPage = useRefetchQueries(); @@ -132,42 +175,43 @@ const EntityAnalyticsHostRiskScoresComponent = () => { } if (!isModuleEnabled && !isTableLoading) { - return ; + return riskEntity === RiskScoreEntity.host ? ( + + ) : ( + + ); } if (isDeprecated && !isTableLoading) { return ( - + ); } if (isModuleEnabled && selectedSeverity.length === 0 && data && data.length === 0) { - return ; + return ; } return ( - + } + title={} titleSize="s" subtitle={ } - id={TABLE_QUERY_ID} + id={TABLE_QUERY_ID(riskEntity)} toggleStatus={toggleStatus} toggleQuery={setToggleStatus} + tooltip={commonI18n.HOST_RISK_TABLE_TOOLTIP} > {toggleStatus && ( {i18n.LEARN_MORE} @@ -177,15 +221,15 @@ const EntityAnalyticsHostRiskScoresComponent = () => { {i18n.VIEW_ALL} @@ -204,7 +248,7 @@ const EntityAnalyticsHostRiskScoresComponent = () => { items={data ?? []} columns={columns} loading={isTableLoading} - id={TABLE_QUERY_ID} + id={TABLE_QUERY_ID(riskEntity)} /> @@ -217,5 +261,5 @@ const EntityAnalyticsHostRiskScoresComponent = () => { ); }; -export const EntityAnalyticsHostRiskScores = React.memo(EntityAnalyticsHostRiskScoresComponent); -EntityAnalyticsHostRiskScores.displayName = 'EntityAnalyticsHostRiskScores'; +export const EntityAnalyticsRiskScores = React.memo(EntityAnalyticsRiskScoresComponent); +EntityAnalyticsRiskScores.displayName = 'EntityAnalyticsRiskScores'; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/translations.ts b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/translations.ts new file mode 100644 index 000000000000..9ca0f659e14f --- /dev/null +++ b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/translations.ts @@ -0,0 +1,51 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { getRiskEntityTranslation } from '../../../../common/components/risk_score/translations'; +import type { RiskScoreEntity } from '../../../../../common/search_strategy'; +export * from '../../../../common/components/risk_score/translations'; + +export const ENTITY_RISK_TOOLTIP = (riskEntity: RiskScoreEntity) => + i18n.translate('xpack.securitySolution.entityAnalytics.riskDashboard.riskToolTip', { + defaultMessage: + '{riskEntity} risk classification is determined by {riskEntityLowercase} risk score. {riskEntity}s classified as Critical or High are indicated as risky.', + values: { + riskEntity: getRiskEntityTranslation(riskEntity), + riskEntityLowercase: getRiskEntityTranslation(riskEntity, true), + }, + }); + +export const ENTITY_RISK = (riskEntity: RiskScoreEntity) => + i18n.translate('xpack.securitySolution.entityAnalytics.riskDashboard.riskClassificationTitle', { + defaultMessage: '{riskEntity} risk classification', + values: { + riskEntity: getRiskEntityTranslation(riskEntity), + }, + }); + +export const ENTITY_NAME = (riskEntity: RiskScoreEntity) => + i18n.translate('xpack.securitySolution.entityAnalytics.riskDashboard.nameTitle', { + defaultMessage: '{riskEntity} Name', + values: { + riskEntity: getRiskEntityTranslation(riskEntity), + }, + }); + +export const VIEW_ALL = i18n.translate( + 'xpack.securitySolution.entityAnalytics.riskDashboard.viewAllLabel', + { + defaultMessage: 'View all', + } +); + +export const LEARN_MORE = i18n.translate( + 'xpack.securitySolution.entityAnalytics.riskDashboard.learnMore', + { + defaultMessage: 'Learn more', + } +); diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/columns.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/columns.tsx deleted file mode 100644 index 05f532617d5c..000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/columns.tsx +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import type { EuiBasicTableColumn } from '@elastic/eui'; -import { EuiIcon, EuiToolTip } from '@elastic/eui'; -import { getEmptyTagValue } from '../../../../common/components/empty_value'; -import { RiskScore } from '../../../../common/components/severity/common'; -import * as i18n from './translations'; -import { UsersTableType } from '../../../../users/store/model'; -import type { RiskSeverity, UserRiskScore } from '../../../../../common/search_strategy'; -import { RiskScoreFields } from '../../../../../common/search_strategy'; -import { UserDetailsLink } from '../../../../common/components/links'; - -type UserRiskScoreColumns = Array>; - -export const getUserRiskScoreColumns = (): UserRiskScoreColumns => [ - { - field: 'user.name', - name: i18n.USER_NAME, - truncateText: false, - mobileOptions: { show: true }, - render: (userName: string) => { - if (userName != null && userName.length > 0) { - return ; - } - return getEmptyTagValue(); - }, - }, - { - field: RiskScoreFields.userRiskScore, - name: i18n.USER_RISK_SCORE, - truncateText: true, - mobileOptions: { show: true }, - render: (riskScore: number) => { - if (riskScore != null) { - return ( - - {riskScore.toFixed(2)} - - ); - } - return getEmptyTagValue(); - }, - }, - { - field: RiskScoreFields.userRisk, - name: ( - - <> - {i18n.USER_RISK} - - - - ), - truncateText: false, - mobileOptions: { show: true }, - render: (risk: RiskSeverity) => { - if (risk != null) { - return ; - } - return getEmptyTagValue(); - }, - }, -]; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/index.test.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/index.test.tsx deleted file mode 100644 index 6ddfd912e832..000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/index.test.tsx +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { render } from '@testing-library/react'; -import React from 'react'; -import { TestProviders } from '../../../../common/mock'; -import { EntityAnalyticsUserRiskScores } from '.'; -import { RiskSeverity } from '../../../../../common/search_strategy'; -import type { SeverityCount } from '../../../../common/components/severity/types'; -import { useUserRiskScore, useUserRiskScoreKpi } from '../../../../risk_score/containers'; - -const mockSeverityCount: SeverityCount = { - [RiskSeverity.low]: 1, - [RiskSeverity.high]: 1, - [RiskSeverity.moderate]: 1, - [RiskSeverity.unknown]: 1, - [RiskSeverity.critical]: 1, -}; - -const mockUseQueryToggle = jest - .fn() - .mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); -jest.mock('../../../../common/containers/query_toggle', () => { - return { - useQueryToggle: () => mockUseQueryToggle(), - }; -}); - -const defaultProps = { - data: undefined, - inspect: null, - refetch: () => {}, - isModuleEnabled: true, - isLicenseValid: true, -}; - -const mockUseUserRiskScore = useUserRiskScore as jest.Mock; -const mockUseUserRiskScoreKpi = useUserRiskScoreKpi as jest.Mock; -jest.mock('../../../../risk_score/containers'); - -describe('EntityAnalyticsUserRiskScores', () => { - beforeEach(() => { - jest.clearAllMocks(); - mockUseUserRiskScoreKpi.mockReturnValue({ severityCount: mockSeverityCount, loading: false }); - mockUseUserRiskScore.mockReturnValue([false, defaultProps]); - }); - - it('renders enable button when module is disable', () => { - mockUseUserRiskScore.mockReturnValue([false, { ...defaultProps, isModuleEnabled: false }]); - const { getByTestId } = render( - - - - ); - - expect(getByTestId('enable_user_risk_score')).toBeInTheDocument(); - }); - - it("doesn't render enable button when module is enable", () => { - const { queryByTestId } = render( - - - - ); - - expect(queryByTestId('enable_user_risk_score')).not.toBeInTheDocument(); - }); - - it('queries when toggleStatus is true', () => { - mockUseQueryToggle.mockReturnValue({ toggleStatus: true, setToggleStatus: jest.fn() }); - render( - - - - ); - - expect(mockUseUserRiskScore.mock.calls[0][0].skip).toEqual(false); - }); - - it('skips query when toggleStatus is false', () => { - mockUseQueryToggle.mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); - render( - - - - ); - expect(mockUseUserRiskScore.mock.calls[0][0].skip).toEqual(true); - }); - - it('renders components when toggleStatus is true', () => { - mockUseQueryToggle.mockReturnValue({ toggleStatus: true, setToggleStatus: jest.fn() }); - const { queryByTestId } = render( - - - - ); - - expect(queryByTestId('entity_analytics_content')).toBeInTheDocument(); - }); - - it('does not render components when toggleStatus is false', () => { - mockUseQueryToggle.mockReturnValue({ toggleStatus: false, setToggleStatus: jest.fn() }); - const { queryByTestId } = render( - - - - ); - - expect(queryByTestId('entity_analytics_content')).not.toBeInTheDocument(); - }); -}); diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/index.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/index.tsx deleted file mode 100644 index 034e62bb37ad..000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/index.tsx +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import React, { useEffect, useMemo, useState } from 'react'; -import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { useDispatch } from 'react-redux'; -import { RiskScoresDeprecated } from '../../../../common/components/risk_score/risk_score_deprecated'; -import { SeverityFilterGroup } from '../../../../common/components/severity/severity_filter_group'; -import { LinkButton, useGetSecuritySolutionLinkProps } from '../../../../common/components/links'; -import { LastUpdatedAt } from '../../../../common/components/last_updated_at'; -import { HeaderSection } from '../../../../common/components/header_section'; -import type { RiskSeverity } from '../../../../../common/search_strategy'; -import { EMPTY_SEVERITY_COUNT, RiskScoreEntity } from '../../../../../common/search_strategy'; -import { SecurityPageName } from '../../../../app/types'; -import * as i18n from './translations'; -import { generateSeverityFilter } from '../../../../hosts/store/helpers'; - -import { useQueryInspector } from '../../../../common/components/page/manage_query'; -import { useGlobalTime } from '../../../../common/containers/use_global_time'; -import { InspectButtonContainer } from '../../../../common/components/inspect'; -import { useQueryToggle } from '../../../../common/containers/query_toggle'; -import { usersActions } from '../../../../users/store'; -import { getUserRiskScoreColumns } from './columns'; -import { useUserRiskScore, useUserRiskScoreKpi } from '../../../../risk_score/containers'; -import { UsersTableType } from '../../../../users/store/model'; -import { getTabsOnUsersUrl } from '../../../../common/components/link_to/redirect_to_users'; -import { RiskScoreDonutChart } from '../common/risk_score_donut_chart'; -import { BasicTableWithoutBorderBottom } from '../common/basic_table_without_border_bottom'; - -import { RISKY_USERS_DOC_LINK } from '../../../../../common/constants'; -import { EntityAnalyticsUserRiskScoreDisable } from '../../../../common/components/risk_score/risk_score_disabled/user_risk_score.disabled'; -import { RiskScoreHeaderTitle } from '../../../../common/components/risk_score/risk_score_onboarding/risk_score_header_title'; -import { RiskScoresNoDataDetected } from '../../../../common/components/risk_score/risk_score_onboarding/risk_score_no_data_detected'; -import { useRefetchQueries } from '../../../../common/hooks/use_refetch_queries'; -import { Loader } from '../../../../common/components/loader'; -import { Panel } from '../../../../common/components/panel'; - -const TABLE_QUERY_ID = 'userRiskDashboardTable'; -const USER_RISK_KPI_QUERY_ID = 'headerUserRiskScoreKpiQuery'; - -const EntityAnalyticsUserRiskScoresComponent = () => { - const { deleteQuery, setQuery, from, to } = useGlobalTime(); - const [updatedAt, setUpdatedAt] = useState(Date.now()); - const { toggleStatus, setToggleStatus } = useQueryToggle(TABLE_QUERY_ID); - const columns = useMemo(() => getUserRiskScoreColumns(), []); - const [selectedSeverity, setSelectedSeverity] = useState([]); - const getSecuritySolutionLinkProps = useGetSecuritySolutionLinkProps(); - const dispatch = useDispatch(); - - const severityFilter = useMemo(() => { - const [filter] = generateSeverityFilter(selectedSeverity, RiskScoreEntity.user); - - return filter ? JSON.stringify(filter.query) : undefined; - }, [selectedSeverity]); - - const timerange = useMemo( - () => ({ - from, - to, - }), - [from, to] - ); - - const { - severityCount, - loading: isKpiLoading, - refetch: refetchKpi, - inspect: inspectKpi, - } = useUserRiskScoreKpi({ - filterQuery: severityFilter, - skip: !toggleStatus, - timerange, - }); - - const [ - isTableLoading, - { data, inspect, refetch, isLicenseValid, isDeprecated, isModuleEnabled }, - ] = useUserRiskScore({ - filterQuery: severityFilter, - skip: !toggleStatus, - pagination: { - cursorStart: 0, - querySize: 5, - }, - timerange, - }); - - useQueryInspector({ - queryId: TABLE_QUERY_ID, - loading: isTableLoading, - refetch, - setQuery, - deleteQuery, - inspect, - }); - - useQueryInspector({ - queryId: USER_RISK_KPI_QUERY_ID, - loading: isKpiLoading, - refetch: refetchKpi, - setQuery, - deleteQuery, - inspect: inspectKpi, - }); - - useEffect(() => { - setUpdatedAt(Date.now()); - }, [isTableLoading, isKpiLoading]); // Update the time when data loads - - const [goToUserRiskTab, userRiskTabUrl] = useMemo(() => { - const { onClick, href } = getSecuritySolutionLinkProps({ - deepLinkId: SecurityPageName.users, - path: getTabsOnUsersUrl(UsersTableType.risk), - onClick: () => { - dispatch( - usersActions.updateUserRiskScoreSeverityFilter({ - severitySelection: [], - }) - ); - }, - }); - return [onClick, href]; - }, [dispatch, getSecuritySolutionLinkProps]); - - const refreshPage = useRefetchQueries(); - - if (!isLicenseValid) { - return null; - } - - if (!isModuleEnabled && !isTableLoading) { - return ; - } - - if (isDeprecated && !isTableLoading) { - return ( - - ); - } - - if (isModuleEnabled && selectedSeverity.length === 0 && data && data.length === 0) { - return ; - } - - return ( - - - } - titleSize="s" - subtitle={ - - } - id={TABLE_QUERY_ID} - toggleStatus={toggleStatus} - toggleQuery={setToggleStatus} - > - {toggleStatus && ( - - - - {i18n.LEARN_MORE} - - - - - - - - {i18n.VIEW_ALL} - - - - )} - - {toggleStatus && ( - - - - - - - - - )} - {(isTableLoading || isKpiLoading) && ( - - )} - - - ); -}; - -export const EntityAnalyticsUserRiskScores = React.memo(EntityAnalyticsUserRiskScoresComponent); -EntityAnalyticsUserRiskScores.displayName = 'EntityAnalyticsUserRiskScores'; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/translations.ts b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/translations.ts deleted file mode 100644 index 058033758549..000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/translations.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; - -export const USER_RISK_TOOLTIP = i18n.translate( - 'xpack.securitySolution.entityAnalytics.usersRiskDashboard.userRiskToolTip', - { - defaultMessage: - 'User risk classification is determined by User risk score. Users classified as Critical or High are indicated as risky.', - } -); - -export const USER_RISK = i18n.translate( - 'xpack.securitySolution.entityAnalytics.usersRiskDashboard.userRiskClassificationTitle', - { - defaultMessage: 'User risk classification', - } -); - -export const USER_RISK_SCORE = i18n.translate( - 'xpack.securitySolution.entityAnalytics.usersRiskDashboard.userRiskScoreTitle', - { - defaultMessage: 'User risk score', - } -); - -export const USER_NAME = i18n.translate( - 'xpack.securitySolution.entityAnalytics.usersRiskDashboard.userNameTitle', - { - defaultMessage: 'User Name', - } -); - -export const TOTAL_LABEL = i18n.translate( - 'xpack.securitySolution.entityAnalytics.usersRiskDashboard.totalLabel', - { - defaultMessage: 'Total', - } -); - -export const VIEW_ALL = i18n.translate( - 'xpack.securitySolution.entityAnalytics.usersRiskDashboard.viewAllLabel', - { - defaultMessage: 'View all', - } -); - -export const LEARN_MORE = i18n.translate( - 'xpack.securitySolution.entityAnalytics.usersRiskDashboard.learnMore', - { - defaultMessage: 'Learn more', - } -); - -export const ENABLE_VIA_DEV_TOOLS = i18n.translate( - 'xpack.securitySolution.entityAnalytics.usersRiskDashboard.enableViaDevToolsButtonTitle', - { - defaultMessage: 'Enable via Dev Tools', - } -); diff --git a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx index 70c304e03116..fe221ee9b098 100644 --- a/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/host_overview/index.tsx @@ -119,7 +119,6 @@ export const HostOverview = React.memo( ), description: ( @@ -135,7 +134,6 @@ export const HostOverview = React.memo( ), description: ( diff --git a/x-pack/plugins/security_solution/public/overview/components/user_overview/index.tsx b/x-pack/plugins/security_solution/public/overview/components/user_overview/index.tsx index 68b40f581d38..8cd4ee428aea 100644 --- a/x-pack/plugins/security_solution/public/overview/components/user_overview/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/user_overview/index.tsx @@ -119,7 +119,6 @@ export const UserOverview = React.memo( ), description: ( @@ -135,7 +134,6 @@ export const UserOverview = React.memo( ), description: ( diff --git a/x-pack/plugins/security_solution/public/overview/pages/entity_analytics.tsx b/x-pack/plugins/security_solution/public/overview/pages/entity_analytics.tsx index 3ef48810d609..94fcd69e962c 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/entity_analytics.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/entity_analytics.tsx @@ -7,6 +7,8 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; +import { EntityAnalyticsRiskScores } from '../components/entity_analytics/risk_score'; +import { RiskScoreEntity } from '../../../common/search_strategy'; import { ENTITY_ANALYTICS } from '../../app/translations'; import { Paywall } from '../../common/components/paywall'; import { useMlCapabilities } from '../../common/components/ml/hooks/use_ml_capabilities'; @@ -18,9 +20,7 @@ import { HeaderPage } from '../../common/components/header_page'; import { LandingPageComponent } from '../../common/components/landing_page'; import * as i18n from './translations'; -import { EntityAnalyticsHostRiskScores } from '../components/entity_analytics/host_risk_score'; import { EntityAnalyticsHeader } from '../components/entity_analytics/header'; -import { EntityAnalyticsUserRiskScores } from '../components/entity_analytics/user_risk_score'; import { EntityAnalyticsAnomalies } from '../components/entity_analytics/anomalies'; import { SiemSearchBar } from '../../common/components/search_bar'; import { InputsModelId } from '../../common/store/inputs/constants'; @@ -45,7 +45,7 @@ const EntityAnalyticsComponent = () => { )} {!isPlatinumOrTrialLicense && capabilitiesFetched ? ( - + ) : isSourcererLoading ? ( ) : ( @@ -55,11 +55,11 @@ const EntityAnalyticsComponent = () => {
- + - + diff --git a/x-pack/plugins/security_solution/public/overview/pages/translations.ts b/x-pack/plugins/security_solution/public/overview/pages/translations.ts index 55dc208ec11c..d4c4e2b17d11 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/translations.ts +++ b/x-pack/plugins/security_solution/public/overview/pages/translations.ts @@ -53,7 +53,8 @@ export const DETECTION_RESPONSE_TITLE = i18n.translate( export const ENTITY_ANALYTICS_LICENSE_DESC = i18n.translate( 'xpack.securitySolution.entityAnalytics.pageDesc', { - defaultMessage: 'Entity Analytics features', + defaultMessage: + 'Detect threats from users and devices within your network with Entity Analytics', } ); diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/cube_for_process.tsx b/x-pack/plugins/security_solution/public/resolver/view/panels/cube_for_process.tsx index d16e1bec3c36..ef22f0f60edc 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/cube_for_process.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/cube_for_process.tsx @@ -51,6 +51,7 @@ export const CubeForProcess = memo(function ({ viewBox="0 0 34 34" data-test-subj={dataTestSubj} isOrigin={isOrigin} + style={{ verticalAlign: 'middle' }} > {i18n.translate('xpack.securitySolution.resolver.node_icon', { diff --git a/x-pack/plugins/security_solution/public/resolver/view/panels/node_detail.tsx b/x-pack/plugins/security_solution/public/resolver/view/panels/node_detail.tsx index 2c4181add11c..a3d3251e4100 100644 --- a/x-pack/plugins/security_solution/public/resolver/view/panels/node_detail.tsx +++ b/x-pack/plugins/security_solution/public/resolver/view/panels/node_detail.tsx @@ -35,7 +35,6 @@ import { PanelContentError } from './panel_content_error'; const StyledCubeForProcess = styled(CubeForProcess)` position: relative; - top: 0.75em; `; const nodeDetailError = i18n.translate('xpack.securitySolution.resolver.panel.nodeDetail.Error', { diff --git a/x-pack/plugins/security_solution/public/risk_score/containers/all/index.tsx b/x-pack/plugins/security_solution/public/risk_score/containers/all/index.tsx index 9c5671640f87..00b16daa4610 100644 --- a/x-pack/plugins/security_solution/public/risk_score/containers/all/index.tsx +++ b/x-pack/plugins/security_solution/public/risk_score/containers/all/index.tsx @@ -11,9 +11,10 @@ import { useRiskScoreFeatureStatus } from '../feature_status'; import { createFilter } from '../../../common/containers/helpers'; import type { RiskScoreSortField, StrategyResponseType } from '../../../../common/search_strategy'; import { - getHostRiskIndex, - getUserRiskIndex, RiskQueries, + getUserRiskIndex, + RiskScoreEntity, + getHostRiskIndex, } from '../../../../common/search_strategy'; import type { ESQuery } from '../../../../common/typed_json'; @@ -51,8 +52,7 @@ export interface UseRiskScoreParams { } interface UseRiskScore extends UseRiskScoreParams { - defaultIndex: string | undefined; - factoryQueryType: T; + riskEntity: T; } export const initialResult: Omit< @@ -63,64 +63,48 @@ export const initialResult: Omit< data: undefined, }; -export const useHostRiskScore = (params?: UseRiskScoreParams) => { - const { - timerange, - onlyLatest = true, - filterQuery, - sort, - skip = false, - pagination, - } = params ?? {}; - const spaceId = useSpaceId(); - const defaultIndex = spaceId ? getHostRiskIndex(spaceId, onlyLatest) : undefined; - +// use this function instead of directly using useRiskScore +// typescript is happy with the type specific hooks +export const useHostRiskScore = ( + params?: UseRiskScoreParams +): [boolean, RiskScoreState] => { return useRiskScore({ - timerange, - onlyLatest, - filterQuery, - sort, - skip, - pagination, - defaultIndex, - factoryQueryType: RiskQueries.hostsRiskScore, + ...params, + riskEntity: RiskScoreEntity.host, }); }; -export const useUserRiskScore = (params?: UseRiskScoreParams) => { - const { - timerange, - onlyLatest = true, - filterQuery, - sort, - skip = false, - pagination, - } = params ?? {}; - const spaceId = useSpaceId(); - const defaultIndex = spaceId ? getUserRiskIndex(spaceId, onlyLatest) : undefined; - - return useRiskScore({ - timerange, - onlyLatest, - filterQuery, - sort, - skip, - pagination, - defaultIndex, - factoryQueryType: RiskQueries.usersRiskScore, +// use this function instead of directly using useRiskScore +// typescript is happy with the type specific hooks +export const useUserRiskScore = ( + params?: UseRiskScoreParams +): [boolean, RiskScoreState] => + useRiskScore({ + ...params, + riskEntity: RiskScoreEntity.user, }); -}; -const useRiskScore = ({ +const useRiskScore = ({ timerange, - onlyLatest, + onlyLatest = true, filterQuery, sort, skip = false, pagination, - defaultIndex, - factoryQueryType, -}: UseRiskScore): [boolean, RiskScoreState] => { + riskEntity, +}: UseRiskScore): [ + boolean, + RiskScoreState +] => { + const spaceId = useSpaceId(); + const defaultIndex = spaceId + ? riskEntity === RiskScoreEntity.host + ? getHostRiskIndex(spaceId, onlyLatest) + : getUserRiskIndex(spaceId, onlyLatest) + : undefined; + const factoryQueryType = + riskEntity === RiskScoreEntity.host ? RiskQueries.hostsRiskScore : RiskQueries.usersRiskScore; + const { querySize, cursorStart } = pagination || {}; const { addError } = useAppToasts(); @@ -131,7 +115,7 @@ const useRiskScore = { test('does not search if license is not valid, and initial isDeprecated state is false', () => { mockUseMlCapabilities.mockReturnValue({ isPlatinumOrTrialLicense: false }); const { result } = renderHook( - () => useRiskScoreFeatureStatus(RiskQueries.hostsRiskScore, 'the_right_one'), + () => useRiskScoreFeatureStatus(RiskScoreEntity.host, 'the_right_one'), { wrapper: TestProviders, } @@ -60,7 +61,7 @@ describe(`risk score feature status`, () => { test('runs search if feature is enabled, and initial isDeprecated state is true', () => { const { result } = renderHook( - () => useRiskScoreFeatureStatus(RiskQueries.hostsRiskScore, 'the_right_one'), + () => useRiskScoreFeatureStatus(RiskScoreEntity.host, 'the_right_one'), { wrapper: TestProviders, } @@ -76,7 +77,7 @@ describe(`risk score feature status`, () => { test('updates state after search returns isDeprecated = false', () => { const { result, rerender } = renderHook( - () => useRiskScoreFeatureStatus(RiskQueries.hostsRiskScore, 'the_right_one'), + () => useRiskScoreFeatureStatus(RiskScoreEntity.host, 'the_right_one'), { wrapper: TestProviders, } diff --git a/x-pack/plugins/security_solution/public/risk_score/containers/feature_status/index.ts b/x-pack/plugins/security_solution/public/risk_score/containers/feature_status/index.ts index 0099ed0df3f0..4cb6507c559f 100644 --- a/x-pack/plugins/security_solution/public/risk_score/containers/feature_status/index.ts +++ b/x-pack/plugins/security_solution/public/risk_score/containers/feature_status/index.ts @@ -8,7 +8,7 @@ import { useCallback, useEffect, useMemo } from 'react'; import { useMlCapabilities } from '../../../common/components/ml/hooks/use_ml_capabilities'; import { REQUEST_NAMES, useFetch } from '../../../common/hooks/use_fetch'; -import { RiskQueries, RiskScoreEntity } from '../../../../common/search_strategy'; +import type { RiskScoreEntity } from '../../../../common/search_strategy'; import { getRiskScoreIndexStatus } from './api'; interface RiskScoresFeatureStatus { @@ -24,15 +24,10 @@ interface RiskScoresFeatureStatus { } export const useRiskScoreFeatureStatus = ( - factoryQueryType: RiskQueries.hostsRiskScore | RiskQueries.usersRiskScore, + riskEntity: RiskScoreEntity.host | RiskScoreEntity.user, defaultIndex?: string ): RiskScoresFeatureStatus => { const { isPlatinumOrTrialLicense, capabilitiesFetched } = useMlCapabilities(); - const entity = useMemo( - () => - factoryQueryType === RiskQueries.hostsRiskScore ? RiskScoreEntity.host : RiskScoreEntity.user, - [factoryQueryType] - ); const { fetch, data, isLoading, error } = useFetch( REQUEST_NAMES.GET_RISK_SCORE_DEPRECATED, @@ -52,10 +47,10 @@ export const useRiskScoreFeatureStatus = ( const searchIndexStatus = useCallback( (indexName: string) => { fetch({ - query: { indexName, entity }, + query: { indexName, entity: riskEntity }, }); }, - [entity, fetch] + [riskEntity, fetch] ); useEffect(() => { diff --git a/x-pack/plugins/security_solution/public/users/components/kpi_users/index.tsx b/x-pack/plugins/security_solution/public/users/components/kpi_users/index.tsx index 831ca2bdc76f..06edd9607386 100644 --- a/x-pack/plugins/security_solution/public/users/components/kpi_users/index.tsx +++ b/x-pack/plugins/security_solution/public/users/components/kpi_users/index.tsx @@ -15,7 +15,7 @@ import { TotalUsersKpi } from './total_users'; import { CallOutSwitcher } from '../../../common/components/callouts'; import * as i18n from './translations'; import { RiskScoreDocLink } from '../../../common/components/risk_score/risk_score_onboarding/risk_score_doc_link'; -import { getUserRiskIndex, RiskQueries, RiskScoreEntity } from '../../../../common/search_strategy'; +import { getUserRiskIndex, RiskScoreEntity } from '../../../../common/search_strategy'; import { useSpaceId } from '../../../common/hooks/use_space_id'; import { useRiskScoreFeatureStatus } from '../../../risk_score/containers/feature_status'; @@ -24,7 +24,7 @@ export const UsersKpiComponent = React.memo( const spaceId = useSpaceId(); const defaultIndex = spaceId ? getUserRiskIndex(spaceId) : undefined; const { isEnabled, isLicenseValid, isLoading } = useRiskScoreFeatureStatus( - RiskQueries.usersRiskScore, + RiskScoreEntity.user, defaultIndex ); diff --git a/x-pack/plugins/security_solution/public/users/components/user_risk_score_table/index.tsx b/x-pack/plugins/security_solution/public/users/components/user_risk_score_table/index.tsx index 245150f4fb49..984f737d9f97 100644 --- a/x-pack/plugins/security_solution/public/users/components/user_risk_score_table/index.tsx +++ b/x-pack/plugins/security_solution/public/users/components/user_risk_score_table/index.tsx @@ -8,8 +8,7 @@ import React, { useMemo, useCallback } from 'react'; import { useDispatch } from 'react-redux'; -import { EuiFlexGroup, EuiFlexItem, EuiIconTip } from '@elastic/eui'; -import styled from 'styled-components'; +import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import type { Columns, Criteria, ItemsPerRow } from '../../../common/components/paginated_table'; import { PaginatedTable } from '../../../common/components/paginated_table'; @@ -32,10 +31,6 @@ import type { UserRiskScore, } from '../../../../common/search_strategy'; -const IconWrapper = styled.span` - margin-left: ${({ theme }) => theme.eui.euiSizeS}; -`; - export const rowItems: ItemsPerRow[] = [ { text: i18n.ROWS_5, @@ -152,21 +147,6 @@ const UserRiskScoreTableComponent: React.FC = ({ ); - const headerTitle = ( - <> - {i18nUsers.NAVIGATION_RISK_TITLE} - - - - - ); - const getUserRiskScoreFilterQuerySelector = useMemo( () => usersSelectors.userRiskScoreSeverityFilterSelector(), [] @@ -201,7 +181,8 @@ const UserRiskScoreTableComponent: React.FC = ({ /> } headerSupplement={risk} - headerTitle={headerTitle} + headerTitle={i18nUsers.NAVIGATION_RISK_TITLE} + headerTooltip={i18n.USER_RISK_TABLE_TOOLTIP} headerUnit={i18n.UNIT(totalCount)} id={id} isInspect={isInspect} diff --git a/x-pack/plugins/security_solution/server/endpoint/services/actions/action_list.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/actions/action_list.test.ts index f08b82a49071..67d527817abf 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/actions/action_list.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/actions/action_list.test.ts @@ -14,7 +14,7 @@ import type { LogsEndpointActionResponse, } from '../../../../common/endpoint/types'; import { EndpointActionGenerator } from '../../../../common/endpoint/data_generators/endpoint_action_generator'; -import { getActionList } from './action_list'; +import { getActionList, getActionListByStatus } from './action_list'; import { CustomHttpRequestError } from '../../../utils/custom_http_request_error'; import { applyActionListEsSearchMock, @@ -650,3 +650,59 @@ describe('When using `getActionList()', () => { await expect(getActionListPromise).rejects.toBeInstanceOf(CustomHttpRequestError); }); }); + +describe('When using `getActionListByStatus()', () => { + let esClient: ElasticsearchClientMock; + let logger: MockedLogger; + // let endpointActionGenerator: EndpointActionGenerator; + let actionRequests: estypes.SearchResponse; + let actionResponses: estypes.SearchResponse; + let endpointAppContextService: EndpointAppContextService; + + beforeEach(() => { + esClient = elasticsearchServiceMock.createScopedClusterClient().asInternalUser; + logger = loggingSystemMock.createLogger(); + // endpointActionGenerator = new EndpointActionGenerator('seed'); + endpointAppContextService = new EndpointAppContextService(); + endpointAppContextService.setup(createMockEndpointAppContextServiceSetupContract()); + endpointAppContextService.start(createMockEndpointAppContextServiceStartContract()); + + actionRequests = createActionRequestsEsSearchResultsMock(undefined); + actionResponses = createActionResponsesEsSearchResultsMock(); + + applyActionListEsSearchMock(esClient, actionRequests, actionResponses); + }); + + afterEach(() => { + endpointAppContextService.stop(); + }); + + it('should return expected output `data` length for selected statuses', async () => { + actionRequests = createActionRequestsEsSearchResultsMock(undefined, true); + actionResponses = createActionResponsesEsSearchResultsMock(); + + applyActionListEsSearchMock(esClient, actionRequests, actionResponses); + // mock metadataService.findHostMetadataForFleetAgents resolved value + (endpointAppContextService.getEndpointMetadataService as jest.Mock) = jest + .fn() + .mockReturnValue({ + findHostMetadataForFleetAgents: jest.fn().mockResolvedValue([]), + }); + + const getActionListByStatusPromise = ({ page }: { page: number }) => + getActionListByStatus({ + esClient, + logger, + metadataService: endpointAppContextService.getEndpointMetadataService(), + page: page ?? 1, + pageSize: 10, + statuses: ['failed', 'pending', 'successful'], + }); + + expect(await (await getActionListByStatusPromise({ page: 1 })).data.length).toEqual(10); + + expect(await (await getActionListByStatusPromise({ page: 2 })).data.length).toEqual(10); + + expect(await (await getActionListByStatusPromise({ page: 3 })).data.length).toEqual(3); + }); +}); diff --git a/x-pack/plugins/security_solution/server/endpoint/services/actions/action_list.ts b/x-pack/plugins/security_solution/server/endpoint/services/actions/action_list.ts index eb53a6a4338a..461f707e336b 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/actions/action_list.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/actions/action_list.ts @@ -92,8 +92,8 @@ export const getActionListByStatus = async ({ userIds, commands, statuses, - // for size 20 -> page 1: (0, 19), page 2: (20,39) ...etc - data: actionDetailsByStatus.slice((page - 1) * size, size * page - 1), + // for size 20 -> page 1: (0, 20), page 2: (20, 40) ...etc + data: actionDetailsByStatus.slice((page - 1) * size, size * page), total: actionDetailsByStatus.length, }; }; @@ -251,7 +251,7 @@ const getActionDetailsList = async ({ }); // compute action details list for each action id - const actionDetails: ActionDetails[] = normalizedActionRequests.map((action) => { + const actionDetails: ActionListApiResponse['data'] = normalizedActionRequests.map((action) => { // pick only those responses that match the current action id const matchedResponses = categorizedResponses.filter((categorizedResponse) => categorizedResponse.type === 'response' diff --git a/x-pack/plugins/security_solution/server/endpoint/services/actions/mocks.ts b/x-pack/plugins/security_solution/server/endpoint/services/actions/mocks.ts index 80c7a5a6ff6c..23705d6bc43b 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/actions/mocks.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/actions/mocks.ts @@ -21,17 +21,22 @@ import { } from '../../../../common/endpoint/constants'; export const createActionRequestsEsSearchResultsMock = ( - agentIds?: string[] + agentIds?: string[], + isMultipleActions: boolean = false ): estypes.SearchResponse => { const endpointActionGenerator = new EndpointActionGenerator('seed'); - return endpointActionGenerator.toEsSearchResponse([ - endpointActionGenerator.generateActionEsHit({ - EndpointActions: { action_id: '123' }, - agent: { id: agentIds ? agentIds : 'agent-a' }, - '@timestamp': '2022-04-27T16:08:47.449Z', - }), - ]); + return isMultipleActions + ? endpointActionGenerator.toEsSearchResponse( + Array.from({ length: 23 }).map(() => endpointActionGenerator.generateActionEsHit()) + ) + : endpointActionGenerator.toEsSearchResponse([ + endpointActionGenerator.generateActionEsHit({ + EndpointActions: { action_id: '123' }, + agent: { id: agentIds ? agentIds : 'agent-a' }, + '@timestamp': '2022-04-27T16:08:47.449Z', + }), + ]); }; export const createActionResponsesEsSearchResultsMock = ( diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_cloudtrail_logging_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_cloudtrail_logging_created.json index dce3794eaa27..1c18ffdb366a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_cloudtrail_logging_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_cloudtrail_logging_created.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_gcp_pub_sub_subscription_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_gcp_pub_sub_subscription_creation.json index 170799f184f4..bde0e521ccc8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_gcp_pub_sub_subscription_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_gcp_pub_sub_subscription_creation.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_gcp_pub_sub_topic_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_gcp_pub_sub_topic_creation.json index 0a81f7147a6f..374cd565a4cd 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_gcp_pub_sub_topic_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_gcp_pub_sub_topic_creation.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_google_drive_ownership_transferred_via_google_workspace.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_google_drive_ownership_transferred_via_google_workspace.json index 7786d21c92e1..84b930fc30b3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_google_drive_ownership_transferred_via_google_workspace.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_google_drive_ownership_transferred_via_google_workspace.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -86,5 +86,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_google_workspace_custom_gmail_route_created_or_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_google_workspace_custom_gmail_route_created_or_modified.json index ecf97a03e224..f6c591d8922d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_google_workspace_custom_gmail_route_created_or_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_google_workspace_custom_gmail_route_created_or_modified.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -86,5 +86,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_microsoft_365_new_inbox_rule.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_microsoft_365_new_inbox_rule.json index 2872c1aa509e..ef67f834a05e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_microsoft_365_new_inbox_rule.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_microsoft_365_new_inbox_rule.json @@ -27,7 +27,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -110,5 +110,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_update_event_hub_auth_rule.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_update_event_hub_auth_rule.json index f3858c18a6e2..ab64a125a544 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_update_event_hub_auth_rule.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/collection_update_event_hub_auth_rule.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_attempted_bypass_of_okta_mfa.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_attempted_bypass_of_okta_mfa.json index cdc1899aef25..854e7c05f1ee 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_attempted_bypass_of_okta_mfa.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_attempted_bypass_of_okta_mfa.json @@ -19,7 +19,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -65,5 +65,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_attempts_to_brute_force_okta_user_account.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_attempts_to_brute_force_okta_user_account.json index 5a51259d349a..1e0e64288a25 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_attempts_to_brute_force_okta_user_account.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_attempts_to_brute_force_okta_user_account.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -73,5 +73,5 @@ "value": 3 }, "type": "threshold", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_aws_iam_assume_role_brute_force.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_aws_iam_assume_role_brute_force.json index 490b96665a83..1ecaf2dd8bfd 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_aws_iam_assume_role_brute_force.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_aws_iam_assume_role_brute_force.json @@ -21,7 +21,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -86,5 +86,5 @@ "value": 25 }, "type": "threshold", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_azure_full_network_packet_capture_detected.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_azure_full_network_packet_capture_detected.json index 7ecff1cab054..0424bd725423 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_azure_full_network_packet_capture_detected.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_azure_full_network_packet_capture_detected.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -74,5 +74,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_iam_user_addition_to_group.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_iam_user_addition_to_group.json index 2140870e22d1..70cfa845453b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_iam_user_addition_to_group.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_iam_user_addition_to_group.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -92,5 +92,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_key_vault_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_key_vault_modified.json index b4cb0de511fa..bda2c0ad53d2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_key_vault_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_key_vault_modified.json @@ -24,7 +24,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -82,5 +82,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_microsoft_365_brute_force_user_account_attempt.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_microsoft_365_brute_force_user_account_attempt.json index b14caa11172a..e4d55e511c98 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_microsoft_365_brute_force_user_account_attempt.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_microsoft_365_brute_force_user_account_attempt.json @@ -24,7 +24,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -90,5 +90,5 @@ "value": 10 }, "type": "threshold", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_microsoft_365_potential_password_spraying_attack.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_microsoft_365_potential_password_spraying_attack.json index 58dcd2838e88..25fbb268525b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_microsoft_365_potential_password_spraying_attack.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_microsoft_365_potential_password_spraying_attack.json @@ -19,7 +19,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -80,5 +80,5 @@ "value": 25 }, "type": "threshold", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_okta_brute_force_or_password_spraying.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_okta_brute_force_or_password_spraying.json index a9838a1be2f7..a5a2a5c4b5f6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_okta_brute_force_or_password_spraying.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_okta_brute_force_or_password_spraying.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -78,5 +78,5 @@ "value": 25 }, "type": "threshold", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_root_console_failure_brute_force.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_root_console_failure_brute_force.json index fa80873d0029..e28873764450 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_root_console_failure_brute_force.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_root_console_failure_brute_force.json @@ -23,7 +23,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ "value": 10 }, "type": "threshold", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_secretsmanager_getsecretvalue.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_secretsmanager_getsecretvalue.json index 2ec5b4d9a877..e48cd55b3dc3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_secretsmanager_getsecretvalue.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_secretsmanager_getsecretvalue.json @@ -26,7 +26,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -79,5 +79,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_storage_account_key_regenerated.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_storage_account_key_regenerated.json index a8f3ebcb02bd..0b21f4e30fe2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_storage_account_key_regenerated.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_storage_account_key_regenerated.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -74,5 +74,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_user_excessive_sso_logon_errors.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_user_excessive_sso_logon_errors.json index 08ce349cf9a2..1fe876087598 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_user_excessive_sso_logon_errors.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_user_excessive_sso_logon_errors.json @@ -20,7 +20,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ "value": 5 }, "type": "threshold", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_user_impersonation_access.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_user_impersonation_access.json index c81d9e99eb40..db1954bf32d4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_user_impersonation_access.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/credential_access_user_impersonation_access.json @@ -20,7 +20,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -61,5 +61,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_application_removed_from_blocklist_in_google_workspace.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_application_removed_from_blocklist_in_google_workspace.json index 42cb730b4bd5..24fbf972f262 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_application_removed_from_blocklist_in_google_workspace.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_application_removed_from_blocklist_in_google_workspace.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -102,5 +102,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_attempt_to_deactivate_okta_network_zone.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_attempt_to_deactivate_okta_network_zone.json index 5a369c99e1e1..48b117098e89 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_attempt_to_deactivate_okta_network_zone.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_attempt_to_deactivate_okta_network_zone.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -77,5 +77,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_attempt_to_delete_okta_network_zone.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_attempt_to_delete_okta_network_zone.json index df742d5e50db..a94413ddbd69 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_attempt_to_delete_okta_network_zone.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_attempt_to_delete_okta_network_zone.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -77,5 +77,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_application_credential_modification.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_application_credential_modification.json index 430a6e5f760c..15d9cfc43b4f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_application_credential_modification.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_application_credential_modification.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -80,5 +80,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_automation_runbook_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_automation_runbook_deleted.json index 2b85723e10a1..ea752fb3e753 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_automation_runbook_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_automation_runbook_deleted.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -69,5 +69,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_blob_permissions_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_blob_permissions_modified.json index 09c799005d1c..d7d398b93b8c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_blob_permissions_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_blob_permissions_modified.json @@ -22,7 +22,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -73,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_diagnostic_settings_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_diagnostic_settings_deletion.json index 050a8949db39..391c7550cebe 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_diagnostic_settings_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_diagnostic_settings_deletion.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_service_principal_addition.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_service_principal_addition.json index 8b409bdb6368..23ffd879c111 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_service_principal_addition.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_azure_service_principal_addition.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -82,5 +82,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudtrail_logging_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudtrail_logging_deleted.json index cb0f9d549a04..c9612870bcdd 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudtrail_logging_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudtrail_logging_deleted.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudtrail_logging_suspended.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudtrail_logging_suspended.json index 97867f74d055..abe9271b8301 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudtrail_logging_suspended.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudtrail_logging_suspended.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudwatch_alarm_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudwatch_alarm_deletion.json index 6fc0a85d8e9c..b6945f8b9f10 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudwatch_alarm_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_cloudwatch_alarm_deletion.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_config_service_rule_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_config_service_rule_deletion.json index 9113f5907dd3..a60d5015f4c6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_config_service_rule_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_config_service_rule_deletion.json @@ -26,7 +26,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -85,5 +85,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_configuration_recorder_stopped.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_configuration_recorder_stopped.json index 6677ce569b49..17cd9c6e1600 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_configuration_recorder_stopped.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_configuration_recorder_stopped.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -88,5 +88,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_domain_added_to_google_workspace_trusted_domains.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_domain_added_to_google_workspace_trusted_domains.json index 75bbc1e8b334..178c5c42f0d6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_domain_added_to_google_workspace_trusted_domains.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_domain_added_to_google_workspace_trusted_domains.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -87,5 +87,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_ec2_flow_log_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_ec2_flow_log_deletion.json index 9104509c8576..1bfe183a5a45 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_ec2_flow_log_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_ec2_flow_log_deletion.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_ec2_network_acl_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_ec2_network_acl_deletion.json index 4eb08d21f5e6..b0ec864e4085 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_ec2_network_acl_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_ec2_network_acl_deletion.json @@ -27,7 +27,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -90,5 +90,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_elasticache_security_group_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_elasticache_security_group_creation.json index 9acd6f767b61..405215618b17 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_elasticache_security_group_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_elasticache_security_group_creation.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -87,5 +87,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_elasticache_security_group_modified_or_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_elasticache_security_group_modified_or_deleted.json index 8548f32e06a0..909a8474c208 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_elasticache_security_group_modified_or_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_elasticache_security_group_modified_or_deleted.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -87,5 +87,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_event_hub_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_event_hub_deletion.json index 36545e9bff9e..5f52bf06a19d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_event_hub_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_event_hub_deletion.json @@ -25,7 +25,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -83,5 +83,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_firewall_policy_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_firewall_policy_deletion.json index f1e0e99c67ec..d0ffb0a05279 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_firewall_policy_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_firewall_policy_deletion.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_frontdoor_firewall_policy_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_frontdoor_firewall_policy_deletion.json index 4269f229a2ae..8c5cfff14d6c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_frontdoor_firewall_policy_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_frontdoor_firewall_policy_deletion.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_created.json index 93ca073a171a..3c9adaefa823 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_created.json @@ -21,8 +21,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -68,5 +69,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_deleted.json index d49edc4f123b..f3debd68ebe0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_deleted.json @@ -21,8 +21,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -68,5 +69,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_modified.json index 3b0ca907a7e4..da1e2ccb8925 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_firewall_rule_modified.json @@ -21,8 +21,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -68,5 +69,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_logging_bucket_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_logging_bucket_deletion.json index 41e6366756a0..8f93b61c574a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_logging_bucket_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_logging_bucket_deletion.json @@ -21,8 +21,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -73,5 +74,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_logging_sink_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_logging_sink_deletion.json index b93701685a11..781bc1d2e9be 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_logging_sink_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_logging_sink_deletion.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_pub_sub_subscription_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_pub_sub_subscription_deletion.json index bf1890f548c5..32e148dc25d6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_pub_sub_subscription_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_pub_sub_subscription_deletion.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_pub_sub_topic_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_pub_sub_topic_deletion.json index 283b83874d89..eee336c3d9b4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_pub_sub_topic_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_pub_sub_topic_deletion.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_storage_bucket_configuration_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_storage_bucket_configuration_modified.json index e0470117bd11..1bb6d123de88 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_storage_bucket_configuration_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_storage_bucket_configuration_modified.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -73,5 +74,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_storage_bucket_permissions_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_storage_bucket_permissions_modified.json index f8f9cfad37be..2a334c80ab68 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_storage_bucket_permissions_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_storage_bucket_permissions_modified.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_network_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_network_deleted.json index 76b058e65a1c..54cb615d7156 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_network_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_network_deleted.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -80,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_route_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_route_created.json index c4f344846bd8..5926141fdabb 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_route_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_route_created.json @@ -21,8 +21,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -76,5 +77,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_route_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_route_deleted.json index e2b483fc9298..ab75552f7a06 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_route_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_gcp_virtual_private_cloud_route_deleted.json @@ -21,8 +21,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -81,5 +82,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_google_workspace_bitlocker_setting_disabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_google_workspace_bitlocker_setting_disabled.json index 018c8d0c9d6d..8c0b5fbbb435 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_google_workspace_bitlocker_setting_disabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_google_workspace_bitlocker_setting_disabled.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -92,5 +92,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_google_workspace_restrictions_for_google_marketplace_changed_to_allow_any_app.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_google_workspace_restrictions_for_google_marketplace_changed_to_allow_any_app.json index ddb123498fa8..d69005491d5e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_google_workspace_restrictions_for_google_marketplace_changed_to_allow_any_app.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_google_workspace_restrictions_for_google_marketplace_changed_to_allow_any_app.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -102,5 +102,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_guardduty_detector_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_guardduty_detector_deletion.json index 5186e952ab84..dab57a174fc5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_guardduty_detector_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_guardduty_detector_deletion.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -88,5 +88,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_kubernetes_events_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_kubernetes_events_deleted.json index af1c51fa0a15..c4f932ad4f6c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_kubernetes_events_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_kubernetes_events_deleted.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_dlp_policy_removed.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_dlp_policy_removed.json index bc5cc6202093..bc1faac1570e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_dlp_policy_removed.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_dlp_policy_removed.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_malware_filter_policy_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_malware_filter_policy_deletion.json index 63901b5d86aa..5f5974ad79b9 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_malware_filter_policy_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_malware_filter_policy_deletion.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -83,5 +83,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_malware_filter_rule_mod.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_malware_filter_rule_mod.json index 3845a4e1c9a1..92d1e2ee110f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_malware_filter_rule_mod.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_malware_filter_rule_mod.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_safe_attach_rule_disabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_safe_attach_rule_disabled.json index 8847290e99c8..098fc20b7dd0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_safe_attach_rule_disabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_exchange_safe_attach_rule_disabled.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -83,5 +83,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_mailboxauditbypassassociation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_mailboxauditbypassassociation.json index dfff4d997635..7896aa38be70 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_mailboxauditbypassassociation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_microsoft_365_mailboxauditbypassassociation.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -85,5 +85,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_network_watcher_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_network_watcher_deletion.json index 167baa27c2fe..7124819843f7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_network_watcher_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_network_watcher_deletion.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_deactivate_okta_policy.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_deactivate_okta_policy.json index e988bc58b4fe..c615e34089ee 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_deactivate_okta_policy.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_deactivate_okta_policy.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -77,5 +77,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_deactivate_okta_policy_rule.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_deactivate_okta_policy_rule.json index 4ba9330f4a47..81d8782e6ce5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_deactivate_okta_policy_rule.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_deactivate_okta_policy_rule.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -77,5 +77,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_delete_okta_policy.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_delete_okta_policy.json index 040e7791483e..86cd009618c3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_delete_okta_policy.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_delete_okta_policy.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -77,5 +77,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_delete_okta_policy_rule.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_delete_okta_policy_rule.json index 7cdd8c780f78..295fb493e6ed 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_delete_okta_policy_rule.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_delete_okta_policy_rule.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -77,5 +77,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_network_zone.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_network_zone.json index f3a771f184e6..15a51b88c097 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_network_zone.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_network_zone.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -77,5 +77,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_policy.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_policy.json index 199d7de64979..1a69f862b695 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_policy.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_policy.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -76,5 +76,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_policy_rule.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_policy_rule.json index 17aeae26a983..358419263a30 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_policy_rule.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_okta_attempt_to_modify_okta_policy_rule.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -77,5 +77,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_s3_bucket_configuration_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_s3_bucket_configuration_deletion.json index 1cada93687ba..b61983f423a6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_s3_bucket_configuration_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_s3_bucket_configuration_deletion.json @@ -28,7 +28,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_suppression_rule_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_suppression_rule_created.json index 493e8dbbd060..139e05bebcc5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_suppression_rule_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_suppression_rule_created.json @@ -24,7 +24,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -75,5 +75,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_suspicious_okta_user_password_reset_or_unlock_attempts.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_suspicious_okta_user_password_reset_or_unlock_attempts.json index 72a518d5542e..f537c79c427e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_suspicious_okta_user_password_reset_or_unlock_attempts.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_suspicious_okta_user_password_reset_or_unlock_attempts.json @@ -25,7 +25,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -106,5 +106,5 @@ "value": 5 }, "type": "threshold", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_waf_acl_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_waf_acl_deletion.json index 378a43273394..9f34837071f7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_waf_acl_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_waf_acl_deletion.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -83,5 +83,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_waf_rule_or_rule_group_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_waf_rule_or_rule_group_deletion.json index b1e136776c8d..59eb206ec6bb 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_waf_rule_or_rule_group_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/defense_evasion_waf_rule_or_rule_group_deletion.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -88,5 +88,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/discovery_blob_container_access_mod.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/discovery_blob_container_access_mod.json index 59c500d79837..42671c621d45 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/discovery_blob_container_access_mod.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/discovery_blob_container_access_mod.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/discovery_denied_service_account_request.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/discovery_denied_service_account_request.json index 84cafb61d094..829a7a90c422 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/discovery_denied_service_account_request.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/discovery_denied_service_account_request.json @@ -21,7 +21,7 @@ "related_integrations": [ { "package": "kubernetes", - "version": "1.17.2" + "version": "^1.4.1" } ], "required_fields": [ @@ -70,5 +70,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/execution_command_virtual_machine.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/execution_command_virtual_machine.json index 1d4397fbf23d..badcfa517ab2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/execution_command_virtual_machine.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/execution_command_virtual_machine.json @@ -25,7 +25,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -76,5 +76,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_full_network_packet_capture_detected.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_full_network_packet_capture_detected.json index 12b267935e02..a4bda89c20be 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_full_network_packet_capture_detected.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_full_network_packet_capture_detected.json @@ -26,7 +26,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -97,5 +97,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_snapshot_change_activity.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_snapshot_change_activity.json index d8de82c5251a..62f31b39b962 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_snapshot_change_activity.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_snapshot_change_activity.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -78,5 +78,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_vm_export_failure.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_vm_export_failure.json index f8f9895aa991..c0d9a50a8a5c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_vm_export_failure.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_ec2_vm_export_failure.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -96,5 +96,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_gcp_logging_sink_modification.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_gcp_logging_sink_modification.json index 00154239c029..dd7a0d6c5926 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_gcp_logging_sink_modification.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_gcp_logging_sink_modification.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_microsoft_365_exchange_transport_rule_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_microsoft_365_exchange_transport_rule_creation.json index 0017b57c6dbc..62cffaebe5b0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_microsoft_365_exchange_transport_rule_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_microsoft_365_exchange_transport_rule_creation.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_microsoft_365_exchange_transport_rule_mod.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_microsoft_365_exchange_transport_rule_mod.json index 5931b6c32f0a..4f6ac0d2e6e9 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_microsoft_365_exchange_transport_rule_mod.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_microsoft_365_exchange_transport_rule_mod.json @@ -24,7 +24,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -85,5 +85,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_rds_snapshot_export.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_rds_snapshot_export.json index 3e344f4a0b87..2da17b0259f6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_rds_snapshot_export.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_rds_snapshot_export.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -76,5 +76,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_rds_snapshot_restored.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_rds_snapshot_restored.json index 264907bd84b6..fc9a4124e2d4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_rds_snapshot_restored.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/exfiltration_rds_snapshot_restored.json @@ -23,7 +23,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -87,5 +87,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_attempt_to_revoke_okta_api_token.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_attempt_to_revoke_okta_api_token.json index 59a472b0713d..0c2c25e53bc3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_attempt_to_revoke_okta_api_token.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_attempt_to_revoke_okta_api_token.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -68,5 +68,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_aws_eventbridge_rule_disabled_or_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_aws_eventbridge_rule_disabled_or_deleted.json index 888b6b54cb17..a8cf9c9f21d7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_aws_eventbridge_rule_disabled_or_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_aws_eventbridge_rule_disabled_or_deleted.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_azure_service_principal_credentials_added.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_azure_service_principal_credentials_added.json index 584f87b741a2..93281b57f429 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_azure_service_principal_credentials_added.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_azure_service_principal_credentials_added.json @@ -24,7 +24,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -75,5 +75,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudtrail_logging_updated.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudtrail_logging_updated.json index 80ad1350df65..a46154a969ef 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudtrail_logging_updated.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudtrail_logging_updated.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -104,5 +104,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudwatch_log_group_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudwatch_log_group_deletion.json index 5734ffe4c312..b0519a0afa47 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudwatch_log_group_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudwatch_log_group_deletion.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -104,5 +104,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudwatch_log_stream_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudwatch_log_stream_deletion.json index 04870a18138e..3b188fb8a1ad 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudwatch_log_stream_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_cloudwatch_log_stream_deletion.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -105,5 +105,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_ec2_disable_ebs_encryption.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_ec2_disable_ebs_encryption.json index 6f280977acbe..78989e7934a4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_ec2_disable_ebs_encryption.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_ec2_disable_ebs_encryption.json @@ -26,7 +26,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_efs_filesystem_or_mount_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_efs_filesystem_or_mount_deleted.json index c581b4cd72b6..1ba9aa185a72 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_efs_filesystem_or_mount_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_efs_filesystem_or_mount_deleted.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_iam_role_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_iam_role_deletion.json index fe9dec0ced23..4f6e6aea313a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_iam_role_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_iam_role_deletion.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_service_account_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_service_account_deleted.json index e8a6f0892257..640c048d79ce 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_service_account_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_service_account_deleted.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_service_account_disabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_service_account_disabled.json index 23531bad359b..f9a09d4eb6e0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_service_account_disabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_service_account_disabled.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_storage_bucket_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_storage_bucket_deleted.json index ec518694a254..8648402625a3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_storage_bucket_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_gcp_storage_bucket_deleted.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -67,5 +68,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_google_workspace_admin_role_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_google_workspace_admin_role_deletion.json index 735baec178a6..791efdc6463e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_google_workspace_admin_role_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_google_workspace_admin_role_deletion.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -80,5 +80,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_google_workspace_mfa_enforcement_disabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_google_workspace_mfa_enforcement_disabled.json index 6095c3c3a392..cf2dd80c5fd3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_google_workspace_mfa_enforcement_disabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_google_workspace_mfa_enforcement_disabled.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -86,5 +86,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_iam_deactivate_mfa_device.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_iam_deactivate_mfa_device.json index 49c4f3255155..99bb18ad4356 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_iam_deactivate_mfa_device.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_iam_deactivate_mfa_device.json @@ -26,7 +26,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -83,5 +83,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_iam_group_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_iam_group_deletion.json index e5b9b9d2b3d0..f16bdaa569c1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_iam_group_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_iam_group_deletion.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_kubernetes_pod_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_kubernetes_pod_deleted.json index 79792cad4e96..0c8c3ab14c16 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_kubernetes_pod_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_kubernetes_pod_deleted.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -68,5 +68,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_microsoft_365_potential_ransomware_activity.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_microsoft_365_potential_ransomware_activity.json index 1419e6c36cd2..ae82beafce00 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_microsoft_365_potential_ransomware_activity.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_microsoft_365_potential_ransomware_activity.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_microsoft_365_unusual_volume_of_file_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_microsoft_365_unusual_volume_of_file_deletion.json index b572bfdbbaef..0954bde76504 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_microsoft_365_unusual_volume_of_file_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_microsoft_365_unusual_volume_of_file_deletion.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_deactivate_okta_application.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_deactivate_okta_application.json index 70551d2c173d..790e19aaf182 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_deactivate_okta_application.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_deactivate_okta_application.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -70,5 +70,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_delete_okta_application.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_delete_okta_application.json index bf7c616bb33f..c816403377b7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_delete_okta_application.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_delete_okta_application.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -69,5 +69,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_modify_okta_application.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_modify_okta_application.json index 853116822a34..c6fdccd64039 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_modify_okta_application.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_okta_attempt_to_modify_okta_application.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -64,5 +64,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_possible_okta_dos_attack.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_possible_okta_dos_attack.json index 85f7502f26e0..7fc0083fc13c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_possible_okta_dos_attack.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_possible_okta_dos_attack.json @@ -19,7 +19,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -70,5 +70,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_group_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_group_deletion.json index 155afc369af2..9c7dcff92bb1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_group_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_group_deletion.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_instance_cluster_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_instance_cluster_deletion.json index 18b277adc56d..bb3527fac3d4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_instance_cluster_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_instance_cluster_deletion.json @@ -29,7 +29,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -85,5 +85,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_instance_cluster_stoppage.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_instance_cluster_stoppage.json index 15e02efcb8e4..dc5ce6e246bf 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_instance_cluster_stoppage.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_rds_instance_cluster_stoppage.json @@ -27,7 +27,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -83,5 +83,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_resource_group_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_resource_group_deletion.json index 453c189f75d1..f7603f5b2f8e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_resource_group_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_resource_group_deletion.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -96,5 +96,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_virtual_network_device_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_virtual_network_device_modified.json index d090ae229add..bf74fe3509c4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_virtual_network_device_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/impact_virtual_network_device_modified.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -69,5 +69,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_high_risk_signin.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_high_risk_signin.json index d06a073fd504..e92a0cc3ea63 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_high_risk_signin.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_high_risk_signin.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -79,5 +79,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_high_risk_signin_atrisk_or_confirmed.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_high_risk_signin_atrisk_or_confirmed.json index c2d57924a39e..7d39ad47973d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_high_risk_signin_atrisk_or_confirmed.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_high_risk_signin_atrisk_or_confirmed.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -74,5 +74,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_powershell_signin.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_powershell_signin.json index d46d34a762cc..4ea3feedaa35 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_powershell_signin.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_azure_active_directory_powershell_signin.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -87,5 +87,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_consent_grant_attack_via_azure_registered_application.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_consent_grant_attack_via_azure_registered_application.json index 01a68b944d29..8828b5037ca2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_consent_grant_attack_via_azure_registered_application.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_consent_grant_attack_via_azure_registered_application.json @@ -22,15 +22,15 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" }, { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" }, { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -114,5 +114,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_console_login_root.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_console_login_root.json index 7612d79572c1..929d34100180 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_console_login_root.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_console_login_root.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -101,5 +101,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_external_guest_user_invite.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_external_guest_user_invite.json index 159e0bd1b9e1..c100bcc9bc97 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_external_guest_user_invite.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_external_guest_user_invite.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -93,5 +93,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_gcp_iam_custom_role_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_gcp_iam_custom_role_creation.json index ad92d1b3498e..eebc12c09215 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_gcp_iam_custom_role_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_gcp_iam_custom_role_creation.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -87,5 +88,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_anti_phish_policy_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_anti_phish_policy_deletion.json index 94ad9f0b4bb8..f071d0121932 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_anti_phish_policy_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_anti_phish_policy_deletion.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_anti_phish_rule_mod.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_anti_phish_rule_mod.json index 7d8a1b23585e..f9ff2bdd02b8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_anti_phish_rule_mod.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_anti_phish_rule_mod.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_safelinks_disabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_safelinks_disabled.json index ac24c0321f6e..a69b1acdaff7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_safelinks_disabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_exchange_safelinks_disabled.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_user_restricted_from_sending_email.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_user_restricted_from_sending_email.json index 34722a9bed96..a6b58f03c5bf 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_user_restricted_from_sending_email.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_microsoft_365_user_restricted_from_sending_email.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_o365_user_reported_phish_malware.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_o365_user_reported_phish_malware.json index 64e64c1d919d..b72807030884 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_o365_user_reported_phish_malware.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_o365_user_reported_phish_malware.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -90,5 +90,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_okta_user_attempted_unauthorized_access.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_okta_user_attempted_unauthorized_access.json index 33d212c9c5e9..77a7e0080cab 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_okta_user_attempted_unauthorized_access.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_okta_user_attempted_unauthorized_access.json @@ -16,7 +16,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_password_recovery.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_password_recovery.json index 2e0c53cead87..cfade77b3e42 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_password_recovery.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_password_recovery.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -80,5 +80,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_suspicious_activity_reported_by_okta_user.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_suspicious_activity_reported_by_okta_user.json index cf7557102e20..ce6ef31fa4a1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_suspicious_activity_reported_by_okta_user.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_suspicious_activity_reported_by_okta_user.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -113,5 +113,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_via_system_manager.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_via_system_manager.json index 78fea7b5dafe..2cc55e2b14ff 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_via_system_manager.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/initial_access_via_system_manager.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/lateral_movement_malware_uploaded_onedrive.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/lateral_movement_malware_uploaded_onedrive.json index 299fba09b77f..86093446957e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/lateral_movement_malware_uploaded_onedrive.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/lateral_movement_malware_uploaded_onedrive.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -78,5 +78,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/lateral_movement_malware_uploaded_sharepoint.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/lateral_movement_malware_uploaded_sharepoint.json index 1cbed1359e9e..021614c0631c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/lateral_movement_malware_uploaded_sharepoint.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/lateral_movement_malware_uploaded_sharepoint.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -78,5 +78,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/okta_threat_detected_by_okta_threatinsight.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/okta_threat_detected_by_okta_threatinsight.json index 71f2addd91d8..18fe87682f81 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/okta_threat_detected_by_okta_threatinsight.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/okta_threat_detected_by_okta_threatinsight.json @@ -19,7 +19,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -48,5 +48,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_administrator_privileges_assigned_to_okta_group.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_administrator_privileges_assigned_to_okta_group.json index e903dce0ff46..be6ab836b1c0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_administrator_privileges_assigned_to_okta_group.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_administrator_privileges_assigned_to_okta_group.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -69,5 +69,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_administrator_role_assigned_to_okta_user.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_administrator_role_assigned_to_okta_user.json index 148ba8c09e88..4d22e033ac12 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_administrator_role_assigned_to_okta_user.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_administrator_role_assigned_to_okta_user.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -68,5 +68,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_application_added_to_google_workspace_domain.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_application_added_to_google_workspace_domain.json index 34870bf55be7..bd21d631ba81 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_application_added_to_google_workspace_domain.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_application_added_to_google_workspace_domain.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -74,5 +74,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_create_okta_api_token.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_create_okta_api_token.json index e1eec9d4e590..66147953d146 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_create_okta_api_token.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_create_okta_api_token.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -68,5 +68,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_deactivate_mfa_for_okta_user_account.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_deactivate_mfa_for_okta_user_account.json index a5b8762ec1aa..c0338b37b53e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_deactivate_mfa_for_okta_user_account.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_deactivate_mfa_for_okta_user_account.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -68,5 +68,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_reset_mfa_factors_for_okta_user_account.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_reset_mfa_factors_for_okta_user_account.json index 585b74cb73e4..0d230518055f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_reset_mfa_factors_for_okta_user_account.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_attempt_to_reset_mfa_factors_for_okta_user_account.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -68,5 +68,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_account_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_account_created.json index ccbf96ab79d0..af6d6bfcb2c5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_account_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_account_created.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_runbook_created_or_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_runbook_created_or_modified.json index 7518dcdf9a5f..1fbf08e86b14 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_runbook_created_or_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_runbook_created_or_modified.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -57,5 +57,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_webhook_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_webhook_created.json index a7a9e7ad8f2d..51088c01c08e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_webhook_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_automation_webhook_created.json @@ -23,7 +23,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -57,5 +57,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_conditional_access_policy_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_conditional_access_policy_modified.json index e2f81083938b..68ba96820751 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_conditional_access_policy_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_conditional_access_policy_modified.json @@ -20,11 +20,11 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" }, { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -75,5 +75,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_global_administrator_role_assigned.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_global_administrator_role_assigned.json index 91c5a8b9bc20..88329c459385 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_global_administrator_role_assigned.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_global_administrator_role_assigned.json @@ -19,7 +19,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -82,5 +82,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_pim_user_added_global_admin.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_pim_user_added_global_admin.json index 7dfc8b953a4b..fddf8ca8bed6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_pim_user_added_global_admin.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_pim_user_added_global_admin.json @@ -21,7 +21,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -82,5 +82,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_privileged_identity_management_role_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_privileged_identity_management_role_modified.json index 80720e7aff6c..fcda83a95bed 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_privileged_identity_management_role_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_azure_privileged_identity_management_role_modified.json @@ -20,7 +20,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -87,5 +87,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_ec2_network_acl_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_ec2_network_acl_creation.json index f510200c25a6..f083d6bd84e5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_ec2_network_acl_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_ec2_network_acl_creation.json @@ -27,7 +27,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -83,5 +83,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_ec2_security_group_configuration_change_detection.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_ec2_security_group_configuration_change_detection.json index 4d33c73f6bbe..69734f6c2ff4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_ec2_security_group_configuration_change_detection.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_ec2_security_group_configuration_change_detection.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -97,5 +97,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_exchange_suspicious_mailbox_right_delegation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_exchange_suspicious_mailbox_right_delegation.json index 0dddfad51753..b1c3453554cf 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_exchange_suspicious_mailbox_right_delegation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_exchange_suspicious_mailbox_right_delegation.json @@ -19,7 +19,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -92,5 +92,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_iam_service_account_key_deletion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_iam_service_account_key_deletion.json index 3376e777cf48..0d9d6775ef00 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_iam_service_account_key_deletion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_iam_service_account_key_deletion.json @@ -21,8 +21,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -73,5 +74,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_key_created_for_service_account.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_key_created_for_service_account.json index 2c39c99f5512..69728373e6c4 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_key_created_for_service_account.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_key_created_for_service_account.json @@ -21,8 +21,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -73,5 +74,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_service_account_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_service_account_created.json index c9aaa61d367e..d30dabdd112d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_service_account_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_gcp_service_account_created.json @@ -20,8 +20,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_2sv_policy_disabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_2sv_policy_disabled.json index be09aceb67c9..a2b738be6655 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_2sv_policy_disabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_2sv_policy_disabled.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -70,5 +70,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_admin_role_assigned_to_user.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_admin_role_assigned_to_user.json index 86825d008eea..9eba65a1e99d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_admin_role_assigned_to_user.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_admin_role_assigned_to_user.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -92,5 +92,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_api_access_granted_via_domain_wide_delegation_of_authority.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_api_access_granted_via_domain_wide_delegation_of_authority.json index 3b828c3b868f..b1d854bc7402 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_api_access_granted_via_domain_wide_delegation_of_authority.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_api_access_granted_via_domain_wide_delegation_of_authority.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -79,5 +79,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_custom_admin_role_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_custom_admin_role_created.json index e25ef8e452d7..775470992ae5 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_custom_admin_role_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_custom_admin_role_created.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -79,5 +79,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_policy_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_policy_modified.json index 7e1366d93687..b14935910b06 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_policy_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_policy_modified.json @@ -20,7 +20,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -82,5 +82,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_role_modified.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_role_modified.json index b9f1fe4cbd7c..bff307fea840 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_role_modified.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_role_modified.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -79,5 +79,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_user_group_access_modified_to_allow_external_access.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_user_group_access_modified_to_allow_external_access.json index 435ad2fdc432..fdd4c46e53a2 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_user_group_access_modified_to_allow_external_access.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_user_group_access_modified_to_allow_external_access.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -92,5 +92,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_user_organizational_unit_changed.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_user_organizational_unit_changed.json index e843d62e1301..76e89a5d4717 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_user_organizational_unit_changed.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_google_workspace_user_organizational_unit_changed.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -92,5 +92,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_iam_group_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_iam_group_creation.json index 09d17c5f088d..d23c3db3c249 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_iam_group_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_iam_group_creation.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -88,5 +88,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_mfa_disabled_for_azure_user.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_mfa_disabled_for_azure_user.json index 8b21e5358f71..b1cabdf2dc00 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_mfa_disabled_for_azure_user.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_mfa_disabled_for_azure_user.json @@ -16,7 +16,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -68,5 +68,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_mfa_disabled_for_google_workspace_organization.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_mfa_disabled_for_google_workspace_organization.json index ea562c183756..b5dde6769661 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_mfa_disabled_for_google_workspace_organization.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_mfa_disabled_for_google_workspace_organization.json @@ -20,7 +20,7 @@ "related_integrations": [ { "package": "google_workspace", - "version": "1.2.0" + "version": "^1.2.0" } ], "required_fields": [ @@ -82,5 +82,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_exchange_dkim_signing_config_disabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_exchange_dkim_signing_config_disabled.json index 1acb6b4097ab..034dd2cca73e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_exchange_dkim_signing_config_disabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_exchange_dkim_signing_config_disabled.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -89,5 +89,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_exchange_management_role_assignment.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_exchange_management_role_assignment.json index 633c904fe746..648c9fb76e85 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_exchange_management_role_assignment.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_exchange_management_role_assignment.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -84,5 +84,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_global_administrator_role_assign.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_global_administrator_role_assign.json index 8ff2741303bd..d9878e325c37 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_global_administrator_role_assign.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_global_administrator_role_assign.json @@ -19,7 +19,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -82,5 +82,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_custom_app_interaction_allowed.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_custom_app_interaction_allowed.json index 485c55e14f22..3535cad54764 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_custom_app_interaction_allowed.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_custom_app_interaction_allowed.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -88,5 +88,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_external_access_enabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_external_access_enabled.json index 6297c5b5ca25..05e60d247053 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_external_access_enabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_external_access_enabled.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -88,5 +88,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_guest_access_enabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_guest_access_enabled.json index 6767d2da121c..d102a801655e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_guest_access_enabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_microsoft_365_teams_guest_access_enabled.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -88,5 +88,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_okta_attempt_to_modify_or_delete_application_sign_on_policy.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_okta_attempt_to_modify_or_delete_application_sign_on_policy.json index 177f4f5c09e9..c3de28469170 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_okta_attempt_to_modify_or_delete_application_sign_on_policy.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_okta_attempt_to_modify_or_delete_application_sign_on_policy.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "okta", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -70,5 +70,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_cluster_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_cluster_creation.json index 13c04ef97a79..6cd477633753 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_cluster_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_cluster_creation.json @@ -27,7 +27,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -92,5 +92,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_group_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_group_creation.json index 8c880e9dcb09..b0193afd93c9 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_group_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_group_creation.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -88,5 +88,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_instance_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_instance_creation.json index 49487238f21f..678d0feea17b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_instance_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_rds_instance_creation.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -76,5 +76,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_redshift_instance_creation.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_redshift_instance_creation.json index 3283c14d9aca..6375be698d4a 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_redshift_instance_creation.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_redshift_instance_creation.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -75,5 +75,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_domain_transfer_lock_disabled.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_domain_transfer_lock_disabled.json index 8dca090e0f9a..2110c9652e3b 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_domain_transfer_lock_disabled.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_domain_transfer_lock_disabled.json @@ -26,7 +26,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -91,5 +91,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_domain_transferred_to_another_account.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_domain_transferred_to_another_account.json index c62d4384302e..05ce6140607c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_domain_transferred_to_another_account.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_domain_transferred_to_another_account.json @@ -25,7 +25,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -90,5 +90,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_hosted_zone_associated_with_a_vpc.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_hosted_zone_associated_with_a_vpc.json index 43d7e004867d..03e739c86e57 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_hosted_zone_associated_with_a_vpc.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_53_hosted_zone_associated_with_a_vpc.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -80,5 +80,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_table_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_table_created.json index 49ed26fdd2d4..2f5858bf331e 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_table_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_table_created.json @@ -27,7 +27,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -78,5 +78,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_table_modified_or_deleted.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_table_modified_or_deleted.json index 9855381acc3a..69c6f31579b8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_table_modified_or_deleted.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_route_table_modified_or_deleted.json @@ -31,7 +31,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -82,5 +82,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_user_added_as_owner_for_azure_application.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_user_added_as_owner_for_azure_application.json index 4fb01f45f6d5..a7f57e93cbaf 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_user_added_as_owner_for_azure_application.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_user_added_as_owner_for_azure_application.json @@ -16,7 +16,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -67,5 +67,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_user_added_as_owner_for_azure_service_principal.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_user_added_as_owner_for_azure_service_principal.json index ed398ed5e9ea..066b0cbfe8d8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_user_added_as_owner_for_azure_service_principal.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/persistence_user_added_as_owner_for_azure_service_principal.json @@ -19,7 +19,7 @@ "related_integrations": [ { "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -70,5 +70,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_aws_suspicious_saml_activity.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_aws_suspicious_saml_activity.json index 21015597f946..e8119d810dbc 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_aws_suspicious_saml_activity.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_aws_suspicious_saml_activity.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -102,5 +102,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_azure_kubernetes_rolebinding_created.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_azure_kubernetes_rolebinding_created.json index deed8fb00637..23173232a65d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_azure_kubernetes_rolebinding_created.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_azure_kubernetes_rolebinding_created.json @@ -21,7 +21,7 @@ { "integration": "activitylogs", "package": "azure", - "version": "0.12.0" + "version": "^1.0.0" } ], "required_fields": [ @@ -66,5 +66,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_cyberarkpas_error_audit_event_promotion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_cyberarkpas_error_audit_event_promotion.json index bb5dbe031c7d..3484db354a1d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_cyberarkpas_error_audit_event_promotion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_cyberarkpas_error_audit_event_promotion.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "cyberarkpas", - "version": "2.2.0" + "version": "^2.2.0" } ], "required_fields": [ @@ -78,5 +78,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_cyberarkpas_recommended_events_to_monitor_promotion.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_cyberarkpas_recommended_events_to_monitor_promotion.json index 71d918844b94..6ee8411d989f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_cyberarkpas_recommended_events_to_monitor_promotion.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_cyberarkpas_recommended_events_to_monitor_promotion.json @@ -22,7 +22,7 @@ "related_integrations": [ { "package": "cyberarkpas", - "version": "2.2.0" + "version": "^2.2.0" } ], "required_fields": [ @@ -83,5 +83,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_gcp_kubernetes_rolebindings_created_or_patched.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_gcp_kubernetes_rolebindings_created_or_patched.json index 1f949b57edc1..41d7c2e58474 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_gcp_kubernetes_rolebindings_created_or_patched.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_gcp_kubernetes_rolebindings_created_or_patched.json @@ -21,8 +21,9 @@ ], "related_integrations": [ { + "integration": "audit", "package": "gcp", - "version": "1.10.0" + "version": "^2.2.1" } ], "required_fields": [ @@ -72,5 +73,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_new_or_modified_federation_domain.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_new_or_modified_federation_domain.json index 90601a72b1b3..fba42b17b4fb 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_new_or_modified_federation_domain.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_new_or_modified_federation_domain.json @@ -23,7 +23,7 @@ "related_integrations": [ { "package": "o365", - "version": "1.3.0" + "version": "^1.3.0" } ], "required_fields": [ @@ -91,5 +91,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_root_login_without_mfa.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_root_login_without_mfa.json index 01b6ebd88018..058ff41c7444 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_root_login_without_mfa.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_root_login_without_mfa.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -91,5 +91,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_sts_assumerole_usage.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_sts_assumerole_usage.json index d6acdcbc3d06..b90ac6954163 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_sts_assumerole_usage.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_sts_assumerole_usage.json @@ -22,7 +22,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -105,5 +105,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_sts_getsessiontoken_abuse.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_sts_getsessiontoken_abuse.json index f0a963883b26..588708bcef4c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_sts_getsessiontoken_abuse.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_sts_getsessiontoken_abuse.json @@ -22,7 +22,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -105,5 +105,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 100 + "version": 101 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_suspicious_assignment_of_controller_service_account.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_suspicious_assignment_of_controller_service_account.json index 9673e704e477..fa217cf1cfd8 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_suspicious_assignment_of_controller_service_account.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_suspicious_assignment_of_controller_service_account.json @@ -20,7 +20,7 @@ "related_integrations": [ { "package": "kubernetes", - "version": "1.17.2" + "version": "^1.4.1" } ], "required_fields": [ @@ -87,5 +87,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 1 + "version": 2 } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_updateassumerolepolicy.json b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_updateassumerolepolicy.json index b632697515ad..6e6bbe4bdef1 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_updateassumerolepolicy.json +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules/privilege_escalation_updateassumerolepolicy.json @@ -24,7 +24,7 @@ { "integration": "cloudtrail", "package": "aws", - "version": "1.10.2" + "version": "^1.5.0" } ], "required_fields": [ @@ -81,5 +81,5 @@ ], "timestamp_override": "event.ingested", "type": "query", - "version": 101 + "version": 102 } diff --git a/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts b/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts index 1d142bbe33c6..a926cba109e6 100644 --- a/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts +++ b/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts @@ -108,6 +108,7 @@ export const DEFAULT_HTTP_SIMPLE_FIELDS: HTTPSimpleFields = { [ConfigKey.MAX_REDIRECTS]: '0', [ConfigKey.MONITOR_TYPE]: DataStream.HTTP, [ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.HTTP, + [ConfigKey.PORT]: null, }; export const DEFAULT_HTTP_ADVANCED_FIELDS: HTTPAdvancedFields = { @@ -144,6 +145,7 @@ export const DEFAULT_TCP_SIMPLE_FIELDS: TCPSimpleFields = { [ConfigKey.HOSTS]: '', [ConfigKey.MONITOR_TYPE]: DataStream.TCP, [ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.TCP, + [ConfigKey.PORT]: null, }; export const DEFAULT_TCP_ADVANCED_FIELDS: TCPAdvancedFields = { diff --git a/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts b/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts index 78e55e97d5b0..409f2b44343e 100644 --- a/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts +++ b/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts @@ -18,6 +18,7 @@ import { tlsValueToStringFormatter, tlsArrayToYamlFormatter, } from '../tls/formatters'; +import { tlsFormatters } from '../tls/formatters'; export type BrowserFormatMap = Record; @@ -72,9 +73,8 @@ export const browserFormatters: BrowserFormatMap = { arrayToJsonFormatter(fields[ConfigKey.JOURNEY_FILTERS_TAGS]), [ConfigKey.THROTTLING_CONFIG]: throttlingFormatter, [ConfigKey.IGNORE_HTTPS_ERRORS]: null, - [ConfigKey.PROJECT_ID]: null, [ConfigKey.PLAYWRIGHT_OPTIONS]: null, - [ConfigKey.ORIGINAL_SPACE]: null, [ConfigKey.TEXT_ASSERTION]: null, ...commonFormatters, + ...tlsFormatters, }; diff --git a/x-pack/plugins/synthetics/common/formatters/common/formatters.ts b/x-pack/plugins/synthetics/common/formatters/common/formatters.ts index 751721e5d703..739c7184e722 100644 --- a/x-pack/plugins/synthetics/common/formatters/common/formatters.ts +++ b/x-pack/plugins/synthetics/common/formatters/common/formatters.ts @@ -29,7 +29,9 @@ export const commonFormatters: CommonFormatMap = { [ConfigKey.MONITOR_SOURCE_TYPE]: null, [ConfigKey.FORM_MONITOR_TYPE]: null, [ConfigKey.JOURNEY_ID]: null, + [ConfigKey.PROJECT_ID]: null, [ConfigKey.CUSTOM_HEARTBEAT_ID]: null, + [ConfigKey.ORIGINAL_SPACE]: null, }; export const arrayToJsonFormatter = (value: string[] = []) => diff --git a/x-pack/plugins/synthetics/common/formatters/http/formatters.ts b/x-pack/plugins/synthetics/common/formatters/http/formatters.ts index 0dc9b795717a..5eeb5888255d 100644 --- a/x-pack/plugins/synthetics/common/formatters/http/formatters.ts +++ b/x-pack/plugins/synthetics/common/formatters/http/formatters.ts @@ -41,6 +41,7 @@ export const httpFormatters: HTTPFormatMap = { [ConfigKey.REQUEST_HEADERS_CHECK]: (fields) => objectToJsonFormatter(fields[ConfigKey.REQUEST_HEADERS_CHECK]), [ConfigKey.REQUEST_METHOD_CHECK]: null, + [ConfigKey.PORT]: null, ...tlsFormatters, ...commonFormatters, }; diff --git a/x-pack/plugins/synthetics/common/formatters/tcp/formatters.ts b/x-pack/plugins/synthetics/common/formatters/tcp/formatters.ts index 5b3737229a12..bec7ceb44484 100644 --- a/x-pack/plugins/synthetics/common/formatters/tcp/formatters.ts +++ b/x-pack/plugins/synthetics/common/formatters/tcp/formatters.ts @@ -19,6 +19,7 @@ export const tcpFormatters: TCPFormatMap = { [ConfigKey.PROXY_USE_LOCAL_RESOLVER]: null, [ConfigKey.RESPONSE_RECEIVE_CHECK]: null, [ConfigKey.REQUEST_SEND_CHECK]: null, + [ConfigKey.PORT]: null, ...tlsFormatters, ...commonFormatters, }; diff --git a/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts index 46bc0f135452..bbb6eb1bb30d 100644 --- a/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts +++ b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types.ts @@ -83,6 +83,8 @@ export const CommonFieldsCodec = t.intersection([ [ConfigKey.MONITOR_SOURCE_TYPE]: SourceTypeCodec, [ConfigKey.CONFIG_ID]: t.string, [ConfigKey.JOURNEY_ID]: t.string, + [ConfigKey.PROJECT_ID]: t.string, + [ConfigKey.ORIGINAL_SPACE]: t.string, [ConfigKey.CUSTOM_HEARTBEAT_ID]: t.string, }), ]); @@ -94,6 +96,7 @@ export const TCPSimpleFieldsCodec = t.intersection([ t.interface({ [ConfigKey.METADATA]: MetadataCodec, [ConfigKey.HOSTS]: t.string, + [ConfigKey.PORT]: t.union([t.number, t.null]), }), CommonFieldsCodec, ]); @@ -151,6 +154,7 @@ export const HTTPSimpleFieldsCodec = t.intersection([ [ConfigKey.METADATA]: MetadataCodec, [ConfigKey.MAX_REDIRECTS]: t.string, [ConfigKey.URLS]: t.string, + [ConfigKey.PORT]: t.union([t.number, t.null]), }), CommonFieldsCodec, ]); @@ -217,8 +221,6 @@ export const EncryptedBrowserSimpleFieldsCodec = t.intersection([ }), t.partial({ [ConfigKey.PLAYWRIGHT_OPTIONS]: t.string, - [ConfigKey.PROJECT_ID]: t.string, - [ConfigKey.ORIGINAL_SPACE]: t.string, [ConfigKey.TEXT_ASSERTION]: t.string, }), ]), @@ -241,7 +243,7 @@ export const BrowserSensitiveSimpleFieldsCodec = t.intersection([ CommonFieldsCodec, ]); -export const BrowserAdvancedFieldsCodec = t.interface({ +export const EncryptedBrowserAdvancedFieldsCodec = t.interface({ [ConfigKey.SCREENSHOTS]: t.string, [ConfigKey.JOURNEY_FILTERS_MATCH]: t.string, [ConfigKey.JOURNEY_FILTERS_TAGS]: t.array(t.string), @@ -263,25 +265,26 @@ export const BrowserSensitiveAdvancedFieldsCodec = t.interface({ [ConfigKey.SYNTHETICS_ARGS]: t.array(t.string), }); -export const BrowserAdvancedsCodec = t.intersection([ - BrowserAdvancedFieldsCodec, +export const BrowserAdvancedFieldsCodec = t.intersection([ + EncryptedBrowserAdvancedFieldsCodec, BrowserSensitiveAdvancedFieldsCodec, ]); export const EncryptedBrowserFieldsCodec = t.intersection([ EncryptedBrowserSimpleFieldsCodec, - BrowserAdvancedFieldsCodec, + EncryptedBrowserAdvancedFieldsCodec, + TLSFieldsCodec, ]); export const BrowserFieldsCodec = t.intersection([ BrowserSimpleFieldsCodec, BrowserAdvancedFieldsCodec, - BrowserSensitiveAdvancedFieldsCodec, + TLSCodec, ]); export type BrowserFields = t.TypeOf; export type BrowserSimpleFields = t.TypeOf; -export type BrowserAdvancedFields = t.TypeOf; +export type BrowserAdvancedFields = t.TypeOf; // MonitorFields, represents any possible monitor type export const MonitorFieldsCodec = t.intersection([ diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_add_edit/form/formatter.test.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_add_edit/form/formatter.test.tsx index 4b4e778b87b9..6ff7cd651b33 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_add_edit/form/formatter.test.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitor_add_edit/form/formatter.test.tsx @@ -134,6 +134,7 @@ describe('format', () => { timeout: '16', type: 'http', urls: 'sample url', + 'url.port': null, username: '', }); }); @@ -347,6 +348,7 @@ describe('format', () => { timeout: '16', type: 'http', urls: 'sample url', + 'url.port': null, username: '', }); }); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/management/monitor_list_table/monitor_enabled.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/management/monitor_list_table/monitor_enabled.tsx index be1123b12d41..e5e7c6bbe378 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/management/monitor_list_table/monitor_enabled.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/management/monitor_list_table/monitor_enabled.tsx @@ -51,7 +51,7 @@ export const MonitorEnabled = ({ const handleEnabledChange = (event: EuiSwitchEvent) => { const checked = event.target.checked; - updateMonitorEnabledState(monitor, checked); + updateMonitorEnabledState(checked); }; return ( diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/actions_popover.test.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/actions_popover.test.tsx index af6799068c27..d37fb8c2a300 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/actions_popover.test.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/actions_popover.test.tsx @@ -111,15 +111,7 @@ describe('ActionsPopover', () => { const enableButton = getByText('Disable monitor'); fireEvent.click(enableButton); expect(updateMonitorEnabledState).toHaveBeenCalledTimes(1); - expect(updateMonitorEnabledState.mock.calls[0]).toEqual([ - { - id: 'somelongstring', - isEnabled: true, - location: { id: 'us_central', isServiceManaged: true }, - name: 'Monitor 1', - }, - false, - ]); + expect(updateMonitorEnabledState.mock.calls[0]).toEqual([false]); }); it('sets enabled state to true', async () => { @@ -139,14 +131,6 @@ describe('ActionsPopover', () => { const enableButton = getByText('Enable monitor'); fireEvent.click(enableButton); expect(updateMonitorEnabledState).toHaveBeenCalledTimes(1); - expect(updateMonitorEnabledState.mock.calls[0]).toEqual([ - { - id: 'somelongstring', - isEnabled: false, - location: { id: 'us_central', isServiceManaged: true }, - name: 'Monitor 1', - }, - true, - ]); + expect(updateMonitorEnabledState.mock.calls[0]).toEqual([true]); }); }); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/actions_popover.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/actions_popover.tsx index 932c6344c471..1267c2ab43c5 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/actions_popover.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/actions_popover.tsx @@ -141,7 +141,7 @@ export function ActionsPopover({ icon: 'invert', onClick: () => { if (status !== FETCH_STATUS.LOADING) - updateMonitorEnabledState(monitor, !monitor.isEnabled); + updateMonitorEnabledState(!monitor.isEnabled); }, }, ], diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_monitor_enable_handler.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_monitor_enable_handler.tsx index 6fed27f2df6b..e00b54ec4b75 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_monitor_enable_handler.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/hooks/use_monitor_enable_handler.tsx @@ -9,11 +9,7 @@ import { useKibana } from '@kbn/kibana-react-plugin/public'; import { FETCH_STATUS } from '@kbn/observability-plugin/public'; import React, { useCallback, useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { - ConfigKey, - EncryptedSyntheticsMonitor, - MonitorOverviewItem, -} from '../components/monitors_page/overview/types'; +import { ConfigKey } from '../components/monitors_page/overview/types'; import { clearMonitorUpsertStatus, fetchUpsertMonitorAction, @@ -41,11 +37,11 @@ export function useMonitorEnableHandler({ const savedObjEnabledState = upsertStatuses[id]?.enabled; const [isEnabled, setIsEnabled] = useState(null); const updateMonitorEnabledState = useCallback( - (monitor: EncryptedSyntheticsMonitor | MonitorOverviewItem, enabled: boolean) => { + (enabled: boolean) => { dispatch( fetchUpsertMonitorAction({ id, - monitor: { ...monitor, [ConfigKey.ENABLED]: enabled }, + monitor: { [ConfigKey.ENABLED]: enabled }, }) ); }, diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/actions.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/actions.ts index 3315719a6bb1..fcfc3d4f22cf 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/actions.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/actions.ts @@ -10,7 +10,6 @@ import { createAction } from '@reduxjs/toolkit'; import { EncryptedSyntheticsMonitor, MonitorManagementListResult, - MonitorOverviewItem, } from '../../../../../common/runtime_types'; import { createAsyncAction } from '../utils/actions'; @@ -23,7 +22,7 @@ export const fetchMonitorListAction = createAsyncAction< export interface UpsertMonitorRequest { id: string; - monitor: EncryptedSyntheticsMonitor | MonitorOverviewItem; + monitor: Partial; } export const fetchUpsertMonitorAction = createAction('fetchUpsertMonitor'); export const fetchUpsertSuccessAction = createAction<{ diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/api.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/api.ts index 5e4e2e1bc1a6..f6a99fd3e02e 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/api.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/api.ts @@ -11,7 +11,6 @@ import { FetchMonitorManagementListQueryArgs, MonitorManagementListResult, MonitorManagementListResultCodec, - MonitorOverviewItem, ServiceLocationErrors, SyntheticsMonitor, } from '../../../../../common/runtime_types'; @@ -55,7 +54,7 @@ export const fetchUpsertMonitor = async ({ monitor, id, }: { - monitor: SyntheticsMonitor | EncryptedSyntheticsMonitor | MonitorOverviewItem; + monitor: Partial | Partial; id?: string; }): Promise<{ attributes: { errors: ServiceLocationErrors } } | SyntheticsMonitor> => { if (id) { diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/utils/testing/__mocks__/synthetics_store.mock.ts b/x-pack/plugins/synthetics/public/apps/synthetics/utils/testing/__mocks__/synthetics_store.mock.ts index 57ce5e39a8db..5fa93522e6c9 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/utils/testing/__mocks__/synthetics_store.mock.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/utils/testing/__mocks__/synthetics_store.mock.ts @@ -13,6 +13,8 @@ import { LocationStatus, ScheduleUnit, SourceType, + VerificationMode, + TLSVersion, } from '../../../../../../common/runtime_types'; /** @@ -338,8 +340,8 @@ function getMonitorDetailsMockSlice() { 'ssl.certificate': '', 'ssl.key': '', 'ssl.key_passphrase': '', - 'ssl.verification_mode': 'full', - 'ssl.supported_protocols': ['TLSv1.1', 'TLSv1.2', 'TLSv1.3'], + 'ssl.verification_mode': VerificationMode.FULL, + 'ssl.supported_protocols': ['TLSv1.1', 'TLSv1.2', 'TLSv1.3'] as TLSVersion[], revision: 1, updated_at: '2022-07-24T17:15:46.342Z', }, diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/donut_chart.test.tsx.snap b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/donut_chart.test.tsx.snap index b4486e65c539..9989a4d5df13 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/donut_chart.test.tsx.snap +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/common/charts/__snapshots__/donut_chart.test.tsx.snap @@ -233,6 +233,17 @@ exports[`DonutChart component passes correct props without errors for valid prop "visible": true, }, }, + "flamegraph": Object { + "navigation": Object { + "buttonBackgroundColor": "rgb(204, 228, 245)", + "buttonDisabledBackgroundColor": "rgba(211, 218, 230, 0.15)", + "buttonDisabledTextColor": "rgb(162, 171, 186)", + "buttonTextColor": "rgb(0, 97, 166)", + "textColor": "rgb(52, 55, 65)", + }, + "scrollbarThumb": "rgb(52, 55, 65)", + "scrollbarTrack": "rgb(211, 218, 230)", + }, "goal": Object { "arcBoxSamplePitch": 0.08726646259971647, "barThicknessMinSizeRatio": 0.1, diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/normalizers.ts index 61f978327b8a..d1d9917f19c3 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/normalizers.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/browser/normalizers.ts @@ -18,6 +18,7 @@ import { getNormalizer, getJsonToJavascriptNormalizer, } from '../common/normalizers'; +import { tlsNormalizers } from '../tls/normalizers'; import { defaultBrowserSimpleFields, defaultBrowserAdvancedFields } from '../contexts'; @@ -107,9 +108,8 @@ export const browserNormalizers: BrowserNormalizerMap = { ConfigKey.JOURNEY_FILTERS_TAGS ), [ConfigKey.IGNORE_HTTPS_ERRORS]: getBrowserNormalizer(ConfigKey.IGNORE_HTTPS_ERRORS), - [ConfigKey.PROJECT_ID]: getBrowserNormalizer(ConfigKey.PROJECT_ID), [ConfigKey.PLAYWRIGHT_OPTIONS]: getBrowserNormalizer(ConfigKey.PLAYWRIGHT_OPTIONS), - [ConfigKey.ORIGINAL_SPACE]: getBrowserNormalizer(ConfigKey.ORIGINAL_SPACE), [ConfigKey.TEXT_ASSERTION]: getBrowserNormalizer(ConfigKey.TEXT_ASSERTION), ...commonNormalizers, + ...tlsNormalizers, }; diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/normalizers.ts index 630ac70a8e05..d05730c5dbe1 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/normalizers.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/common/normalizers.ts @@ -93,5 +93,7 @@ export const commonNormalizers: CommonNormalizerMap = { [ConfigKey.MONITOR_SOURCE_TYPE]: getCommonNormalizer(ConfigKey.MONITOR_SOURCE_TYPE), [ConfigKey.FORM_MONITOR_TYPE]: getCommonNormalizer(ConfigKey.FORM_MONITOR_TYPE), [ConfigKey.JOURNEY_ID]: getCommonNormalizer(ConfigKey.JOURNEY_ID), + [ConfigKey.PROJECT_ID]: getCommonNormalizer(ConfigKey.PROJECT_ID), [ConfigKey.CUSTOM_HEARTBEAT_ID]: getCommonNormalizer(ConfigKey.CUSTOM_HEARTBEAT_ID), + [ConfigKey.ORIGINAL_SPACE]: getCommonNormalizer(ConfigKey.ORIGINAL_SPACE), }; diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/normalizers.ts index f7e7ad3eeac2..a783639f1ab1 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/normalizers.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/http/normalizers.ts @@ -34,6 +34,7 @@ export const getHTTPJsonToJavascriptNormalizer = (key: ConfigKey) => { export const httpNormalizers: HTTPNormalizerMap = { [ConfigKey.METADATA]: getHTTPJsonToJavascriptNormalizer(ConfigKey.METADATA), [ConfigKey.URLS]: getHTTPNormalizer(ConfigKey.URLS), + [ConfigKey.PORT]: getHTTPNormalizer(ConfigKey.PORT), [ConfigKey.MAX_REDIRECTS]: getHTTPNormalizer(ConfigKey.MAX_REDIRECTS), [ConfigKey.USERNAME]: getHTTPNormalizer(ConfigKey.USERNAME), [ConfigKey.PASSWORD]: getHTTPNormalizer(ConfigKey.PASSWORD), diff --git a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/normalizers.ts b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/normalizers.ts index ae36de49fb57..86efeeae6920 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/normalizers.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/components/fleet_package/tcp/normalizers.ts @@ -33,6 +33,7 @@ export const getTCPJsonToJavascriptNormalizer = (key: ConfigKey) => { export const tcpNormalizers: TCPNormalizerMap = { [ConfigKey.METADATA]: getTCPJsonToJavascriptNormalizer(ConfigKey.METADATA), [ConfigKey.HOSTS]: getTCPNormalizer(ConfigKey.HOSTS), + [ConfigKey.PORT]: getTCPNormalizer(ConfigKey.PORT), [ConfigKey.PROXY_URL]: getTCPNormalizer(ConfigKey.PROXY_URL), [ConfigKey.PROXY_USE_LOCAL_RESOLVER]: getTCPNormalizer(ConfigKey.PROXY_USE_LOCAL_RESOLVER), [ConfigKey.RESPONSE_RECEIVE_CHECK]: getTCPNormalizer(ConfigKey.RESPONSE_RECEIVE_CHECK), diff --git a/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts b/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts index 1016e37b87e0..1f9a55e34761 100644 --- a/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts +++ b/x-pack/plugins/synthetics/server/routes/monitor_cruds/add_monitor.ts @@ -67,7 +67,7 @@ export const addSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = () => ({ const validationResult = validateMonitor(monitorWithDefaults as MonitorFields); - if (!validationResult.valid) { + if (!validationResult.valid || !validationResult.decodedMonitor) { const { reason: message, details, payload } = validationResult; return response.badRequest({ body: { message, attributes: { details, ...payload } } }); } @@ -78,8 +78,7 @@ export const addSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = () => ({ try { const { errors, newMonitor } = await syncNewMonitor({ - normalizedMonitor: monitorWithDefaults, - monitor, + normalizedMonitor: validationResult.decodedMonitor, server, syntheticsMonitorClient, savedObjectsClient, @@ -140,7 +139,6 @@ export const createNewSavedObjectMonitor = async ({ export const syncNewMonitor = async ({ id, - monitor, server, syntheticsMonitorClient, savedObjectsClient, @@ -150,7 +148,6 @@ export const syncNewMonitor = async ({ spaceId, }: { id?: string; - monitor: SyntheticsMonitor; normalizedMonitor: SyntheticsMonitor; server: UptimeServerSetup; syntheticsMonitorClient: SyntheticsMonitorClient; @@ -201,7 +198,7 @@ export const syncNewMonitor = async ({ formatTelemetryEvent({ errors: syncErrors, monitor: monitorSavedObject, - isInlineScript: Boolean((monitor as MonitorFields)[ConfigKey.SOURCE_INLINE]), + isInlineScript: Boolean((normalizedMonitor as MonitorFields)[ConfigKey.SOURCE_INLINE]), kibanaVersion: server.kibanaVersion, }) ); diff --git a/x-pack/plugins/synthetics/server/routes/monitor_cruds/edit_monitor.ts b/x-pack/plugins/synthetics/server/routes/monitor_cruds/edit_monitor.ts index a16a1ba7089e..d6b50880ed35 100644 --- a/x-pack/plugins/synthetics/server/routes/monitor_cruds/edit_monitor.ts +++ b/x-pack/plugins/synthetics/server/routes/monitor_cruds/edit_monitor.ts @@ -84,13 +84,13 @@ export const editSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = () => ( const validationResult = validateMonitor(editedMonitor as MonitorFields); - if (!validationResult.valid) { + if (!validationResult.valid || !validationResult.decodedMonitor) { const { reason: message, details, payload } = validationResult; return response.badRequest({ body: { message, attributes: { details, ...payload } } }); } const monitorWithRevision = { - ...editedMonitor, + ...validationResult.decodedMonitor, revision: (previousMonitor.attributes[ConfigKey.REVISION] || 0) + 1, }; const formattedMonitor = formatSecrets(monitorWithRevision); @@ -102,7 +102,7 @@ export const editSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = () => ( syntheticsMonitorClient, savedObjectsClient, request, - normalizedMonitor: editedMonitor, + normalizedMonitor: validationResult.decodedMonitor, monitorWithRevision: formattedMonitor, spaceId, }); diff --git a/x-pack/plugins/synthetics/server/routes/monitor_cruds/monitor_validation.test.ts b/x-pack/plugins/synthetics/server/routes/monitor_cruds/monitor_validation.test.ts index 8a532279dda8..76bda0f4a2f1 100644 --- a/x-pack/plugins/synthetics/server/routes/monitor_cruds/monitor_validation.test.ts +++ b/x-pack/plugins/synthetics/server/routes/monitor_cruds/monitor_validation.test.ts @@ -109,6 +109,7 @@ describe('validateMonitor', () => { [ConfigKey.METADATA]: testMetaData, [ConfigKey.HOSTS]: 'https://host1.com', [ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.TCP, + [ConfigKey.PORT]: null, }; testTCPAdvancedFields = { @@ -131,6 +132,7 @@ describe('validateMonitor', () => { [ConfigKey.MAX_REDIRECTS]: '3', [ConfigKey.URLS]: 'https://example.com', [ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.HTTP, + [ConfigKey.PORT]: null, }; testHTTPAdvancedFields = { @@ -453,7 +455,8 @@ function getJsonPayload() { ' },' + ' "url": "https://example-url.com",' + ' "isServiceManaged": true' + - ' }]' + + ' }],' + + ' "url.port": null' + '}'; return JSON.parse(json); diff --git a/x-pack/plugins/synthetics/server/routes/monitor_cruds/monitor_validation.ts b/x-pack/plugins/synthetics/server/routes/monitor_cruds/monitor_validation.ts index d648722e0d5c..77cd0fa23a7c 100644 --- a/x-pack/plugins/synthetics/server/routes/monitor_cruds/monitor_validation.ts +++ b/x-pack/plugins/synthetics/server/routes/monitor_cruds/monitor_validation.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import * as t from 'io-ts'; import { isLeft } from 'fp-ts/lib/Either'; import { formatErrors } from '@kbn/securitysolution-io-ts-utils'; @@ -19,6 +20,7 @@ import { ICMPSimpleFieldsCodec, MonitorFields, TCPFieldsCodec, + SyntheticsMonitor, } from '../../../common/runtime_types'; type MonitorCodecType = @@ -39,6 +41,7 @@ export interface ValidationResult { reason: string; details: string; payload: object; + decodedMonitor?: SyntheticsMonitor; } /** @@ -58,9 +61,10 @@ export function validateMonitor(monitorFields: MonitorFields): ValidationResult }; } - const codec = monitorTypeToCodecMap[monitorType]; + // Cast it to ICMPCodec to satisfy typing. During runtime, correct codec will be used to decode. + const SyntheticsMonitorCodec = monitorTypeToCodecMap[monitorType] as typeof ICMPSimpleFieldsCodec; - if (!codec) { + if (!SyntheticsMonitorCodec) { return { valid: false, reason: `Payload is not a valid monitor object`, @@ -69,8 +73,8 @@ export function validateMonitor(monitorFields: MonitorFields): ValidationResult }; } - // Cast it to ICMPCodec to satisfy typing. During runtime, correct codec will be used to decode. - const decodedMonitor = (codec as typeof ICMPSimpleFieldsCodec).decode(monitorFields); + const ExactSyntheticsMonitorCodec = t.exact(SyntheticsMonitorCodec); + const decodedMonitor = ExactSyntheticsMonitorCodec.decode(monitorFields); if (isLeft(decodedMonitor)) { return { @@ -81,7 +85,13 @@ export function validateMonitor(monitorFields: MonitorFields): ValidationResult }; } - return { valid: true, reason: '', details: '', payload: monitorFields }; + return { + valid: true, + reason: '', + details: '', + payload: monitorFields, + decodedMonitor: decodedMonitor.right, + }; } export function validateProjectMonitor(monitorFields: ProjectMonitor): ValidationResult { diff --git a/x-pack/plugins/synthetics/server/routes/synthetics_service/run_once_monitor.ts b/x-pack/plugins/synthetics/server/routes/synthetics_service/run_once_monitor.ts index 394567f45b60..5bbc8c27e3eb 100644 --- a/x-pack/plugins/synthetics/server/routes/synthetics_service/run_once_monitor.ts +++ b/x-pack/plugins/synthetics/server/routes/synthetics_service/run_once_monitor.ts @@ -26,7 +26,7 @@ export const runOnceSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = () = const validationResult = validateMonitor(monitor); - if (!validationResult.valid) { + if (!validationResult.valid || !validationResult.decodedMonitor) { const { reason: message, details, payload } = validationResult; return response.badRequest({ body: { message, attributes: { details, ...payload } } }); } @@ -36,7 +36,7 @@ export const runOnceSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = () = const errors = await syntheticsService.runOnceConfigs([ formatHeartbeatRequest({ // making it enabled, even if it's disabled in the UI - monitor: { ...monitor, enabled: true }, + monitor: { ...validationResult.decodedMonitor, enabled: true }, monitorId, runOnce: true, }), diff --git a/x-pack/plugins/synthetics/server/synthetics_service/formatters/browser.ts b/x-pack/plugins/synthetics/server/synthetics_service/formatters/browser.ts index 7095e437aea2..d9ee08ace167 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/formatters/browser.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/formatters/browser.ts @@ -14,6 +14,7 @@ import { } from './common'; import { BrowserFields, ConfigKey } from '../../../common/runtime_types/monitor_management'; import { DEFAULT_BROWSER_ADVANCED_FIELDS } from '../../../common/constants/monitor_defaults'; +import { tlsFormatters } from './tls'; export type BrowserFormatMap = Record; @@ -66,10 +67,9 @@ export const browserFormatters: BrowserFormatMap = { [ConfigKey.JOURNEY_FILTERS_TAGS]: (fields) => arrayFormatter(fields[ConfigKey.JOURNEY_FILTERS_TAGS]), [ConfigKey.IGNORE_HTTPS_ERRORS]: null, - [ConfigKey.PROJECT_ID]: null, [ConfigKey.PLAYWRIGHT_OPTIONS]: (fields) => stringToObjectFormatter(fields[ConfigKey.PLAYWRIGHT_OPTIONS] || ''), - [ConfigKey.ORIGINAL_SPACE]: null, [ConfigKey.TEXT_ASSERTION]: null, ...commonFormatters, + ...tlsFormatters, }; diff --git a/x-pack/plugins/synthetics/server/synthetics_service/formatters/common.ts b/x-pack/plugins/synthetics/server/synthetics_service/formatters/common.ts index f9c3125041b4..a2427357e368 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/formatters/common.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/formatters/common.ts @@ -31,7 +31,9 @@ export const commonFormatters: CommonFormatMap = { fields[ConfigKey.MONITOR_SOURCE_TYPE] || SourceType.UI, [ConfigKey.FORM_MONITOR_TYPE]: null, [ConfigKey.JOURNEY_ID]: null, + [ConfigKey.PROJECT_ID]: null, [ConfigKey.CUSTOM_HEARTBEAT_ID]: null, + [ConfigKey.ORIGINAL_SPACE]: null, }; export const arrayFormatter = (value: string[] = []) => (value.length ? value : null); diff --git a/x-pack/plugins/synthetics/server/synthetics_service/formatters/http.ts b/x-pack/plugins/synthetics/server/synthetics_service/formatters/http.ts index b8652e0813a0..83545eb198ba 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/formatters/http.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/formatters/http.ts @@ -14,6 +14,7 @@ export type HTTPFormatMap = Record; export const httpFormatters: HTTPFormatMap = { [ConfigKey.METADATA]: (fields) => objectFormatter(fields[ConfigKey.METADATA]), [ConfigKey.URLS]: null, + [ConfigKey.PORT]: null, [ConfigKey.MAX_REDIRECTS]: null, [ConfigKey.USERNAME]: null, [ConfigKey.PASSWORD]: null, diff --git a/x-pack/plugins/synthetics/server/synthetics_service/formatters/tcp.ts b/x-pack/plugins/synthetics/server/synthetics_service/formatters/tcp.ts index c295a17ed896..25ba5c08e9b3 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/formatters/tcp.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/formatters/tcp.ts @@ -14,6 +14,7 @@ export type TCPFormatMap = Record; export const tcpFormatters: TCPFormatMap = { [ConfigKey.METADATA]: null, [ConfigKey.HOSTS]: null, + [ConfigKey.PORT]: null, [ConfigKey.PROXY_URL]: null, [ConfigKey.PROXY_USE_LOCAL_RESOLVER]: null, [ConfigKey.RESPONSE_RECEIVE_CHECK]: null, diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/http_monitor.test.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/http_monitor.test.ts index 922c5ca6dab0..cea5aa8b50de 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/http_monitor.test.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/http_monitor.test.ts @@ -179,6 +179,7 @@ describe('http normalizers', () => { timeout: '80', type: 'http', urls: 'http://localhost:9200', + 'url.port': null, username: '', }, unsupportedKeys: ['check.response.body', 'unsupportedKey.nestedUnsupportedKey'], @@ -232,6 +233,7 @@ describe('http normalizers', () => { timeout: '80', type: 'http', urls: 'http://localhost:9200', + 'url.port': null, username: '', }, unsupportedKeys: [], diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/icmp_monitor.test.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/icmp_monitor.test.ts index e32ddf4f328a..74ac2cb2bfaf 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/icmp_monitor.test.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/icmp_monitor.test.ts @@ -8,7 +8,7 @@ import { Locations, LocationStatus, PrivateLocation } from '../../../../common/runtime_types'; import { normalizeProjectMonitors } from '.'; -describe('http normalizers', () => { +describe('icmp normalizers', () => { describe('normalize push monitors', () => { const projectId = 'test-project-id'; const locations: Locations = [ @@ -81,7 +81,7 @@ describe('http normalizers', () => { }, ]; - it('properly normalizes http monitors', () => { + it('properly normalizes icmp monitors', () => { const actual = normalizeProjectMonitors({ locations, privateLocations, diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/tcp_monitor.test.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/tcp_monitor.test.ts index 094bf018ba12..a479bbc09d47 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/tcp_monitor.test.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/tcp_monitor.test.ts @@ -8,7 +8,7 @@ import { Locations, LocationStatus, PrivateLocation } from '../../../../common/runtime_types'; import { normalizeProjectMonitors } from '.'; -describe('http normalizers', () => { +describe('tcp normalizers', () => { describe('normalize push monitors', () => { const projectId = 'test-project-id'; const locations: Locations = [ @@ -83,7 +83,7 @@ describe('http normalizers', () => { }, ]; - it('properly normalizes http monitors', () => { + it('properly normalizes tcp monitors', () => { const actual = normalizeProjectMonitors({ locations, privateLocations, @@ -106,6 +106,7 @@ describe('http normalizers', () => { enabled: true, form_monitor_type: 'tcp', hosts: 'smtp.gmail.com:587', + 'url.port': null, journey_id: 'gmail-smtp', locations: [ { @@ -157,6 +158,7 @@ describe('http normalizers', () => { enabled: true, form_monitor_type: 'tcp', hosts: 'localhost:18278', + 'url.port': null, journey_id: 'always-down', locations: [ { @@ -221,6 +223,7 @@ describe('http normalizers', () => { enabled: true, form_monitor_type: 'tcp', hosts: 'localhost', + 'url.port': null, journey_id: 'always-down', locations: [ { diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/project_monitor_formatter.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/project_monitor_formatter.ts index 1ca27869aa2c..16cbf3f33a8a 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/project_monitor_formatter.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/project_monitor_formatter.ts @@ -19,7 +19,6 @@ import { deleteMonitorBulk } from '../../routes/monitor_cruds/bulk_cruds/delete_ import { SyntheticsMonitorClient } from '../synthetics_monitor/synthetics_monitor_client'; import { syncEditedMonitorBulk } from '../../routes/monitor_cruds/bulk_cruds/edit_monitor_bulk'; import { - BrowserFields, ConfigKey, SyntheticsMonitorWithSecrets, EncryptedSyntheticsMonitor, @@ -124,16 +123,16 @@ export class ProjectMonitorFormatter { const existingMonitors = await this.getProjectMonitorsForProject(); this.staleMonitorsMap = await this.getStaleMonitorsMap(existingMonitors); - const normalizedNewMonitors: BrowserFields[] = []; + const normalizedNewMonitors: SyntheticsMonitor[] = []; const normalizedUpdateMonitors: Array<{ previousMonitor: SavedObjectsFindResult; - monitor: BrowserFields; + monitor: SyntheticsMonitor; }> = []; for (const monitor of this.monitors) { const previousMonitor = existingMonitors.find( (monitorObj) => - (monitorObj.attributes as BrowserFields)[ConfigKey.JOURNEY_ID] === monitor.id + (monitorObj.attributes as SyntheticsMonitor)[ConfigKey.JOURNEY_ID] === monitor.id ); const normM = await this.validateProjectMonitor({ @@ -154,7 +153,7 @@ export class ProjectMonitorFormatter { await this.createMonitorsBulk(normalizedNewMonitors); - const { updatedCount } = await this.updateMonitors(normalizedUpdateMonitors); + const { updatedCount } = await this.updateMonitorsBulk(normalizedUpdateMonitors); if (normalizedUpdateMonitors.length > 0) { let updateMessage = ''; @@ -228,16 +227,16 @@ export class ProjectMonitorFormatter { } /* Validates that the normalized monitor is a valid monitor saved object type */ - const { valid: isNormalizedMonitorValid } = this.validateMonitor({ + const { valid: isNormalizedMonitorValid, decodedMonitor } = this.validateMonitor({ validationResult: validateMonitor(normalizedMonitor as MonitorFields), monitorId: monitor.id, }); - if (!isNormalizedMonitorValid) { + if (!isNormalizedMonitorValid || !decodedMonitor) { return null; } - return normalizedMonitor; + return decodedMonitor; } catch (e) { this.server.logger.error(e); this.failedMonitors.push({ @@ -259,7 +258,7 @@ export class ProjectMonitorFormatter { const staleMonitors: StaleMonitorMap = {}; existingMonitors.forEach((savedObject) => { - const journeyId = (savedObject.attributes as BrowserFields)[ConfigKey.JOURNEY_ID]; + const journeyId = (savedObject.attributes as SyntheticsMonitor)[ConfigKey.JOURNEY_ID]; if (journeyId) { staleMonitors[journeyId] = { stale: true, @@ -291,7 +290,7 @@ export class ProjectMonitorFormatter { return hits; }; - private createMonitorsBulk = async (monitors: BrowserFields[]) => { + private createMonitorsBulk = async (monitors: SyntheticsMonitor[]) => { try { if (monitors.length > 0) { const { newMonitors } = await syncNewMonitorBulk({ @@ -352,9 +351,9 @@ export class ProjectMonitorFormatter { ); }; - private updateMonitors = async ( + private updateMonitorsBulk = async ( monitors: Array<{ - monitor: BrowserFields; + monitor: SyntheticsMonitor; previousMonitor: SavedObjectsFindResult; }> ): Promise<{ diff --git a/x-pack/plugins/threat_intelligence/common/types/component_type.ts b/x-pack/plugins/threat_intelligence/common/types/component_type.ts deleted file mode 100644 index d5982b15c351..000000000000 --- a/x-pack/plugins/threat_intelligence/common/types/component_type.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/** - * Used in multiple component to drive the render of the component depending on where they're used. - */ -export enum ComponentType { - EuiDataGrid = 'EuiDataGrid', - ContextMenu = 'ContextMenu', -} diff --git a/x-pack/plugins/threat_intelligence/public/common/mocks/mock_indicators_filters_context.tsx b/x-pack/plugins/threat_intelligence/public/common/mocks/mock_indicators_filters_context.tsx index 4b7832631fd1..baad954a4466 100644 --- a/x-pack/plugins/threat_intelligence/public/common/mocks/mock_indicators_filters_context.tsx +++ b/x-pack/plugins/threat_intelligence/public/common/mocks/mock_indicators_filters_context.tsx @@ -11,7 +11,7 @@ import { IndicatorsFiltersContextValue } from '../../modules/indicators/containe export const mockIndicatorsFiltersContext: IndicatorsFiltersContextValue = { filterManager: { getFilters: () => [], - setFilters: () => {}, + setFilters: () => window.alert('setFilters'), } as unknown as FilterManager, filters: [], filterQuery: { diff --git a/x-pack/plugins/threat_intelligence/public/common/utils/barchart.test.ts b/x-pack/plugins/threat_intelligence/public/common/utils/barchart.test.ts deleted file mode 100644 index 004071059a73..000000000000 --- a/x-pack/plugins/threat_intelligence/public/common/utils/barchart.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { Aggregation } from '../../modules/indicators/services/fetch_aggregated_indicators'; -import { convertAggregationToChartSeries } from './barchart'; - -const aggregation1: Aggregation = { - events: { - buckets: [ - { - doc_count: 0, - key: 1641016800000, - key_as_string: '1 Jan 2022 06:00:00 GMT', - }, - { - doc_count: 10, - key: 1641038400000, - key_as_string: '1 Jan 2022 12:00:00 GMT', - }, - ], - }, - doc_count: 0, - key: '[Filebeat] AbuseCH Malware', -}; -const aggregation2: Aggregation = { - events: { - buckets: [ - { - doc_count: 20, - key: 1641016800000, - key_as_string: '1 Jan 2022 06:00:00 GMT', - }, - { - doc_count: 8, - key: 1641038400000, - key_as_string: '1 Jan 2022 12:00:00 GMT', - }, - ], - }, - doc_count: 0, - key: '[Filebeat] AbuseCH MalwareBazaar', -}; - -describe('barchart', () => { - describe('convertAggregationToChartSeries', () => { - it('should convert Aggregation[] to ChartSeries[]', () => { - expect(convertAggregationToChartSeries([aggregation1, aggregation2])).toEqual([ - { - x: '1 Jan 2022 06:00:00 GMT', - y: 0, - g: '[Filebeat] AbuseCH Malware', - }, - { - x: '1 Jan 2022 12:00:00 GMT', - y: 10, - g: '[Filebeat] AbuseCH Malware', - }, - { - x: '1 Jan 2022 06:00:00 GMT', - y: 20, - g: '[Filebeat] AbuseCH MalwareBazaar', - }, - { - x: '1 Jan 2022 12:00:00 GMT', - y: 8, - g: '[Filebeat] AbuseCH MalwareBazaar', - }, - ]); - }); - }); -}); diff --git a/x-pack/plugins/threat_intelligence/public/common/utils/barchart.ts b/x-pack/plugins/threat_intelligence/public/common/utils/barchart.ts deleted file mode 100644 index c994e7e9f3a3..000000000000 --- a/x-pack/plugins/threat_intelligence/public/common/utils/barchart.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { - Aggregation, - AggregationValue, - ChartSeries, -} from '../../modules/indicators/services/fetch_aggregated_indicators'; - -/** - * Converts data received from an Elastic search with date_histogram aggregation enabled to something usable in the "@elastic/chart" BarChart component - * @param aggregations An array of {@link Aggregation} objects to process - * @returns An array of {@link ChartSeries} directly usable in a BarChart component - */ -export const convertAggregationToChartSeries = (aggregations: Aggregation[]): ChartSeries[] => - aggregations.reduce( - (accumulated: ChartSeries[], current: Aggregation) => - accumulated.concat( - current.events.buckets.map((val: AggregationValue) => ({ - x: val.key_as_string, - y: val.doc_count, - g: current.key, - })) - ), - [] - ); diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/__snapshots__/wrapper.test.tsx.snap b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/__snapshots__/wrapper.test.tsx.snap new file mode 100644 index 000000000000..f7ae645c3b1d --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/__snapshots__/wrapper.test.tsx.snap @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` when not loading or refetching should render barchart and field selector dropdown 1`] = ` + +
+
+
+

+ Trend +

+
+
+
+
+ +
+
+ + threat.feed.name + +
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ +`; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/__snapshots__/indicators_barchart.test.tsx.snap b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/__snapshots__/barchart.test.tsx.snap similarity index 100% rename from x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/__snapshots__/indicators_barchart.test.tsx.snap rename to x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/__snapshots__/barchart.test.tsx.snap diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/indicators_barchart.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/barchart.stories.tsx similarity index 87% rename from x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/indicators_barchart.stories.tsx rename to x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/barchart.stories.tsx index bb0a1b1205b5..0a8831cfc6ff 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/indicators_barchart.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/barchart.stories.tsx @@ -9,10 +9,10 @@ import moment from 'moment'; import React from 'react'; import { Story } from '@storybook/react'; import { TimeRangeBounds } from '@kbn/data-plugin/common'; -import { StoryProvidersComponent } from '../../../../common/mocks/story_providers'; -import { mockKibanaTimelinesService } from '../../../../common/mocks/mock_kibana_timelines_service'; -import { IndicatorsBarChart } from './indicators_barchart'; -import { ChartSeries } from '../../services/fetch_aggregated_indicators'; +import { StoryProvidersComponent } from '../../../../../common/mocks/story_providers'; +import { mockKibanaTimelinesService } from '../../../../../common/mocks/mock_kibana_timelines_service'; +import { IndicatorsBarChart } from '.'; +import { ChartSeries } from '../../../services'; const mockIndicators: ChartSeries[] = [ { diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/indicators_barchart.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/barchart.test.tsx similarity index 88% rename from x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/indicators_barchart.test.tsx rename to x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/barchart.test.tsx index 19542bdf200a..4a95c0ec890f 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/indicators_barchart.test.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/barchart.test.tsx @@ -9,9 +9,9 @@ import moment from 'moment-timezone'; import React from 'react'; import { render } from '@testing-library/react'; import { TimeRangeBounds } from '@kbn/data-plugin/common'; -import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; -import { IndicatorsBarChart } from './indicators_barchart'; -import { ChartSeries } from '../../services/fetch_aggregated_indicators'; +import { TestProvidersComponent } from '../../../../../common/mocks/test_providers'; +import { IndicatorsBarChart } from '.'; +import { ChartSeries } from '../../../services'; moment.suppressDeprecationWarnings = true; moment.tz.setDefault('UTC'); diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/indicators_barchart.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/barchart.tsx similarity index 85% rename from x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/indicators_barchart.tsx rename to x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/barchart.tsx index d5535f53a862..f15a1f2e4cd3 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart/indicators_barchart.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/barchart/barchart.tsx @@ -9,13 +9,14 @@ import React, { VFC } from 'react'; import { Axis, BarSeries, Chart, Position, ScaleType, Settings } from '@elastic/charts'; import { EuiThemeProvider } from '@elastic/eui'; import { TimeRangeBounds } from '@kbn/data-plugin/common'; -import { IndicatorBarchartLegendAction } from '../indicator_barchart_legend_action/indicator_barchart_legend_action'; -import { barChartTimeAxisLabelFormatter } from '../../../../common/utils/dates'; -import type { ChartSeries } from '../../services/fetch_aggregated_indicators'; +import { IndicatorBarchartLegendAction } from '../legend_action'; +import { barChartTimeAxisLabelFormatter } from '../../../../../common/utils/dates'; +import type { ChartSeries } from '../../../services'; const ID = 'tiIndicator'; const DEFAULT_CHART_HEIGHT = '200px'; const DEFAULT_CHART_WIDTH = '100%'; +const DEFAULT_LEGEND_SIZE = 200; export interface IndicatorsBarChartProps { /** @@ -27,7 +28,7 @@ export interface IndicatorsBarChartProps { */ dateRange: TimeRangeBounds; /** - * Indicator field selected in the IndicatorFieldSelector component, passed to the {@link AddToTimeline} to populate the timeline. + * Indicator field selected in the IndicatorFieldSelector component, passed to AddToTimeline to populate the timeline. */ field: string; /** @@ -50,8 +51,8 @@ export const IndicatorsBarChart: VFC = ({ } /> , - , - , + , + , + , ]; return ( @@ -70,7 +54,8 @@ export const IndicatorBarchartLegendAction: VFC setPopover(!isPopoverOpen)} + onClick={() => setPopover((prevIsPopoverOpen) => !prevIsPopoverOpen)} + style={{ height: '100%' }} /> } diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.stories.tsx new file mode 100644 index 000000000000..74fd94d6d562 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.stories.tsx @@ -0,0 +1,216 @@ +/* + * 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 moment from 'moment'; +import React from 'react'; +import { MemoryRouter } from 'react-router-dom'; +import { of } from 'rxjs'; +import { Story } from '@storybook/react'; +import { DataView, DataViewField } from '@kbn/data-views-plugin/common'; +import { TimeRange } from '@kbn/es-query'; +import { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import { IUiSettingsClient } from '@kbn/core/public'; +import { StoryProvidersComponent } from '../../../../common/mocks/story_providers'; +import { mockKibanaTimelinesService } from '../../../../common/mocks/mock_kibana_timelines_service'; +import { DEFAULT_TIME_RANGE } from '../../../query_bar/hooks/use_filters/utils'; +import { IndicatorsBarChartWrapper } from '.'; +import { Aggregation, AGGREGATION_NAME, ChartSeries } from '../../services'; + +export default { + component: IndicatorsBarChartWrapper, + title: 'IndicatorsBarChartWrapper', +}; + +const mockTimeRange: TimeRange = DEFAULT_TIME_RANGE; + +const mockIndexPattern: DataView = { + fields: [ + { + name: '@timestamp', + type: 'date', + } as DataViewField, + { + name: 'threat.feed.name', + type: 'string', + } as DataViewField, + ], +} as DataView; + +const validDate: string = '1 Jan 2022 00:00:00 GMT'; +const numberOfDays: number = 1; +const aggregation1: Aggregation = { + events: { + buckets: [ + { + doc_count: 0, + key: 1641016800000, + key_as_string: '1 Jan 2022 06:00:00 GMT', + }, + { + doc_count: 10, + key: 1641038400000, + key_as_string: '1 Jan 2022 12:00:00 GMT', + }, + ], + }, + doc_count: 0, + key: '[Filebeat] AbuseCH Malware', +}; +const aggregation2: Aggregation = { + events: { + buckets: [ + { + doc_count: 20, + key: 1641016800000, + key_as_string: '1 Jan 2022 06:00:00 GMT', + }, + { + doc_count: 8, + key: 1641038400000, + key_as_string: '1 Jan 2022 12:00:00 GMT', + }, + ], + }, + doc_count: 0, + key: '[Filebeat] AbuseCH MalwareBazaar', +}; + +const dataServiceMock = { + search: { + search: () => + of({ + rawResponse: { + aggregations: { + [AGGREGATION_NAME]: { + buckets: [aggregation1, aggregation2], + }, + }, + }, + }), + }, + query: { + timefilter: { + timefilter: { + calculateBounds: () => ({ + min: moment(validDate), + max: moment(validDate).add(numberOfDays, 'days'), + }), + }, + }, + filterManager: { + getFilters: () => {}, + setFilters: () => {}, + getUpdates$: () => of(), + }, + }, +} as unknown as DataPublicPluginStart; + +const uiSettingsMock = { + get: () => {}, +} as unknown as IUiSettingsClient; + +const timelinesMock = mockKibanaTimelinesService; + +export const Default: Story = () => { + return ( + + + + ); +}; + +Default.decorators = [(story) => {story()}]; + +export const InitialLoad: Story = () => { + return ( + + + + ); +}; + +InitialLoad.decorators = [(story) => {story()}]; + +export const UpdatingData: Story = () => { + const mockIndicators: ChartSeries[] = [ + { + x: '1 Jan 2022 00:00:00 GMT', + y: 2, + g: '[Filebeat] AbuseCH Malware', + }, + { + x: '1 Jan 2022 00:00:00 GMT', + y: 10, + g: '[Filebeat] AbuseCH MalwareBazaar', + }, + { + x: '1 Jan 2022 06:00:00 GMT', + y: 0, + g: '[Filebeat] AbuseCH Malware', + }, + { + x: '1 Jan 2022 06:00:00 GMT', + y: 0, + g: '[Filebeat] AbuseCH MalwareBazaar', + }, + { + x: '1 Jan 2022 12:00:00 GMT', + y: 25, + g: '[Filebeat] AbuseCH Malware', + }, + { + x: '1 Jan 2022 18:00:00 GMT', + y: 15, + g: '[Filebeat] AbuseCH MalwareBazaar', + }, + ]; + + return ( + + + + ); +}; + +UpdatingData.decorators = [(story) => {story()}]; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.test.tsx new file mode 100644 index 000000000000..577afefe8083 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.test.tsx @@ -0,0 +1,97 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; +import { TimeRange } from '@kbn/es-query'; +import { DataView, DataViewField } from '@kbn/data-views-plugin/common'; +import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; +import { CHART_UPDATE_PROGRESS_TEST_ID, IndicatorsBarChartWrapper } from '.'; +import { DEFAULT_TIME_RANGE } from '../../../query_bar/hooks/use_filters/utils'; +import moment from 'moment'; + +jest.mock('../../../query_bar/hooks/use_filters'); + +const mockIndexPattern: DataView = { + fields: [ + { + name: '@timestamp', + type: 'date', + } as DataViewField, + { + name: 'threat.feed.name', + type: 'string', + } as DataViewField, + ], +} as DataView; + +const mockTimeRange: TimeRange = DEFAULT_TIME_RANGE; + +describe('', () => { + describe('when not loading or refetching', () => { + it('should render barchart and field selector dropdown', () => { + const component = render( + + + + ); + + expect(component.asFragment()).toMatchSnapshot(); + }); + }); + + describe('when loading for the first time', () => { + it('should render progress indicator', () => { + const component = render( + + + + ); + + expect(component.queryByRole('progressbar')).toBeInTheDocument(); + }); + }); + + describe('when updating the data', () => { + it('should render progress indicator', () => { + const component = render( + + + + ); + + expect(component.queryByTestId(CHART_UPDATE_PROGRESS_TEST_ID)).toBeInTheDocument(); + }); + }); +}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.tsx similarity index 61% rename from x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.tsx rename to x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.tsx index 31148685e370..57ec76d17bd4 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.tsx @@ -6,25 +6,34 @@ */ import React, { memo } from 'react'; -import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui'; +import { + EuiFlexGroup, + EuiFlexItem, + EuiLoadingSpinner, + EuiPanel, + EuiProgress, + EuiTitle, +} from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { TimeRange } from '@kbn/es-query'; import { TimeRangeBounds } from '@kbn/data-plugin/common'; import { SecuritySolutionDataViewBase } from '../../../../types'; import { RawIndicatorFieldId } from '../../../../../common/types/indicator'; -import { IndicatorsFieldSelector } from '../indicators_field_selector/indicators_field_selector'; -import { IndicatorsBarChart } from '../indicators_barchart/indicators_barchart'; -import { ChartSeries } from '../../services/fetch_aggregated_indicators'; +import { IndicatorsFieldSelector } from './field_selector'; +import { IndicatorsBarChart } from './barchart'; +import { ChartSeries } from '../../services'; const DEFAULT_FIELD = RawIndicatorFieldId.Feed; +export const CHART_UPDATE_PROGRESS_TEST_ID = 'tiBarchartWrapper-updating'; + export interface IndicatorsBarChartWrapperProps { /** * From and to values received from the KQL bar and passed down to the hook to query data. */ timeRange?: TimeRange; /** - * List of fields coming from the Security Solution sourcerer data view, passed down to the {@link IndicatorFieldSelector} to populate the dropdown. + * List of fields coming from the Security Solution sourcerer data view, passed down to the {@link IndicatorsFieldSelector} to populate the dropdown. */ indexPattern: SecuritySolutionDataViewBase; @@ -35,6 +44,12 @@ export interface IndicatorsBarChartWrapperProps { field: string; onFieldChange: (value: string) => void; + + /** Is initial load in progress? */ + isLoading?: boolean; + + /** Is data update in progress? */ + isFetching?: boolean; } /** @@ -42,9 +57,21 @@ export interface IndicatorsBarChartWrapperProps { * and handles retrieving aggregated indicator data. */ export const IndicatorsBarChartWrapper = memo( - ({ timeRange, indexPattern, series, dateRange, field, onFieldChange }) => { + ({ timeRange, indexPattern, isLoading, isFetching, series, dateRange, field, onFieldChange }) => { + if (isLoading) { + return ( + + + + + + + + ); + } + return ( - <> +
@@ -64,12 +91,20 @@ export const IndicatorsBarChartWrapper = memo( /> - {timeRange ? ( + + {isFetching && ( + + )} + + {timeRange && ( - ) : ( - <> )} - +
); } ); diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/fields_table/fields_table.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/fields_table/fields_table.tsx index e670d6b90e02..eb5b2d0ca258 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/fields_table/fields_table.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/fields_table/fields_table.tsx @@ -22,7 +22,7 @@ export interface IndicatorFieldsTableProps { export const IndicatorFieldsTable: VFC = ({ fields, indicator, - ...rest + 'data-test-subj': dataTestSubj, }) => { const columns = useMemo( () => @@ -49,15 +49,26 @@ export const IndicatorFieldsTable: VFC = ({ actions: [ { render: (field: string) => ( - + ), width: '72px', }, ], }, ] as Array>, - [indicator, rest] + [indicator, dataTestSubj] ); - return ; + return ( + + ); }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.tsx index 24fe1cc0082e..11102df79701 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.tsx @@ -21,7 +21,7 @@ import { useGeneratedHtmlId, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { InvestigateInTimelineButton } from '../../../timeline/components/investigate_in_timeline_button'; +import { InvestigateInTimelineButton } from '../../../timeline/components/investigate_in_timeline'; import { DateFormatter } from '../../../../components/date_formatter/date_formatter'; import { Indicator, RawIndicatorFieldId } from '../../../../../common/types/indicator'; import { IndicatorsFlyoutJson } from './json_tab'; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/indicator_value_actions/indicator_value_actions.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/indicator_value_actions/indicator_value_actions.tsx index 919b39da28c3..0ee9ae050aa9 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/indicator_value_actions/indicator_value_actions.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/indicator_value_actions/indicator_value_actions.tsx @@ -5,13 +5,12 @@ * 2.0. */ -import type { EuiButtonEmpty, EuiButtonIcon } from '@elastic/eui'; -import { EuiFlexGroup } from '@elastic/eui'; import React, { VFC } from 'react'; +import { EuiFlexGroup } from '@elastic/eui'; import { Indicator } from '../../../../../../common/types/indicator'; -import { FilterIn } from '../../../../query_bar/components/filter_in'; -import { FilterOut } from '../../../../query_bar/components/filter_out'; -import { AddToTimeline } from '../../../../timeline/components/add_to_timeline'; +import { FilterInButtonIcon } from '../../../../query_bar/components/filter_in'; +import { FilterOutButtonIcon } from '../../../../query_bar/components/filter_out'; +import { AddToTimelineButtonIcon } from '../../../../timeline/components/add_to_timeline'; import { fieldAndValueValid, getIndicatorFieldAndValue } from '../../../utils/field_value'; export const TIMELINE_BUTTON_TEST_ID = 'TimelineButton'; @@ -27,10 +26,6 @@ interface IndicatorValueActions { * Indicator field used for the filter in/out and add to timeline feature. */ field: string; - /** - * Only used with `EuiDataGrid` (see {@link AddToTimelineButtonProps}). - */ - Component?: typeof EuiButtonEmpty | typeof EuiButtonIcon; /** * Used for unit and e2e tests. */ @@ -40,28 +35,22 @@ interface IndicatorValueActions { export const IndicatorValueActions: VFC = ({ indicator, field, - Component, - ...props + 'data-test-subj': dataTestSubj, }) => { const { key, value } = getIndicatorFieldAndValue(indicator, field); if (!fieldAndValueValid(key, value)) { return null; } - const filterInTestId = `${props['data-test-subj']}${FILTER_IN_BUTTON_TEST_ID}`; - const filterOutTestId = `${props['data-test-subj']}${FILTER_OUT_BUTTON_TEST_ID}`; - const timelineTestId = `${props['data-test-subj']}${TIMELINE_BUTTON_TEST_ID}`; + const filterInTestId = `${dataTestSubj}${FILTER_IN_BUTTON_TEST_ID}`; + const filterOutTestId = `${dataTestSubj}${FILTER_OUT_BUTTON_TEST_ID}`; + const timelineTestId = `${dataTestSubj}${TIMELINE_BUTTON_TEST_ID}`; return ( - - - + + + ); }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/block/block.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/block/block.tsx index dd8d4335feca..0866edde505b 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/block/block.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/block/block.tsx @@ -50,10 +50,14 @@ export interface IndicatorBlockProps { /** * Renders indicator field value in a rectangle, to highlight it even more */ -export const IndicatorBlock: VFC = ({ field, indicator, ...props }) => { +export const IndicatorBlock: VFC = ({ + field, + indicator, + 'data-test-subj': dataTestSubj, +}) => { return ( - + @@ -61,7 +65,11 @@ export const IndicatorBlock: VFC = ({ field, indicator, ... - + diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/highlighted_values_table/highlighted_values_table.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/highlighted_values_table/highlighted_values_table.tsx index 6ce9c332d632..7ccbbdf2f1c9 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/highlighted_values_table/highlighted_values_table.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/highlighted_values_table/highlighted_values_table.tsx @@ -34,7 +34,7 @@ interface HighlightedValuesTableProps { */ export const HighlightedValuesTable: VFC = ({ indicator, - ...props + 'data-test-subj': dataTestSubj, }) => { const indicatorType = unwrapValue(indicator, RawIndicatorFieldId.Type); @@ -48,7 +48,7 @@ export const HighlightedValuesTable: VFC = ({ search={false} indicator={indicator} fields={highlightedFields} - {...props} + data-test-subj={dataTestSubj} /> ); }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/__snapshots__/indicators_barchart_wrapper.test.tsx.snap b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/__snapshots__/indicators_barchart_wrapper.test.tsx.snap deleted file mode 100644 index bc2b71303138..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/__snapshots__/indicators_barchart_wrapper.test.tsx.snap +++ /dev/null @@ -1,268 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render barchart and field selector dropdown 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
-
-
-

- Trend -

-
-
-
-
- -
-
- - threat.feed.name - -
- -
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- , - "container":
-
-
-

- Trend -

-
-
-
-
- -
-
- - threat.feed.name - -
- -
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.stories.tsx deleted file mode 100644 index f08e8f3b2f0e..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.stories.tsx +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import moment from 'moment'; -import React from 'react'; -import { MemoryRouter } from 'react-router-dom'; -import { of } from 'rxjs'; -import { Story } from '@storybook/react'; -import { DataView, DataViewField } from '@kbn/data-views-plugin/common'; -import { TimeRange } from '@kbn/es-query'; -import { DataPublicPluginStart } from '@kbn/data-plugin/public'; -import { IUiSettingsClient } from '@kbn/core/public'; -import { StoryProvidersComponent } from '../../../../common/mocks/story_providers'; -import { mockKibanaTimelinesService } from '../../../../common/mocks/mock_kibana_timelines_service'; -import { DEFAULT_TIME_RANGE } from '../../../query_bar/hooks/use_filters/utils'; -import { IndicatorsBarChartWrapper } from './indicators_barchart_wrapper'; -import { Aggregation, AGGREGATION_NAME } from '../../services/fetch_aggregated_indicators'; - -export default { - component: IndicatorsBarChartWrapper, - title: 'IndicatorsBarChartWrapper', -}; - -export const Default: Story = () => { - const mockTimeRange: TimeRange = DEFAULT_TIME_RANGE; - - const mockIndexPattern: DataView = { - fields: [ - { - name: '@timestamp', - type: 'date', - } as DataViewField, - { - name: 'threat.feed.name', - type: 'string', - } as DataViewField, - ], - } as DataView; - - const validDate: string = '1 Jan 2022 00:00:00 GMT'; - const numberOfDays: number = 1; - const aggregation1: Aggregation = { - events: { - buckets: [ - { - doc_count: 0, - key: 1641016800000, - key_as_string: '1 Jan 2022 06:00:00 GMT', - }, - { - doc_count: 10, - key: 1641038400000, - key_as_string: '1 Jan 2022 12:00:00 GMT', - }, - ], - }, - doc_count: 0, - key: '[Filebeat] AbuseCH Malware', - }; - const aggregation2: Aggregation = { - events: { - buckets: [ - { - doc_count: 20, - key: 1641016800000, - key_as_string: '1 Jan 2022 06:00:00 GMT', - }, - { - doc_count: 8, - key: 1641038400000, - key_as_string: '1 Jan 2022 12:00:00 GMT', - }, - ], - }, - doc_count: 0, - key: '[Filebeat] AbuseCH MalwareBazaar', - }; - - const dataServiceMock = { - search: { - search: () => - of({ - rawResponse: { - aggregations: { - [AGGREGATION_NAME]: { - buckets: [aggregation1, aggregation2], - }, - }, - }, - }), - }, - query: { - timefilter: { - timefilter: { - calculateBounds: () => ({ - min: moment(validDate), - max: moment(validDate).add(numberOfDays, 'days'), - }), - }, - }, - filterManager: { - getFilters: () => {}, - setFilters: () => {}, - getUpdates$: () => of(), - }, - }, - } as unknown as DataPublicPluginStart; - - const uiSettingsMock = { - get: () => {}, - } as unknown as IUiSettingsClient; - - const timelinesMock = mockKibanaTimelinesService; - - return ( - - - - ); -}; -Default.decorators = [(story) => {story()}]; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.test.tsx deleted file mode 100644 index 48d084b0e832..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.test.tsx +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { render } from '@testing-library/react'; -import { TimeRange } from '@kbn/es-query'; -import { DataView, DataViewField } from '@kbn/data-views-plugin/common'; -import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; -import { IndicatorsBarChartWrapper } from './indicators_barchart_wrapper'; -import { DEFAULT_TIME_RANGE } from '../../../query_bar/hooks/use_filters/utils'; -import { useFilters } from '../../../query_bar/hooks/use_filters'; -import moment from 'moment'; - -jest.mock('../../../query_bar/hooks/use_filters'); - -const mockIndexPattern: DataView = { - fields: [ - { - name: '@timestamp', - type: 'date', - } as DataViewField, - { - name: 'threat.feed.name', - type: 'string', - } as DataViewField, - ], -} as DataView; - -const mockTimeRange: TimeRange = DEFAULT_TIME_RANGE; - -const stub = () => {}; - -describe('', () => { - beforeEach(() => { - (useFilters as jest.MockedFunction).mockReturnValue({ - filters: [], - filterQuery: { language: 'kuery', query: '' }, - filterManager: {} as any, - handleSavedQuery: stub, - handleSubmitQuery: stub, - handleSubmitTimeRange: stub, - }); - }); - it('should render barchart and field selector dropdown', () => { - const component = render( - - - - ); - - expect(component).toMatchSnapshot(); - }); -}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/actions_row_cell.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/actions_row_cell.tsx index 1744bf8ac06c..2f84b14db0c3 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/actions_row_cell.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/actions_row_cell.tsx @@ -7,7 +7,7 @@ import React, { useContext, VFC } from 'react'; import { EuiFlexGroup } from '@elastic/eui'; -import { InvestigateInTimelineButtonIcon } from '../../../timeline/components/investigate_in_timeline_button_icon'; +import { InvestigateInTimelineButtonIcon } from '../../../timeline/components/investigate_in_timeline'; import { Indicator } from '../../../../../common/types/indicator'; import { OpenIndicatorFlyoutButton } from '../open_indicator_flyout_button/open_indicator_flyout_button'; import { IndicatorsTableContext } from './context'; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/cell_actions.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/cell_actions.tsx index d10ba709bfa2..9cca631ac3b5 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/cell_actions.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/cell_actions.tsx @@ -7,12 +7,11 @@ import React, { VFC } from 'react'; import { EuiDataGridColumnCellActionProps } from '@elastic/eui/src/components/datagrid/data_grid_types'; -import { ComponentType } from '../../../../../common/types/component_type'; import { Indicator } from '../../../../../common/types/indicator'; -import { AddToTimeline } from '../../../timeline/components/add_to_timeline'; +import { AddToTimelineCellAction } from '../../../timeline/components/add_to_timeline'; +import { FilterInCellAction } from '../../../query_bar/components/filter_in'; +import { FilterOutCellAction } from '../../../query_bar/components/filter_out'; import { fieldAndValueValid, getIndicatorFieldAndValue } from '../../utils/field_value'; -import { FilterIn } from '../../../query_bar/components/filter_in'; -import { FilterOut } from '../../../query_bar/components/filter_out'; import type { Pagination } from '../../services/fetch_indicators'; export const CELL_TIMELINE_BUTTON_TEST_ID = 'tiIndicatorsTableCellTimelineButton'; @@ -52,24 +51,22 @@ export const CellActions: VFC = ({ return ( <> - - - diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.stories.tsx index 6505996a26a7..95217171cb9e 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.stories.tsx @@ -36,7 +36,7 @@ const columnSettings = { onSort: stub, }, }; -export function WithIndicators() { +export function IndicatorsFullyLoaded() { const indicatorsFixture: Indicator[] = Array(10).fill(generateMockIndicator()); return ( @@ -62,6 +62,55 @@ export function WithIndicators() { ); } +export function FirstLoad() { + return ( + + + + ); +} + +export function DataUpdateInProgress() { + const indicatorsFixture: Indicator[] = Array(10).fill(generateMockIndicator()); + + return ( + + + + + + ); +} + export function WithNoIndicators() { return ( diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.test.tsx index 027033ae4771..eb1d4c3411c1 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.test.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.test.tsx @@ -7,7 +7,11 @@ import { act, render, screen } from '@testing-library/react'; import React from 'react'; -import { IndicatorsTable, IndicatorsTableProps } from './indicators_table'; +import { + IndicatorsTable, + IndicatorsTableProps, + TABLE_UPDATE_PROGRESS_TEST_ID, +} from './indicators_table'; import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator'; import { BUTTON_TEST_ID } from '../open_indicator_flyout_button'; @@ -56,7 +60,7 @@ const indicatorsFixture: Indicator[] = [ ]; describe('', () => { - it('should render loading spinner when loading', async () => { + it('should render loading spinner when doing initial loading', async () => { await act(async () => { render( @@ -68,6 +72,25 @@ describe('', () => { expect(screen.queryByRole('progressbar')).toBeInTheDocument(); }); + it('should render loading indicator when doing data update', async () => { + await act(async () => { + render( + + + + ); + }); + + screen.debug(); + + expect(screen.queryByTestId(TABLE_UPDATE_PROGRESS_TEST_ID)).toBeInTheDocument(); + }); + it('should render datagrid when loading is done', async () => { await act(async () => { render( @@ -75,6 +98,7 @@ describe('', () => { @@ -92,5 +116,8 @@ describe('', () => { }); expect(screen.queryByTestId(TITLE_TEST_ID)).toBeInTheDocument(); + + expect(screen.queryByRole('progressbar')).not.toBeInTheDocument(); + expect(screen.queryByTestId(TABLE_UPDATE_PROGRESS_TEST_ID)).not.toBeInTheDocument(); }); }); diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.tsx index d1888431f7d8..739100347187 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_table/indicators_table.tsx @@ -13,6 +13,8 @@ import { EuiFlexItem, EuiLoadingSpinner, EuiPanel, + EuiProgress, + EuiSpacer, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; @@ -39,7 +41,8 @@ export interface IndicatorsTableProps { /** * If true, no data is available yet */ - isLoading: boolean; + isLoading?: boolean; + isFetching?: boolean; indexPattern: SecuritySolutionDataViewBase; browserFields: BrowserFields; columnSettings: ColumnSettingsValue; @@ -54,6 +57,8 @@ const gridStyle = { fontSize: 's', } as const; +export const TABLE_UPDATE_PROGRESS_TEST_ID = `${TABLE_TEST_ID}-updating` as const; + export const IndicatorsTable: VFC = ({ indicators, indicatorCount, @@ -61,6 +66,7 @@ export const IndicatorsTable: VFC = ({ onChangeItemsPerPage, pagination, isLoading, + isFetching, browserFields, columnSettings: { columns, columnVisibility, handleResetColumns, handleToggleColumn, sorting }, }) => { @@ -157,44 +163,57 @@ export const IndicatorsTable: VFC = ({ } return ( - + <> + {isFetching && ( + + )} + + + + ); }, [ - columnVisibility, - mappedColumns, + isLoading, indicatorCount, + isFetching, leadingControlColumns, - isLoading, + renderCellValue, + toolbarOptions, + pagination, onChangeItemsPerPage, onChangePage, - pagination, - renderCellValue, sorting, - toolbarOptions, + columnVisibility, + mappedColumns, ]); return ( -
- + +
{flyoutFragment} {gridFragment} - -
+
+ ); }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/index.ts b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/index.ts new file mode 100644 index 000000000000..23461fc80995 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/index.ts @@ -0,0 +1,11 @@ +/* + * 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. + */ + +export * from './use_aggregated_indicators'; +export * from './use_indicators_filters_context'; +export * from './use_indicators_total_count'; +export * from './use_sourcerer_data_view'; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_aggregated_indicators.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_aggregated_indicators.test.tsx index 85c703cf5dca..7791020d58e0 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_aggregated_indicators.test.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_aggregated_indicators.test.tsx @@ -12,7 +12,7 @@ import { mockedTimefilterService, TestProvidersComponent, } from '../../../common/mocks/test_providers'; -import { createFetchAggregatedIndicators } from '../services/fetch_aggregated_indicators'; +import { createFetchAggregatedIndicators } from '../services'; jest.mock('../services/fetch_aggregated_indicators'); @@ -28,7 +28,8 @@ const renderUseAggregatedIndicators = () => wrapper: TestProvidersComponent, }); -describe('useAggregatedIndicators()', () => { +// FLAKY: https://github.com/elastic/kibana/issues/142312 +describe.skip('useAggregatedIndicators()', () => { beforeEach(jest.clearAllMocks); type MockedCreateFetchAggregatedIndicators = jest.MockedFunction< @@ -88,6 +89,8 @@ describe('useAggregatedIndicators()', () => { "max": "2022-01-02T00:00:00.000Z", "min": "2022-01-01T00:00:00.000Z", }, + "isFetching": true, + "isLoading": true, "onFieldChange": [Function], "selectedField": "threat.feed.name", "series": Array [], diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_aggregated_indicators.ts b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_aggregated_indicators.ts index 98e672ac3ad9..dd603d387c17 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_aggregated_indicators.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_aggregated_indicators.ts @@ -13,7 +13,7 @@ import { useInspector } from '../../../hooks/use_inspector'; import { RawIndicatorFieldId } from '../../../../common/types/indicator'; import { useKibana } from '../../../hooks/use_kibana'; import { DEFAULT_TIME_RANGE } from '../../query_bar/hooks/use_filters/utils'; -import { useSourcererDataView } from './use_sourcerer_data_view'; +import { useSourcererDataView } from '.'; import { ChartSeries, createFetchAggregatedIndicators, @@ -22,11 +22,17 @@ import { export interface UseAggregatedIndicatorsParam { /** - * From and To values passed to the {@link }useAggregatedIndicators} hook + * From and To values passed to the {@link useAggregatedIndicators} hook * to query indicators for the Indicators barchart. */ timeRange?: TimeRange; + /** + * Filters data passed to the {@link useAggregatedIndicators} hook to query indicators. + */ filters: Filter[]; + /** + * Query data passed to the {@link useAggregatedIndicators} hook to query indicators. + */ filterQuery: Query; } @@ -49,6 +55,12 @@ export interface UseAggregatedIndicatorsValue { * Indicator field used to query the aggregated Indicators. */ selectedField: string; + + /** Is initial load in progress? */ + isLoading?: boolean; + + /** Is data update in progress? */ + isFetching?: boolean; } const DEFAULT_FIELD = RawIndicatorFieldId.Feed; @@ -80,7 +92,7 @@ export const useAggregatedIndicators = ({ [inspectorAdapters, queryService, searchService] ); - const { data } = useQuery( + const { data, isLoading, isFetching } = useQuery( [ 'indicatorsBarchart', { @@ -97,7 +109,8 @@ export const useAggregatedIndicators = ({ }: { signal?: AbortSignal; queryKey: [string, FetchAggregatedIndicatorsParams]; - }) => aggregatedIndicatorsQuery(queryParams, signal) + }) => aggregatedIndicatorsQuery(queryParams, signal), + { keepPreviousData: true } ); const dateRange = useMemo( @@ -110,5 +123,7 @@ export const useAggregatedIndicators = ({ series: data || [], onFieldChange: setField, selectedField: field, + isLoading, + isFetching, }; }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/indicators_page.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/indicators_page.tsx index fff2caad5715..e0b5158274c1 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/indicators_page.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/indicators_page.tsx @@ -7,7 +7,7 @@ import React, { FC, VFC } from 'react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { IndicatorsBarChartWrapper } from './components/indicators_barchart_wrapper/indicators_barchart_wrapper'; +import { IndicatorsBarChartWrapper } from './components/barchart'; import { IndicatorsTable } from './components/indicators_table/indicators_table'; import { useIndicators } from './hooks/use_indicators'; import { DefaultPageLayout } from '../../components/layout'; @@ -53,10 +53,11 @@ const IndicatorsPageContent: VFC = () => { handleRefresh, indicatorCount, indicators, - isLoading, onChangeItemsPerPage, onChangePage, pagination, + isLoading: isLoadingIndicators, + isFetching: isFetchingIndicators, } = useIndicators({ filters, filterQuery, @@ -64,7 +65,14 @@ const IndicatorsPageContent: VFC = () => { sorting: columnSettings.sorting.columns, }); - const { dateRange, series, selectedField, onFieldChange } = useAggregatedIndicators({ + const { + dateRange, + series, + selectedField, + onFieldChange, + isLoading: isLoadingAggregatedIndicators, + isFetching: isFetchingAggregatedIndicators, + } = useAggregatedIndicators({ timeRange, filters, filterQuery, @@ -97,7 +105,10 @@ const IndicatorsPageContent: VFC = () => { indexPattern={indexPattern} field={selectedField} onFieldChange={onFieldChange} + isFetching={isFetchingAggregatedIndicators} + isLoading={isLoadingAggregatedIndicators} /> + { pagination={pagination} indicatorCount={indicatorCount} indicators={indicators} - isLoading={isLoading} + isLoading={isLoadingIndicators} + isFetching={isFetchingIndicators} onChangeItemsPerPage={onChangeItemsPerPage} onChangePage={onChangePage} /> diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/services/fetch_aggregated_indicators.test.ts b/x-pack/plugins/threat_intelligence/public/modules/indicators/services/fetch_aggregated_indicators.test.ts index c5503f1b32a0..007623943c53 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/services/fetch_aggregated_indicators.test.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/services/fetch_aggregated_indicators.test.ts @@ -8,12 +8,54 @@ import { mockedQueryService, mockedSearchService } from '../../../common/mocks/test_providers'; import { BehaviorSubject, throwError } from 'rxjs'; import { RequestAdapter } from '@kbn/inspector-plugin/common'; -import { AGGREGATION_NAME, createFetchAggregatedIndicators } from './fetch_aggregated_indicators'; +import { + Aggregation, + AGGREGATION_NAME, + convertAggregationToChartSeries, + createFetchAggregatedIndicators, +} from '.'; const aggregationResponse = { rawResponse: { aggregations: { [AGGREGATION_NAME]: { buckets: [] } } }, }; +const aggregation1: Aggregation = { + events: { + buckets: [ + { + doc_count: 0, + key: 1641016800000, + key_as_string: '1 Jan 2022 06:00:00 GMT', + }, + { + doc_count: 10, + key: 1641038400000, + key_as_string: '1 Jan 2022 12:00:00 GMT', + }, + ], + }, + doc_count: 0, + key: '[Filebeat] AbuseCH Malware', +}; +const aggregation2: Aggregation = { + events: { + buckets: [ + { + doc_count: 20, + key: 1641016800000, + key_as_string: '1 Jan 2022 06:00:00 GMT', + }, + { + doc_count: 8, + key: 1641038400000, + key_as_string: '1 Jan 2022 12:00:00 GMT', + }, + ], + }, + doc_count: 0, + key: '[Filebeat] AbuseCH MalwareBazaar', +}; + describe('FetchAggregatedIndicatorsService', () => { beforeEach(jest.clearAllMocks); @@ -115,3 +157,30 @@ describe('FetchAggregatedIndicatorsService', () => { }); }); }); + +describe('convertAggregationToChartSeries', () => { + it('should convert Aggregation[] to ChartSeries[]', () => { + expect(convertAggregationToChartSeries([aggregation1, aggregation2])).toEqual([ + { + x: '1 Jan 2022 06:00:00 GMT', + y: 0, + g: '[Filebeat] AbuseCH Malware', + }, + { + x: '1 Jan 2022 12:00:00 GMT', + y: 10, + g: '[Filebeat] AbuseCH Malware', + }, + { + x: '1 Jan 2022 06:00:00 GMT', + y: 20, + g: '[Filebeat] AbuseCH MalwareBazaar', + }, + { + x: '1 Jan 2022 12:00:00 GMT', + y: 8, + g: '[Filebeat] AbuseCH MalwareBazaar', + }, + ]); + }); +}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/services/fetch_aggregated_indicators.ts b/x-pack/plugins/threat_intelligence/public/modules/indicators/services/fetch_aggregated_indicators.ts index 6cf0fea18b2c..0edc0cca34e5 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/services/fetch_aggregated_indicators.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/services/fetch_aggregated_indicators.ts @@ -9,7 +9,6 @@ import { TimeRangeBounds } from '@kbn/data-plugin/common'; import type { ISearchStart, QueryStart } from '@kbn/data-plugin/public'; import type { Filter, Query, TimeRange } from '@kbn/es-query'; import { RequestAdapter } from '@kbn/inspector-plugin/common'; -import { convertAggregationToChartSeries } from '../../../common/utils/barchart'; import { calculateBarchartColumnTimeInterval } from '../../../common/utils/dates'; import { RawIndicatorFieldId } from '../../../../common/types/indicator'; import { getIndicatorQueryParams } from '../utils/get_indicator_query_params'; @@ -55,6 +54,24 @@ export interface FetchAggregatedIndicatorsParams { field: string; } +/** + * Converts data received from an Elastic search with date_histogram aggregation enabled to something usable in the "@elastic/chart" BarChart component + * @param aggregations An array of {@link Aggregation} objects to process + * @returns An array of {@link ChartSeries} directly usable in a BarChart component + */ +export const convertAggregationToChartSeries = (aggregations: Aggregation[]): ChartSeries[] => + aggregations.reduce( + (accumulated: ChartSeries[], current: Aggregation) => + accumulated.concat( + current.events.buckets.map((val: AggregationValue) => ({ + x: val.key_as_string, + y: val.doc_count, + g: current.key, + })) + ), + [] + ); + export const createFetchAggregatedIndicators = ({ inspectorAdapter, diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/index.ts b/x-pack/plugins/threat_intelligence/public/modules/indicators/services/index.ts similarity index 75% rename from x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/index.ts rename to x-pack/plugins/threat_intelligence/public/modules/indicators/services/index.ts index 6ed30045b29b..3215ff662159 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/index.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/services/index.ts @@ -5,4 +5,5 @@ * 2.0. */ -export * from './investigate_in_timeline_button_icon'; +export * from './fetch_aggregated_indicators'; +export * from './fetch_indicators'; diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/__snapshots__/filter_in.test.tsx.snap b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/__snapshots__/filter_in.test.tsx.snap index 34e37aaf1dd4..b9a31b09a40e 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/__snapshots__/filter_in.test.tsx.snap +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/__snapshots__/filter_in.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[` should render an empty component (wrong data input) 1`] = ` +exports[` should render an empty component (wrong data input) 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -61,7 +61,7 @@ Object { } `; -exports[` should render an empty component (wrong field input) 1`] = ` +exports[` should render an empty component (wrong field input) 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -122,7 +122,7 @@ Object { } `; -exports[` should render one Component (for EuiDataGrid use) 1`] = ` +exports[` should render one Component (for EuiDataGrid use) 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -223,7 +223,7 @@ Object { } `; -exports[` should render one EuiButtonIcon 1`] = ` +exports[` should render one EuiButtonIcon 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -320,7 +320,7 @@ Object { } `; -exports[` should render one EuiContextMenuItem (for EuiContextMenu use) 1`] = ` +exports[` should render one EuiContextMenuItem (for EuiContextMenu use) 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -340,7 +340,9 @@ Object { - Filter In + + Filter In + @@ -362,7 +364,9 @@ Object { - Filter In + + Filter In + diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.stories.tsx index 08297774e51f..d32adf70ee10 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.stories.tsx @@ -7,23 +7,70 @@ import React from 'react'; import { Story } from '@storybook/react'; +import { EuiContextMenuPanel, EuiDataGrid, EuiDataGridColumn } from '@elastic/eui'; +import { EuiDataGridColumnVisibility } from '@elastic/eui/src/components/datagrid/data_grid_types'; import { mockIndicatorsFiltersContext } from '../../../../common/mocks/mock_indicators_filters_context'; import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator'; +import { FilterInButtonIcon, FilterInContextMenu, FilterInCellAction } from '.'; import { IndicatorsFiltersContext } from '../../../indicators/containers/indicators_filters/context'; -import { FilterIn } from '.'; export default { - component: FilterIn, title: 'FilterIn', }; -export const Default: Story = () => { +export const ButtonIcon: Story = () => { const mockIndicator: Indicator = generateMockIndicator(); const mockField: string = 'threat.feed.name'; return ( - + + + ); +}; + +export const ContextMenu: Story = () => { + const mockIndicator: Indicator = generateMockIndicator(); + const mockField: string = 'threat.feed.name'; + const items = []; + + return ( + + + + ); +}; + +export const DataGrid: Story = () => { + const mockIndicator: Indicator = generateMockIndicator(); + const mockField: string = 'threat.feed.name'; + const columnId: string = '1'; + const columns: EuiDataGridColumn[] = [ + { + id: columnId, + cellActions: [ + ({ Component }) => ( + + ), + ], + }, + ]; + const columnVisibility: EuiDataGridColumnVisibility = { + visibleColumns: [columnId], + setVisibleColumns: () => window.alert('setVisibleColumns'), + }; + const rowCount: number = 1; + const renderCellValue = () => <>; + + return ( + + ); }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.test.tsx index 788ac9b2e442..0abfa0652230 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.test.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.test.tsx @@ -11,8 +11,7 @@ import { EuiButtonIcon } from '@elastic/eui'; import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator'; import { useIndicatorsFiltersContext } from '../../../indicators/hooks/use_indicators_filters_context'; import { mockIndicatorsFiltersContext } from '../../../../common/mocks/mock_indicators_filters_context'; -import { FilterIn } from '.'; -import { ComponentType } from '../../../../../common/types/component_type'; +import { FilterInButtonIcon, FilterInContextMenu, FilterInCellAction } from '.'; jest.mock('../../../indicators/hooks/use_indicators_filters_context'); @@ -22,48 +21,46 @@ const mockField: string = 'threat.feed.name'; const mockTestId: string = 'abc'; -describe('', () => { +describe(' ', () => { beforeEach(() => { ( useIndicatorsFiltersContext as jest.MockedFunction ).mockReturnValue(mockIndicatorsFiltersContext); }); - it('should render one EuiButtonIcon', () => { - const component = render( - - ); + it('should render an empty component (wrong data input)', () => { + const component = render(); - expect(component.getByTestId(mockTestId)).toBeInTheDocument(); expect(component).toMatchSnapshot(); }); - it('should render one Component (for EuiDataGrid use)', () => { - const mockType: ComponentType = ComponentType.EuiDataGrid; - const mockComponent: FunctionComponent = () => ; + it('should render an empty component (wrong field input)', () => { + const component = render(); + + expect(component).toMatchSnapshot(); + }); + it('should render one EuiButtonIcon', () => { const component = render( - + ); + expect(component.getByTestId(mockTestId)).toBeInTheDocument(); expect(component).toMatchSnapshot(); }); it('should render one EuiContextMenuItem (for EuiContextMenu use)', () => { - const mockType: ComponentType = ComponentType.ContextMenu; - const component = render(); + const component = render(); expect(component).toMatchSnapshot(); }); - it('should render an empty component (wrong data input)', () => { - const component = render(); - - expect(component).toMatchSnapshot(); - }); + it('should render one Component (for EuiDataGrid use)', () => { + const mockComponent: FunctionComponent = () => ; - it('should render an empty component (wrong field input)', () => { - const component = render(); + const component = render( + + ); expect(component).toMatchSnapshot(); }); diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.tsx index d6d62b3e3538..af6b608c1fb9 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_in/filter_in.tsx @@ -5,22 +5,20 @@ * 2.0. */ -import React, { useCallback, VFC } from 'react'; +import React, { VFC } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonEmpty, EuiButtonIcon, EuiContextMenuItem, EuiToolTip } from '@elastic/eui'; -import { Filter } from '@kbn/es-query'; -import { ComponentType } from '../../../../../common/types/component_type'; -import { useIndicatorsFiltersContext } from '../../../indicators/hooks/use_indicators_filters_context'; -import { - fieldAndValueValid, - getIndicatorFieldAndValue, -} from '../../../indicators/utils/field_value'; -import { FilterIn as FilterInConst, updateFiltersArray } from '../../utils/filter'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { useFilterInOut } from '../../hooks/use_filter_in_out'; +import { FilterIn } from '../../utils/filter'; import { Indicator } from '../../../../../common/types/indicator'; import { useStyles } from './styles'; const ICON_TYPE = 'plusInCircle'; -const ICON_TITLE = i18n.translate('xpack.threatIntelligence.queryBar.filterInButton', { +const ICON_TITLE = i18n.translate('xpack.threatIntelligence.queryBar.filterInButtonIcon', { + defaultMessage: 'Filter In', +}); +const CELL_ACTION_TITLE = i18n.translate('xpack.threatIntelligence.queryBar.filterInCellAction', { defaultMessage: 'Filter In', }); @@ -33,70 +31,36 @@ export interface FilterInProps { * Value used to filter in /out in the KQL bar. */ field: string; - /** - * Dictates the way the FilterIn component is rendered depending on the situation in which it's used - */ - type?: ComponentType; - /** - * Display component for when the FilterIn component is used within a DataGrid - */ - as?: typeof EuiButtonEmpty | typeof EuiButtonIcon | typeof EuiContextMenuItem; /** * Used for unit and e2e tests. */ ['data-test-subj']?: string; } +export interface FilterInCellActionProps extends FilterInProps { + /** + * Display component for when the FilterIn component is used within an {@link EuiDataGrid}. + */ + Component: typeof EuiButtonEmpty | typeof EuiButtonIcon; +} + /** * Retrieves the indicator's field and value, then creates a new {@link Filter} and adds it to the {@link FilterManager}. * - * The component has 3 renders depending on where it's used: within a EuiContextMenu, a EuiDataGrid or not. + * This component renders an {@link EuiButtonIcon}. * - * @returns filter in button + * @returns filter in button icon */ -export const FilterIn: VFC = ({ data, field, type, as: Component, ...props }) => { - const styles = useStyles(); - - const { filterManager } = useIndicatorsFiltersContext(); - - const { key, value } = - typeof data === 'string' ? { key: field, value: data } : getIndicatorFieldAndValue(data, field); - - const filterIn = useCallback((): void => { - const existingFilters = filterManager.getFilters(); - const newFilters: Filter[] = updateFiltersArray(existingFilters, key, value, FilterInConst); - filterManager.setFilters(newFilters); - }, [filterManager, key, value]); - - if (!fieldAndValueValid(key, value)) { +export const FilterInButtonIcon: VFC = ({ + data, + field, + 'data-test-subj': dataTestSub, +}) => { + const { filterFn } = useFilterInOut({ indicator: data, field, filterType: FilterIn }); + if (!filterFn) { return <>; } - if (type === ComponentType.EuiDataGrid) { - return ( - -
- {/* @ts-ignore*/} - -
-
- ); - } - - if (type === ComponentType.ContextMenu) { - return ( - - Filter In - - ); - } - return ( = ({ data, field, type, as: Component, iconSize="s" size="xs" color="primary" - onClick={filterIn} - {...props} + onClick={filterFn} + data-test-subj={dataTestSub} /> ); }; + +/** + * Retrieves the indicator's field and value, then creates a new {@link Filter} and adds it to the {@link FilterManager}. + * + * This component is to be used in an EuiContextMenu. + * + * @returns filter in item for a context menu + */ +export const FilterInContextMenu: VFC = ({ + data, + field, + 'data-test-subj': dataTestSub, +}) => { + const { filterFn } = useFilterInOut({ indicator: data, field, filterType: FilterIn }); + if (!filterFn) { + return <>; + } + + return ( + + + + ); +}; + +/** + * Retrieves the indicator's field and value, then creates a new {@link Filter} and adds it to the {@link FilterManager}. + * + * This component is to be used in an EuiDataGrid. + * + * @returns filter in button for data grid + */ +export const FilterInCellAction: VFC = ({ + data, + field, + Component, + 'data-test-subj': dataTestSub, +}) => { + const styles = useStyles(); + + const { filterFn } = useFilterInOut({ indicator: data, field, filterType: FilterIn }); + if (!filterFn) { + return <>; + } + + return ( + +
+ {/* @ts-ignore*/} + +
+
+ ); +}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/__snapshots__/filter_out.test.tsx.snap b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/__snapshots__/filter_out.test.tsx.snap index bfee4c6363ba..686e543636d0 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/__snapshots__/filter_out.test.tsx.snap +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/__snapshots__/filter_out.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[` should render an empty component (wrong data input) 1`] = ` +exports[` should render an empty component (wrong data input) 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -61,7 +61,7 @@ Object { } `; -exports[` should render an empty component (wrong field input) 1`] = ` +exports[` should render an empty component (wrong field input) 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -122,7 +122,7 @@ Object { } `; -exports[` should render one Component (for EuiDataGrid use) 1`] = ` +exports[` should render one Component (for EuiDataGrid use) 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -223,7 +223,7 @@ Object { } `; -exports[` should render one EuiButtonIcon 1`] = ` +exports[` should render one EuiButtonIcon 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -320,7 +320,7 @@ Object { } `; -exports[` should render one EuiContextMenuItem (for EuiContextMenu use) 1`] = ` +exports[` should render one EuiContextMenuItem (for EuiContextMenu use) 1`] = ` Object { "asFragment": [Function], "baseElement": @@ -340,7 +340,9 @@ Object { - Filter Out + + Filter Out + @@ -362,7 +364,9 @@ Object { - Filter Out + + Filter Out + diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.stories.tsx index cf625c23754a..463b249998eb 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.stories.tsx @@ -7,23 +7,70 @@ import React from 'react'; import { Story } from '@storybook/react'; +import { EuiContextMenuPanel, EuiDataGrid, EuiDataGridColumn } from '@elastic/eui'; +import { EuiDataGridColumnVisibility } from '@elastic/eui/src/components/datagrid/data_grid_types'; import { mockIndicatorsFiltersContext } from '../../../../common/mocks/mock_indicators_filters_context'; import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator'; +import { FilterOutButtonIcon, FilterOutContextMenu, FilterOutCellAction } from '.'; import { IndicatorsFiltersContext } from '../../../indicators/containers/indicators_filters/context'; -import { FilterOut } from '.'; export default { - component: FilterOut, title: 'FilterOut', }; -export const Default: Story = () => { +export const ButtonIcon: Story = () => { const mockIndicator: Indicator = generateMockIndicator(); const mockField: string = 'threat.feed.name'; return ( - + + + ); +}; + +export const ContextMenu: Story = () => { + const mockIndicator: Indicator = generateMockIndicator(); + const mockField: string = 'threat.feed.name'; + const items = []; + + return ( + + + + ); +}; + +export const DataGrid: Story = () => { + const mockIndicator: Indicator = generateMockIndicator(); + const mockField: string = 'threat.feed.name'; + const columnId: string = '1'; + const columns: EuiDataGridColumn[] = [ + { + id: columnId, + cellActions: [ + ({ Component }) => ( + + ), + ], + }, + ]; + const columnVisibility: EuiDataGridColumnVisibility = { + visibleColumns: [columnId], + setVisibleColumns: () => window.alert('setVisibleColumns'), + }; + const rowCount: number = 1; + const renderCellValue = () => <>; + + return ( + + ); }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.test.tsx index 6a65ff503692..fa25a095191d 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.test.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.test.tsx @@ -11,8 +11,7 @@ import { EuiButtonIcon } from '@elastic/eui'; import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator'; import { useIndicatorsFiltersContext } from '../../../indicators/hooks/use_indicators_filters_context'; import { mockIndicatorsFiltersContext } from '../../../../common/mocks/mock_indicators_filters_context'; -import { FilterOut } from '.'; -import { ComponentType } from '../../../../../common/types/component_type'; +import { FilterOutButtonIcon, FilterOutContextMenu, FilterOutCellAction } from '.'; jest.mock('../../../indicators/hooks/use_indicators_filters_context'); @@ -22,49 +21,46 @@ const mockField: string = 'threat.feed.name'; const mockTestId: string = 'abc'; -describe('', () => { +describe(' ', () => { beforeEach(() => { ( useIndicatorsFiltersContext as jest.MockedFunction ).mockReturnValue(mockIndicatorsFiltersContext); }); - it('should render one EuiButtonIcon', () => { - const component = render( - - ); + it('should render an empty component (wrong data input)', () => { + const component = render(); - expect(component.getByTestId(mockTestId)).toBeInTheDocument(); expect(component).toMatchSnapshot(); }); - it('should render one Component (for EuiDataGrid use)', () => { - const mockType: ComponentType = ComponentType.EuiDataGrid; - const mockComponent: FunctionComponent = () => ; + it('should render an empty component (wrong field input)', () => { + const component = render(); + + expect(component).toMatchSnapshot(); + }); + it('should render one EuiButtonIcon', () => { const component = render( - + ); + expect(component.getByTestId(mockTestId)).toBeInTheDocument(); expect(component).toMatchSnapshot(); }); it('should render one EuiContextMenuItem (for EuiContextMenu use)', () => { - const mockType: ComponentType = ComponentType.ContextMenu; - - const component = render(); + const component = render(); expect(component).toMatchSnapshot(); }); - it('should render an empty component (wrong data input)', () => { - const component = render(); - - expect(component).toMatchSnapshot(); - }); + it('should render one Component (for EuiDataGrid use)', () => { + const mockComponent: FunctionComponent = () => ; - it('should render an empty component (wrong field input)', () => { - const component = render(); + const component = render( + + ); expect(component).toMatchSnapshot(); }); diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.tsx index afa1bc02a6ba..3f77c14285f9 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/filter_out/filter_out.tsx @@ -5,22 +5,20 @@ * 2.0. */ -import React, { useCallback, VFC } from 'react'; +import React, { VFC } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonEmpty, EuiButtonIcon, EuiContextMenuItem, EuiToolTip } from '@elastic/eui'; -import { Filter } from '@kbn/es-query'; -import { ComponentType } from '../../../../../common/types/component_type'; -import { useIndicatorsFiltersContext } from '../../../indicators/hooks/use_indicators_filters_context'; -import { - fieldAndValueValid, - getIndicatorFieldAndValue, -} from '../../../indicators/utils/field_value'; -import { FilterOut as FilterOutConst, updateFiltersArray } from '../../utils/filter'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { useFilterInOut } from '../../hooks/use_filter_in_out'; +import { FilterOut } from '../../utils/filter'; import { Indicator } from '../../../../../common/types/indicator'; import { useStyles } from './styles'; const ICON_TYPE = 'minusInCircle'; -const ICON_TITLE = i18n.translate('xpack.threatIntelligence.queryBar.filterOutButton', { +const ICON_TITLE = i18n.translate('xpack.threatIntelligence.queryBar.filterOutButtonIcon', { + defaultMessage: 'Filter Out', +}); +const CELL_ACTION_TITLE = i18n.translate('xpack.threatIntelligence.queryBar.filterOutCellAction', { defaultMessage: 'Filter Out', }); @@ -33,70 +31,36 @@ export interface FilterOutProps { * Value used to filter in /out in the KQL bar. */ field: string; - /** - * Dictates the way the FilterOut component is rendered depending on the situation in which it's used - */ - type?: ComponentType; - /** - * Display component for when the FilterIn component is used within a DataGrid - */ - as?: typeof EuiButtonEmpty | typeof EuiButtonIcon; /** * Used for unit and e2e tests. */ ['data-test-subj']?: string; } +export interface FilterOutCellActionProps extends FilterOutProps { + /** + * Display component for when the FilterIn component is used within an {@link EuiDataGrid}. + */ + Component: typeof EuiButtonEmpty | typeof EuiButtonIcon; +} + /** * Retrieves the indicator's field and value, then creates a new {@link Filter} and adds it to the {@link FilterManager}. * - * The component has 3 renders depending on where it's used: within a EuiContextMenu, a EuiDataGrid or not. + * This component renders an {@link EuiButtonIcon}. * - * @returns filter out button + * @returns filter out button icon */ -export const FilterOut: VFC = ({ data, field, type, as: Component, ...props }) => { - const styles = useStyles(); - - const { filterManager } = useIndicatorsFiltersContext(); - - const { key, value } = - typeof data === 'string' ? { key: field, value: data } : getIndicatorFieldAndValue(data, field); - - const filterOut = useCallback(() => { - const existingFilters: Filter[] = filterManager.getFilters(); - const newFilters: Filter[] = updateFiltersArray(existingFilters, key, value, FilterOutConst); - filterManager.setFilters(newFilters); - }, [filterManager, key, value]); - - if (!fieldAndValueValid(key, value)) { +export const FilterOutButtonIcon: VFC = ({ + data, + field, + 'data-test-subj': dataTestSub, +}) => { + const { filterFn } = useFilterInOut({ indicator: data, field, filterType: FilterOut }); + if (!filterFn) { return <>; } - if (type === ComponentType.EuiDataGrid) { - return ( - -
- {/* @ts-ignore*/} - -
-
- ); - } - - if (type === ComponentType.ContextMenu) { - return ( - - Filter Out - - ); - } - return ( = ({ data, field, type, as: Componen iconSize="s" size="xs" color="primary" - onClick={filterOut} - {...props} + onClick={filterFn} + data-test-subj={dataTestSub} /> ); }; + +/** + * Retrieves the indicator's field and value, then creates a new {@link Filter} and adds it to the {@link FilterManager}. + * + * This component is to be used in an EuiContextMenu. + * + * @returns filter in item for a context menu + */ +export const FilterOutContextMenu: VFC = ({ + data, + field, + 'data-test-subj': dataTestSub, +}) => { + const { filterFn } = useFilterInOut({ indicator: data, field, filterType: FilterOut }); + if (!filterFn) { + return <>; + } + + return ( + + + + ); +}; + +/** + * Retrieves the indicator's field and value, then creates a new {@link Filter} and adds it to the {@link FilterManager}. + * + * This component is to be used in an EuiDataGrid. + * + * @returns filter in button for data grid + */ +export const FilterOutCellAction: VFC = ({ + data, + field, + Component, + 'data-test-subj': dataTestSub, +}) => { + const styles = useStyles(); + + const { filterFn } = useFilterInOut({ indicator: data, field, filterType: FilterOut }); + if (!filterFn) { + return <>; + } + + return ( + +
+ {/* @ts-ignore*/} + +
+
+ ); +}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filter_in_out.test.ts b/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filter_in_out.test.ts new file mode 100644 index 000000000000..6099ed848667 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filter_in_out.test.ts @@ -0,0 +1,56 @@ +/* + * 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 { renderHook, RenderHookResult, Renderer } from '@testing-library/react-hooks'; +import { + generateMockIndicator, + generateMockUrlIndicator, + Indicator, +} from '../../../../common/types/indicator'; +import { TestProvidersComponent } from '../../../common/mocks/test_providers'; +import { useFilterInOut, UseFilterInValue } from './use_filter_in_out'; +import { FilterIn } from '../utils/filter'; + +describe('useFilterInOut()', () => { + let hookResult: RenderHookResult<{}, UseFilterInValue, Renderer>; + + it('should return empty object if Indicator is incorrect', () => { + const indicator: Indicator = generateMockIndicator(); + indicator.fields['threat.indicator.name'] = ['wrong']; + const field: string = 'field'; + const filterType = FilterIn; + + hookResult = renderHook(() => useFilterInOut({ indicator, field, filterType }), { + wrapper: TestProvidersComponent, + }); + expect(hookResult.result.current).toEqual({}); + }); + + it('should return filterFn for Indicator', () => { + const indicator: Indicator = generateMockUrlIndicator(); + const field: string = 'threat.indicator.name'; + const filterType = FilterIn; + + hookResult = renderHook(() => useFilterInOut({ indicator, field, filterType }), { + wrapper: TestProvidersComponent, + }); + + expect(hookResult.result.current).toHaveProperty('filterFn'); + }); + + it('should return filterFn for string', () => { + const indicator: string = '0.0.0.0'; + const field: string = 'threat.indicator.name'; + const filterType = FilterIn; + + hookResult = renderHook(() => useFilterInOut({ indicator, field, filterType }), { + wrapper: TestProvidersComponent, + }); + + expect(hookResult.result.current).toHaveProperty('filterFn'); + }); +}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filter_in_out.ts b/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filter_in_out.ts new file mode 100644 index 000000000000..d44bb8528afa --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filter_in_out.ts @@ -0,0 +1,66 @@ +/* + * 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 { useCallback } from 'react'; +import { Filter } from '@kbn/es-query'; +import { useIndicatorsFiltersContext } from '../../indicators/hooks/use_indicators_filters_context'; +import { fieldAndValueValid, getIndicatorFieldAndValue } from '../../indicators/utils/field_value'; +import { FilterIn, FilterOut, updateFiltersArray } from '../utils/filter'; +import { Indicator } from '../../../../common/types/indicator'; + +export interface UseFilterInParam { + /** + * Indicator used to retrieve the field and value then use to update the filters + */ + indicator: Indicator | string; + /** + * Value used to filter in /out in the KQL bar. + */ + field: string; + /** + * To filter in or out. + */ + filterType: typeof FilterIn | typeof FilterOut; +} + +export interface UseFilterInValue { + /** + * Filter function to run on click event. + */ + filterFn: (() => void) | undefined; +} + +/** + * Custom hook that uses an indicator, a field and a type (FilterIn or FilterOut) and returns the filter function. + * + */ +export const useFilterInOut = ({ + indicator, + field, + filterType, +}: UseFilterInParam): UseFilterInValue => { + const { filterManager } = useIndicatorsFiltersContext(); + + const { key, value } = + typeof indicator === 'string' + ? { key: field, value: indicator } + : getIndicatorFieldAndValue(indicator, field); + + const filterFn = useCallback((): void => { + const existingFilters = filterManager.getFilters(); + const newFilters: Filter[] = updateFiltersArray(existingFilters, key, value, filterType); + filterManager.setFilters(newFilters); + }, [filterManager, filterType, key, value]); + + if (!fieldAndValueValid(key, value)) { + return {} as unknown as UseFilterInValue; + } + + return { + filterFn, + }; +}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.stories.tsx index ee3f2d67ed91..beefdafd9d59 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.stories.tsx @@ -9,13 +9,12 @@ import React from 'react'; import { Story } from '@storybook/react'; import { CoreStart } from '@kbn/core/public'; import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public'; +import { EuiContextMenuPanel } from '@elastic/eui'; import { mockKibanaTimelinesService } from '../../../../common/mocks/mock_kibana_timelines_service'; -import { EMPTY_VALUE } from '../../../../../common/constants'; import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator'; -import { AddToTimeline } from './add_to_timeline'; +import { AddToTimelineButtonIcon, AddToTimelineContextMenu } from './add_to_timeline'; export default { - component: AddToTimeline, title: 'AddToTimeline', }; @@ -25,28 +24,23 @@ const KibanaReactContext = createKibanaReactContext({ timelines: mockKibanaTimelinesService, } as unknown as CoreStart); -export const Default: Story = () => { +export const ButtonIcon: Story = () => { const mockData: Indicator = generateMockIndicator(); return ( - + ); }; -export const WithIndicator: Story = () => { - const mockData: string = 'ip'; +export const ContextMenu: Story = () => { + const mockData: Indicator = generateMockIndicator(); + const items = []; return ( - + ); }; - -export const EmptyValue: Story = () => ( - - - -); diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.test.tsx index b8ca854613b0..85e581bc8dc1 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.test.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { render } from '@testing-library/react'; import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator'; import { EMPTY_VALUE } from '../../../../../common/constants'; -import { AddToTimeline } from './add_to_timeline'; +import { AddToTimelineButtonIcon } from './add_to_timeline'; import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; describe('', () => { @@ -19,7 +19,7 @@ describe('', () => { const component = render( - + ); expect(component).toMatchSnapshot(); @@ -31,7 +31,7 @@ describe('', () => { const component = render( - + ); expect(component).toMatchSnapshot(); @@ -43,7 +43,7 @@ describe('', () => { const component = render( - + ); expect(component).toMatchSnapshot(); @@ -56,7 +56,7 @@ describe('', () => { const component = render( - + ); expect(component).toMatchSnapshot(); @@ -69,7 +69,7 @@ describe('', () => { const component = render( - + ); expect(component).toMatchSnapshot(); @@ -81,7 +81,7 @@ describe('', () => { const component = render( - + ); expect(component).toMatchSnapshot(); diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.tsx index 5b33a3bfeaa3..44f9df4225ba 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/add_to_timeline/add_to_timeline.tsx @@ -13,7 +13,6 @@ import { EuiContextMenuItem, EuiFlexItem, EuiToolTip } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { generateDataProvider } from '../../utils/data_provider'; -import { ComponentType } from '../../../../../common/types/component_type'; import { fieldAndValueValid, getIndicatorFieldAndValue, @@ -21,6 +20,18 @@ import { import { useKibana } from '../../../../hooks/use_kibana'; import { Indicator } from '../../../../../common/types/indicator'; import { useStyles } from './styles'; +import { useAddToTimeline } from '../../hooks/use_add_to_timeline'; + +const BUTTON_ICON_TOOLTIP = i18n.translate( + 'xpack.threatIntelligence.timeline.addToTimelineButtonIcon', + { defaultMessage: 'Add to Timeline' } +); +const CELL_ACTION_TOOLTIP = i18n.translate( + 'xpack.threatIntelligence.timeline.addToTimelineCellAction', + { + defaultMessage: 'Add to Timeline', + } +); export interface AddToTimelineProps { /** @@ -32,30 +43,61 @@ export interface AddToTimelineProps { */ field: string; /** - * Dictates the way the FilterIn component is rendered depending on the situation in which it's used + * Used for unit and e2e tests. */ - type?: ComponentType; + ['data-test-subj']?: string; +} + +export interface AddToTimelineCellActionProps extends AddToTimelineProps { /** * Only used with `EuiDataGrid` (see {@link AddToTimelineButtonProps}). */ - as?: typeof EuiButtonEmpty | typeof EuiButtonIcon; - /** - * Used for unit and e2e tests. - */ - ['data-test-subj']?: string; + Component: typeof EuiButtonEmpty | typeof EuiButtonIcon; } /** - * Add to timeline button, used in many places throughout the TI plugin. - * Support being passed a {@link Indicator} or a string, can be used in a `EuiDataGrid` or as a normal button. - * Leverages the built-in functionality retrieves from the timeLineService (see ThreatIntelligenceSecuritySolutionContext in x-pack/plugins/threat_intelligence/public/types.ts) + * Add to timeline feature, leverages the built-in functionality retrieves from the timeLineService (see ThreatIntelligenceSecuritySolutionContext in x-pack/plugins/threat_intelligence/public/types.ts) * Clicking on the button will add a key-value pair to an Untitled timeline. * - * The component has 2 renders depending on where it's used: within a EuiContextMenu or not. + * This component is renders an {@link EuiButtonIcon}. * - * @returns add to timeline button or an empty component. + * @returns add to timeline button or an empty component */ -export const AddToTimeline: VFC = ({ data, field, type, as, ...props }) => { +export const AddToTimelineButtonIcon: VFC = ({ + data, + field, + 'data-test-subj': dataTestSubj, +}) => { + const addToTimelineButton = + useKibana().services.timelines.getHoverActions().getAddToTimelineButton; + + const { addToTimelineProps } = useAddToTimeline({ indicator: data, field }); + if (!addToTimelineProps) { + return <>; + } + + return ( + + + {addToTimelineButton(addToTimelineProps)} + + + ); +}; + +/** + * Add to timeline feature, leverages the built-in functionality retrieves from the timeLineService (see ThreatIntelligenceSecuritySolutionContext in x-pack/plugins/threat_intelligence/public/types.ts) + * Clicking on the button will add a key-value pair to an Untitled timeline. + * + * This component is to be used in an EuiContextMenu. + * + * @returns add to timeline item for a context menu + */ +export const AddToTimelineContextMenu: VFC = ({ + data, + field, + 'data-test-subj': dataTestSubj, +}) => { const styles = useStyles(); const contextMenuRef = useRef(null); @@ -81,37 +123,55 @@ export const AddToTimeline: VFC = ({ data, field, type, as, // Use case is for the barchart legend (for example). // We can't use the addToTimelineButton directly because the UI doesn't work in a EuiContextMenu. // We hide it and use the defaultFocusedButtonRef props to programmatically click it. - if (type === ComponentType.ContextMenu) { - addToTimelineProps.defaultFocusedButtonRef = contextMenuRef; - - return ( - <> -
{addToTimelineButton(addToTimelineProps)}
- contextMenuRef.current?.click()} - {...props} - > - - - - ); - } + addToTimelineProps.defaultFocusedButtonRef = contextMenuRef; + + return ( + <> +
{addToTimelineButton(addToTimelineProps)}
+ contextMenuRef.current?.click()} + data-test-subj={dataTestSubj} + > + + + + ); +}; - if (as) addToTimelineProps.Component = as; +/** + * Add to timeline feature, leverages the built-in functionality retrieves from the timeLineService (see ThreatIntelligenceSecuritySolutionContext in x-pack/plugins/threat_intelligence/public/types.ts) + * Clicking on the button will add a key-value pair to an Untitled timeline. + * + * This component is to be used as a cellAction in an {@link EuiDataGrid}. + * + * @returns add to timeline button or an empty component + */ +export const AddToTimelineCellAction: VFC = ({ + data, + field, + Component, + 'data-test-subj': dataTestSubj, +}) => { + const addToTimelineButton = + useKibana().services.timelines.getHoverActions().getAddToTimelineButton; + + const { addToTimelineProps } = useAddToTimeline({ indicator: data, field }); + if (!addToTimelineProps) { + return <>; + } + addToTimelineProps.Component = Component; return ( - - {addToTimelineButton(addToTimelineProps)} + + + {addToTimelineButton(addToTimelineProps)} + ); }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/__snapshots__/investigate_in_timeline.test.tsx.snap b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/__snapshots__/investigate_in_timeline.test.tsx.snap new file mode 100644 index 000000000000..0db32e3424f5 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/__snapshots__/investigate_in_timeline.test.tsx.snap @@ -0,0 +1,313 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` should render button when Indicator data is correct 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+ +
+ , + "container":
+ +
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[` should render empty component when Indicator data is incorrect 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+ , + "container":
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[` should render button icon when Indicator data is correct 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+ + + +
+ , + "container":
+ + + +
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[` should render empty component when calculated value is - 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+ , + "container":
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/index.ts b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/index.ts new file mode 100644 index 000000000000..34bd1d7d5627 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/index.ts @@ -0,0 +1,8 @@ +/* + * 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. + */ + +export * from './investigate_in_timeline'; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/investigate_in_timeline_button_icon.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/investigate_in_timeline.stories.tsx similarity index 67% rename from x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/investigate_in_timeline_button_icon.stories.tsx rename to x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/investigate_in_timeline.stories.tsx index 15c5bc0c23ed..08fe4b782c2c 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/investigate_in_timeline_button_icon.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/investigate_in_timeline.stories.tsx @@ -9,16 +9,23 @@ import React from 'react'; import { Story } from '@storybook/react'; import { StoryProvidersComponent } from '../../../../common/mocks/story_providers'; import { generateMockUrlIndicator } from '../../../../../common/types/indicator'; -import { InvestigateInTimelineButtonIcon } from './investigate_in_timeline_button_icon'; +import { InvestigateInTimelineButton, InvestigateInTimelineButtonIcon } from '.'; export default { - component: InvestigateInTimelineButtonIcon, - title: 'InvestigateInTimelineButtonIcon', + title: 'InvestigateInTimeline', }; const mockIndicator = generateMockUrlIndicator(); -export const Default: Story = () => { +export const Button: Story = () => { + return ( + + + + ); +}; + +export const ButtonIcon: Story = () => { return ( diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/investigate_in_timeline.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/investigate_in_timeline.test.tsx new file mode 100644 index 000000000000..cd7aba14fff5 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/investigate_in_timeline.test.tsx @@ -0,0 +1,77 @@ +/* + * 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 React from 'react'; +import { render } from '@testing-library/react'; +import { + generateMockIndicator, + generateMockUrlIndicator, + Indicator, +} from '../../../../../common/types/indicator'; +import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; +import { InvestigateInTimelineButton, InvestigateInTimelineButtonIcon } from '.'; +import { EMPTY_VALUE } from '../../../../../common/constants'; + +describe('', () => { + describe('', () => { + it('should render button when Indicator data is correct', () => { + const mockData: Indicator = generateMockUrlIndicator(); + const mockId = 'mockId'; + + const component = render( + + + + ); + + expect(component.getByTestId(mockId)).toBeInTheDocument(); + expect(component).toMatchSnapshot(); + }); + + it('should render empty component when Indicator data is incorrect', () => { + const mockData: Indicator = generateMockIndicator(); + mockData.fields['threat.indicator.first_seen'] = ['']; + + const component = render( + + + + ); + + expect(component).toMatchSnapshot(); + }); + }); + + describe('', () => { + it('should render button icon when Indicator data is correct', () => { + const mockData: Indicator = generateMockUrlIndicator(); + const mockId = 'mockId'; + + const component = render( + + + + ); + + expect(component.getByTestId(mockId)).toBeInTheDocument(); + expect(component).toMatchSnapshot(); + }); + + it(`should render empty component when calculated value is ${EMPTY_VALUE}`, () => { + const mockData: Indicator = generateMockIndicator(); + mockData.fields['threat.indicator.first_seen'] = ['']; + + const component = render( + + + + ); + + expect(component).toMatchSnapshot(); + }); + }); +}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/investigate_in_timeline.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/investigate_in_timeline.tsx new file mode 100644 index 000000000000..cd1f7ce2a2d9 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline/investigate_in_timeline.tsx @@ -0,0 +1,90 @@ +/* + * 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 React, { VFC } from 'react'; +import { EuiButton, EuiButtonIcon, EuiToolTip } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { i18n } from '@kbn/i18n'; +import { useInvestigateInTimeline } from '../../hooks/use_investigate_in_timeline'; +import { Indicator } from '../../../../../common/types/indicator'; + +const BUTTON_ICON_LABEL: string = i18n.translate( + 'xpack.threatIntelligence.timeline.investigateInTimelineButtonIcon', + { + defaultMessage: 'Investigate in Timeline', + } +); + +export interface InvestigateInTimelineButtonProps { + /** + * Value passed to the timeline. Used in combination with field if is type of {@link Indicator}. + */ + data: Indicator; + /** + * Used for unit and e2e tests. + */ + ['data-test-subj']?: string; +} + +/** + * Investigate in timeline button, uses the InvestigateInTimelineAction component (x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx) + * retrieved from the SecuritySolutionContext. + * + * This component renders an {@link EuiButton}. + * + * @returns add to timeline button + */ +export const InvestigateInTimelineButton: VFC = ({ + data, + 'data-test-subj': dataTestSub, +}) => { + const { investigateInTimelineFn } = useInvestigateInTimeline({ indicator: data }); + if (!investigateInTimelineFn) { + return <>; + } + + return ( + + + + ); +}; + +/** + * Investigate in timeline button uses the InvestigateInTimelineAction component (x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx) + * retrieved from the SecuritySolutionContext. + * + * This component renders an {@link EuiButtonIcon}. + * + * @returns add to timeline button icon + */ +export const InvestigateInTimelineButtonIcon: VFC = ({ + data, + 'data-test-subj': dataTestSub, +}) => { + const { investigateInTimelineFn } = useInvestigateInTimeline({ indicator: data }); + if (!investigateInTimelineFn) { + return <>; + } + + return ( + + + + ); +}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/__snapshots__/investigate_in_timeline_button.test.tsx.snap b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/__snapshots__/investigate_in_timeline_button.test.tsx.snap deleted file mode 100644 index a01cfb51e66d..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/__snapshots__/investigate_in_timeline_button.test.tsx.snap +++ /dev/null @@ -1,155 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render button when Indicator data is correct 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
- -
- , - "container":
- -
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; - -exports[` should render empty component when Indicator data is incorrect 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
- , - "container":
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/investigate_in_timeline_button.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/investigate_in_timeline_button.stories.tsx deleted file mode 100644 index c3c8e65001a3..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/investigate_in_timeline_button.stories.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { Story } from '@storybook/react'; -import { StoryProvidersComponent } from '../../../../common/mocks/story_providers'; -import { generateMockUrlIndicator } from '../../../../../common/types/indicator'; -import { InvestigateInTimelineButton } from './investigate_in_timeline_button'; - -export default { - component: InvestigateInTimelineButton, - title: 'InvestigateInTimelineButton', -}; - -const mockIndicator = generateMockUrlIndicator(); - -export const Default: Story = () => { - return ( - - - - ); -}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/investigate_in_timeline_button.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/investigate_in_timeline_button.test.tsx deleted file mode 100644 index b064ead7e645..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/investigate_in_timeline_button.test.tsx +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { render } from '@testing-library/react'; -import { - generateMockIndicator, - generateMockUrlIndicator, - Indicator, -} from '../../../../../common/types/indicator'; -import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; -import { InvestigateInTimelineButton } from './investigate_in_timeline_button'; - -describe('', () => { - it('should render button when Indicator data is correct', () => { - const mockData: Indicator = generateMockUrlIndicator(); - const mockId = 'mockId'; - - const component = render( - - - - ); - - expect(component.getByTestId(mockId)).toBeInTheDocument(); - expect(component).toMatchSnapshot(); - }); - - it('should render empty component when Indicator data is incorrect', () => { - const mockData: Indicator = generateMockIndicator(); - mockData.fields['threat.indicator.first_seen'] = ['']; - - const component = render( - - - - ); - - expect(component).toMatchSnapshot(); - }); -}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/investigate_in_timeline_button.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/investigate_in_timeline_button.tsx deleted file mode 100644 index 479f17527562..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button/investigate_in_timeline_button.tsx +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { VFC } from 'react'; -import { EuiButton } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n-react'; -import { useInvestigateInTimeline } from '../../hooks/use_investigate_in_timeline'; -import { Indicator } from '../../../../../common/types/indicator'; - -export interface InvestigateInTimelineButtonProps { - /** - * Value passed to the timeline. Used in combination with field if is type of {@link Indicator}. - */ - data: Indicator; - /** - * Used for unit and e2e tests. - */ - ['data-test-subj']?: string; -} - -/** - * Investigate in timeline button, supports being passed a {@link Indicator}. - * This implementation uses the InvestigateInTimelineAction component (x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx) - * retrieved from the SecuritySolutionContext. - * - * @returns add to timeline button or an empty component. - */ -export const InvestigateInTimelineButton: VFC = ({ - data, - ...props -}) => { - const { onClick } = useInvestigateInTimeline({ indicator: data }); - - if (!onClick) { - return <>; - } - - return ( - - - - ); -}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/__snapshots__/investigate_in_timeline_button_icon.test.tsx.snap b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/__snapshots__/investigate_in_timeline_button_icon.test.tsx.snap deleted file mode 100644 index 263e893f3f8b..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/__snapshots__/investigate_in_timeline_button_icon.test.tsx.snap +++ /dev/null @@ -1,159 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render button icon when Indicator data is correct 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
- - - -
- , - "container":
- - - -
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; - -exports[` should render empty component when calculated value is - 1`] = ` -Object { - "asFragment": [Function], - "baseElement": -
- , - "container":
, - "debug": [Function], - "findAllByAltText": [Function], - "findAllByDisplayValue": [Function], - "findAllByLabelText": [Function], - "findAllByPlaceholderText": [Function], - "findAllByRole": [Function], - "findAllByTestId": [Function], - "findAllByText": [Function], - "findAllByTitle": [Function], - "findByAltText": [Function], - "findByDisplayValue": [Function], - "findByLabelText": [Function], - "findByPlaceholderText": [Function], - "findByRole": [Function], - "findByTestId": [Function], - "findByText": [Function], - "findByTitle": [Function], - "getAllByAltText": [Function], - "getAllByDisplayValue": [Function], - "getAllByLabelText": [Function], - "getAllByPlaceholderText": [Function], - "getAllByRole": [Function], - "getAllByTestId": [Function], - "getAllByText": [Function], - "getAllByTitle": [Function], - "getByAltText": [Function], - "getByDisplayValue": [Function], - "getByLabelText": [Function], - "getByPlaceholderText": [Function], - "getByRole": [Function], - "getByTestId": [Function], - "getByText": [Function], - "getByTitle": [Function], - "queryAllByAltText": [Function], - "queryAllByDisplayValue": [Function], - "queryAllByLabelText": [Function], - "queryAllByPlaceholderText": [Function], - "queryAllByRole": [Function], - "queryAllByTestId": [Function], - "queryAllByText": [Function], - "queryAllByTitle": [Function], - "queryByAltText": [Function], - "queryByDisplayValue": [Function], - "queryByLabelText": [Function], - "queryByPlaceholderText": [Function], - "queryByRole": [Function], - "queryByTestId": [Function], - "queryByText": [Function], - "queryByTitle": [Function], - "rerender": [Function], - "unmount": [Function], -} -`; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/investigate_in_timeline_button_icon.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/investigate_in_timeline_button_icon.test.tsx deleted file mode 100644 index 3cdaa0528ca5..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/investigate_in_timeline_button_icon.test.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React from 'react'; -import { render } from '@testing-library/react'; -import { - generateMockIndicator, - generateMockUrlIndicator, - Indicator, -} from '../../../../../common/types/indicator'; -import { EMPTY_VALUE } from '../../../../../common/constants'; -import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; -import { InvestigateInTimelineButtonIcon } from './investigate_in_timeline_button_icon'; - -describe('', () => { - it('should render button icon when Indicator data is correct', () => { - const mockData: Indicator = generateMockUrlIndicator(); - const mockId = 'mockId'; - - const component = render( - - - - ); - - expect(component.getByTestId(mockId)).toBeInTheDocument(); - expect(component).toMatchSnapshot(); - }); - - it(`should render empty component when calculated value is ${EMPTY_VALUE}`, () => { - const mockData: Indicator = generateMockIndicator(); - mockData.fields['threat.indicator.first_seen'] = ['']; - - const component = render( - - - - ); - - expect(component).toMatchSnapshot(); - }); -}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/investigate_in_timeline_button_icon.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/investigate_in_timeline_button_icon.tsx deleted file mode 100644 index 888f420a3cac..000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/components/investigate_in_timeline_button_icon/investigate_in_timeline_button_icon.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import React, { VFC } from 'react'; -import { EuiButtonIcon, EuiToolTip } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; -import { useInvestigateInTimeline } from '../../hooks/use_investigate_in_timeline'; -import { Indicator } from '../../../../../common/types/indicator'; - -const BUTTON_LABEL: string = i18n.translate( - 'xpack.threatIntelligence.investigateInTimelineButtonIcon', - { - defaultMessage: 'Investigate in Timeline', - } -); - -export interface InvestigateInTimelineButtonIconProps { - /** - * Value passed to the timeline. Used in combination with field if is type of {@link Indicator}. - */ - data: Indicator; - /** - * Used for unit and e2e tests. - */ - ['data-test-subj']?: string; -} - -/** - * Investigate in timeline button, supports being passed a {@link Indicator}. - * This implementation uses the InvestigateInTimelineAction component (x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/investigate_in_timeline_action.tsx) - * retrieved from the SecuritySolutionContext. - * - * @returns add to timeline button or an empty component. - */ -export const InvestigateInTimelineButtonIcon: VFC = ({ - data, - ...props -}) => { - const { onClick } = useInvestigateInTimeline({ indicator: data }); - - if (!onClick) { - return <>; - } - - return ( - - - - ); -}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/index.ts b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/index.ts index b4e2c354c6df..fa8129790129 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/index.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/index.ts @@ -5,4 +5,5 @@ * 2.0. */ +export * from './use_add_to_timeline'; export * from './use_investigate_in_timeline'; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_add_to_timeline.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_add_to_timeline.test.tsx new file mode 100644 index 000000000000..a92c75227310 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_add_to_timeline.test.tsx @@ -0,0 +1,62 @@ +/* + * 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 { EMPTY_VALUE } from '../../../../common/constants'; +import { renderHook, RenderHookResult, Renderer } from '@testing-library/react-hooks'; +import { + generateMockIndicator, + generateMockUrlIndicator, + Indicator, +} from '../../../../common/types/indicator'; +import { TestProvidersComponent } from '../../../common/mocks/test_providers'; +import { useAddToTimeline, UseAddToTimelineValue } from './use_add_to_timeline'; + +describe('useInvestigateInTimeline()', () => { + let hookResult: RenderHookResult<{}, UseAddToTimelineValue, Renderer>; + + xit('should return empty object if Indicator is incorrect', () => { + const indicator: Indicator = generateMockIndicator(); + indicator.fields['threat.indicator.name'] = ['wrong']; + const field = 'threat.indicator.name'; + + hookResult = renderHook(() => useAddToTimeline({ indicator, field }), { + wrapper: TestProvidersComponent, + }); + expect(hookResult.result.current).toEqual({}); + }); + + it(`should return empty object if indicator string is ${EMPTY_VALUE}`, () => { + const indicator: string = EMPTY_VALUE; + const field = 'threat.indicator.ip'; + + hookResult = renderHook(() => useAddToTimeline({ indicator, field }), { + wrapper: TestProvidersComponent, + }); + expect(hookResult.result.current).toEqual({}); + }); + + xit('should return empty object if field is incorrect', () => { + const indicator: Indicator = generateMockIndicator(); + const field = 'abc'; + + hookResult = renderHook(() => useAddToTimeline({ indicator, field }), { + wrapper: TestProvidersComponent, + }); + expect(hookResult.result.current).toEqual({}); + }); + + xit('should return addToTimelineProps', () => { + const indicator: Indicator = generateMockUrlIndicator(); + const field = 'threat.indicator.ip'; + + hookResult = renderHook(() => useAddToTimeline({ indicator, field }), { + wrapper: TestProvidersComponent, + }); + + expect(hookResult.result.current).toHaveProperty('addToTimelineProps'); + }); +}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_add_to_timeline.ts b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_add_to_timeline.ts new file mode 100644 index 000000000000..ab69481d3b52 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_add_to_timeline.ts @@ -0,0 +1,61 @@ +/* + * 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 { DataProvider } from '@kbn/timelines-plugin/common'; +import { AddToTimelineButtonProps } from '@kbn/timelines-plugin/public'; +import { generateDataProvider } from '../utils/data_provider'; +import { fieldAndValueValid, getIndicatorFieldAndValue } from '../../indicators/utils/field_value'; +import { Indicator } from '../../../../common/types/indicator'; + +export interface UseAddToTimelineParam { + /** + * Indicator used to retrieve the field and value then passed to the Investigate in Timeline logic + */ + indicator: Indicator | string; + /** + * Indicator's field to retrieve indicator's value + */ + field: string; +} + +export interface UseAddToTimelineValue { + /** + * Props to pass to the addToTimeline feature. + */ + addToTimelineProps: AddToTimelineButtonProps | undefined; +} + +/** + * Custom hook that gets an {@link Indicator}, retrieves the field (from the RawIndicatorFieldId.Name) + * and value, then creates DataProviders used to do the Investigate in Timeline logic + * (see /kibana/x-pack/plugins/security_solution/public/threat_intelligence/use_investigate_in_timeline.ts) + */ +export const useAddToTimeline = ({ + indicator, + field, +}: UseAddToTimelineParam): UseAddToTimelineValue => { + const { key, value } = + typeof indicator === 'string' + ? { key: field, value: indicator } + : getIndicatorFieldAndValue(indicator, field); + + if (!fieldAndValueValid(key, value)) { + return {} as unknown as UseAddToTimelineValue; + } + + const dataProvider: DataProvider[] = [generateDataProvider(key, value as string)]; + + const addToTimelineProps: AddToTimelineButtonProps = { + dataProvider, + field: key, + ownFocus: false, + }; + + return { + addToTimelineProps, + }; +}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_investigate_in_timeline.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_investigate_in_timeline.test.tsx index cbc040a936dc..30c42d7096f2 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_investigate_in_timeline.test.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_investigate_in_timeline.test.tsx @@ -13,6 +13,7 @@ import { import { generateMockIndicator, generateMockUrlIndicator, + Indicator, } from '../../../../common/types/indicator'; import { TestProvidersComponent } from '../../../common/mocks/test_providers'; @@ -20,7 +21,7 @@ describe('useInvestigateInTimeline()', () => { let hookResult: RenderHookResult<{}, UseInvestigateInTimelineValue, Renderer>; it('should return empty object if Indicator is incorrect', () => { - const indicator = generateMockIndicator(); + const indicator: Indicator = generateMockIndicator(); indicator.fields['threat.indicator.name'] = ['wrong']; hookResult = renderHook(() => useInvestigateInTimeline({ indicator }), { @@ -29,13 +30,13 @@ describe('useInvestigateInTimeline()', () => { expect(hookResult.result.current).toEqual({}); }); - it('should return ', () => { - const indicator = generateMockUrlIndicator(); + it('should return investigateInTimelineFn', () => { + const indicator: Indicator = generateMockUrlIndicator(); hookResult = renderHook(() => useInvestigateInTimeline({ indicator }), { wrapper: TestProvidersComponent, }); - expect(hookResult.result.current).toHaveProperty('onClick'); + expect(hookResult.result.current).toHaveProperty('investigateInTimelineFn'); }); }); diff --git a/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_investigate_in_timeline.ts b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_investigate_in_timeline.ts index 4f79990d00c3..efae8b441a67 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_investigate_in_timeline.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/timeline/hooks/use_investigate_in_timeline.ts @@ -26,7 +26,10 @@ export interface UseInvestigateInTimelineParam { } export interface UseInvestigateInTimelineValue { - onClick: (() => Promise) | undefined; + /** + * Investigate in Timeline function to run on click event. + */ + investigateInTimelineFn: (() => Promise) | undefined; } /** @@ -51,13 +54,13 @@ export const useInvestigateInTimeline = ({ const to = unwrapValue(indicator, RawIndicatorFieldId.TimeStamp) as string; const from = moment(to).subtract(10, 'm').toISOString(); - const investigateInTimelineClick = securitySolutionContext?.getUseInvestigateInTimeline({ + const investigateInTimelineFn = securitySolutionContext?.getUseInvestigateInTimeline({ dataProviders, from, to, }); return { - onClick: investigateInTimelineClick, + investigateInTimelineFn, }; }; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/__snapshots__/popover_form.test.tsx.snap b/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/__snapshots__/popover_form.test.tsx.snap index 5f74967ff423..966b3487ebfb 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/__snapshots__/popover_form.test.tsx.snap +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/__snapshots__/popover_form.test.tsx.snap @@ -2,12 +2,12 @@ exports[`Transform: Aggregation Minimal initialization 1`] = ` ', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + test('Minimal initialization', () => { const defaultData: PivotAggsConfig = { agg: PIVOT_SUPPORTED_AGGS.CARDINALITY, @@ -37,4 +40,67 @@ describe('Transform: Aggregation ', () => { expect(wrapper).toMatchSnapshot(); }); + + test('preserves the field for unsupported aggs', async () => { + const mockOnChange = jest.fn(); + const { getByTestId } = render( + + + + ); + + const aggNameInput = getByTestId('transformAggName'); + fireEvent.change(aggNameInput, { + target: { value: 'betterName' }, + }); + + const applyButton = getByTestId('transformApplyAggChanges'); + fireEvent.click(applyButton); + + expect(mockOnChange).toHaveBeenCalledTimes(1); + expect(mockOnChange).toHaveBeenCalledWith({ + field: 'AvgTicketPrice', + keyed: true, + ranges: [ + { + to: 500, + }, + { + from: 500, + to: 700, + }, + { + from: 700, + }, + ], + // @ts-ignore + agg: 'range', + aggName: 'betterName', + dropDownName: 'AvgTicketPrice.ranges', + }); + }); }); diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/popover_form.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/popover_form.tsx index 56eeea8a242c..0585d4553a99 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/popover_form.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/popover_form.tsx @@ -100,8 +100,8 @@ export const PopoverForm: React.FC = ({ defaultData, otherAggNames, onCha ...aggConfigDef, agg, aggName, - field: resultField, dropDownName: defaultData.dropDownName, + ...(isUnsupportedAgg ? {} : { field: resultField }), }; return updatedItem; @@ -153,7 +153,7 @@ export const PopoverForm: React.FC = ({ defaultData, otherAggNames, onCha } return ( - + = ({ defaultData, otherAggNames, onCha fontSize="s" language="json" paddingSize="s" - style={{ width: '100%', height: '200px' }} + css={{ width: '100%', height: '200px' }} > {JSON.stringify(getEsAggFromAggConfig(defaultData), null, 2)} diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 60b692e720ec..151159fa0980 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -3720,10 +3720,10 @@ "indexPatternEditor.status.partialMatchLabel.partialMatchDetail": "Votre modèle d'indexation ne correspond à aucun flux de données, index ni alias d'index, mais {strongIndices} {matchedIndicesLength, plural, one {est semblable} other {sont semblables} }.", "indexPatternEditor.status.partialMatchLabel.strongIndicesLabel": "{matchedIndicesLength, plural, one {source} other {# sources} }", "indexPatternEditor.status.successLabel.successDetail": "Votre modèle d'indexation correspond à {sourceCount} {sourceCount, plural, one {source} other {sources} }.", - "indexPatternEditor.aliasLabel": "Alias", + "dataViews.aliasLabel": "Alias", "indexPatternEditor.createIndex.noMatch": "Le nom doit correspondre à au moins un flux de données, index ou alias d'index.", "indexPatternEditor.createIndexPattern.stepTime.noTimeFieldOptionLabel": "--- Je ne souhaite pas utiliser le filtre temporel ---", - "indexPatternEditor.dataStreamLabel": "Flux de données", + "dataViews.dataStreamLabel": "Flux de données", "indexPatternEditor.dataView.unableSaveLabel": "Échec de l'enregistrement de la vue de données.", "indexPatternEditor.dataViewExists.ValidationErrorMessage": "Une vue de données de ce nom existe déjà.", "indexPatternEditor.editDataView.editConfirmationModal.confirmButton": "Confirmer", @@ -3754,8 +3754,8 @@ "indexPatternEditor.form.customIndexPatternIdLabel": "ID de vue de données personnalisé", "indexPatternEditor.form.nameAriaLabel": "Champ de nom facultatif", "indexPatternEditor.form.titleAriaLabel": "Champ de modèle d'indexation", - "indexPatternEditor.frozenLabel": "Frozen", - "indexPatternEditor.indexLabel": "Index", + "dataViews.frozenLabel": "Frozen", + "dataViews.indexLabel": "Index", "indexPatternEditor.loadingHeader": "Recherche d'index correspondants…", "indexPatternEditor.requireTimestampOption.ValidationErrorMessage": "Sélectionnez un champ d'horodatage.", "indexPatternEditor.rollupDataView.createIndex.noMatchError": "Erreur de vue de données de cumul : doit correspondre à un index de cumul", @@ -3763,7 +3763,7 @@ "indexPatternEditor.rollupDataView.warning.textParagraphOne": "Kibana propose un support bêta pour les vues de données basées sur les cumuls. Vous pourriez rencontrer des problèmes lors de l'utilisation de ces vues dans les recherches enregistrées, les visualisations et les tableaux de bord. Ils ne sont pas compatibles avec certaines fonctionnalités avancées, telles que Timelion et le Machine Learning.", "indexPatternEditor.rollupDataView.warning.textParagraphTwo": "Vous pouvez mettre une vue de données de cumul en correspondance avec un index de cumul et zéro index régulier ou plus. Une vue de données de cumul dispose d'indicateurs, de champs, d'intervalles et d'agrégations limités. Un index de cumul se limite aux index disposant d'une configuration de tâche ou de plusieurs tâches avec des configurations compatibles.", "indexPatternEditor.rollupIndexPattern.warning.title": "Fonctionnalité bêta", - "indexPatternEditor.rollupLabel": "Cumul", + "dataViews.rollupLabel": "Cumul", "indexPatternEditor.saved": "'{indexPatternName}' enregistré", "indexPatternEditor.status.noSystemIndicesLabel": "Aucun flux de données, index ni alias d'index ne correspond à votre modèle d'indexation.", "indexPatternEditor.status.noSystemIndicesWithPromptLabel": "Aucun flux de données, index ni alias d'index ne correspond à votre modèle d'indexation.", @@ -11543,7 +11543,6 @@ "xpack.enterpriseSearch.content.searchIndex.totalStats.domainCountCardLabel": "Nombre de domaines", "xpack.enterpriseSearch.content.searchIndex.totalStats.ingestionTypeCardLabel": "Type d’ingestion", "xpack.enterpriseSearch.content.searchIndices.actions.columnTitle": "Actions", - "xpack.enterpriseSearch.content.searchIndices.content.breadcrumb": "Contenu", "xpack.enterpriseSearch.content.searchIndices.create.buttonTitle": "Créer un nouvel index", "xpack.enterpriseSearch.content.searchIndices.docsCount.columnTitle": "Nombre de documents", "xpack.enterpriseSearch.content.searchIndices.health.columnTitle": "Intégrité des index", @@ -17839,10 +17838,7 @@ "xpack.lens.indexPattern.terms.addaFilter": "Ajouter un champ", "xpack.lens.indexPattern.terms.addRegex": "Utiliser une expression régulière", "xpack.lens.indexPattern.terms.advancedSettings": "Avancé", - "xpack.lens.indexPattern.terms.deleteButtonAriaLabel": "Supprimer", - "xpack.lens.indexPattern.terms.deleteButtonDisabled": "Cette fonction nécessite au minimum un champ défini.", "xpack.lens.indexPattern.terms.deleteButtonLabel": "Supprimer", - "xpack.lens.indexPattern.terms.dragToReorder": "Faire glisser pour réorganiser", "xpack.lens.indexPattern.terms.exclude": "Exclure les valeurs", "xpack.lens.indexPattern.terms.include": "Inclure les valeurs", "xpack.lens.indexPattern.terms.includeExcludePatternPlaceholder": "Entrer une expression régulière pour filtrer les valeurs", @@ -25863,7 +25859,6 @@ "xpack.securitySolution.alertDetails.overview.highlightedFields.alertPrevalenceTooltip": "Nombre total d'alertes de même valeur dans la plage temporelle actuellement sélectionnée. Cette valeur n'est pas affectée par d'autres filtres.", "xpack.securitySolution.alertDetails.overview.highlightedFields.field": "Champ", "xpack.securitySolution.alertDetails.overview.highlightedFields.value": "Valeur", - "xpack.securitySolution.alertDetails.overview.hostRiskDataTitle": "Données de risque de l’hôte", "xpack.securitySolution.alertDetails.overview.insights": "Informations exploitables", "xpack.securitySolution.alertDetails.overview.insights.related_alerts_by_process_ancestry": "Alertes connexes par processus ancêtre", "xpack.securitySolution.alertDetails.overview.insights.related_alerts_by_process_ancestry_error": "Impossible de récupérer les alertes.", @@ -28301,7 +28296,6 @@ "xpack.securitySolution.exceptions.referenceModalCancelButton": "Annuler", "xpack.securitySolution.exceptions.referenceModalDeleteButton": "Retirer la liste d'exceptions", "xpack.securitySolution.exceptions.referenceModalTitle": "Retirer la liste d'exceptions", - "xpack.securitySolution.exceptions.searchPlaceholder": "par ex. Exemple de liste de noms", "xpack.securitySolution.exceptions.viewer.addCommentPlaceholder": "Ajouter un nouveau commentaire...", "xpack.securitySolution.exceptions.viewer.addToClipboard": "Commentaire", "xpack.securitySolution.exceptions.viewer.addToDetectionsListLabel": "Ajouter une exception à une règle", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 0aa5fa39b93e..5465a9a7be7f 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -3715,10 +3715,10 @@ "indexPatternEditor.status.partialMatchLabel.partialMatchDetail": "インデックスパターンはどのデータストリーム、インデックス、インデックスエイリアスとも一致しませんが、{strongIndices} {matchedIndicesLength, plural, other {が} }類似しています。", "indexPatternEditor.status.partialMatchLabel.strongIndicesLabel": "{matchedIndicesLength, plural, other {# ソース} }", "indexPatternEditor.status.successLabel.successDetail": "インデックスパターンは、{sourceCount} {sourceCount, plural, other {ソース} }と一致します。", - "indexPatternEditor.aliasLabel": "エイリアス", + "dataViews.aliasLabel": "エイリアス", "indexPatternEditor.createIndex.noMatch": "名前は1つ以上のデータストリーム、インデックス、またはインデックスエイリアスと一致する必要があります。", "indexPatternEditor.createIndexPattern.stepTime.noTimeFieldOptionLabel": "--- 時間フィルターを使用しない ---", - "indexPatternEditor.dataStreamLabel": "データストリーム", + "dataViews.dataStreamLabel": "データストリーム", "indexPatternEditor.dataView.unableSaveLabel": "データビューの保存に失敗しました。", "indexPatternEditor.dataViewExists.ValidationErrorMessage": "この名前のデータビューはすでに存在します。", "indexPatternEditor.editDataView.editConfirmationModal.confirmButton": "確認", @@ -3749,8 +3749,8 @@ "indexPatternEditor.form.customIndexPatternIdLabel": "カスタムデータビューID", "indexPatternEditor.form.nameAriaLabel": "名前フィールド(任意)", "indexPatternEditor.form.titleAriaLabel": "インデックスパターンフィールド", - "indexPatternEditor.frozenLabel": "凍結", - "indexPatternEditor.indexLabel": "インデックス", + "dataViews.frozenLabel": "凍結", + "dataViews.indexLabel": "インデックス", "indexPatternEditor.loadingHeader": "一致するインデックスを検索中…", "indexPatternEditor.requireTimestampOption.ValidationErrorMessage": "タイムスタンプフィールドを選択します。", "indexPatternEditor.rollupDataView.createIndex.noMatchError": "ロールアップデータビューエラー:ロールアップインデックスの 1 つと一致している必要があります", @@ -3758,7 +3758,7 @@ "indexPatternEditor.rollupDataView.warning.textParagraphOne": "Kibanaではロールアップに基づいてデータビューのデータサポートを提供します。保存された検索、可視化、ダッシュボードでこれらを使用すると問題が発生する場合があります。Timelionや機械学習などの一部の高度な機能ではサポートされていません。", "indexPatternEditor.rollupDataView.warning.textParagraphTwo": "ロールアップデータビューは、1つのロールアップインデックスとゼロ以上の標準インデックスと一致させることができます。ロールアップデータビューでは、メトリック、フィールド、間隔、アグリゲーションが制限されています。ロールアップインデックスは、1つのジョブ構成があるインデックス、または複数のジョブと互換する構成があるインデックスに制限されています。", "indexPatternEditor.rollupIndexPattern.warning.title": "ベータ機能", - "indexPatternEditor.rollupLabel": "ロールアップ", + "dataViews.rollupLabel": "ロールアップ", "indexPatternEditor.saved": "'{indexPatternName}'が保存されました", "indexPatternEditor.status.noSystemIndicesLabel": "データストリーム、インデックス、またはインデックスエイリアスがインデックスパターンと一致しません。", "indexPatternEditor.status.noSystemIndicesWithPromptLabel": "データストリーム、インデックス、またはインデックスエイリアスがインデックスパターンと一致しません。", @@ -11529,7 +11529,6 @@ "xpack.enterpriseSearch.content.searchIndex.totalStats.domainCountCardLabel": "ドメインカウント", "xpack.enterpriseSearch.content.searchIndex.totalStats.ingestionTypeCardLabel": "インジェスチョンタイプ", "xpack.enterpriseSearch.content.searchIndices.actions.columnTitle": "アクション", - "xpack.enterpriseSearch.content.searchIndices.content.breadcrumb": "コンテンツ", "xpack.enterpriseSearch.content.searchIndices.create.buttonTitle": "新しいインデックスを作成", "xpack.enterpriseSearch.content.searchIndices.docsCount.columnTitle": "ドキュメント数", "xpack.enterpriseSearch.content.searchIndices.health.columnTitle": "インデックス正常性", @@ -17822,10 +17821,7 @@ "xpack.lens.indexPattern.terms.addaFilter": "フィールドの追加", "xpack.lens.indexPattern.terms.addRegex": "正規表現を使用", "xpack.lens.indexPattern.terms.advancedSettings": "高度な設定", - "xpack.lens.indexPattern.terms.deleteButtonAriaLabel": "削除", - "xpack.lens.indexPattern.terms.deleteButtonDisabled": "この関数には定義された1つのフィールドの最小値が必須です", "xpack.lens.indexPattern.terms.deleteButtonLabel": "削除", - "xpack.lens.indexPattern.terms.dragToReorder": "ドラッグして並べ替え", "xpack.lens.indexPattern.terms.exclude": "値を除外", "xpack.lens.indexPattern.terms.include": "値を含める", "xpack.lens.indexPattern.terms.includeExcludePatternPlaceholder": "値をフィルターするには正規表現を入力します", @@ -25838,7 +25834,6 @@ "xpack.securitySolution.alertDetails.overview.highlightedFields.alertPrevalenceTooltip": "現在選択した時間範囲内で同じ値のアラートの合計件数。この値は追加のフィルターによる影響は受けません。", "xpack.securitySolution.alertDetails.overview.highlightedFields.field": "フィールド", "xpack.securitySolution.alertDetails.overview.highlightedFields.value": "値", - "xpack.securitySolution.alertDetails.overview.hostRiskDataTitle": "ホストリスクデータ", "xpack.securitySolution.alertDetails.overview.insights": "インサイト", "xpack.securitySolution.alertDetails.overview.insights.related_alerts_by_process_ancestry": "上位プロセス別関連アラート", "xpack.securitySolution.alertDetails.overview.insights.related_alerts_by_process_ancestry_error": "アラートを取得できませんでした。", @@ -28276,7 +28271,6 @@ "xpack.securitySolution.exceptions.referenceModalCancelButton": "キャンセル", "xpack.securitySolution.exceptions.referenceModalDeleteButton": "例外リストを削除", "xpack.securitySolution.exceptions.referenceModalTitle": "例外リストを削除", - "xpack.securitySolution.exceptions.searchPlaceholder": "例:例外リスト名", "xpack.securitySolution.exceptions.viewer.addCommentPlaceholder": "新しいコメントを追加...", "xpack.securitySolution.exceptions.viewer.addToClipboard": "コメント", "xpack.securitySolution.exceptions.viewer.addToDetectionsListLabel": "ルール例外の追加", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index baf98e70b8dd..e2de967852a8 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -3720,10 +3720,10 @@ "indexPatternEditor.status.partialMatchLabel.partialMatchDetail": "您的索引模式不匹配任何数据流、索引或索引别名,但{strongIndices}{matchedIndicesLength, plural, other {} }类似。", "indexPatternEditor.status.partialMatchLabel.strongIndicesLabel": "{matchedIndicesLength, plural, one {个源} other {# 个源} }", "indexPatternEditor.status.successLabel.successDetail": "您的索引模式匹配 {sourceCount} 个{sourceCount, plural, other {源} }。", - "indexPatternEditor.aliasLabel": "别名", + "dataViews.aliasLabel": "别名", "indexPatternEditor.createIndex.noMatch": "名称必须匹配一个或多个数据流、索引或索引别名。", "indexPatternEditor.createIndexPattern.stepTime.noTimeFieldOptionLabel": "--- 我不想使用时间筛选 ---", - "indexPatternEditor.dataStreamLabel": "数据流", + "dataViews.dataStreamLabel": "数据流", "indexPatternEditor.dataView.unableSaveLabel": "无法保存数据视图。", "indexPatternEditor.dataViewExists.ValidationErrorMessage": "具有此名称的数据视图已存在。", "indexPatternEditor.editDataView.editConfirmationModal.confirmButton": "确认", @@ -3754,8 +3754,8 @@ "indexPatternEditor.form.customIndexPatternIdLabel": "定制数据视图 ID", "indexPatternEditor.form.nameAriaLabel": "名称字段(可选)", "indexPatternEditor.form.titleAriaLabel": "索引模式字段", - "indexPatternEditor.frozenLabel": "已冻结", - "indexPatternEditor.indexLabel": "索引", + "dataViews.frozenLabel": "已冻结", + "dataViews.indexLabel": "索引", "indexPatternEditor.loadingHeader": "正在寻找匹配的索引......", "indexPatternEditor.requireTimestampOption.ValidationErrorMessage": "选择时间戳字段。", "indexPatternEditor.rollupDataView.createIndex.noMatchError": "汇总/打包数据视图错误:必须匹配一个汇总/打包索引", @@ -3763,7 +3763,7 @@ "indexPatternEditor.rollupDataView.warning.textParagraphOne": "Kibana 基于汇总/打包为数据视图提供公测版支持。将这些视图用于已保存搜索、可视化以及仪表板可能会遇到问题。某些高级功能,如 Timelion 和 Machine Learning,不支持这些模式。", "indexPatternEditor.rollupDataView.warning.textParagraphTwo": "可以根据一个汇总/打包索引和零个或更多常规索引匹配汇总/打包数据视图。汇总/打包数据视图的指标、字段、时间间隔和聚合有限。汇总/打包索引仅限于具有一个作业配置或多个作业配置兼容的索引。", "indexPatternEditor.rollupIndexPattern.warning.title": "公测版功能", - "indexPatternEditor.rollupLabel": "汇总/打包", + "dataViews.rollupLabel": "汇总/打包", "indexPatternEditor.saved": "已保存“{indexPatternName}”", "indexPatternEditor.status.noSystemIndicesLabel": "没有数据流、索引或索引别名匹配您的索引模式。", "indexPatternEditor.status.noSystemIndicesWithPromptLabel": "没有数据流、索引或索引别名匹配您的索引模式。", @@ -11548,7 +11548,6 @@ "xpack.enterpriseSearch.content.searchIndex.totalStats.domainCountCardLabel": "域计数", "xpack.enterpriseSearch.content.searchIndex.totalStats.ingestionTypeCardLabel": "采集类型", "xpack.enterpriseSearch.content.searchIndices.actions.columnTitle": "操作", - "xpack.enterpriseSearch.content.searchIndices.content.breadcrumb": "内容", "xpack.enterpriseSearch.content.searchIndices.create.buttonTitle": "创建新索引", "xpack.enterpriseSearch.content.searchIndices.docsCount.columnTitle": "文档计数", "xpack.enterpriseSearch.content.searchIndices.health.columnTitle": "索引运行状况", @@ -17847,10 +17846,7 @@ "xpack.lens.indexPattern.terms.addaFilter": "添加字段", "xpack.lens.indexPattern.terms.addRegex": "使用正则表达式", "xpack.lens.indexPattern.terms.advancedSettings": "高级", - "xpack.lens.indexPattern.terms.deleteButtonAriaLabel": "删除", - "xpack.lens.indexPattern.terms.deleteButtonDisabled": "此函数需要至少定义一个字段", "xpack.lens.indexPattern.terms.deleteButtonLabel": "删除", - "xpack.lens.indexPattern.terms.dragToReorder": "拖动以重新排序", "xpack.lens.indexPattern.terms.exclude": "排除值", "xpack.lens.indexPattern.terms.include": "包括值", "xpack.lens.indexPattern.terms.includeExcludePatternPlaceholder": "输入正则表达式以筛选值", @@ -25872,7 +25868,6 @@ "xpack.securitySolution.alertDetails.overview.highlightedFields.alertPrevalenceTooltip": "在当前选定的时间范围内具有相同值的告警的总计数。此值不受其他筛选影响。", "xpack.securitySolution.alertDetails.overview.highlightedFields.field": "字段", "xpack.securitySolution.alertDetails.overview.highlightedFields.value": "值", - "xpack.securitySolution.alertDetails.overview.hostRiskDataTitle": "主机风险数据", "xpack.securitySolution.alertDetails.overview.insights": "洞见", "xpack.securitySolution.alertDetails.overview.insights.related_alerts_by_process_ancestry": "按进程体系列出相关告警", "xpack.securitySolution.alertDetails.overview.insights.related_alerts_by_process_ancestry_error": "无法获取告警。", @@ -28310,7 +28305,6 @@ "xpack.securitySolution.exceptions.referenceModalCancelButton": "取消", "xpack.securitySolution.exceptions.referenceModalDeleteButton": "移除例外列表", "xpack.securitySolution.exceptions.referenceModalTitle": "移除例外列表", - "xpack.securitySolution.exceptions.searchPlaceholder": "例如,示例列表名称", "xpack.securitySolution.exceptions.viewer.addCommentPlaceholder": "添加新注释......", "xpack.securitySolution.exceptions.viewer.addToClipboard": "注释", "xpack.securitySolution.exceptions.viewer.addToDetectionsListLabel": "添加规则例外", diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/json_editor_with_message_variables.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/json_editor_with_message_variables.tsx index 135d4783da82..643e1b69a513 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/json_editor_with_message_variables.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/json_editor_with_message_variables.tsx @@ -148,6 +148,7 @@ export const JsonEditorWithMessageVariables: React.FunctionComponent = ({ return ( 0 && inputTargetValue !== undefined} diff --git a/x-pack/test/api_integration/apis/ml/jobs/index.ts b/x-pack/test/api_integration/apis/ml/jobs/index.ts index e530b6bfb362..8152f3e760b6 100644 --- a/x-pack/test/api_integration/apis/ml/jobs/index.ts +++ b/x-pack/test/api_integration/apis/ml/jobs/index.ts @@ -23,5 +23,6 @@ export default function ({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./stop_datafeeds')); loadTestFile(require.resolve('./stop_datafeeds_spaces')); loadTestFile(require.resolve('./get_groups')); + loadTestFile(require.resolve('./jobs')); }); } diff --git a/x-pack/test/api_integration/apis/ml/jobs/jobs.ts b/x-pack/test/api_integration/apis/ml/jobs/jobs.ts new file mode 100644 index 000000000000..c843aab29dc4 --- /dev/null +++ b/x-pack/test/api_integration/apis/ml/jobs/jobs.ts @@ -0,0 +1,210 @@ +/* + * 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 expect from '@kbn/expect'; +import type { CombinedJobWithStats } from '@kbn/ml-plugin/common/types/anomaly_detection_jobs'; +import { FtrProviderContext } from '../../../ftr_provider_context'; +import { COMMON_REQUEST_HEADERS } from '../../../../functional/services/ml/common_api'; +import { USER } from '../../../../functional/services/ml/security_common'; +import { MULTI_METRIC_JOB_CONFIG, SINGLE_METRIC_JOB_CONFIG, DATAFEED_CONFIG } from './common_jobs'; + +export default ({ getService }: FtrProviderContext) => { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertestWithoutAuth'); + const ml = getService('ml'); + + const idSpace1 = 'space1'; + + const testSetupJobConfigs = [SINGLE_METRIC_JOB_CONFIG, MULTI_METRIC_JOB_CONFIG]; + + const testSetupJobConfigsWithSpace = [ + { ...SINGLE_METRIC_JOB_CONFIG, job_id: `${SINGLE_METRIC_JOB_CONFIG.job_id}-${idSpace1}` }, + ]; + + const testCalendarsConfigs = [ + { + calendar_id: `test_get_cal_1`, + job_ids: ['multi-metric'], + description: `Test calendar 1`, + }, + { + calendar_id: `test_get_cal_2`, + job_ids: [MULTI_METRIC_JOB_CONFIG.job_id, 'multi-metric'], + description: `Test calendar 2`, + }, + { + calendar_id: `test_get_cal_3`, + job_ids: ['brand-new-group'], + description: `Test calendar 3`, + }, + ]; + + async function runGetJobsRequest( + user: USER, + requestBody: object, + expectedResponsecode: number, + space?: string + ): Promise { + const path = space === undefined ? '/api/ml/jobs/jobs' : `/s/${space}/api/ml/jobs/jobs`; + const { body, status } = await supertest + .post(path) + .auth(user, ml.securityCommon.getPasswordForUser(user)) + .set(COMMON_REQUEST_HEADERS) + .send(requestBody); + ml.api.assertResponseStatusCode(expectedResponsecode, status, body); + + return body; + } + + const expectedJobProperties = [ + { + jobId: MULTI_METRIC_JOB_CONFIG.job_id, + datafeedId: `datafeed-${MULTI_METRIC_JOB_CONFIG.job_id}`, + calendarIds: ['test_get_cal_1', 'test_get_cal_2'], + groups: ['farequote', 'automated', 'multi-metric'], + modelBytes: 0, + datafeedTotalSearchTimeMs: 0, + }, + { + jobId: SINGLE_METRIC_JOB_CONFIG.job_id, + datafeedId: `datafeed-${SINGLE_METRIC_JOB_CONFIG.job_id}`, + calendarIds: undefined, + groups: ['farequote', 'automated', 'single-metric'], + modelBytes: 0, + datafeedTotalSearchTimeMs: 0, + }, + ]; + + const expectedJobPropertiesWithSpace = [ + { + jobId: `${SINGLE_METRIC_JOB_CONFIG.job_id}-${idSpace1}`, + datafeedId: `datafeed-${SINGLE_METRIC_JOB_CONFIG.job_id}-${idSpace1}`, + calendarIds: undefined, + groups: ['farequote', 'automated', 'single-metric'], + modelBytes: 0, + datafeedTotalSearchTimeMs: 0, + }, + ]; + + describe('get combined jobs with stats', function () { + before(async () => { + await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); + await ml.testResources.setKibanaTimeZoneToUTC(); + + for (const job of testSetupJobConfigs) { + await ml.api.createAnomalyDetectionJob(job); + await ml.api.createDatafeed({ + ...DATAFEED_CONFIG, + datafeed_id: `datafeed-${job.job_id}`, + job_id: job.job_id, + }); + } + + for (const job of testSetupJobConfigsWithSpace) { + await ml.api.createAnomalyDetectionJob(job, idSpace1); + await ml.api.createDatafeed( + { + ...DATAFEED_CONFIG, + datafeed_id: `datafeed-${job.job_id}`, + job_id: job.job_id, + }, + idSpace1 + ); + } + + for (const cal of testCalendarsConfigs) { + await ml.api.createCalendar(cal.calendar_id, cal); + } + }); + + after(async () => { + await ml.api.cleanMlIndices(); + }); + + it('returns expected list of combined jobs with stats in default space', async () => { + const jobs = await runGetJobsRequest(USER.ML_VIEWER, {}, 200); + + expect(jobs.length).to.eql( + testSetupJobConfigs.length, + `number of jobs in default space should be ${testSetupJobConfigs.length})` + ); + + jobs.forEach((job, i) => { + expect(job.job_id).to.eql( + expectedJobProperties[i].jobId, + `job id should be equal to ${JSON.stringify(expectedJobProperties[i].jobId)})` + ); + expect(job.datafeed_config.datafeed_id).to.eql( + expectedJobProperties[i].datafeedId, + `datafeed id should be equal to ${JSON.stringify(expectedJobProperties[i].datafeedId)})` + ); + expect(job.calendars).to.eql( + expectedJobProperties[i].calendarIds, + `calendars should be equal to ${JSON.stringify(expectedJobProperties[i].calendarIds)})` + ); + expect(job.groups).to.eql( + expectedJobProperties[i].groups, + `groups should be equal to ${JSON.stringify(expectedJobProperties[i].groups)})` + ); + expect(job.model_size_stats.model_bytes).to.eql( + expectedJobProperties[i].modelBytes, + `model_bytes should be equal to ${JSON.stringify(expectedJobProperties[i].modelBytes)})` + ); + expect(job.datafeed_config.timing_stats.total_search_time_ms).to.eql( + expectedJobProperties[i].datafeedTotalSearchTimeMs, + `datafeed total_search_time_ms should be equal to ${JSON.stringify( + expectedJobProperties[i].datafeedTotalSearchTimeMs + )})` + ); + }); + }); + + it('returns expected list of combined jobs with stats in specified space', async () => { + const jobs = await runGetJobsRequest(USER.ML_VIEWER, {}, 200, idSpace1); + + expect(jobs.length).to.eql( + testSetupJobConfigsWithSpace.length, + `number of jobs in default space should be ${testSetupJobConfigsWithSpace.length})` + ); + + jobs.forEach((job, i) => { + expect(job.job_id).to.eql( + expectedJobPropertiesWithSpace[i].jobId, + `job id should be equal to ${JSON.stringify(expectedJobPropertiesWithSpace[i].jobId)})` + ); + expect(job.datafeed_config.datafeed_id).to.eql( + expectedJobPropertiesWithSpace[i].datafeedId, + `datafeed id should be equal to ${JSON.stringify( + expectedJobPropertiesWithSpace[i].datafeedId + )})` + ); + expect(job.calendars).to.eql( + expectedJobPropertiesWithSpace[i].calendarIds, + `calendars should be equal to ${JSON.stringify( + expectedJobPropertiesWithSpace[i].calendarIds + )})` + ); + expect(job.groups).to.eql( + expectedJobPropertiesWithSpace[i].groups, + `groups should be equal to ${JSON.stringify(expectedJobPropertiesWithSpace[i].groups)})` + ); + expect(job.model_size_stats.model_bytes).to.eql( + expectedJobPropertiesWithSpace[i].modelBytes, + `model_bytes should be equal to ${JSON.stringify( + expectedJobPropertiesWithSpace[i].modelBytes + )})` + ); + expect(job.datafeed_config.timing_stats.total_search_time_ms).to.eql( + expectedJobPropertiesWithSpace[i].datafeedTotalSearchTimeMs, + `datafeed total_search_time_ms should be equal to ${JSON.stringify( + expectedJobPropertiesWithSpace[i].datafeedTotalSearchTimeMs + )})` + ); + }); + }); + }); +}; diff --git a/x-pack/test/api_integration/apis/ml/modules/index.ts b/x-pack/test/api_integration/apis/ml/modules/index.ts index de8919976fd3..d28263b48770 100644 --- a/x-pack/test/api_integration/apis/ml/modules/index.ts +++ b/x-pack/test/api_integration/apis/ml/modules/index.ts @@ -38,5 +38,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./get_module')); loadTestFile(require.resolve('./recognize_module')); loadTestFile(require.resolve('./setup_module')); + loadTestFile(require.resolve('./jobs_exist')); }); } diff --git a/x-pack/test/api_integration/apis/ml/modules/jobs_exist.ts b/x-pack/test/api_integration/apis/ml/modules/jobs_exist.ts new file mode 100644 index 000000000000..3e5cd0aa996d --- /dev/null +++ b/x-pack/test/api_integration/apis/ml/modules/jobs_exist.ts @@ -0,0 +1,119 @@ +/* + * 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 expect from '@kbn/expect'; + +import { FtrProviderContext } from '../../../ftr_provider_context'; +import { USER } from '../../../../functional/services/ml/security_common'; +import { COMMON_REQUEST_HEADERS } from '../../../../functional/services/ml/common_api'; + +export default ({ getService }: FtrProviderContext) => { + const esArchiver = getService('esArchiver'); + const supertest = getService('supertestWithoutAuth'); + const ml = getService('ml'); + + const idSpace1 = 'space1'; + const sourceDataArchive = 'x-pack/test/functional/es_archives/ml/module_sample_logs'; + const moduleInfo = { + moduleId: 'sample_data_weblogs', + jobIds: ['low_request_rate', 'response_code_rates', 'url_scanning'], + dataView: { name: 'ft_module_sample_logs', timeField: '@timestamp' }, + }; + + async function runRequest(moduleId: string, expectedStatusCode: number, user: USER) { + const { body, status } = await supertest + .get(`/api/ml/modules/jobs_exist/${moduleId}`) + .auth(user, ml.securityCommon.getPasswordForUser(user)) + .set(COMMON_REQUEST_HEADERS); + + ml.api.assertResponseStatusCode(expectedStatusCode, status, body); + return body; + } + + describe('GET ml/modules/jobs_exist/{moduleId}', function () { + before(async () => { + await ml.testResources.setKibanaTimeZoneToUTC(); + await esArchiver.loadIfNeeded(sourceDataArchive); + // create data view in default space + await ml.testResources.createIndexPatternIfNeeded( + moduleInfo.dataView.name, + moduleInfo.dataView.timeField + ); + // create data view in idSpace1 + await ml.testResources.createIndexPatternIfNeeded( + moduleInfo.dataView.name, + moduleInfo.dataView.timeField, + idSpace1 + ); + }); + + afterEach(async () => { + await ml.api.cleanMlIndices(); + }); + + after(async () => { + // delete all data views in all spaces + await ml.testResources.deleteIndexPatternByTitle(moduleInfo.dataView.name); + await ml.testResources.deleteIndexPatternByTitle(moduleInfo.dataView.name, idSpace1); + }); + + it('should find jobs installed by module without prefix', async () => { + const prefix = ''; + await ml.api.setupModule(moduleInfo.moduleId, { + prefix, + indexPatternName: moduleInfo.dataView.name, + startDatafeed: false, + estimateModelMemory: false, + }); + const { jobsExist, jobs } = await runRequest(moduleInfo.moduleId, 200, USER.ML_POWERUSER); + + const expectedJobIds = moduleInfo.jobIds.map((j) => ({ id: `${prefix}${j}` })); + expect(jobsExist).to.eql(true, 'Expected jobsExist to be true'); + expect(jobs).to.eql(expectedJobIds, `Expected jobs to be ${expectedJobIds}`); + }); + + it('should find jobs installed by module with prefix', async () => { + const prefix = 'pf1_'; + await ml.api.setupModule(moduleInfo.moduleId, { + prefix, + indexPatternName: moduleInfo.dataView.name, + startDatafeed: false, + estimateModelMemory: false, + }); + const { jobsExist, jobs } = await runRequest(moduleInfo.moduleId, 200, USER.ML_POWERUSER); + + const expectedJobIds = moduleInfo.jobIds.map((j) => ({ id: `${prefix}${j}` })); + expect(jobsExist).to.eql(true, 'Expected jobsExist to be true'); + expect(jobs).to.eql(expectedJobIds, `Expected jobs to be ${expectedJobIds}`); + }); + + it('should not find jobs installed into a different space', async () => { + const prefix = 'pf1_'; + await ml.api.setupModule( + moduleInfo.moduleId, + { + prefix, + indexPatternName: moduleInfo.dataView.name, + startDatafeed: false, + estimateModelMemory: false, + }, + idSpace1 + ); + const { jobsExist, jobs } = await runRequest(moduleInfo.moduleId, 200, USER.ML_POWERUSER); + + expect(jobsExist).to.eql(false, 'Expected jobsExist to be false'); + expect(jobs).to.eql(undefined, `Expected jobs to be undefined`); + }); + + it("should not find jobs for module which hasn't been installed", async () => { + const { jobsExist, jobs } = await runRequest('apache_ecs', 200, USER.ML_POWERUSER); + + expect(jobsExist).to.eql(false, 'Expected jobsExist to be false'); + expect(jobs).to.eql(undefined, `Expected jobs to be undefined`); + }); + }); +}; diff --git a/x-pack/test/api_integration/apis/ml/saved_objects/index.ts b/x-pack/test/api_integration/apis/ml/saved_objects/index.ts index f1464095edff..5139a121e07d 100644 --- a/x-pack/test/api_integration/apis/ml/saved_objects/index.ts +++ b/x-pack/test/api_integration/apis/ml/saved_objects/index.ts @@ -18,5 +18,6 @@ export default function ({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./sync_jobs')); loadTestFile(require.resolve('./sync_trained_models')); loadTestFile(require.resolve('./update_jobs_spaces')); + loadTestFile(require.resolve('./remove_from_current_space')); }); } diff --git a/x-pack/test/api_integration/apis/ml/saved_objects/remove_from_current_space.ts b/x-pack/test/api_integration/apis/ml/saved_objects/remove_from_current_space.ts new file mode 100644 index 000000000000..3e98c51ea047 --- /dev/null +++ b/x-pack/test/api_integration/apis/ml/saved_objects/remove_from_current_space.ts @@ -0,0 +1,137 @@ +/* + * 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 expect from '@kbn/expect'; +import { MlSavedObjectType } from '@kbn/ml-plugin/common/types/saved_objects'; +import { FtrProviderContext } from '../../../ftr_provider_context'; +import { USER } from '../../../../functional/services/ml/security_common'; +import { COMMON_REQUEST_HEADERS } from '../../../../functional/services/ml/common_api'; + +export default ({ getService }: FtrProviderContext) => { + const esArchiver = getService('esArchiver'); + const ml = getService('ml'); + const spacesService = getService('spaces'); + const supertest = getService('supertestWithoutAuth'); + + const adJobId = 'fq_single'; + const dfaJobId = 'ihp_od'; + const trainedModelId = 'trained_model'; + const idSpace1 = 'space1'; + const idSpace2 = 'space2'; + const defaultSpaceId = 'default'; + + async function runRequest( + requestBody: { + ids: string[]; + mlSavedObjectType: MlSavedObjectType; + }, + space: string, + expectedStatusCode: number, + user: USER + ) { + const { body, status } = await supertest + .post(`/s/${space}/api/ml/saved_objects/remove_item_from_current_space`) + .auth(user, ml.securityCommon.getPasswordForUser(user)) + .set(COMMON_REQUEST_HEADERS) + .send(requestBody); + ml.api.assertResponseStatusCode(expectedStatusCode, status, body); + + return body; + } + + describe('POST saved_objects/remove_item_from_current_space', () => { + before(async () => { + await ml.testResources.setKibanaTimeZoneToUTC(); + await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ihp_outlier'); + + // create spaces + await spacesService.create({ id: idSpace1, name: 'space_one', disabledFeatures: [] }); + await spacesService.create({ id: idSpace2, name: 'space_two', disabledFeatures: [] }); + + // create anomaly detection job + await ml.api.createAnomalyDetectionJob(ml.commonConfig.getADFqSingleMetricJobConfig(adJobId)); + // create data frame analytics job + await ml.api.createDataFrameAnalyticsJob( + ml.commonConfig.getDFAIhpOutlierDetectionJobConfig(dfaJobId) + ); + // Create trained model + const trainedModelConfig = ml.api.createTestTrainedModelConfig(trainedModelId, 'regression'); + await ml.api.createTrainedModel(trainedModelId, trainedModelConfig.body); + + // reassign spaces for all items + await ml.api.updateJobSpaces(adJobId, 'anomaly-detector', [idSpace1, idSpace2], []); + await ml.api.updateJobSpaces(dfaJobId, 'data-frame-analytics', [idSpace1, idSpace2], []); + await ml.api.updateTrainedModelSpaces(trainedModelId, [idSpace1, idSpace2], []); + }); + + after(async () => { + await ml.api.cleanMlIndices(); + await ml.testResources.cleanMLSavedObjects(); + await spacesService.delete(idSpace1); + await spacesService.delete(idSpace2); + }); + + it('should remove AD job from current space', async () => { + await ml.api.assertJobSpaces(adJobId, 'anomaly-detector', [ + defaultSpaceId, + idSpace1, + idSpace2, + ]); + const mlSavedObjectType = 'anomaly-detector'; + const body = await runRequest( + { + ids: [adJobId], + mlSavedObjectType, + }, + idSpace1, + 200, + USER.ML_POWERUSER + ); + + expect(body).to.eql({ [adJobId]: { success: true, type: mlSavedObjectType } }); + await ml.api.assertJobSpaces(adJobId, mlSavedObjectType, [defaultSpaceId, idSpace2]); + }); + + it('should remove DFA job from current space', async () => { + await ml.api.assertJobSpaces(dfaJobId, 'data-frame-analytics', [ + defaultSpaceId, + idSpace1, + idSpace2, + ]); + const mlSavedObjectType = 'data-frame-analytics'; + const body = await runRequest( + { + ids: [dfaJobId], + mlSavedObjectType, + }, + idSpace2, + 200, + USER.ML_POWERUSER + ); + + expect(body).to.eql({ [dfaJobId]: { success: true, type: mlSavedObjectType } }); + await ml.api.assertJobSpaces(dfaJobId, mlSavedObjectType, [defaultSpaceId, idSpace1]); + }); + + it('should remove trained model from current space', async () => { + await ml.api.assertTrainedModelSpaces(trainedModelId, [defaultSpaceId, idSpace1, idSpace2]); + const mlSavedObjectType = 'trained-model'; + const body = await runRequest( + { + ids: [trainedModelId], + mlSavedObjectType, + }, + idSpace2, + 200, + USER.ML_POWERUSER + ); + + expect(body).to.eql({ [trainedModelId]: { success: true, type: mlSavedObjectType } }); + await ml.api.assertTrainedModelSpaces(trainedModelId, [defaultSpaceId, idSpace1]); + }); + }); +}; diff --git a/x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts b/x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts index 4e65bf1c4dbe..f96479a50bc6 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/add_monitor.ts @@ -140,6 +140,41 @@ export default function ({ getService }: FtrProviderContext) { expect(apiResponse.status).eql(400); }); + it('omits unknown keys', async () => { + // Delete a required property to make payload invalid + const newMonitor = { + name: 'Sample name', + url: 'https://elastic.co', + unknownKey: 'unknownValue', + type: 'http', + locations: [ + { + id: 'eu-west-01', + label: 'Europe West', + geo: { + lat: 33.2343132435, + lon: 73.2342343434, + }, + url: 'https://example-url.com', + isServiceManaged: true, + }, + ], + }; + + const apiResponse = await supertestAPI + .post(API_URLS.SYNTHETICS_MONITORS) + .set('kbn-xsrf', 'true') + .send(newMonitor) + .expect(200); + + const response = await supertestAPI + .get(`${API_URLS.SYNTHETICS_MONITORS}/${apiResponse.body.id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + expect(response.body.attributes).not.to.have.keys('unknownkey', 'url'); + }); + it('can create monitor with API key with proper permissions', async () => { await supertestAPI .post('/internal/security/api_key') diff --git a/x-pack/test/api_integration/apis/uptime/rest/add_monitor_project.ts b/x-pack/test/api_integration/apis/uptime/rest/add_monitor_project.ts index 105e6521c1da..9dce7e7d8fda 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/add_monitor_project.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/add_monitor_project.ts @@ -96,6 +96,114 @@ export default function ({ getService }: FtrProviderContext) { icmpProjectMonitors = setUniqueIds(getFixtureJson('project_icmp_monitor')); }); + it('project monitors - handles browser monitors', async () => { + const successfulMonitors = [projectMonitors.monitors[0]]; + + try { + const messages = await parseStreamApiResponse( + projectMonitorEndpoint, + JSON.stringify(projectMonitors) + ); + + expect(messages).to.have.length(2); + expect(messages[1].updatedMonitors).eql([]); + expect(messages[1].createdMonitors).eql(successfulMonitors.map((monitor) => monitor.id)); + expect(messages[1].failedMonitors).eql([]); + + for (const monitor of successfulMonitors) { + const journeyId = monitor.id; + const createdMonitorsResponse = await supertest + .get(API_URLS.SYNTHETICS_MONITORS) + .query({ filter: `${syntheticsMonitorType}.attributes.journey_id: ${journeyId}` }) + .set('kbn-xsrf', 'true') + .expect(200); + + const decryptedCreatedMonitor = await supertest + .get(`${API_URLS.SYNTHETICS_MONITORS}/${createdMonitorsResponse.body.monitors[0].id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + expect(decryptedCreatedMonitor.body.attributes).to.eql({ + __ui: { + is_zip_url_tls_enabled: false, + script_source: { + file_name: '', + is_generated_script: false, + }, + }, + config_id: '', + custom_heartbeat_id: `${journeyId}-test-suite-default`, + enabled: true, + 'filter_journeys.match': 'check if title is present', + 'filter_journeys.tags': [], + form_monitor_type: 'multistep', + ignore_https_errors: false, + journey_id: journeyId, + locations: [ + { + geo: { + lat: 0, + lon: 0, + }, + id: 'localhost', + isInvalid: false, + isServiceManaged: true, + label: 'Local Synthetics Service', + status: 'experimental', + url: 'mockDevUrl', + }, + ], + name: 'check if title is present', + namespace: 'default', + origin: 'project', + original_space: 'default', + playwright_options: '{"headless":true,"chromiumSandbox":false}', + playwright_text_assertion: '', + project_id: 'test-suite', + params: '', + revision: 1, + schedule: { + number: '10', + unit: 'm', + }, + screenshots: 'on', + 'service.name': '', + 'source.zip_url.folder': '', + 'source.zip_url.proxy_url': '', + 'source.zip_url.url': '', + 'source.zip_url.password': '', + 'source.zip_url.username': '', + synthetics_args: [], + tags: [], + 'throttling.config': '5d/3u/20l', + 'throttling.download_speed': '5', + 'throttling.is_enabled': true, + 'throttling.latency': '20', + 'throttling.upload_speed': '3', + 'ssl.certificate': '', + 'ssl.certificate_authorities': '', + 'ssl.supported_protocols': ['TLSv1.1', 'TLSv1.2', 'TLSv1.3'], + 'ssl.verification_mode': 'full', + 'ssl.key': '', + 'ssl.key_passphrase': '', + 'source.inline.script': '', + 'source.project.content': + 'UEsDBBQACAAIAON5qVQAAAAAAAAAAAAAAAAfAAAAZXhhbXBsZXMvdG9kb3MvYmFzaWMuam91cm5leS50c22Q0WrDMAxF3/sVF7MHB0LMXlc6RvcN+wDPVWNviW0sdUsp/fe5SSiD7UFCWFfHujIGlpnkybwxFTZfoY/E3hsaLEtwhs9RPNWKDU12zAOxkXRIbN4tB9d9pFOJdO6EN2HMqQguWN9asFBuQVMmJ7jiWNII9fIXrbabdUYr58l9IhwhQQZCYORCTFFUC31Btj21NRc7Mq4Nds+4bDD/pNVgT9F52Jyr2Fa+g75LAPttg8yErk+S9ELpTmVotlVwnfNCuh2lepl3+JflUmSBJ3uggt1v9INW/lHNLKze9dJe1J3QJK8pSvWkm6aTtCet5puq+x63+AFQSwcIAPQ3VfcAAACcAQAAUEsBAi0DFAAIAAgA43mpVAD0N1X3AAAAnAEAAB8AAAAAAAAAAAAgAKSBAAAAAGV4YW1wbGVzL3RvZG9zL2Jhc2ljLmpvdXJuZXkudHNQSwUGAAAAAAEAAQBNAAAARAEAAAAA', + timeout: null, + type: 'browser', + 'url.port': null, + urls: '', + }); + } + } finally { + await Promise.all([ + successfulMonitors.map((monitor) => { + return deleteMonitor(monitor.id, httpProjectMonitors.project); + }), + ]); + } + }); + it('project monitors - handles http monitors', async () => { const kibanaVersion = await kibanaServer.version.get(); const successfulMonitors = [httpProjectMonitors.monitors[1]]; @@ -130,7 +238,12 @@ export default function ({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'true') .expect(200); - expect(createdMonitorsResponse.body.monitors[0].attributes).to.eql({ + const decryptedCreatedMonitor = await supertest + .get(`${API_URLS.SYNTHETICS_MONITORS}/${createdMonitorsResponse.body.monitors[0].id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + expect(decryptedCreatedMonitor.body.attributes).to.eql({ __ui: { is_tls_enabled: false, }, @@ -138,6 +251,16 @@ export default function ({ getService }: FtrProviderContext) { 'check.response.status': ['200'], config_id: '', custom_heartbeat_id: `${journeyId}-test-suite-default`, + 'check.response.body.negative': [], + 'check.response.body.positive': ['Saved', 'saved'], + 'check.response.headers': {}, + 'check.request.body': { + type: 'text', + value: '', + }, + 'check.request.headers': { + 'Content-Type': 'application/x-www-form-urlencoded', + }, enabled: false, form_monitor_type: 'http', journey_id: journeyId, @@ -161,6 +284,8 @@ export default function ({ getService }: FtrProviderContext) { origin: 'project', original_space: 'default', project_id: 'test-suite', + username: '', + password: '', proxy_url: '', 'response.include_body': 'always', 'response.include_headers': false, @@ -174,10 +299,13 @@ export default function ({ getService }: FtrProviderContext) { 'ssl.certificate_authorities': '', 'ssl.supported_protocols': ['TLSv1.1', 'TLSv1.2', 'TLSv1.3'], 'ssl.verification_mode': 'full', + 'ssl.key': '', + 'ssl.key_passphrase': '', tags: Array.isArray(monitor.tags) ? monitor.tags : monitor.tags?.split(','), timeout: '80', type: 'http', urls: Array.isArray(monitor.urls) ? monitor.urls?.[0] : monitor.urls, + 'url.port': null, }); } } finally { @@ -223,12 +351,19 @@ export default function ({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'true') .expect(200); - expect(createdMonitorsResponse.body.monitors[0].attributes).to.eql({ + const decryptedCreatedMonitor = await supertest + .get(`${API_URLS.SYNTHETICS_MONITORS}/${createdMonitorsResponse.body.monitors[0].id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + expect(decryptedCreatedMonitor.body.attributes).to.eql({ __ui: { is_tls_enabled: false, }, config_id: '', custom_heartbeat_id: `${journeyId}-test-suite-default`, + 'check.receive': '', + 'check.send': '', enabled: true, form_monitor_type: 'tcp', journey_id: journeyId, @@ -263,10 +398,13 @@ export default function ({ getService }: FtrProviderContext) { 'ssl.certificate_authorities': '', 'ssl.supported_protocols': ['TLSv1.1', 'TLSv1.2', 'TLSv1.3'], 'ssl.verification_mode': 'full', + 'ssl.key': '', + 'ssl.key_passphrase': '', tags: Array.isArray(monitor.tags) ? monitor.tags : monitor.tags?.split(','), timeout: '16', type: 'tcp', hosts: Array.isArray(monitor.hosts) ? monitor.hosts?.[0] : monitor.hosts, + 'url.port': null, }); } } finally { @@ -312,7 +450,12 @@ export default function ({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'true') .expect(200); - expect(createdMonitorsResponse.body.monitors[0].attributes).to.eql({ + const decryptedCreatedMonitor = await supertest + .get(`${API_URLS.SYNTHETICS_MONITORS}/${createdMonitorsResponse.body.monitors[0].id}`) + .set('kbn-xsrf', 'true') + .expect(200); + + expect(decryptedCreatedMonitor.body.attributes).to.eql({ config_id: '', custom_heartbeat_id: `${journeyId}-test-suite-default`, enabled: true, diff --git a/x-pack/test/api_integration/apis/uptime/rest/edit_monitor.ts b/x-pack/test/api_integration/apis/uptime/rest/edit_monitor.ts index 480d07e7144f..eb44aa36a76c 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/edit_monitor.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/edit_monitor.ts @@ -16,7 +16,7 @@ import { getFixtureJson } from './helper/get_fixture_json'; import { PrivateLocationTestService } from './services/private_location_test_service'; export default function ({ getService }: FtrProviderContext) { - describe('[PUT] /internal/uptime/service/monitors', function () { + describe('EditMonitor', function () { this.tags('skipCloud'); const supertest = getService('supertest'); @@ -109,6 +109,66 @@ export default function ({ getService }: FtrProviderContext) { ); }); + it('strips unknown keys from monitor edits', async () => { + const newMonitor = httpMonitorJson; + + const { id: monitorId, attributes: savedMonitor } = await saveMonitor( + newMonitor as MonitorFields + ); + + expect(savedMonitor).eql(omit(newMonitor, secretKeys)); + + const updates: Partial = { + [ConfigKey.URLS]: 'https://modified-host.com', + [ConfigKey.NAME]: 'Modified name', + [ConfigKey.LOCATIONS]: [ + { + id: 'eu-west-01', + label: 'Europe West', + geo: { + lat: 33.2343132435, + lon: 73.2342343434, + }, + url: 'https://example-url.com', + isServiceManaged: true, + }, + ], + [ConfigKey.REQUEST_HEADERS_CHECK]: { + sampleHeader2: 'sampleValue2', + }, + [ConfigKey.METADATA]: { + script_source: { + is_generated_script: false, + file_name: 'test-file.name', + }, + }, + unknownkey: 'unknownvalue', + } as Partial; + + const modifiedMonitor = omit( + { + ...newMonitor, + ...updates, + [ConfigKey.METADATA]: { + ...newMonitor[ConfigKey.METADATA], + ...updates[ConfigKey.METADATA], + }, + }, + ['unknownkey'] + ); + + const editResponse = await supertest + .put(API_URLS.SYNTHETICS_MONITORS + '/' + monitorId) + .set('kbn-xsrf', 'true') + .send(modifiedMonitor) + .expect(200); + + expect(editResponse.body.attributes).eql( + omit({ ...modifiedMonitor, revision: 2 }, secretKeys) + ); + expect(editResponse.body.attributes).not.to.have.keys('unknownkey'); + }); + it('returns 404 if monitor id is not present', async () => { const invalidMonitorId = 'invalid-id'; const expected404Message = `Monitor id ${invalidMonitorId} not found!`; diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/http_monitor.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/http_monitor.json index 76478fd7aee1..45a2e11e9f30 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/http_monitor.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/http_monitor.json @@ -23,6 +23,7 @@ "max_redirects": "3", "password": "test", "urls": "https://nextjs-test-synthetics.vercel.app/api/users", + "url.port": null, "proxy_url": "http://proxy.com", "check.response.body.negative": [], "check.response.body.positive": [], diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/icmp_monitor.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/icmp_monitor.json index d9df06d1c7c3..052c811461ae 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/icmp_monitor.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/icmp_monitor.json @@ -1,5 +1,5 @@ { - "type": "tcp", + "type": "icmp", "locations": [], "journey_id": "", "enabled": true, @@ -14,25 +14,8 @@ "tagT2" ], "timeout": "16", - "__ui": { - "is_tls_enabled": true, - "is_zip_url_tls_enabled": false - }, "hosts": "192.33.22.111:3333", - "proxy_url": "", - "proxy_use_local_resolver": false, - "check.receive": "", - "check.send": "", - "ssl.certificate_authorities": "", - "ssl.certificate": "", - "ssl.key": "", - "ssl.key_passphrase": "", - "ssl.verification_mode": "full", - "ssl.supported_protocols": [ - "TLSv1.1", - "TLSv1.2", - "TLSv1.3" - ], + "wait": "1", "name": "Test HTTP Monitor 04", "namespace": "testnamespace", "origin": "ui", diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/tcp_monitor.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/tcp_monitor.json index 1c726c1bcc70..e0b4ca03b1d8 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/tcp_monitor.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/tcp_monitor.json @@ -15,6 +15,7 @@ "is_zip_url_tls_enabled": false }, "hosts": "example-host:40", + "url.port": null, "proxy_url": "", "proxy_use_local_resolver": false, "check.receive": "", diff --git a/x-pack/test/functional/apps/discover/visualize_field.ts b/x-pack/test/functional/apps/discover/visualize_field.ts index 0a7f075d50bd..be1f22311050 100644 --- a/x-pack/test/functional/apps/discover/visualize_field.ts +++ b/x-pack/test/functional/apps/discover/visualize_field.ts @@ -26,12 +26,20 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { 'spaceSelector', 'header', ]); + const monacoEditor = getService('monacoEditor'); + + const defaultSettings = { + 'discover:enableSql': true, + }; async function setDiscoverTimeRange() { await PageObjects.timePicker.setDefaultAbsoluteRange(); } describe('discover field visualize button', () => { + before(async () => { + await kibanaServer.uiSettings.replace(defaultSettings); + }); beforeEach(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); await kibanaServer.importExport.load( @@ -95,5 +103,23 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(selectedPattern).to.eql('logst*'); }); }); + + it('should visualize correctly text based language queries', async () => { + await PageObjects.discover.selectTextBaseLang('SQL'); + await PageObjects.header.waitUntilLoadingHasFinished(); + await monacoEditor.setCodeEditorValue( + 'SELECT extension, AVG("bytes") as average FROM "logstash-*" GROUP BY extension' + ); + await testSubjects.click('querySubmitButton'); + await PageObjects.header.waitUntilLoadingHasFinished(); + + await testSubjects.click('textBased-visualize'); + + await retry.try(async () => { + const dimensions = await testSubjects.findAll('lns-dimensionTrigger-textBased'); + expect(dimensions).to.have.length(2); + expect(await dimensions[1].getVisibleText()).to.be('average'); + }); + }); }); } diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts index 7d6cc5ea9881..a3314aabce72 100644 --- a/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/cloning.ts @@ -16,6 +16,7 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); // FLAKY: https://github.com/elastic/kibana/issues/142118 + // Failing: See https://github.com/elastic/kibana/issues/142118 describe.skip('jobs cloning supported by UI form', function () { const testDataList: Array<{ suiteTitle: string; diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/results_view_content.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/results_view_content.ts index 2bddf0a7d951..af023ea52d9b 100644 --- a/x-pack/test/functional/apps/ml/data_frame_analytics/results_view_content.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/results_view_content.ts @@ -14,7 +14,8 @@ export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); - describe('results view content and total feature importance', function () { + // Failing: See https://github.com/elastic/kibana/issues/142152 + describe.skip('results view content and total feature importance', function () { const testDataList: Array<{ suiteTitle: string; archive: string; diff --git a/x-pack/test/functional/services/ml/api.ts b/x-pack/test/functional/services/ml/api.ts index 62d46e644f17..d6802d2cb0f7 100644 --- a/x-pack/test/functional/services/ml/api.ts +++ b/x-pack/test/functional/services/ml/api.ts @@ -8,6 +8,7 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import expect from '@kbn/expect'; import { ProvidedType } from '@kbn/test'; +import type { TypeOf } from '@kbn/config-schema'; import fs from 'fs'; import { Calendar } from '@kbn/ml-plugin/server/models/calendar'; import { Annotation } from '@kbn/ml-plugin/common/types/annotations'; @@ -17,6 +18,7 @@ import { DataFrameTaskStateType } from '@kbn/ml-plugin/common/types/data_frame_a import { DATA_FRAME_TASK_STATE } from '@kbn/ml-plugin/common/constants/data_frame_analytics'; import { Datafeed, Job } from '@kbn/ml-plugin/common/types/anomaly_detection_jobs'; import { JobType } from '@kbn/ml-plugin/common/types/saved_objects'; +import { setupModuleBodySchema } from '@kbn/ml-plugin/server/routes/schemas/modules'; import { ML_ANNOTATIONS_INDEX_ALIAS_READ, ML_ANNOTATIONS_INDEX_ALIAS_WRITE, @@ -1445,5 +1447,21 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { log.debug('> Ingest pipeline deleted'); }, + + async setupModule( + moduleId: string, + body: TypeOf, + space?: string + ) { + log.debug(`Setting up module with ID: "${moduleId}"`); + const { body: module, status } = await kbnSupertest + .post(`${space ? `/s/${space}` : ''}/api/ml/modules/setup/${moduleId}`) + .set(COMMON_REQUEST_HEADERS) + .send(body); + this.assertResponseStatusCode(200, status, module); + + log.debug('Module set up'); + return module; + }, }; } diff --git a/x-pack/test/functional/services/ml/custom_urls.ts b/x-pack/test/functional/services/ml/custom_urls.ts index 1695b575e1f0..46e145cda1c3 100644 --- a/x-pack/test/functional/services/ml/custom_urls.ts +++ b/x-pack/test/functional/services/ml/custom_urls.ts @@ -111,7 +111,7 @@ export function MachineLearningCustomUrlsProvider({ ); expect(actualLabel).to.eql( expectedLabel, - `Expected custom url item to be '${expectedLabel}' (got '${actualLabel}')` + `Expected custom url label to be '${expectedLabel}' (got '${actualLabel}')` ); }, @@ -123,7 +123,7 @@ export function MachineLearningCustomUrlsProvider({ ); expect(actualUrl).to.eql( expectedUrl, - `Expected custom url item to be '${expectedUrl}' (got '${actualUrl}')` + `Expected custom url value to be '${expectedUrl}' (got '${actualUrl}')` ); }, diff --git a/x-pack/test/functional/services/ml/test_resources.ts b/x-pack/test/functional/services/ml/test_resources.ts index d1a7557caf2b..56d01a4f1a86 100644 --- a/x-pack/test/functional/services/ml/test_resources.ts +++ b/x-pack/test/functional/services/ml/test_resources.ts @@ -54,15 +54,25 @@ export function MachineLearningTestResourcesProvider( await kibanaServer.uiSettings.unset('hideAnnouncements'); }, - async savedObjectExistsById(id: string, objectType: SavedObjectType): Promise { - const response = await supertest.get(`/api/saved_objects/${objectType}/${id}`); + async savedObjectExistsById( + id: string, + objectType: SavedObjectType, + space?: string + ): Promise { + const response = await supertest.get( + `${space ? `/s/${space}` : ''}/api/saved_objects/${objectType}/${id}` + ); return response.status === 200; }, - async savedObjectExistsByTitle(title: string, objectType: SavedObjectType): Promise { - const id = await this.getSavedObjectIdByTitle(title, objectType); + async savedObjectExistsByTitle( + title: string, + objectType: SavedObjectType, + space?: string + ): Promise { + const id = await this.getSavedObjectIdByTitle(title, objectType, space); if (id) { - return await this.savedObjectExistsById(id, objectType); + return await this.savedObjectExistsById(id, objectType, space); } else { return false; } @@ -70,11 +80,14 @@ export function MachineLearningTestResourcesProvider( async getSavedObjectIdByTitle( title: string, - objectType: SavedObjectType + objectType: SavedObjectType, + space?: string ): Promise { log.debug(`Searching for '${objectType}' with title '${title}'...`); const { body: findResponse, status } = await supertest - .get(`/api/saved_objects/_find?type=${objectType}&per_page=10000`) + .get( + `${space ? `/s/${space}` : ''}/api/saved_objects/_find?type=${objectType}&per_page=10000` + ) .set(COMMON_REQUEST_HEADERS); mlApi.assertResponseStatusCode(200, status, findResponse); @@ -104,8 +117,8 @@ export function MachineLearningTestResourcesProvider( return savedObjectIds; }, - async getIndexPatternId(title: string): Promise { - return this.getSavedObjectIdByTitle(title, SavedObjectType.INDEX_PATTERN); + async getIndexPatternId(title: string, space?: string): Promise { + return this.getSavedObjectIdByTitle(title, SavedObjectType.INDEX_PATTERN, space); }, async getSavedSearchId(title: string): Promise { @@ -120,7 +133,11 @@ export function MachineLearningTestResourcesProvider( return this.getSavedObjectIdByTitle(title, SavedObjectType.DASHBOARD); }, - async createIndexPattern(title: string, timeFieldName?: string): Promise { + async createIndexPattern( + title: string, + timeFieldName?: string, + space?: string + ): Promise { log.debug( `Creating index pattern with title '${title}'${ timeFieldName !== undefined ? ` and time field '${timeFieldName}'` : '' @@ -128,12 +145,12 @@ export function MachineLearningTestResourcesProvider( ); const { body: createResponse, status } = await supertest - .post(`/api/saved_objects/${SavedObjectType.INDEX_PATTERN}`) + .post(`${space ? `/s/${space}` : ''}/api/saved_objects/${SavedObjectType.INDEX_PATTERN}`) .set(COMMON_REQUEST_HEADERS) .send({ attributes: { title, timeFieldName } }); mlApi.assertResponseStatusCode(200, status, createResponse); - await this.assertIndexPatternExistByTitle(title); + await this.assertIndexPatternExistByTitle(title, space); log.debug(` > Created with id '${createResponse.id}'`); return createResponse.id; @@ -152,13 +169,17 @@ export function MachineLearningTestResourcesProvider( return createResponse; }, - async createIndexPatternIfNeeded(title: string, timeFieldName?: string): Promise { - const indexPatternId = await this.getIndexPatternId(title); + async createIndexPatternIfNeeded( + title: string, + timeFieldName?: string, + space?: string + ): Promise { + const indexPatternId = await this.getIndexPatternId(title, space); if (indexPatternId !== undefined) { log.debug(`Index pattern with title '${title}' already exists. Nothing to create.`); return indexPatternId; } else { - return await this.createIndexPattern(title, timeFieldName); + return await this.createIndexPattern(title, timeFieldName, space); } }, @@ -301,7 +322,12 @@ export function MachineLearningTestResourcesProvider( ); }, - async deleteSavedObjectById(id: string, objectType: SavedObjectType, force: boolean = false) { + async deleteSavedObjectById( + id: string, + objectType: SavedObjectType, + force: boolean = false, + space?: string + ) { log.debug(`Deleting ${objectType} with id '${id}'...`); if ((await this.savedObjectExistsById(id, objectType)) === false) { @@ -309,31 +335,31 @@ export function MachineLearningTestResourcesProvider( return; } else { const { body, status } = await supertest - .delete(`/api/saved_objects/${objectType}/${id}`) + .delete(`${space ? `/s/${space}` : ''}/api/saved_objects/${objectType}/${id}`) .set(COMMON_REQUEST_HEADERS) .query({ force }); mlApi.assertResponseStatusCode(200, status, body); - await this.assertSavedObjectNotExistsById(id, objectType); + await this.assertSavedObjectNotExistsById(id, objectType, space); log.debug(` > Deleted ${objectType} with id '${id}'`); } }, - async deleteIndexPatternByTitle(title: string) { + async deleteIndexPatternByTitle(title: string, space?: string) { log.debug(`Deleting index pattern with title '${title}'...`); - const indexPatternId = await this.getIndexPatternId(title); + const indexPatternId = await this.getIndexPatternId(title, space); if (indexPatternId === undefined) { log.debug(`Index pattern with title '${title}' does not exists. Nothing to delete.`); return; } else { - await this.deleteIndexPatternById(indexPatternId); + await this.deleteIndexPatternById(indexPatternId, space); } }, - async deleteIndexPatternById(id: string) { - await this.deleteSavedObjectById(id, SavedObjectType.INDEX_PATTERN); + async deleteIndexPatternById(id: string, space?: string) { + await this.deleteSavedObjectById(id, SavedObjectType.INDEX_PATTERN, false, space); }, async deleteSavedSearchByTitle(title: string) { @@ -396,12 +422,16 @@ export function MachineLearningTestResourcesProvider( } }, - async assertSavedObjectExistsByTitle(title: string, objectType: SavedObjectType) { + async assertSavedObjectExistsByTitle( + title: string, + objectType: SavedObjectType, + space?: string + ) { await retry.waitForWithTimeout( `${objectType} with title '${title}' to exist`, 5 * 1000, async () => { - if ((await this.savedObjectExistsByTitle(title, objectType)) === true) { + if ((await this.savedObjectExistsByTitle(title, objectType, space)) === true) { return true; } else { throw new Error(`${objectType} with title '${title}' should exist.`); @@ -438,12 +468,12 @@ export function MachineLearningTestResourcesProvider( ); }, - async assertSavedObjectNotExistsById(id: string, objectType: SavedObjectType) { + async assertSavedObjectNotExistsById(id: string, objectType: SavedObjectType, space?: string) { await retry.waitForWithTimeout( `${objectType} with id '${id}' not to exist`, 5 * 1000, async () => { - if ((await this.savedObjectExistsById(id, objectType)) === false) { + if ((await this.savedObjectExistsById(id, objectType, space)) === false) { return true; } else { throw new Error(`${objectType} with id '${id}' should not exist.`); @@ -452,8 +482,8 @@ export function MachineLearningTestResourcesProvider( ); }, - async assertIndexPatternExistByTitle(title: string) { - await this.assertSavedObjectExistsByTitle(title, SavedObjectType.INDEX_PATTERN); + async assertIndexPatternExistByTitle(title: string, space?: string) { + await this.assertSavedObjectExistsByTitle(title, SavedObjectType.INDEX_PATTERN, space); }, async assertIndexPatternExistById(id: string) { diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts index 56dfa17ef626..d32c5bd58a94 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/details.ts @@ -136,9 +136,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { return response; } - // Failing: See https://github.com/elastic/kibana/issues/129337 - // Failing: See https://github.com/elastic/kibana/issues/129337 - describe.skip('Rule Details', function () { + describe('Rule Details', function () { describe('Header', function () { const testRunUuid = uuid.v4(); before(async () => { @@ -200,19 +198,27 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); }); - it('shouldnt allow you to snooze a disabled rule', async () => { + it('should allow you to snooze a disabled rule', async () => { const actionsDropdown = await testSubjects.find('statusDropdown'); expect(await actionsDropdown.getVisibleText()).to.eql('Disabled'); - await actionsDropdown.click(); - const actionsMenuElem = await testSubjects.find('ruleStatusMenu'); - const actionsMenuItemElem = await actionsMenuElem.findAllByClassName('euiContextMenuItem'); + let snoozeBadge = await testSubjects.find('rulesListNotifyBadge-unsnoozed'); + await snoozeBadge.click(); - expect(await actionsMenuItemElem.at(2)?.getVisibleText()).to.eql('Snooze'); - expect(await actionsMenuItemElem.at(2)?.getAttribute('disabled')).to.eql('true'); - // close the dropdown - await actionsDropdown.click(); + const snoozeIndefinite = await testSubjects.find('ruleSnoozeIndefiniteApply'); + await snoozeIndefinite.click(); + + await retry.try(async () => { + await testSubjects.existOrFail('rulesListNotifyBadge-snoozedIndefinitely'); + }); + + // Unsnooze the rule for the next test + snoozeBadge = await testSubjects.find('rulesListNotifyBadge-snoozedIndefinitely'); + await snoozeBadge.click(); + + const snoozeCancel = await testSubjects.find('ruleSnoozeCancel'); + await snoozeCancel.click(); }); it('should reenable a disabled the rule', async () => { @@ -232,42 +238,26 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); it('should snooze the rule', async () => { - const actionsDropdown = await testSubjects.find('statusDropdown'); - - expect(await actionsDropdown.getVisibleText()).to.eql('Enabled'); - - await actionsDropdown.click(); - const actionsMenuElem = await testSubjects.find('ruleStatusMenu'); - const actionsMenuItemElem = await actionsMenuElem.findAllByClassName('euiContextMenuItem'); - - await actionsMenuItemElem.at(2)?.click(); + const snoozeBadge = await testSubjects.find('rulesListNotifyBadge-unsnoozed'); + await snoozeBadge.click(); const snoozeIndefinite = await testSubjects.find('ruleSnoozeIndefiniteApply'); await snoozeIndefinite.click(); await retry.try(async () => { - expect(await actionsDropdown.getVisibleText()).to.eql('Snoozed'); - const remainingSnoozeTime = await testSubjects.find('remainingSnoozeTime'); - expect(await remainingSnoozeTime.getVisibleText()).to.eql('Indefinitely'); + await testSubjects.existOrFail('rulesListNotifyBadge-snoozedIndefinitely'); }); }); it('should unsnooze the rule', async () => { - const actionsDropdown = await testSubjects.find('statusDropdown'); - - expect(await actionsDropdown.getVisibleText()).to.eql('Snoozed'); - - await actionsDropdown.click(); - const actionsMenuElem = await testSubjects.find('ruleStatusMenu'); - const actionsMenuItemElem = await actionsMenuElem.findAllByClassName('euiContextMenuItem'); - - await actionsMenuItemElem.at(2)?.click(); + const snoozeBadge = await testSubjects.find('rulesListNotifyBadge-snoozedIndefinitely'); + await snoozeBadge.click(); const snoozeCancel = await testSubjects.find('ruleSnoozeCancel'); await snoozeCancel.click(); await retry.try(async () => { - expect(await actionsDropdown.getVisibleText()).to.eql('Enabled'); + await testSubjects.existOrFail('rulesListNotifyBadge-unsnoozed'); }); }); }); @@ -510,6 +500,22 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { expect(await testSubjects.exists('addNewActionConnectorActionGroup-0')).to.eql(true); expect(await testSubjects.exists('addNewActionConnectorActionGroup-1')).to.eql(true); + + // delete connector + await pageObjects.common.navigateToApp('triggersActions'); + // refresh to see alert + await browser.refresh(); + await pageObjects.header.waitUntilLoadingHasFinished(); + + // verify content + await testSubjects.existOrFail('rulesList'); + + await pageObjects.triggersActionsUI.changeTabs('connectorsTab'); + await pageObjects.triggersActionsUI.searchConnectors('new connector'); + await testSubjects.click('deleteConnector'); + await testSubjects.existOrFail('deleteIdsConfirmation'); + await testSubjects.click('deleteIdsConfirmation > confirmModalConfirmButton'); + await testSubjects.missingOrFail('deleteIdsConfirmation'); }); }); @@ -890,6 +896,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { it('renders the event log list and can filter/sort', async () => { await browser.refresh(); + await (await testSubjects.find('eventLogListTab')).click(); // Check to see if the experimental is enabled, if not, just return const tabbedContentExists = await testSubjects.exists('ruleDetailsTabbedContent'); diff --git a/x-pack/test/plugin_api_integration/test_suites/task_manager/task_management.ts b/x-pack/test/plugin_api_integration/test_suites/task_manager/task_management.ts index 123259cadf0c..fd7e07dacb47 100644 --- a/x-pack/test/plugin_api_integration/test_suites/task_manager/task_management.ts +++ b/x-pack/test/plugin_api_integration/test_suites/task_manager/task_management.ts @@ -54,7 +54,8 @@ export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); const testHistoryIndex = '.kibana_task_manager_test_result'; - describe('scheduling and running tasks', () => { + // Failing: See https://github.com/elastic/kibana/issues/141002 + describe.skip('scheduling and running tasks', () => { beforeEach(async () => { // clean up before each test return await supertest.delete('/api/sample_tasks').set('kbn-xsrf', 'xxx').expect(200); diff --git a/x-pack/test/saved_object_api_integration/spaces_only/apis/bulk_create.ts b/x-pack/test/saved_object_api_integration/spaces_only/apis/bulk_create.ts index 4e5059933dd7..34e18b76088f 100644 --- a/x-pack/test/saved_object_api_integration/spaces_only/apis/bulk_create.ts +++ b/x-pack/test/saved_object_api_integration/spaces_only/apis/bulk_create.ts @@ -116,7 +116,8 @@ export default function ({ getService }: FtrProviderContext) { }); }; - describe('_bulk_create', () => { + // Failing: See https://github.com/elastic/kibana/issues/141782 + describe.skip('_bulk_create', () => { getTestScenarios([false, true]).spaces.forEach(({ spaceId, modifier: overwrite }) => { const suffix = overwrite ? ' with overwrite enabled' : ''; const tests = createTests(overwrite!, spaceId); diff --git a/yarn.lock b/yarn.lock index 804502ebeb4c..b9db4636175d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1455,10 +1455,10 @@ dependencies: object-hash "^1.3.0" -"@elastic/charts@49.0.0": - version "49.0.0" - resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-49.0.0.tgz#6cda2bdb8c92691c12843ba44014fad5a60d61b0" - integrity sha512-LXurKWGyPWXgMUJ6l21tSI4y9N3lJh3yJkDGCjvW9M5P3CXICR1V9ZizMMZlj9p1OXULsccrInsiUBFMU0Ktog== +"@elastic/charts@50.0.1": + version "50.0.1" + resolved "https://registry.yarnpkg.com/@elastic/charts/-/charts-50.0.1.tgz#a0ee66668c857be7cfea2e134e0b84930d1564c5" + integrity sha512-O1L8rot0dycTQo/0eW7aD2P4K3Bh1LtzMgRBXYZAtIpbzdxveRkl8fOlIkGxeeHE4YNvntUJaJWeyT+ngGg7QA== dependencies: "@popperjs/core" "^2.4.0" bezier-easing "^2.1.0" @@ -3118,6 +3118,10 @@ version "0.0.0" uid "" +"@kbn/core-plugins-base-server-internal@link:bazel-bin/packages/core/plugins/core-plugins-base-server-internal": + version "0.0.0" + uid "" + "@kbn/core-plugins-browser-internal@link:bazel-bin/packages/core/plugins/core-plugins-browser-internal": version "0.0.0" uid "" @@ -3150,6 +3154,14 @@ version "0.0.0" uid "" +"@kbn/core-rendering-server-internal@link:bazel-bin/packages/core/rendering/core-rendering-server-internal": + version "0.0.0" + uid "" + +"@kbn/core-rendering-server-mocks@link:bazel-bin/packages/core/rendering/core-rendering-server-mocks": + version "0.0.0" + uid "" + "@kbn/core-root-browser-internal@link:bazel-bin/packages/core/root/core-root-browser-internal": version "0.0.0" uid "" @@ -7251,6 +7263,10 @@ version "0.0.0" uid "" +"@types/kbn__core-plugins-base-server-internal@link:bazel-bin/packages/core/plugins/core-plugins-base-server-internal/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__core-plugins-browser-internal@link:bazel-bin/packages/core/plugins/core-plugins-browser-internal/npm_module_types": version "0.0.0" uid "" @@ -7287,6 +7303,14 @@ version "0.0.0" uid "" +"@types/kbn__core-rendering-server-internal@link:bazel-bin/packages/core/rendering/core-rendering-server-internal/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__core-rendering-server-mocks@link:bazel-bin/packages/core/rendering/core-rendering-server-mocks/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__core-root-browser-internal@link:bazel-bin/packages/core/root/core-root-browser-internal/npm_module_types": version "0.0.0" uid "" @@ -12559,10 +12583,10 @@ cypress-recurse@^1.23.0: resolved "https://registry.yarnpkg.com/cypress-recurse/-/cypress-recurse-1.23.0.tgz#f87334747516de6737bc4708754e8f429057bc6d" integrity sha512-CAsdvynhuR3SUEXVJRO2jBEnZRJ6nJp7nMXHwzV4UQq9Lap3Bj72AwcJK0cl51fJXcTaGDXYTQQ9zvGe3TyaQA== -cypress@^10.7.0: - version "10.7.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.7.0.tgz#2d37f8b9751c6de33ee48639cb7e67a2ce593231" - integrity sha512-gTFvjrUoBnqPPOu9Vl5SBHuFlzx/Wxg/ZXIz2H4lzoOLFelKeF7mbwYUOzgzgF0oieU2WhJAestQdkgwJMMTvQ== +cypress@^10.9.0: + version "10.9.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.9.0.tgz#273a61a6304766f9d6423e5ac8d4a9a11ed8b485" + integrity sha512-MjIWrRpc+bQM9U4kSSdATZWZ2hUqHGFEQTF7dfeZRa4MnalMtc88FIE49USWP2ZVtfy5WPBcgfBX+YorFqGElA== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" @@ -12583,7 +12607,7 @@ cypress@^10.7.0: dayjs "^1.10.4" debug "^4.3.2" enquirer "^2.3.6" - eventemitter2 "^6.4.3" + eventemitter2 "6.4.7" execa "4.1.0" executable "^4.1.1" extract-zip "2.0.1" @@ -14679,10 +14703,10 @@ eventemitter-asyncresource@^1.0.0: resolved "https://registry.yarnpkg.com/eventemitter-asyncresource/-/eventemitter-asyncresource-1.0.0.tgz#734ff2e44bf448e627f7748f905d6bdd57bdb65b" integrity sha512-39F7TBIV0G7gTelxwbEqnwhp90eqCPON1k0NwNfwhgKn4Co4ybUbj2pECcXT0B3ztRKZ7Pw1JujUUgmQJHcVAQ== -eventemitter2@^6.4.3: - version "6.4.3" - resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.3.tgz#35c563619b13f3681e7eb05cbdaf50f56ba58820" - integrity sha512-t0A2msp6BzOf+QAcI6z9XMktLj52OjGQg+8SJH6v5+3uxNpWYRR3wQmfA+6xtMU9kOC59qk9licus5dYcrYkMQ== +eventemitter2@6.4.7: + version "6.4.7" + resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.7.tgz#a7f6c4d7abf28a14c1ef3442f21cb306a054271d" + integrity sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg== eventemitter3@^4.0.0: version "4.0.7"