diff --git a/.buildkite/scripts/build_kibana.sh b/.buildkite/scripts/build_kibana.sh index 90f9da8ac8de4..2757c956920f7 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/common/util.sh b/.buildkite/scripts/common/util.sh index 1ce05856ec6b7..748babfc0650b 100755 --- a/.buildkite/scripts/common/util.sh +++ b/.buildkite/scripts/common/util.sh @@ -39,6 +39,7 @@ check_for_changed_files() { C_RESET='\033[0m' # Reset color SHOULD_AUTO_COMMIT_CHANGES="${2:-}" + CUSTOM_FIX_MESSAGE="${3:-}" GIT_CHANGES="$(git ls-files --modified -- . ':!:.bazelrc')" if [ "$GIT_CHANGES" ]; then @@ -75,7 +76,11 @@ check_for_changed_files() { else echo -e "\n${RED}ERROR: '$1' caused changes to the following files:${C_RESET}\n" echo -e "$GIT_CHANGES\n" - echo -e "\n${YELLOW}TO FIX: Run '$1' locally, commit the changes and push to your branch${C_RESET}\n" + if [ "$CUSTOM_FIX_MESSAGE" ]; then + echo "$CUSTOM_FIX_MESSAGE" + else + echo -e "\n${YELLOW}TO FIX: Run '$1' locally, commit the changes and push to your branch${C_RESET}\n" + fi exit 1 fi fi diff --git a/.buildkite/scripts/download_build_artifacts.sh b/.buildkite/scripts/download_build_artifacts.sh index dd0ae660543a8..1e793346da33b 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/checks.sh b/.buildkite/scripts/steps/checks.sh index 4af63d318c804..0e11ac04eea1d 100755 --- a/.buildkite/scripts/steps/checks.sh +++ b/.buildkite/scripts/steps/checks.sh @@ -8,6 +8,7 @@ export DISABLE_BOOTSTRAP_VALIDATION=false .buildkite/scripts/steps/checks/precommit_hook.sh .buildkite/scripts/steps/checks/ftr_configs.sh .buildkite/scripts/steps/checks/bazel_packages.sh +.buildkite/scripts/steps/checks/event_log.sh .buildkite/scripts/steps/checks/telemetry.sh .buildkite/scripts/steps/checks/ts_projects.sh .buildkite/scripts/steps/checks/jest_configs.sh diff --git a/.buildkite/scripts/steps/checks/event_log.sh b/.buildkite/scripts/steps/checks/event_log.sh new file mode 100755 index 0000000000000..dc9c01902c010 --- /dev/null +++ b/.buildkite/scripts/steps/checks/event_log.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check Event Log Schema + +# event log schema is pinned to a specific version of ECS +ECS_STABLE_VERSION=1.8 +git clone --depth 1 -b $ECS_STABLE_VERSION https://github.com/elastic/ecs.git ../ecs + +node x-pack/plugins/event_log/scripts/create_schemas.js + +check_for_changed_files 'node x-pack/plugins/event_log/scripts/create_schemas.js' false 'Follow the directions in x-pack/plugins/event_log/generated/README.md to make schema changes for the event log.' diff --git a/.buildkite/scripts/steps/demo_env/Dockerfile b/.buildkite/scripts/steps/demo_env/Dockerfile index a0b1c3311dc8c..4e841c04bbf42 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/.buildkite/scripts/steps/storybooks/build_and_upload.ts b/.buildkite/scripts/steps/storybooks/build_and_upload.ts index 8575ee683d82f..dcceca7848910 100644 --- a/.buildkite/scripts/steps/storybooks/build_and_upload.ts +++ b/.buildkite/scripts/steps/storybooks/build_and_upload.ts @@ -41,6 +41,7 @@ const STORYBOOKS = [ 'presentation', 'security_solution', 'shared_ux', + 'triggers_actions_ui', 'ui_actions_enhanced', 'unified_search', ]; diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d802eb4024a08..b7d588bc89269 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 @@ -915,6 +918,7 @@ packages/kbn-rule-data-utils @elastic/apm-ui packages/kbn-safer-lodash-set @elastic/kibana-security packages/kbn-securitysolution-autocomplete @elastic/security-solution-platform packages/kbn-securitysolution-es-utils @elastic/security-solution-platform +packages/kbn-securitysolution-exception-list-components @elastic/security-solution-platform packages/kbn-securitysolution-hook-utils @elastic/security-solution-platform packages/kbn-securitysolution-io-ts-alerting-types @elastic/security-solution-platform packages/kbn-securitysolution-io-ts-list-types @elastic/security-solution-platform diff --git a/.gitignore b/.gitignore index 98b294dbd6dc2..82a13e661a5bb 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/.i18nrc.json b/.i18nrc.json index 20b2588ca2fab..462daff20de63 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -60,6 +60,7 @@ "kibana-react": "src/plugins/kibana_react", "kibanaOverview": "src/plugins/kibana_overview", "lists": "packages/kbn-securitysolution-list-utils/src", + "exceptionList-components": "packages/kbn-securitysolution-exception-list-components/src", "management": ["src/legacy/core_plugins/management", "src/plugins/management"], "monaco": "packages/kbn-monaco/src", "navigation": "src/plugins/navigation", diff --git a/api_docs/actions.mdx b/api_docs/actions.mdx index 4d0790ec95184..f845dffebd44e 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-28 +date: 2022-10-04 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 88e4157414a7f..c624a6191fca4 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-28 +date: 2022-10-04 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 c3bd7eb349a07..bc33359fc9b04 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiops'] --- import aiopsObj from './aiops.devdocs.json'; diff --git a/api_docs/alerting.devdocs.json b/api_docs/alerting.devdocs.json index a19bdb320740d..e0cc3c68239e4 100644 --- a/api_docs/alerting.devdocs.json +++ b/api_docs/alerting.devdocs.json @@ -2666,8 +2666,6 @@ "Alert", "; scheduleActions: (actionGroup: ActionGroupIds, context?: Context) => ", "Alert", - "; scheduleActionsWithSubGroup: (actionGroup: ActionGroupIds, subgroup: string, context?: Context) => ", - "Alert", "; setContext: (context: Context) => ", "Alert", "; getContext: () => Context; hasContext: () => boolean; }" @@ -2832,7 +2830,11 @@ "section": "def-common.IExecutionErrorsResult", "text": "IExecutionErrorsResult" }, - ">; bulkEdit: ; getGlobalExecutionKpiWithAuth: ({ dateStart, dateEnd, filter, }: ", + "GetGlobalExecutionKPIParams", + ") => Promise<{ success: number; unknown: number; failure: number; activeAlerts: number; newAlerts: number; recoveredAlerts: number; erroredActions: number; triggeredActions: number; }>; getRuleExecutionKPI: ({ id, dateStart, dateEnd, filter }: ", + "GetRuleExecutionKPIParams", + ") => Promise<{ success: number; unknown: number; failure: number; activeAlerts: number; newAlerts: number; recoveredAlerts: number; erroredActions: number; triggeredActions: number; }>; bulkEdit: ; }; observability: { setup: { getScopedAnnotationsClient: (requestContext: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", " & { licensing: Promise<", { "pluginId": "licensing", @@ -5696,13 +5684,7 @@ "label": "context", "description": [], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", " & { licensing: Promise<", { "pluginId": "licensing", diff --git a/api_docs/apm.mdx b/api_docs/apm.mdx index d9218c6f9c48f..c5590b95953e3 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-28 +date: 2022-10-04 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 b574eadcc22f7..fde29f929d3e8 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'banners'] --- import bannersObj from './banners.devdocs.json'; diff --git a/api_docs/bfetch.devdocs.json b/api_docs/bfetch.devdocs.json index 74f1cf1aee455..f060159bc0f3a 100644 --- a/api_docs/bfetch.devdocs.json +++ b/api_docs/bfetch.devdocs.json @@ -357,13 +357,7 @@ "(path: string, params: (request: ", "KibanaRequest", ", context: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", ") => ", { "pluginId": "bfetch", @@ -375,13 +369,7 @@ ", method?: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | undefined, pluginRouter?: ", "IRouter", "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", "> | undefined) => void" ], "path": "src/plugins/bfetch/server/plugin.ts", @@ -414,13 +402,7 @@ "(request: ", "KibanaRequest", ", context: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", ") => ", { "pluginId": "bfetch", @@ -461,13 +443,7 @@ "signature": [ "IRouter", "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", "> | undefined" ], "path": "src/plugins/bfetch/server/plugin.ts", diff --git a/api_docs/bfetch.mdx b/api_docs/bfetch.mdx index e8fa3ead871d7..1b66b97f34a98 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-28 +date: 2022-10-04 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 9c484f7dfc615..72ab30c5fdb70 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-28 +date: 2022-10-04 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 2ec486a4957e7..2a80740fc9956 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-28 +date: 2022-10-04 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 b204ddb7b0ee0..18c757fc09259 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-28 +date: 2022-10-04 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 fdf2f80ec284b..dce65a128457b 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-28 +date: 2022-10-04 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 33e6421081033..653ae1b77adef 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-28 +date: 2022-10-04 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 8cdffb406e1d3..b3b220266009b 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-28 +date: 2022-10-04 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 e365d6a87afe3..ac8e3d27f519b 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-28 +date: 2022-10-04 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 69b2dfc22a263..79cb9a68aae5d 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'controls'] --- import controlsObj from './controls.devdocs.json'; diff --git a/api_docs/core.devdocs.json b/api_docs/core.devdocs.json index 607bae8fad1fc..dc8c7cd70e377 100644 --- a/api_docs/core.devdocs.json +++ b/api_docs/core.devdocs.json @@ -10389,7 +10389,7 @@ "\nThe outcome for a successful `resolve` call is one of the following values:\n\n * `'exactMatch'` -- One document exactly matched the given ID.\n * `'aliasMatch'` -- One document with a legacy URL alias matched the given ID; in this case the `saved_object.id` field is different\n than the given ID.\n * `'conflict'` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the\n `saved_object` object is the exact match, and the `saved_object.id` field is the same as the given ID." ], "signature": [ - "\"exactMatch\" | \"aliasMatch\" | \"conflict\"" + "\"conflict\" | \"exactMatch\" | \"aliasMatch\"" ], "path": "node_modules/@types/kbn__core-saved-objects-api-browser/index.d.ts", "deprecated": false, @@ -10850,6 +10850,14 @@ "plugin": "visualizations", "path": "src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx" }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/public/services/dashboard_saved_object/lib/load_dashboard_state_from_saved_object.ts" + }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/public/services/dashboard_saved_object/lib/load_dashboard_state_from_saved_object.ts" + }, { "plugin": "infra", "path": "x-pack/plugins/infra/public/hooks/use_find_saved_object.tsx" @@ -11184,11 +11192,15 @@ }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts" + "path": "src/plugins/dashboard/server/saved_objects/migrations/migrate_extract_panel_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts" + "path": "src/plugins/dashboard/server/saved_objects/migrations/migrate_extract_panel_references.ts" + }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts" }, { "plugin": "dashboard", @@ -11232,43 +11244,35 @@ }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "ml", @@ -11278,6 +11282,14 @@ "plugin": "ml", "path": "x-pack/plugins/ml/common/types/modules.ts" }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/public/services/dashboard_saved_object/lib/save_dashboard_state_to_saved_object.ts" + }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/public/services/dashboard_saved_object/lib/save_dashboard_state_to_saved_object.ts" + }, { "plugin": "@kbn/core-saved-objects-server-internal", "path": "packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/collect_references_deep.test.ts" @@ -15356,9 +15368,9 @@ "label": "SavedObjectsFindOptions", "description": [], "signature": [ - "{ type: string | string[]; filter?: any; search?: string | undefined; aggs?: Record | undefined; fields?: string[] | undefined; page?: number | undefined; perPage?: number | undefined; sortField?: string | undefined; searchFields?: string[] | undefined; hasReference?: ", + "> | undefined; page?: number | undefined; perPage?: number | undefined; sortField?: string | undefined; searchFields?: string[] | undefined; hasReference?: ", "SavedObjectsFindOptionsReference", " | ", "SavedObjectsFindOptionsReference", @@ -21534,13 +21546,7 @@ "signature": [ "HttpServicePreboot", "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", ">" ], "path": "src/core/server/index.ts", @@ -21575,7 +21581,10 @@ "description": [ "\nThe `core` context provided to route handler.\n\nProvides the following clients and services:\n - {@link SavedObjectsClient | savedObjects.client} - Saved Objects client\n which uses the credentials of the incoming request\n - {@link ISavedObjectTypeRegistry | savedObjects.typeRegistry} - Type registry containing\n all the registered types.\n - {@link IScopedClusterClient | elasticsearch.client} - Elasticsearch\n data client which uses the credentials of the incoming request\n - {@link IUiSettingsClient | uiSettings.client} - uiSettings client\n which uses the credentials of the incoming request" ], - "path": "src/core/server/core_route_handler_context.ts", + "signature": [ + "CoreRequestHandlerContext" + ], + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", "deprecated": false, "trackAdoption": false, "children": [ @@ -21589,7 +21598,7 @@ "signature": [ "SavedObjectsRequestHandlerContext" ], - "path": "src/core/server/core_route_handler_context.ts", + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", "deprecated": false, "trackAdoption": false }, @@ -21603,7 +21612,7 @@ "signature": [ "ElasticsearchRequestHandlerContext" ], - "path": "src/core/server/core_route_handler_context.ts", + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", "deprecated": false, "trackAdoption": false }, @@ -21617,7 +21626,7 @@ "signature": [ "UiSettingsRequestHandlerContext" ], - "path": "src/core/server/core_route_handler_context.ts", + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", "deprecated": false, "trackAdoption": false }, @@ -21631,7 +21640,7 @@ "signature": [ "DeprecationsRequestHandlerContext" ], - "path": "src/core/server/core_route_handler_context.ts", + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", "deprecated": false, "trackAdoption": false } @@ -21802,13 +21811,7 @@ "signature": [ "HttpServiceSetup", "<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", "> & { resources: ", { "pluginId": "core", @@ -25950,21 +25953,9 @@ ], "signature": [ "(route: ", "RouteConfig", ", handler: ", @@ -29394,36 +29385,6 @@ ], "initialIsOpen": false }, - { - "parentPluginId": "core", - "id": "def-server.IRenderOptions", - "type": "Interface", - "tags": [], - "label": "IRenderOptions", - "description": [], - "path": "src/core/server/rendering/types.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "core", - "id": "def-server.IRenderOptions.isAnonymousPage", - "type": "CompoundType", - "tags": [], - "label": "isAnonymousPage", - "description": [ - "\nSet whether the page is anonymous, which determines what plugins are enabled and whether to output user settings in the page metadata.\n`false` by default." - ], - "signature": [ - "boolean | undefined" - ], - "path": "src/core/server/rendering/types.ts", - "deprecated": false, - "trackAdoption": false - } - ], - "initialIsOpen": false - }, { "parentPluginId": "core", "id": "def-server.IRouter", @@ -39420,6 +39381,37 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "core", + "id": "def-server.PrebootCoreRequestHandlerContext", + "type": "Interface", + "tags": [], + "label": "PrebootCoreRequestHandlerContext", + "description": [], + "signature": [ + "PrebootCoreRequestHandlerContext" + ], + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-server.PrebootCoreRequestHandlerContext.uiSettings", + "type": "Object", + "tags": [], + "label": "uiSettings", + "description": [], + "signature": [ + "PrebootUiSettingsRequestHandlerContext" + ], + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "core", "id": "def-server.PrebootPlugin", @@ -39523,6 +39515,41 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "core", + "id": "def-server.PrebootRequestHandlerContext", + "type": "Interface", + "tags": [], + "label": "PrebootRequestHandlerContext", + "description": [], + "signature": [ + "PrebootRequestHandlerContext", + " extends ", + "RequestHandlerContextBase" + ], + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "core", + "id": "def-server.PrebootRequestHandlerContext.core", + "type": "Object", + "tags": [], + "label": "core", + "description": [], + "signature": [ + "Promise<", + "PrebootCoreRequestHandlerContext", + ">" + ], + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "core", "id": "def-server.RegisterDeprecationsConfig", @@ -39588,17 +39615,11 @@ "\nBase context passed to a route handler, containing the `core` context part.\n" ], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", " extends ", "RequestHandlerContextBase" ], - "path": "src/core/server/index.ts", + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", "deprecated": false, "trackAdoption": false, "children": [ @@ -39611,16 +39632,10 @@ "description": [], "signature": [ "Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.CoreRequestHandlerContext", - "text": "CoreRequestHandlerContext" - }, + "CoreRequestHandlerContext", ">" ], - "path": "src/core/server/index.ts", + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", "deprecated": false, "trackAdoption": false } @@ -40487,6 +40502,14 @@ "plugin": "visualizations", "path": "src/plugins/visualizations/public/embeddable/visualize_embeddable.tsx" }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/public/services/dashboard_saved_object/lib/load_dashboard_state_from_saved_object.ts" + }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/public/services/dashboard_saved_object/lib/load_dashboard_state_from_saved_object.ts" + }, { "plugin": "infra", "path": "x-pack/plugins/infra/public/hooks/use_find_saved_object.tsx" @@ -40821,11 +40844,15 @@ }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts" + "path": "src/plugins/dashboard/server/saved_objects/migrations/migrate_extract_panel_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts" + "path": "src/plugins/dashboard/server/saved_objects/migrations/migrate_extract_panel_references.ts" + }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts" }, { "plugin": "dashboard", @@ -40869,43 +40896,35 @@ }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/common/saved_dashboard_references.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts" + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts" }, { "plugin": "ml", @@ -40915,6 +40934,14 @@ "plugin": "ml", "path": "x-pack/plugins/ml/common/types/modules.ts" }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/public/services/dashboard_saved_object/lib/save_dashboard_state_to_saved_object.ts" + }, + { + "plugin": "dashboard", + "path": "src/plugins/dashboard/public/services/dashboard_saved_object/lib/save_dashboard_state_to_saved_object.ts" + }, { "plugin": "@kbn/core-saved-objects-server-internal", "path": "packages/core/saved-objects/core-saved-objects-server-internal/src/routes/legacy_import_export/lib/collect_references_deep.test.ts" @@ -45734,11 +45761,11 @@ }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/server/saved_objects/migrations_730.ts" + "path": "src/plugins/dashboard/server/saved_objects/migrations/migrate_to_730/migrations_730.ts" }, { "plugin": "dashboard", - "path": "src/plugins/dashboard/server/saved_objects/migrations_730.ts" + "path": "src/plugins/dashboard/server/saved_objects/migrations/migrate_to_730/migrations_730.ts" }, { "plugin": "@kbn/core-saved-objects-migration-server-internal", @@ -46719,7 +46746,7 @@ "\nThe outcome for a successful `resolve` call is one of the following values:\n\n * `'exactMatch'` -- One document exactly matched the given ID.\n * `'aliasMatch'` -- One document with a legacy URL alias matched the given ID; in this case the `saved_object.id` field is different\n than the given ID.\n * `'conflict'` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the\n `saved_object` object is the exact match, and the `saved_object.id` field is the same as the given ID." ], "signature": [ - "\"exactMatch\" | \"aliasMatch\" | \"conflict\"" + "\"conflict\" | \"exactMatch\" | \"aliasMatch\"" ], "path": "node_modules/@types/kbn__core-saved-objects-api-server/index.d.ts", "deprecated": false, @@ -50176,16 +50203,10 @@ "\nMixin allowing plugins to define their own request handler contexts.\n" ], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", " & { [Key in keyof T]: T[Key] extends Promise ? T[Key] : Promise; }" ], - "path": "src/core/server/index.ts", + "path": "node_modules/@types/kbn__core-http-request-handler-context-server/index.d.ts", "deprecated": false, "trackAdoption": false, "initialIsOpen": false @@ -53662,9 +53683,9 @@ "label": "SavedObjectsCreatePointInTimeFinderOptions", "description": [], "signature": [ - "{ type: string | string[]; filter?: any; search?: string | undefined; aggs?: Record | undefined; fields?: string[] | undefined; perPage?: number | undefined; sortField?: string | undefined; sortOrder?: ", + "> | undefined; perPage?: number | undefined; sortField?: string | undefined; sortOrder?: ", "SortOrder", " | undefined; searchFields?: string[] | undefined; rootSearchFields?: string[] | undefined; hasReference?: ", "SavedObjectsFindOptionsReference", diff --git a/api_docs/core.mdx b/api_docs/core.mdx index d554613d1ec1e..48204394f0a85 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'core'] --- import coreObj from './core.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) for que | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 2684 | 0 | 35 | 0 | +| 2686 | 0 | 29 | 0 | ## Client diff --git a/api_docs/custom_integrations.devdocs.json b/api_docs/custom_integrations.devdocs.json index 7a339106c7a6d..44611a9497dfc 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, @@ -438,7 +438,7 @@ "label": "categories", "description": [], "signature": [ - "(\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\")[]" + "(\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"infrastructure\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\")[]" ], "path": "src/plugins/custom_integrations/common/index.ts", "deprecated": false, @@ -488,7 +488,7 @@ "\nA category applicable to an Integration." ], "signature": [ - "\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\"" + "\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"infrastructure\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\"" ], "path": "src/plugins/custom_integrations/common/index.ts", "deprecated": false, @@ -728,7 +728,7 @@ "label": "categories", "description": [], "signature": [ - "(\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\")[]" + "(\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"infrastructure\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\")[]" ], "path": "src/plugins/custom_integrations/common/index.ts", "deprecated": false, @@ -838,7 +838,7 @@ "label": "id", "description": [], "signature": [ - "\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\"" + "\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"infrastructure\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\"" ], "path": "src/plugins/custom_integrations/common/index.ts", "deprecated": false, @@ -860,7 +860,7 @@ "\nThe list of all available categories." ], "signature": [ - "(\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\")[]" + "(\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"infrastructure\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\")[]" ], "path": "src/plugins/custom_integrations/common/index.ts", "deprecated": false, @@ -877,7 +877,7 @@ "\nA category applicable to an Integration." ], "signature": [ - "\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\"" + "\"custom\" | \"enterprise_search\" | \"sample_data\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"infrastructure\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"microsoft_365\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\" | \"communications\" | \"file_storage\" | \"language_client\" | \"upload_file\" | \"website_search\" | \"geo\"" ], "path": "src/plugins/custom_integrations/common/index.ts", "deprecated": false, @@ -1097,6 +1097,17 @@ "deprecated": false, "trackAdoption": false }, + { + "parentPluginId": "customIntegrations", + "id": "def-common.INTEGRATION_CATEGORY_DISPLAY.infrastructure", + "type": "string", + "tags": [], + "label": "infrastructure", + "description": [], + "path": "src/plugins/custom_integrations/common/index.ts", + "deprecated": false, + "trackAdoption": false + }, { "parentPluginId": "customIntegrations", "id": "def-common.INTEGRATION_CATEGORY_DISPLAY.kubernetes", diff --git a/api_docs/custom_integrations.mdx b/api_docs/custom_integrations.mdx index b25052db9516d..dc07d39503245 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'customIntegrations'] --- import customIntegrationsObj from './custom_integrations.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 | |-------------------|-----------|------------------------|-----------------| -| 103 | 0 | 84 | 1 | +| 104 | 0 | 85 | 1 | ## Client diff --git a/api_docs/dashboard.devdocs.json b/api_docs/dashboard.devdocs.json index 447c0d0af07ee..c185507fd9101 100644 --- a/api_docs/dashboard.devdocs.json +++ b/api_docs/dashboard.devdocs.json @@ -1,33 +1,99 @@ { "id": "dashboard", "client": { - "classes": [ + "classes": [], + "functions": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer", - "type": "Class", + "id": "def-public.cleanEmptyKeys", + "type": "Function", "tags": [], - "label": "DashboardContainer", + "label": "cleanEmptyKeys", "description": [], "signature": [ + "(stateObj: Record) => Record" + ], + "path": "src/plugins/dashboard/public/locator.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainer", - "text": "DashboardContainer" - }, - " extends ", + "parentPluginId": "dashboard", + "id": "def-public.cleanEmptyKeys.$1", + "type": "Object", + "tags": [], + "label": "stateObj", + "description": [], + "signature": [ + "Record" + ], + "path": "src/plugins/dashboard/public/locator.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-public.createDashboardEditUrl", + "type": "Function", + "tags": [], + "label": "createDashboardEditUrl", + "description": [], + "signature": [ + "(id: string | undefined, editMode: boolean | undefined) => string" + ], + "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.Container", - "text": "Container" + "parentPluginId": "dashboard", + "id": "def-public.createDashboardEditUrl.$1", + "type": "string", + "tags": [], + "label": "id", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": false }, - "<", - "InheritedChildInput", - ", ", + { + "parentPluginId": "dashboard", + "id": "def-public.createDashboardEditUrl.$2", + "type": "CompoundType", + "tags": [], + "label": "editMode", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": false + } + ], + "returnComment": [], + "initialIsOpen": false + } + ], + "interfaces": [ + { + "parentPluginId": "dashboard", + "id": "def-public.DashboardContainerInput", + "type": "Interface", + "tags": [], + "label": "DashboardContainerInput", + "description": [], + "signature": [ { "pluginId": "dashboard", "scope": "public", @@ -35,1674 +101,1479 @@ "section": "def-public.DashboardContainerInput", "text": "DashboardContainerInput" }, - ", ", + " extends ", { "pluginId": "embeddable", "scope": "public", "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerOutput", - "text": "ContainerOutput" + "section": "def-public.ContainerInput", + "text": "ContainerInput" }, - ">" + "<{}>" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, "trackAdoption": false, "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.type", - "type": "string", - "tags": [], - "label": "type", - "description": [], - "signature": [ - "\"dashboard\"" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.controlGroup", + "id": "def-public.DashboardContainerInput.controlGroupInput", "type": "Object", "tags": [], - "label": "controlGroup", + "label": "controlGroupInput", "description": [], "signature": [ { "pluginId": "controls", - "scope": "public", + "scope": "common", "docId": "kibControlsPluginApi", - "section": "def-public.ControlGroupContainer", - "text": "ControlGroupContainer" + "section": "def-common.PersistableControlGroupInput", + "text": "PersistableControlGroupInput" }, " | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.getAllDataViews", - "type": "Function", + "id": "def-public.DashboardContainerInput.refreshConfig", + "type": "Object", "tags": [], - "label": "getAllDataViews", - "description": [ - "\nGets all the dataviews that are actively being used in the dashboard" - ], + "label": "refreshConfig", + "description": [], "signature": [ - "() => ", { - "pluginId": "dataViews", + "pluginId": "data", "scope": "common", - "docId": "kibDataViewsPluginApi", - "section": "def-common.DataView", - "text": "DataView" + "docId": "kibDataQueryPluginApi", + "section": "def-common.RefreshInterval", + "text": "RefreshInterval" }, - "[]" + " | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [ - "An array of dataviews" - ] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.setAllDataViews", - "type": "Function", + "id": "def-public.DashboardContainerInput.isEmbeddedExternally", + "type": "CompoundType", "tags": [], - "label": "setAllDataViews", - "description": [ - "\nUse this to set the dataviews that are used in the dashboard when they change/update" - ], + "label": "isEmbeddedExternally", + "description": [], "signature": [ - "(newDataViews: ", - { - "pluginId": "dataViews", - "scope": "common", - "docId": "kibDataViewsPluginApi", - "section": "def-common.DataView", - "text": "DataView" - }, - "[]) => void" + "boolean | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.setAllDataViews.$1", - "type": "Array", - "tags": [], - "label": "newDataViews", - "description": [ - "The new array of dataviews that will overwrite the old dataviews array" - ], - "signature": [ - { - "pluginId": "dataViews", - "scope": "common", - "docId": "kibDataViewsPluginApi", - "section": "def-common.DataView", - "text": "DataView" - }, - "[]" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - } - ], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.getPanelCount", - "type": "Function", + "id": "def-public.DashboardContainerInput.isFullScreenMode", + "type": "boolean", "tags": [], - "label": "getPanelCount", + "label": "isFullScreenMode", "description": [], - "signature": [ - "() => number" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.getPanelTitles", - "type": "Function", + "id": "def-public.DashboardContainerInput.expandedPanelId", + "type": "string", "tags": [], - "label": "getPanelTitles", + "label": "expandedPanelId", "description": [], "signature": [ - "() => Promise" + "string | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.Unnamed", - "type": "Function", + "id": "def-public.DashboardContainerInput.timeRange", + "type": "Object", "tags": [], - "label": "Constructor", + "label": "timeRange", "description": [], "signature": [ - "any" + "{ from: string; to: string; mode?: \"absolute\" | \"relative\" | undefined; }" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.Unnamed.$1", - "type": "Object", - "tags": [], - "label": "initialInput", - "description": [], - "signature": [ - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainerInput", - "text": "DashboardContainerInput" - } - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.Unnamed.$2", - "type": "Object", - "tags": [], - "label": "parent", - "description": [], - "signature": [ - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.Container", - "text": "Container" - }, - "<{}, ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerInput", - "text": "ContainerInput" - }, - "<{}>, ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerOutput", - "text": "ContainerOutput" - }, - "> | undefined" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.Unnamed.$3", - "type": "CompoundType", - "tags": [], - "label": "controlGroup", - "description": [], - "signature": [ - { - "pluginId": "controls", - "scope": "public", - "docId": "kibControlsPluginApi", - "section": "def-public.ControlGroupContainer", - "text": "ControlGroupContainer" - }, - " | ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ErrorEmbeddable", - "text": "ErrorEmbeddable" - }, - " | undefined" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": false - } - ], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.createNewPanelState", - "type": "Function", + "id": "def-public.DashboardContainerInput.timeslice", + "type": "Object", "tags": [], - "label": "createNewPanelState", + "label": "timeslice", "description": [], "signature": [ - ">(factory: ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.EmbeddableFactory", - "text": "EmbeddableFactory" - }, - ", partial?: Partial) => ", - "DashboardPanelState", - "" + "[number, number] | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.createNewPanelState.$1", - "type": "Object", - "tags": [], - "label": "factory", - "description": [], - "signature": [ - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.EmbeddableFactory", - "text": "EmbeddableFactory" - }, - "" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.createNewPanelState.$2", - "type": "Object", - "tags": [], - "label": "partial", - "description": [], - "signature": [ - "Partial" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - } - ], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.showPlaceholderUntil", - "type": "Function", + "id": "def-public.DashboardContainerInput.timeRestore", + "type": "boolean", "tags": [], - "label": "showPlaceholderUntil", + "label": "timeRestore", "description": [], - "signature": [ - "(newStateComplete: Promise>>, placementMethod?: ", - "PanelPlacementMethod", - " | undefined, placementArgs?: TPlacementMethodArgs | undefined) => void" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.showPlaceholderUntil.$1", - "type": "Object", - "tags": [], - "label": "newStateComplete", - "description": [], - "signature": [ - "Promise>>" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.showPlaceholderUntil.$2", - "type": "Function", - "tags": [], - "label": "placementMethod", - "description": [], - "signature": [ - "PanelPlacementMethod", - " | undefined" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.showPlaceholderUntil.$3", - "type": "Uncategorized", - "tags": [], - "label": "placementArgs", - "description": [], - "signature": [ - "TPlacementMethodArgs | undefined" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": false - } - ], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.replacePanel", - "type": "Function", + "id": "def-public.DashboardContainerInput.description", + "type": "string", "tags": [], - "label": "replacePanel", + "label": "description", "description": [], "signature": [ - "(previousPanelState: ", - "DashboardPanelState", - "<", - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddableInput", - "text": "EmbeddableInput" - }, - ">, newPanelState: Partial<", - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.PanelState", - "text": "PanelState" - }, - "<{ id: string; }>>, generateNewId?: boolean | undefined) => void" + "string | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.replacePanel.$1", - "type": "Object", - "tags": [], - "label": "previousPanelState", - "description": [], - "signature": [ - "DashboardPanelState", - "<", - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddableInput", - "text": "EmbeddableInput" - }, - ">" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.replacePanel.$2", - "type": "Object", - "tags": [], - "label": "newPanelState", - "description": [], - "signature": [ - "Partial<", - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.PanelState", - "text": "PanelState" - }, - "<{ id: string; }>>" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.replacePanel.$3", - "type": "CompoundType", - "tags": [], - "label": "generateNewId", - "description": [], - "signature": [ - "boolean | undefined" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": false - } - ], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.addOrUpdateEmbeddable", - "type": "Function", + "id": "def-public.DashboardContainerInput.useMargins", + "type": "boolean", "tags": [], - "label": "addOrUpdateEmbeddable", + "label": "useMargins", "description": [], - "signature": [ - " = ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.IEmbeddable", - "text": "IEmbeddable" - }, - ">(type: string, explicitInput: Partial, embeddableId?: string | undefined) => Promise" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.addOrUpdateEmbeddable.$1", - "type": "string", - "tags": [], - "label": "type", - "description": [], - "signature": [ - "string" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.addOrUpdateEmbeddable.$2", - "type": "Object", - "tags": [], - "label": "explicitInput", - "description": [], - "signature": [ - "Partial" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.addOrUpdateEmbeddable.$3", - "type": "string", - "tags": [], - "label": "embeddableId", - "description": [], - "signature": [ - "string | undefined" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": false - } - ], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.render", - "type": "Function", + "id": "def-public.DashboardContainerInput.syncColors", + "type": "CompoundType", "tags": [], - "label": "render", + "label": "syncColors", "description": [], "signature": [ - "(dom: HTMLElement) => void" + "boolean | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.render.$1", - "type": "Object", - "tags": [], - "label": "dom", - "description": [], - "signature": [ - "HTMLElement" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - } - ], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.destroy", - "type": "Function", + "id": "def-public.DashboardContainerInput.syncTooltips", + "type": "CompoundType", "tags": [], - "label": "destroy", + "label": "syncTooltips", "description": [], "signature": [ - "() => void" + "boolean | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.getInheritedInput", - "type": "Function", + "id": "def-public.DashboardContainerInput.viewMode", + "type": "Enum", "tags": [], - "label": "getInheritedInput", + "label": "viewMode", "description": [], "signature": [ - "(id: string) => ", - "InheritedChildInput" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "children": [ { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainer.getInheritedInput.$1", - "type": "string", - "tags": [], - "label": "id", - "description": [], - "signature": [ - "string" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.ViewMode", + "text": "ViewMode" } ], - "returnComment": [] - } - ], - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition", - "type": "Class", - "tags": [], - "label": "DashboardContainerFactoryDefinition", - "description": [], - "signature": [ - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainerFactoryDefinition", - "text": "DashboardContainerFactoryDefinition" - }, - " implements ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.EmbeddableFactoryDefinition", - "text": "EmbeddableFactoryDefinition" - }, - "<", - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainerInput", - "text": "DashboardContainerInput" - }, - ", ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerOutput", - "text": "ContainerOutput" - }, - ", ", - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainer", - "text": "DashboardContainer" + "path": "src/plugins/dashboard/public/types.ts", + "deprecated": false, + "trackAdoption": false }, - ", unknown>" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", - "deprecated": false, - "trackAdoption": false, - "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.isContainerType", - "type": "boolean", + "id": "def-public.DashboardContainerInput.filters", + "type": "Array", "tags": [], - "label": "isContainerType", + "label": "filters", "description": [], "signature": [ - "true" + "Filter", + "[]" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.type", + "id": "def-public.DashboardContainerInput.title", "type": "string", "tags": [], - "label": "type", + "label": "title", "description": [], - "signature": [ - "\"dashboard\"" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.inject", - "type": "Function", + "id": "def-public.DashboardContainerInput.query", + "type": "Object", "tags": [], - "label": "inject", + "label": "query", "description": [], "signature": [ - "(state: ", - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddableStateWithType", - "text": "EmbeddableStateWithType" - }, - ", references: ", - "SavedObjectReference", - "[]) => ", - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddableStateWithType", - "text": "EmbeddableStateWithType" - } + "{ query: string | { [key: string]: any; }; language: string; }" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "returnComment": [], - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.inject.$1", - "type": "Uncategorized", - "tags": [], - "label": "state", - "description": [], - "signature": [ - "P" - ], - "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.inject.$2", - "type": "Array", - "tags": [], - "label": "references", - "description": [], - "signature": [ - "SavedObjectReference", - "[]" - ], - "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", - "deprecated": false, - "trackAdoption": false - } - ] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.extract", - "type": "Function", + "id": "def-public.DashboardContainerInput.panels", + "type": "Object", "tags": [], - "label": "extract", + "label": "panels", "description": [], "signature": [ - "(state: ", + "{ [panelId: string]: ", { - "pluginId": "embeddable", + "pluginId": "dashboard", "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddableStateWithType", - "text": "EmbeddableStateWithType" + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelState", + "text": "DashboardPanelState" }, - ") => { state: ", + "<", { "pluginId": "embeddable", "scope": "common", "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddableStateWithType", - "text": "EmbeddableStateWithType" + "section": "def-common.EmbeddableInput", + "text": "EmbeddableInput" }, - "; references: ", - "SavedObjectReference", - "[]; }" + " & { [k: string]: unknown; }>; }" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "returnComment": [], - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.extract.$1", - "type": "Uncategorized", - "tags": [], - "label": "state", - "description": [], - "signature": [ - "P" - ], - "path": "src/plugins/kibana_utils/common/persistable_state/types.ts", - "deprecated": false, - "trackAdoption": false - } - ] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.Unnamed", - "type": "Function", + "id": "def-public.DashboardContainerInput.executionContext", + "type": "Object", "tags": [], - "label": "Constructor", + "label": "executionContext", "description": [], "signature": [ - "any" + "KibanaExecutionContext", + " | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", + "path": "src/plugins/dashboard/public/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.Unnamed.$1", - "type": "Object", - "tags": [], - "label": "persistableStateService", - "description": [], - "signature": [ - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddablePersistableStateService", - "text": "EmbeddablePersistableStateService" - } - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - } + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-public.DashboardFeatureFlagConfig", + "type": "Interface", + "tags": [], + "label": "DashboardFeatureFlagConfig", + "description": [], + "path": "src/plugins/dashboard/public/plugin.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dashboard", + "id": "def-public.DashboardFeatureFlagConfig.allowByValueEmbeddables", + "type": "boolean", + "tags": [], + "label": "allowByValueEmbeddables", + "description": [], + "path": "src/plugins/dashboard/public/plugin.tsx", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-public.SavedDashboardPanel", + "type": "Interface", + "tags": [], + "label": "SavedDashboardPanel", + "description": [ + "\nA saved dashboard panel parsed directly from the Dashboard Attributes panels JSON" + ], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dashboard", + "id": "def-public.SavedDashboardPanel.embeddableConfig", + "type": "Object", + "tags": [], + "label": "embeddableConfig", + "description": [], + "signature": [ + "{ [key: string]: ", + "Serializable", + "; }" ], - "returnComment": [] + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.isEditable", - "type": "Function", + "id": "def-public.SavedDashboardPanel.id", + "type": "string", "tags": [], - "label": "isEditable", + "label": "id", "description": [], "signature": [ - "() => Promise" + "string | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] + "trackAdoption": false + }, + { + "parentPluginId": "dashboard", + "id": "def-public.SavedDashboardPanel.type", + "type": "string", + "tags": [], + "label": "type", + "description": [], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.getDisplayName", - "type": "Function", + "id": "def-public.SavedDashboardPanel.panelRefName", + "type": "string", "tags": [], - "label": "getDisplayName", + "label": "panelRefName", "description": [], "signature": [ - "() => string" + "string | undefined" ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.getDefaultInput", - "type": "Function", + "id": "def-public.SavedDashboardPanel.gridData", + "type": "Object", "tags": [], - "label": "getDefaultInput", + "label": "gridData", "description": [], "signature": [ - "() => Partial<", { "pluginId": "dashboard", - "scope": "public", + "scope": "common", "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainerInput", - "text": "DashboardContainerInput" - }, - ">" + "section": "def-common.GridData", + "text": "GridData" + } ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.create", - "type": "Function", + "id": "def-public.SavedDashboardPanel.panelIndex", + "type": "string", "tags": [], - "label": "create", + "label": "panelIndex", "description": [], - "signature": [ - "(initialInput: ", - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainerInput", - "text": "DashboardContainerInput" - }, - ", parent?: ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.Container", - "text": "Container" - }, - "<{}, ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerInput", - "text": "ContainerInput" - }, - "<{}>, ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerOutput", - "text": "ContainerOutput" - }, - "> | undefined) => Promise<", - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainer", - "text": "DashboardContainer" - }, - " | ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ErrorEmbeddable", - "text": "ErrorEmbeddable" - }, - ">" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.create.$1", - "type": "Object", - "tags": [], - "label": "initialInput", - "description": [], - "signature": [ - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainerInput", - "text": "DashboardContainerInput" - } - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerFactoryDefinition.create.$2", - "type": "Object", - "tags": [], - "label": "parent", - "description": [], - "signature": [ - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.Container", - "text": "Container" - }, - "<{}, ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerInput", - "text": "ContainerInput" - }, - "<{}>, ", - { - "pluginId": "embeddable", - "scope": "public", - "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerOutput", - "text": "ContainerOutput" - }, - "> | undefined" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx", - "deprecated": false, - "trackAdoption": false, - "isRequired": false - } + "trackAdoption": false + }, + { + "parentPluginId": "dashboard", + "id": "def-public.SavedDashboardPanel.version", + "type": "string", + "tags": [], + "label": "version", + "description": [], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dashboard", + "id": "def-public.SavedDashboardPanel.title", + "type": "string", + "tags": [], + "label": "title", + "description": [], + "signature": [ + "string | undefined" ], - "returnComment": [] + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false } ], "initialIsOpen": false } ], - "functions": [ + "enums": [], + "misc": [ { "parentPluginId": "dashboard", - "id": "def-public.cleanEmptyKeys", - "type": "Function", + "id": "def-public.DASHBOARD_CONTAINER_TYPE", + "type": "string", "tags": [], - "label": "cleanEmptyKeys", + "label": "DASHBOARD_CONTAINER_TYPE", "description": [], "signature": [ - "(stateObj: Record) => Record" + "\"dashboard\"" ], - "path": "src/plugins/dashboard/public/locator.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.cleanEmptyKeys.$1", - "type": "Object", - "tags": [], - "label": "stateObj", - "description": [], - "signature": [ - "Record" - ], - "path": "src/plugins/dashboard/public/locator.ts", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - } - ], - "returnComment": [], "initialIsOpen": false }, { "parentPluginId": "dashboard", - "id": "def-public.createDashboardEditUrl", - "type": "Function", + "id": "def-public.DashboardAppLocator", + "type": "Type", "tags": [], - "label": "createDashboardEditUrl", + "label": "DashboardAppLocator", "description": [], "signature": [ - "(id: string | undefined, editMode: boolean | undefined) => string" - ], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ { - "parentPluginId": "dashboard", - "id": "def-public.createDashboardEditUrl.$1", - "type": "string", - "tags": [], - "label": "id", - "description": [], - "signature": [ - "string | undefined" - ], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", - "deprecated": false, - "trackAdoption": false, - "isRequired": false + "pluginId": "share", + "scope": "common", + "docId": "kibSharePluginApi", + "section": "def-common.LocatorPublic", + "text": "LocatorPublic" }, + "<", { - "parentPluginId": "dashboard", - "id": "def-public.createDashboardEditUrl.$2", - "type": "CompoundType", - "tags": [], - "label": "editMode", - "description": [], - "signature": [ - "boolean | undefined" - ], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", - "deprecated": false, - "trackAdoption": false, - "isRequired": false - } + "pluginId": "dashboard", + "scope": "public", + "docId": "kibDashboardPluginApi", + "section": "def-public.DashboardAppLocatorParams", + "text": "DashboardAppLocatorParams" + }, + ">" ], - "returnComment": [], + "path": "src/plugins/dashboard/public/locator.ts", + "deprecated": false, + "trackAdoption": false, "initialIsOpen": false - } - ], - "interfaces": [ + }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput", - "type": "Interface", + "id": "def-public.DashboardAppLocatorParams", + "type": "Type", "tags": [], - "label": "DashboardContainerInput", - "description": [], + "label": "DashboardAppLocatorParams", + "description": [ + "\nWe use `type` instead of `interface` to avoid having to extend this type with\n`SerializableRecord`. See https://github.com/microsoft/TypeScript/issues/15300." + ], "signature": [ + "{ dashboardId?: string | undefined; timeRange?: ", + "TimeRange", + " | undefined; refreshInterval?: ", { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardContainerInput", - "text": "DashboardContainerInput" + "pluginId": "data", + "scope": "common", + "docId": "kibDataQueryPluginApi", + "section": "def-common.RefreshInterval", + "text": "RefreshInterval" }, - " extends ", + " | undefined; filters?: ", + "Filter", + "[] | undefined; query?: ", + "Query", + " | undefined; useHash?: boolean | undefined; preserveSavedFilters?: boolean | undefined; viewMode?: ", { "pluginId": "embeddable", - "scope": "public", + "scope": "common", "docId": "kibEmbeddablePluginApi", - "section": "def-public.ContainerInput", - "text": "ContainerInput" + "section": "def-common.ViewMode", + "text": "ViewMode" }, - "<{}>" + " | undefined; searchSessionId?: string | undefined; panels?: (", + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.SavedDashboardPanel", + "text": "SavedDashboardPanel" + }, + " & ", + "SerializableRecord", + ")[] | undefined; savedQuery?: string | undefined; tags?: string[] | undefined; options?: ", + "DashboardOptions", + " | undefined; controlGroupInput?: ", + { + "pluginId": "controls", + "scope": "common", + "docId": "kibControlsPluginApi", + "section": "def-common.SerializableControlGroupInput", + "text": "SerializableControlGroupInput" + }, + " | undefined; }" ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/locator.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + } + ], + "objects": [ + { + "parentPluginId": "dashboard", + "id": "def-public.DashboardConstants", + "type": "Object", + "tags": [], + "label": "DashboardConstants", + "description": [], + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false, "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.controlGroupInput", - "type": "Object", + "id": "def-public.DashboardConstants.LANDING_PAGE_PATH", + "type": "string", "tags": [], - "label": "controlGroupInput", + "label": "LANDING_PAGE_PATH", "description": [], - "signature": [ - { - "pluginId": "controls", - "scope": "common", - "docId": "kibControlsPluginApi", - "section": "def-common.PersistableControlGroupInput", - "text": "PersistableControlGroupInput" - }, - " | undefined" - ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.refreshConfig", - "type": "Object", + "id": "def-public.DashboardConstants.CREATE_NEW_DASHBOARD_URL", + "type": "string", "tags": [], - "label": "refreshConfig", + "label": "CREATE_NEW_DASHBOARD_URL", "description": [], - "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataQueryPluginApi", - "section": "def-common.RefreshInterval", - "text": "RefreshInterval" - }, - " | undefined" - ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.isEmbeddedExternally", - "type": "CompoundType", + "id": "def-public.DashboardConstants.VIEW_DASHBOARD_URL", + "type": "string", "tags": [], - "label": "isEmbeddedExternally", + "label": "VIEW_DASHBOARD_URL", "description": [], - "signature": [ - "boolean | undefined" - ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.isFullScreenMode", - "type": "boolean", + "id": "def-public.DashboardConstants.PRINT_DASHBOARD_URL", + "type": "string", "tags": [], - "label": "isFullScreenMode", + "label": "PRINT_DASHBOARD_URL", "description": [], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.expandedPanelId", + "id": "def-public.DashboardConstants.ADD_EMBEDDABLE_ID", "type": "string", "tags": [], - "label": "expandedPanelId", + "label": "ADD_EMBEDDABLE_ID", "description": [], - "signature": [ - "string | undefined" - ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.timeRange", - "type": "Object", + "id": "def-public.DashboardConstants.ADD_EMBEDDABLE_TYPE", + "type": "string", "tags": [], - "label": "timeRange", + "label": "ADD_EMBEDDABLE_TYPE", "description": [], - "signature": [ - "{ from: string; to: string; mode?: \"absolute\" | \"relative\" | undefined; }" - ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.timeslice", - "type": "Object", + "id": "def-public.DashboardConstants.DASHBOARDS_ID", + "type": "string", "tags": [], - "label": "timeslice", + "label": "DASHBOARDS_ID", "description": [], - "signature": [ - "[number, number] | undefined" - ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.timeRestore", - "type": "boolean", + "id": "def-public.DashboardConstants.DASHBOARD_ID", + "type": "string", "tags": [], - "label": "timeRestore", + "label": "DASHBOARD_ID", "description": [], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.description", + "id": "def-public.DashboardConstants.DASHBOARD_SAVED_OBJECT_TYPE", "type": "string", "tags": [], - "label": "description", + "label": "DASHBOARD_SAVED_OBJECT_TYPE", "description": [], - "signature": [ - "string | undefined" - ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.useMargins", - "type": "boolean", + "id": "def-public.DashboardConstants.SEARCH_SESSION_ID", + "type": "string", "tags": [], - "label": "useMargins", + "label": "SEARCH_SESSION_ID", "description": [], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.syncColors", - "type": "CompoundType", + "id": "def-public.DashboardConstants.CHANGE_CHECK_DEBOUNCE", + "type": "number", "tags": [], - "label": "syncColors", + "label": "CHANGE_CHECK_DEBOUNCE", "description": [], - "signature": [ - "boolean | undefined" - ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.syncTooltips", - "type": "CompoundType", + "id": "def-public.DashboardConstants.CHANGE_APPLY_DEBOUNCE", + "type": "number", "tags": [], - "label": "syncTooltips", + "label": "CHANGE_APPLY_DEBOUNCE", "description": [], - "signature": [ - "boolean | undefined" - ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/public/dashboard_constants.ts", "deprecated": false, "trackAdoption": false - }, + } + ], + "initialIsOpen": false + } + ], + "setup": { + "parentPluginId": "dashboard", + "id": "def-public.DashboardSetup", + "type": "Interface", + "tags": [], + "label": "DashboardSetup", + "description": [], + "path": "src/plugins/dashboard/public/plugin.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dashboard", + "id": "def-public.DashboardSetup.locator", + "type": "Object", + "tags": [], + "label": "locator", + "description": [], + "signature": [ + { + "pluginId": "dashboard", + "scope": "public", + "docId": "kibDashboardPluginApi", + "section": "def-public.DashboardAppLocator", + "text": "DashboardAppLocator" + }, + " | undefined" + ], + "path": "src/plugins/dashboard/public/plugin.tsx", + "deprecated": false, + "trackAdoption": false + } + ], + "lifecycle": "setup", + "initialIsOpen": true + }, + "start": { + "parentPluginId": "dashboard", + "id": "def-public.DashboardStart", + "type": "Interface", + "tags": [], + "label": "DashboardStart", + "description": [], + "path": "src/plugins/dashboard/public/plugin.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dashboard", + "id": "def-public.DashboardStart.getDashboardContainerByValueRenderer", + "type": "Function", + "tags": [], + "label": "getDashboardContainerByValueRenderer", + "description": [], + "signature": [ + "() => React.FC" + ], + "path": "src/plugins/dashboard/public/plugin.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [], + "returnComment": [] + }, + { + "parentPluginId": "dashboard", + "id": "def-public.DashboardStart.locator", + "type": "Object", + "tags": [], + "label": "locator", + "description": [], + "signature": [ + { + "pluginId": "dashboard", + "scope": "public", + "docId": "kibDashboardPluginApi", + "section": "def-public.DashboardAppLocator", + "text": "DashboardAppLocator" + }, + " | undefined" + ], + "path": "src/plugins/dashboard/public/plugin.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dashboard", + "id": "def-public.DashboardStart.dashboardFeatureFlagConfig", + "type": "Object", + "tags": [], + "label": "dashboardFeatureFlagConfig", + "description": [], + "signature": [ + { + "pluginId": "dashboard", + "scope": "public", + "docId": "kibDashboardPluginApi", + "section": "def-public.DashboardFeatureFlagConfig", + "text": "DashboardFeatureFlagConfig" + } + ], + "path": "src/plugins/dashboard/public/plugin.tsx", + "deprecated": false, + "trackAdoption": false + } + ], + "lifecycle": "start", + "initialIsOpen": true + } + }, + "server": { + "classes": [], + "functions": [ + { + "parentPluginId": "dashboard", + "id": "def-server.findByValueEmbeddables", + "type": "Function", + "tags": [], + "label": "findByValueEmbeddables", + "description": [], + "signature": [ + "(savedObjectClient: Pick<", + "ISavedObjectsRepository", + ", \"find\">, embeddableType: string) => Promise<{ [key: string]: ", + "Serializable", + "; }[]>" + ], + "path": "src/plugins/dashboard/server/usage/find_by_value_embeddables.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.viewMode", - "type": "Enum", + "id": "def-server.findByValueEmbeddables.$1", + "type": "Object", "tags": [], - "label": "viewMode", + "label": "savedObjectClient", "description": [], "signature": [ - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.ViewMode", - "text": "ViewMode" - } + "Pick<", + "ISavedObjectsRepository", + ", \"find\">" ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/server/usage/find_by_value_embeddables.ts", "deprecated": false, - "trackAdoption": false + "trackAdoption": false, + "isRequired": true }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.filters", - "type": "Array", + "id": "def-server.findByValueEmbeddables.$2", + "type": "string", "tags": [], - "label": "filters", + "label": "embeddableType", "description": [], "signature": [ - "Filter", - "[]" + "string" ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/server/usage/find_by_value_embeddables.ts", "deprecated": false, - "trackAdoption": false + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + } + ], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [], + "setup": { + "parentPluginId": "dashboard", + "id": "def-server.DashboardPluginSetup", + "type": "Interface", + "tags": [], + "label": "DashboardPluginSetup", + "description": [], + "path": "src/plugins/dashboard/server/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "lifecycle": "setup", + "initialIsOpen": true + }, + "start": { + "parentPluginId": "dashboard", + "id": "def-server.DashboardPluginStart", + "type": "Interface", + "tags": [], + "label": "DashboardPluginStart", + "description": [], + "path": "src/plugins/dashboard/server/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "lifecycle": "start", + "initialIsOpen": true + } + }, + "common": { + "classes": [], + "functions": [ + { + "parentPluginId": "dashboard", + "id": "def-common.convertPanelMapToSavedPanels", + "type": "Function", + "tags": [], + "label": "convertPanelMapToSavedPanels", + "description": [], + "signature": [ + "(panels: ", + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelMap", + "text": "DashboardPanelMap" + }, + ", version: string) => ", + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.SavedDashboardPanel", + "text": "SavedDashboardPanel" }, + "[]" + ], + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.title", - "type": "string", + "id": "def-common.convertPanelMapToSavedPanels.$1", + "type": "Object", "tags": [], - "label": "title", + "label": "panels", "description": [], - "path": "src/plugins/dashboard/public/types.ts", + "signature": [ + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelMap", + "text": "DashboardPanelMap" + } + ], + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", "deprecated": false, - "trackAdoption": false + "trackAdoption": false, + "isRequired": true }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.query", - "type": "Object", + "id": "def-common.convertPanelMapToSavedPanels.$2", + "type": "string", "tags": [], - "label": "query", + "label": "version", "description": [], "signature": [ - "{ query: string | { [key: string]: any; }; language: string; }" + "string" ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", "deprecated": false, - "trackAdoption": false + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.convertPanelStateToSavedDashboardPanel", + "type": "Function", + "tags": [], + "label": "convertPanelStateToSavedDashboardPanel", + "description": [], + "signature": [ + "(panelState: ", + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelState", + "text": "DashboardPanelState" + }, + "<", + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.SavedObjectEmbeddableInput", + "text": "SavedObjectEmbeddableInput" }, + ">, version: string) => ", + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.SavedDashboardPanel", + "text": "SavedDashboardPanel" + } + ], + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.panels", + "id": "def-common.convertPanelStateToSavedDashboardPanel.$1", "type": "Object", "tags": [], - "label": "panels", + "label": "panelState", "description": [], "signature": [ - "{ [panelId: string]: ", - "DashboardPanelState", + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelState", + "text": "DashboardPanelState" + }, "<", { "pluginId": "embeddable", "scope": "common", "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddableInput", - "text": "EmbeddableInput" + "section": "def-common.SavedObjectEmbeddableInput", + "text": "SavedObjectEmbeddableInput" }, - " & { [k: string]: unknown; }>; }" + ">" ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", "deprecated": false, - "trackAdoption": false + "trackAdoption": false, + "isRequired": true }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardContainerInput.executionContext", - "type": "Object", + "id": "def-common.convertPanelStateToSavedDashboardPanel.$2", + "type": "string", "tags": [], - "label": "executionContext", + "label": "version", "description": [], "signature": [ - "KibanaExecutionContext", - " | undefined" + "string" ], - "path": "src/plugins/dashboard/public/types.ts", + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", "deprecated": false, - "trackAdoption": false + "trackAdoption": false, + "isRequired": true } ], + "returnComment": [], "initialIsOpen": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardFeatureFlagConfig", - "type": "Interface", + "id": "def-common.convertSavedDashboardPanelToPanelState", + "type": "Function", "tags": [], - "label": "DashboardFeatureFlagConfig", + "label": "convertSavedDashboardPanelToPanelState", "description": [], - "path": "src/plugins/dashboard/public/plugin.tsx", + "signature": [ + "(savedDashboardPanel: ", + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.SavedDashboardPanel", + "text": "SavedDashboardPanel" + }, + ") => ", + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelState", + "text": "DashboardPanelState" + }, + "" + ], + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", "deprecated": false, "trackAdoption": false, "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardFeatureFlagConfig.allowByValueEmbeddables", - "type": "boolean", + "id": "def-common.convertSavedDashboardPanelToPanelState.$1", + "type": "Object", "tags": [], - "label": "allowByValueEmbeddables", + "label": "savedDashboardPanel", "description": [], - "path": "src/plugins/dashboard/public/plugin.tsx", + "signature": [ + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.SavedDashboardPanel", + "text": "SavedDashboardPanel" + } + ], + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", "deprecated": false, - "trackAdoption": false + "trackAdoption": false, + "isRequired": true } ], + "returnComment": [], "initialIsOpen": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject", - "type": "Interface", + "id": "def-common.convertSavedPanelsToPanelMap", + "type": "Function", "tags": [], - "label": "DashboardSavedObject", + "label": "convertSavedPanelsToPanelMap", "description": [], "signature": [ + "(panels?: ", { "pluginId": "dashboard", - "scope": "public", + "scope": "common", "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardSavedObject", - "text": "DashboardSavedObject" + "section": "def-common.SavedDashboardPanel", + "text": "SavedDashboardPanel" }, - " extends ", + "[] | undefined) => ", { - "pluginId": "savedObjects", - "scope": "public", - "docId": "kibSavedObjectsPluginApi", - "section": "def-public.SavedObject", - "text": "SavedObject" - }, - "<", - "SavedObjectAttributes", - ">" + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelMap", + "text": "DashboardPanelMap" + } ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", "deprecated": false, "trackAdoption": false, "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.id", - "type": "string", + "id": "def-common.convertSavedPanelsToPanelMap.$1", + "type": "Array", "tags": [], - "label": "id", + "label": "panels", "description": [], "signature": [ - "string | undefined" + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.SavedDashboardPanel", + "text": "SavedDashboardPanel" + }, + "[] | undefined" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/lib/dashboard_panel_converters.ts", "deprecated": false, - "trackAdoption": false + "trackAdoption": false, + "isRequired": false + } + ], + "returnComment": [], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.createExtract", + "type": "Function", + "tags": [], + "label": "createExtract", + "description": [], + "signature": [ + "(persistableStateService: ", + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddablePersistableStateService", + "text": "EmbeddablePersistableStateService" }, + ") => (state: ", { - "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.timeRestore", - "type": "boolean", - "tags": [], - "label": "timeRestore", - "description": [], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", - "deprecated": false, - "trackAdoption": false + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddableStateWithType", + "text": "EmbeddableStateWithType" + }, + ") => { state: ", + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddableStateWithType", + "text": "EmbeddableStateWithType" }, + "; references: ", + "SavedObjectReference", + "[]; }" + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_container_references.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.timeTo", - "type": "string", + "id": "def-common.createExtract.$1", + "type": "Object", "tags": [], - "label": "timeTo", + "label": "persistableStateService", "description": [], "signature": [ - "string | undefined" - ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", - "deprecated": false, - "trackAdoption": false - }, + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddablePersistableStateService", + "text": "EmbeddablePersistableStateService" + } + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_container_references.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.createInject", + "type": "Function", + "tags": [], + "label": "createInject", + "description": [], + "signature": [ + "(persistableStateService: ", + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddablePersistableStateService", + "text": "EmbeddablePersistableStateService" + }, + ") => (state: ", + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddableStateWithType", + "text": "EmbeddableStateWithType" + }, + ", references: ", + "SavedObjectReference", + "[]) => ", + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddableStateWithType", + "text": "EmbeddableStateWithType" + } + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_container_references.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.timeFrom", - "type": "string", + "id": "def-common.createInject.$1", + "type": "Object", "tags": [], - "label": "timeFrom", + "label": "persistableStateService", "description": [], "signature": [ - "string | undefined" + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddablePersistableStateService", + "text": "EmbeddablePersistableStateService" + } + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_container_references.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.extractReferences", + "type": "Function", + "tags": [], + "label": "extractReferences", + "description": [], + "signature": [ + "({ attributes, references = [] }: SavedObjectAttributesAndReferences, deps: ", + "ExtractDeps", + ") => SavedObjectAttributesAndReferences" + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dashboard", + "id": "def-common.extractReferences.$1", + "type": "Object", + "tags": [], + "label": "{ attributes, references = [] }", + "description": [], + "signature": [ + "SavedObjectAttributesAndReferences" + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + }, + { + "parentPluginId": "dashboard", + "id": "def-common.extractReferences.$2", + "type": "Object", + "tags": [], + "label": "deps", + "description": [], + "signature": [ + "ExtractDeps" + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.injectReferences", + "type": "Function", + "tags": [], + "label": "injectReferences", + "description": [], + "signature": [ + "({ attributes, references = [] }: SavedObjectAttributesAndReferences, deps: ", + "InjectDeps", + ") => ", + "SavedObjectAttributes" + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dashboard", + "id": "def-common.injectReferences.$1", + "type": "Object", + "tags": [], + "label": "{ attributes, references = [] }", + "description": [], + "signature": [ + "SavedObjectAttributesAndReferences" + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + }, + { + "parentPluginId": "dashboard", + "id": "def-common.injectReferences.$2", + "type": "Object", + "tags": [], + "label": "deps", + "description": [], + "signature": [ + "InjectDeps" + ], + "path": "src/plugins/dashboard/common/persistable_state/dashboard_saved_object_references.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + } + ], + "interfaces": [ + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardAttributes", + "type": "Interface", + "tags": [], + "label": "DashboardAttributes", + "description": [ + "\nThe attributes of the dashboard saved object. This interface should be the\nsource of truth for the latest dashboard attributes shape after all migrations." + ], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardAttributes.controlGroupInput", + "type": "CompoundType", + "tags": [], + "label": "controlGroupInput", + "description": [], + "signature": [ + { + "pluginId": "controls", + "scope": "common", + "docId": "kibControlsPluginApi", + "section": "def-common.RawControlGroupAttributes", + "text": "RawControlGroupAttributes" + }, + " | undefined" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.description", - "type": "string", + "id": "def-common.DashboardAttributes.refreshInterval", + "type": "Object", "tags": [], - "label": "description", + "label": "refreshInterval", "description": [], "signature": [ - "string | undefined" + { + "pluginId": "data", + "scope": "common", + "docId": "kibDataQueryPluginApi", + "section": "def-common.RefreshInterval", + "text": "RefreshInterval" + }, + " | undefined" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.panelsJSON", - "type": "string", + "id": "def-common.DashboardAttributes.timeRestore", + "type": "boolean", "tags": [], - "label": "panelsJSON", + "label": "timeRestore", "description": [], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.optionsJSON", + "id": "def-common.DashboardAttributes.optionsJSON", "type": "string", "tags": [], "label": "optionsJSON", @@ -1710,687 +1581,501 @@ "signature": [ "string | undefined" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardAttributes.useMargins", + "type": "CompoundType", + "tags": [], + "label": "useMargins", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardAttributes.description", + "type": "string", + "tags": [], + "label": "description", + "description": [], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardAttributes.panelsJSON", + "type": "string", + "tags": [], + "label": "panelsJSON", + "description": [], + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.uiStateJSON", + "id": "def-common.DashboardAttributes.timeFrom", "type": "string", "tags": [], - "label": "uiStateJSON", + "label": "timeFrom", "description": [], "signature": [ "string | undefined" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.lastSavedTitle", - "type": "string", + "id": "def-common.DashboardAttributes.version", + "type": "number", "tags": [], - "label": "lastSavedTitle", + "label": "version", "description": [], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.refreshInterval", - "type": "Object", + "id": "def-common.DashboardAttributes.timeTo", + "type": "string", "tags": [], - "label": "refreshInterval", + "label": "timeTo", "description": [], "signature": [ - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataQueryPluginApi", - "section": "def-common.RefreshInterval", - "text": "RefreshInterval" - }, - " | undefined" + "string | undefined" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardAttributes.title", + "type": "string", + "tags": [], + "label": "title", + "description": [], + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.searchSource", + "id": "def-common.DashboardAttributes.kibanaSavedObjectMeta", "type": "Object", "tags": [], - "label": "searchSource", + "label": "kibanaSavedObjectMeta", "description": [], "signature": [ - "{ create: () => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSource", - "text": "SearchSource" - }, - "; history: ", - "SearchRequest", - "[]; setOverwriteDataViewType: (overwriteType: string | false | undefined) => void; setField: (field: K, value: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSourceFields", - "text": "SearchSourceFields" - }, - "[K]) => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSource", - "text": "SearchSource" - }, - "; removeField: (field: K) => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSource", - "text": "SearchSource" - }, - "; setFields: (newFields: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSourceFields", - "text": "SearchSourceFields" - }, - ") => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSource", - "text": "SearchSource" - }, - "; getId: () => string; getFields: () => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSourceFields", - "text": "SearchSourceFields" - }, - "; getField: (field: K, recurse?: boolean) => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSourceFields", - "text": "SearchSourceFields" - }, - "[K]; getActiveIndexFilter: () => string[]; getOwnField: (field: K) => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSourceFields", - "text": "SearchSourceFields" - }, - "[K]; createCopy: () => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSource", - "text": "SearchSource" - }, - "; createChild: (options?: {}) => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSource", - "text": "SearchSource" - }, - "; setParent: (parent?: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.ISearchSource", - "text": "ISearchSource" - }, - " | undefined, options?: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSourceOptions", - "text": "SearchSourceOptions" - }, - ") => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSource", - "text": "SearchSource" - }, - "; getParent: () => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSource", - "text": "SearchSource" - }, - " | undefined; fetch$: (options?: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSourceSearchOptions", - "text": "SearchSourceSearchOptions" - }, - ") => ", - "Observable", - "<", + "{ searchSourceJSON: string; }" + ], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardContainerStateWithType", + "type": "Interface", + "tags": [], + "label": "DashboardContainerStateWithType", + "description": [ + "--------------------------------------------------------------------\nDashboard container types\n -----------------------------------------------------------------------\n\nTypes below this line are copied here because so many important types are tied up in public. These types should be\nmoved from public into common." + ], + "signature": [ + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardContainerStateWithType", + "text": "DashboardContainerStateWithType" + }, + " extends ", + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddableStateWithType", + "text": "EmbeddableStateWithType" + } + ], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardContainerStateWithType.panels", + "type": "Object", + "tags": [], + "label": "panels", + "description": [], + "signature": [ + "{ [panelId: string]: ", { - "pluginId": "data", + "pluginId": "dashboard", "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.IKibanaSearchResponse", - "text": "IKibanaSearchResponse" + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelState", + "text": "DashboardPanelState" }, "<", - "SearchResponse", - ">>>; fetch: (options?: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSourceSearchOptions", - "text": "SearchSourceSearchOptions" - }, - ") => Promise<", - "SearchResponse", - ">>; onRequestStart: (handler: (searchSource: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSource", - "text": "SearchSource" - }, - ", options?: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SearchSourceSearchOptions", - "text": "SearchSourceSearchOptions" - }, - " | undefined) => Promise) => void; getSearchRequestBody: () => any; destroy: () => void; getSerializedFields: (recurse?: boolean) => ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataSearchPluginApi", - "section": "def-common.SerializedSearchSourceFields", - "text": "SerializedSearchSourceFields" - }, - "; serialize: () => { searchSourceJSON: string; references: ", - "SavedObjectReference", - "[]; }; toExpressionAst: ({ asDatatable }?: ExpressionAstOptions) => ", { - "pluginId": "expressions", + "pluginId": "embeddable", "scope": "common", - "docId": "kibExpressionsPluginApi", - "section": "def-common.ExpressionAstExpression", - "text": "ExpressionAstExpression" + "docId": "kibEmbeddablePluginApi", + "section": "def-common.EmbeddableInput", + "text": "EmbeddableInput" }, - "; parseActiveIndexPatternFromQueryString: (queryString: string) => string[]; }" + " & { [k: string]: unknown; }>; }" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.getQuery", - "type": "Function", + "id": "def-common.DashboardContainerStateWithType.controlGroupInput", + "type": "Object", "tags": [], - "label": "getQuery", + "label": "controlGroupInput", "description": [], "signature": [ - "() => ", - "Query" + { + "pluginId": "controls", + "scope": "common", + "docId": "kibControlsPluginApi", + "section": "def-common.PersistableControlGroupInput", + "text": "PersistableControlGroupInput" + }, + " | undefined" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] - }, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardPanelMap", + "type": "Interface", + "tags": [], + "label": "DashboardPanelMap", + "description": [], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.getFilters", - "type": "Function", + "id": "def-common.DashboardPanelMap.Unnamed", + "type": "IndexSignature", "tags": [], - "label": "getFilters", + "label": "[key: string]: DashboardPanelState", "description": [], "signature": [ - "() => ", - "Filter", - "[]" + "[key: string]: ", + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelState", + "text": "DashboardPanelState" + }, + "<", + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.SavedObjectEmbeddableInput", + "text": "SavedObjectEmbeddableInput" + }, + ">" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.DashboardPanelState", + "type": "Interface", + "tags": [], + "label": "DashboardPanelState", + "description": [ + "--------------------------------------------------------------------\nDashboard panel types\n -----------------------------------------------------------------------\n\nThe dashboard panel format expected by the embeddable container." + ], + "signature": [ + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.DashboardPanelState", + "text": "DashboardPanelState" }, + " extends ", + { + "pluginId": "embeddable", + "scope": "common", + "docId": "kibEmbeddablePluginApi", + "section": "def-common.PanelState", + "text": "PanelState" + }, + "" + ], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.getFullEditPath", - "type": "Function", + "id": "def-common.DashboardPanelState.gridData", + "type": "Object", "tags": [], - "label": "getFullEditPath", + "label": "gridData", "description": [], "signature": [ - "(editMode?: boolean | undefined) => string" - ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ { - "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.getFullEditPath.$1", - "type": "CompoundType", - "tags": [], - "label": "editMode", - "description": [], - "signature": [ - "boolean | undefined" - ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", - "deprecated": false, - "trackAdoption": false, - "isRequired": false + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.GridData", + "text": "GridData" } ], - "returnComment": [] + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.outcome", - "type": "CompoundType", + "id": "def-common.DashboardPanelState.panelRefName", + "type": "string", "tags": [], - "label": "outcome", + "label": "panelRefName", "description": [], "signature": [ - "\"exactMatch\" | \"aliasMatch\" | \"conflict\" | undefined" + "string | undefined" ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false - }, + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "dashboard", + "id": "def-common.GridData", + "type": "Interface", + "tags": [], + "label": "GridData", + "description": [ + "\nGrid type for React Grid Layout" + ], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.aliasId", - "type": "string", + "id": "def-common.GridData.w", + "type": "number", "tags": [], - "label": "aliasId", + "label": "w", "description": [], - "signature": [ - "string | undefined" - ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.aliasPurpose", - "type": "CompoundType", + "id": "def-common.GridData.h", + "type": "number", "tags": [], - "label": "aliasPurpose", + "label": "h", "description": [], - "signature": [ - "\"savedObjectConversion\" | \"savedObjectImport\" | undefined" - ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardSavedObject.controlGroupInput", - "type": "Object", + "id": "def-common.GridData.x", + "type": "number", "tags": [], - "label": "controlGroupInput", + "label": "x", "description": [], - "signature": [ - "Omit<", - { - "pluginId": "controls", - "scope": "common", - "docId": "kibControlsPluginApi", - "section": "def-common.RawControlGroupAttributes", - "text": "RawControlGroupAttributes" - }, - ", \"id\"> | undefined" - ], - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false - } - ], - "initialIsOpen": false - } - ], - "enums": [], - "misc": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DASHBOARD_CONTAINER_TYPE", - "type": "string", - "tags": [], - "label": "DASHBOARD_CONTAINER_TYPE", - "description": [], - "signature": [ - "\"dashboard\"" - ], - "path": "src/plugins/dashboard/public/application/embeddable/dashboard_constants.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardAppLocator", - "type": "Type", - "tags": [], - "label": "DashboardAppLocator", - "description": [], - "signature": [ - { - "pluginId": "share", - "scope": "common", - "docId": "kibSharePluginApi", - "section": "def-common.LocatorPublic", - "text": "LocatorPublic" - }, - "<", - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardAppLocatorParams", - "text": "DashboardAppLocatorParams" - }, - ">" - ], - "path": "src/plugins/dashboard/public/locator.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardAppLocatorParams", - "type": "Type", - "tags": [], - "label": "DashboardAppLocatorParams", - "description": [ - "\nWe use `type` instead of `interface` to avoid having to extend this type with\n`SerializableRecord`. See https://github.com/microsoft/TypeScript/issues/15300." - ], - "signature": [ - "{ dashboardId?: string | undefined; timeRange?: ", - "TimeRange", - " | undefined; refreshInterval?: ", - { - "pluginId": "data", - "scope": "common", - "docId": "kibDataQueryPluginApi", - "section": "def-common.RefreshInterval", - "text": "RefreshInterval" - }, - " | undefined; filters?: ", - "Filter", - "[] | undefined; query?: ", - "Query", - " | undefined; useHash?: boolean | undefined; preserveSavedFilters?: boolean | undefined; viewMode?: ", - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.ViewMode", - "text": "ViewMode" }, - " | undefined; searchSessionId?: string | undefined; panels?: ", { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.SavedDashboardPanel730ToLatest", - "text": "SavedDashboardPanel730ToLatest" + "parentPluginId": "dashboard", + "id": "def-common.GridData.y", + "type": "number", + "tags": [], + "label": "y", + "description": [], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false }, - "[] | undefined; savedQuery?: string | undefined; tags?: string[] | undefined; options?: ", - "DashboardOptions", - " | undefined; controlGroupInput?: ", { - "pluginId": "controls", - "scope": "common", - "docId": "kibControlsPluginApi", - "section": "def-common.SerializableControlGroupInput", - "text": "SerializableControlGroupInput" - }, - " | undefined; }" + "parentPluginId": "dashboard", + "id": "def-common.GridData.i", + "type": "string", + "tags": [], + "label": "i", + "description": [], + "path": "src/plugins/dashboard/common/types.ts", + "deprecated": false, + "trackAdoption": false + } ], - "path": "src/plugins/dashboard/public/locator.ts", - "deprecated": false, - "trackAdoption": false, "initialIsOpen": false }, { "parentPluginId": "dashboard", - "id": "def-public.SavedDashboardPanel", - "type": "Type", + "id": "def-common.SavedDashboardPanel", + "type": "Interface", "tags": [], "label": "SavedDashboardPanel", "description": [ - "\nThis should always represent the latest dashboard panel shape, after all possible migrations." - ], - "signature": [ - "Pick<", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.RawSavedDashboardPanel730ToLatest", - "text": "RawSavedDashboardPanel730ToLatest" - }, - ", \"type\" | \"title\" | \"panelIndex\" | \"gridData\" | \"version\" | \"embeddableConfig\" | \"panelRefName\"> & { readonly id?: string | undefined; readonly type: string; }" + "\nA saved dashboard panel parsed directly from the Dashboard Attributes panels JSON" ], "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false, - "initialIsOpen": false - } - ], - "objects": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants", - "type": "Object", - "tags": [], - "label": "DashboardConstants", - "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", - "deprecated": false, - "trackAdoption": false, "children": [ { "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.LANDING_PAGE_PATH", - "type": "string", - "tags": [], - "label": "LANDING_PAGE_PATH", - "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.CREATE_NEW_DASHBOARD_URL", - "type": "string", + "id": "def-common.SavedDashboardPanel.embeddableConfig", + "type": "Object", "tags": [], - "label": "CREATE_NEW_DASHBOARD_URL", + "label": "embeddableConfig", "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "signature": [ + "{ [key: string]: ", + "Serializable", + "; }" + ], + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.VIEW_DASHBOARD_URL", + "id": "def-common.SavedDashboardPanel.id", "type": "string", "tags": [], - "label": "VIEW_DASHBOARD_URL", + "label": "id", "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "signature": [ + "string | undefined" + ], + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.PRINT_DASHBOARD_URL", + "id": "def-common.SavedDashboardPanel.type", "type": "string", "tags": [], - "label": "PRINT_DASHBOARD_URL", + "label": "type", "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.ADD_EMBEDDABLE_ID", + "id": "def-common.SavedDashboardPanel.panelRefName", "type": "string", "tags": [], - "label": "ADD_EMBEDDABLE_ID", + "label": "panelRefName", "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "signature": [ + "string | undefined" + ], + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.ADD_EMBEDDABLE_TYPE", - "type": "string", + "id": "def-common.SavedDashboardPanel.gridData", + "type": "Object", "tags": [], - "label": "ADD_EMBEDDABLE_TYPE", + "label": "gridData", "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "signature": [ + { + "pluginId": "dashboard", + "scope": "common", + "docId": "kibDashboardPluginApi", + "section": "def-common.GridData", + "text": "GridData" + } + ], + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.DASHBOARDS_ID", + "id": "def-common.SavedDashboardPanel.panelIndex", "type": "string", "tags": [], - "label": "DASHBOARDS_ID", + "label": "panelIndex", "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.DASHBOARD_ID", + "id": "def-common.SavedDashboardPanel.version", "type": "string", "tags": [], - "label": "DASHBOARD_ID", + "label": "version", "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.SEARCH_SESSION_ID", + "id": "def-common.SavedDashboardPanel.title", "type": "string", "tags": [], - "label": "SEARCH_SESSION_ID", - "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.CHANGE_CHECK_DEBOUNCE", - "type": "number", - "tags": [], - "label": "CHANGE_CHECK_DEBOUNCE", - "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardConstants.CHANGE_APPLY_DEBOUNCE", - "type": "number", - "tags": [], - "label": "CHANGE_APPLY_DEBOUNCE", + "label": "title", "description": [], - "path": "src/plugins/dashboard/public/dashboard_constants.ts", + "signature": [ + "string | undefined" + ], + "path": "src/plugins/dashboard/common/types.ts", "deprecated": false, "trackAdoption": false } @@ -2398,674 +2083,8 @@ "initialIsOpen": false } ], - "setup": { - "parentPluginId": "dashboard", - "id": "def-public.DashboardSetup", - "type": "Interface", - "tags": [], - "label": "DashboardSetup", - "description": [], - "path": "src/plugins/dashboard/public/plugin.tsx", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardSetup.locator", - "type": "Object", - "tags": [], - "label": "locator", - "description": [], - "signature": [ - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardAppLocator", - "text": "DashboardAppLocator" - }, - " | undefined" - ], - "path": "src/plugins/dashboard/public/plugin.tsx", - "deprecated": false, - "trackAdoption": false - } - ], - "lifecycle": "setup", - "initialIsOpen": true - }, - "start": { - "parentPluginId": "dashboard", - "id": "def-public.DashboardStart", - "type": "Interface", - "tags": [], - "label": "DashboardStart", - "description": [], - "path": "src/plugins/dashboard/public/plugin.tsx", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardStart.getSavedDashboardLoader", - "type": "Function", - "tags": [], - "label": "getSavedDashboardLoader", - "description": [], - "signature": [ - "() => ", - "SavedObjectLoader" - ], - "path": "src/plugins/dashboard/public/plugin.tsx", - "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardStart.getDashboardContainerByValueRenderer", - "type": "Function", - "tags": [], - "label": "getDashboardContainerByValueRenderer", - "description": [], - "signature": [ - "() => React.FC" - ], - "path": "src/plugins/dashboard/public/plugin.tsx", - "deprecated": false, - "trackAdoption": false, - "children": [], - "returnComment": [] - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardStart.locator", - "type": "Object", - "tags": [], - "label": "locator", - "description": [], - "signature": [ - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardAppLocator", - "text": "DashboardAppLocator" - }, - " | undefined" - ], - "path": "src/plugins/dashboard/public/plugin.tsx", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "dashboard", - "id": "def-public.DashboardStart.dashboardFeatureFlagConfig", - "type": "Object", - "tags": [], - "label": "dashboardFeatureFlagConfig", - "description": [], - "signature": [ - { - "pluginId": "dashboard", - "scope": "public", - "docId": "kibDashboardPluginApi", - "section": "def-public.DashboardFeatureFlagConfig", - "text": "DashboardFeatureFlagConfig" - } - ], - "path": "src/plugins/dashboard/public/plugin.tsx", - "deprecated": false, - "trackAdoption": false - } - ], - "lifecycle": "start", - "initialIsOpen": true - } - }, - "server": { - "classes": [], - "functions": [ - { - "parentPluginId": "dashboard", - "id": "def-server.findByValueEmbeddables", - "type": "Function", - "tags": [], - "label": "findByValueEmbeddables", - "description": [], - "signature": [ - "(savedObjectClient: Pick<", - "ISavedObjectsRepository", - ", \"find\">, embeddableType: string) => Promise<{ [key: string]: ", - "Serializable", - "; }[]>" - ], - "path": "src/plugins/dashboard/server/usage/find_by_value_embeddables.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-server.findByValueEmbeddables.$1", - "type": "Object", - "tags": [], - "label": "savedObjectClient", - "description": [], - "signature": [ - "Pick<", - "ISavedObjectsRepository", - ", \"find\">" - ], - "path": "src/plugins/dashboard/server/usage/find_by_value_embeddables.ts", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-server.findByValueEmbeddables.$2", - "type": "string", - "tags": [], - "label": "embeddableType", - "description": [], - "signature": [ - "string" - ], - "path": "src/plugins/dashboard/server/usage/find_by_value_embeddables.ts", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - } - ], - "returnComment": [], - "initialIsOpen": false - } - ], - "interfaces": [], "enums": [], "misc": [], - "objects": [], - "setup": { - "parentPluginId": "dashboard", - "id": "def-server.DashboardPluginSetup", - "type": "Interface", - "tags": [], - "label": "DashboardPluginSetup", - "description": [], - "path": "src/plugins/dashboard/server/types.ts", - "deprecated": false, - "trackAdoption": false, - "children": [], - "lifecycle": "setup", - "initialIsOpen": true - }, - "start": { - "parentPluginId": "dashboard", - "id": "def-server.DashboardPluginStart", - "type": "Interface", - "tags": [], - "label": "DashboardPluginStart", - "description": [], - "path": "src/plugins/dashboard/server/types.ts", - "deprecated": false, - "trackAdoption": false, - "children": [], - "lifecycle": "start", - "initialIsOpen": true - } - }, - "common": { - "classes": [], - "functions": [ - { - "parentPluginId": "dashboard", - "id": "def-common.migratePanelsTo730", - "type": "Function", - "tags": [], - "label": "migratePanelsTo730", - "description": [], - "signature": [ - "(panels: (", - "RawSavedDashboardPanelTo60", - " | ", - "RawSavedDashboardPanel610", - " | ", - "RawSavedDashboardPanel620", - " | ", - "RawSavedDashboardPanel640To720", - " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.SavedDashboardPanelTo60", - "text": "SavedDashboardPanelTo60" - }, - " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.SavedDashboardPanel610", - "text": "SavedDashboardPanel610" - }, - " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.SavedDashboardPanel620", - "text": "SavedDashboardPanel620" - }, - " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.SavedDashboardPanel630", - "text": "SavedDashboardPanel630" - }, - ")[], version: string, useMargins: boolean, uiState: { [key: string]: ", - "SerializableRecord", - "; } | undefined) => ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.RawSavedDashboardPanel730ToLatest", - "text": "RawSavedDashboardPanel730ToLatest" - }, - "[]" - ], - "path": "src/plugins/dashboard/common/migrate_to_730_panels.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-common.migratePanelsTo730.$1", - "type": "Array", - "tags": [], - "label": "panels", - "description": [], - "signature": [ - "(", - "RawSavedDashboardPanelTo60", - " | ", - "RawSavedDashboardPanel610", - " | ", - "RawSavedDashboardPanel620", - " | ", - "RawSavedDashboardPanel640To720", - " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.SavedDashboardPanelTo60", - "text": "SavedDashboardPanelTo60" - }, - " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.SavedDashboardPanel610", - "text": "SavedDashboardPanel610" - }, - " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.SavedDashboardPanel620", - "text": "SavedDashboardPanel620" - }, - " | ", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.SavedDashboardPanel630", - "text": "SavedDashboardPanel630" - }, - ")[]" - ], - "path": "src/plugins/dashboard/common/migrate_to_730_panels.ts", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-common.migratePanelsTo730.$2", - "type": "string", - "tags": [], - "label": "version", - "description": [], - "signature": [ - "string" - ], - "path": "src/plugins/dashboard/common/migrate_to_730_panels.ts", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-common.migratePanelsTo730.$3", - "type": "boolean", - "tags": [], - "label": "useMargins", - "description": [], - "signature": [ - "boolean" - ], - "path": "src/plugins/dashboard/common/migrate_to_730_panels.ts", - "deprecated": false, - "trackAdoption": false, - "isRequired": true - }, - { - "parentPluginId": "dashboard", - "id": "def-common.migratePanelsTo730.$4", - "type": "Object", - "tags": [], - "label": "uiState", - "description": [], - "path": "src/plugins/dashboard/common/migrate_to_730_panels.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-common.migratePanelsTo730.$4.Unnamed", - "type": "IndexSignature", - "tags": [], - "label": "[key: string]: SerializableRecord", - "description": [], - "signature": [ - "[key: string]: ", - "SerializableRecord" - ], - "path": "src/plugins/dashboard/common/migrate_to_730_panels.ts", - "deprecated": false, - "trackAdoption": false - } - ] - } - ], - "returnComment": [], - "initialIsOpen": false - } - ], - "interfaces": [ - { - "parentPluginId": "dashboard", - "id": "def-common.DashboardContainerStateWithType", - "type": "Interface", - "tags": [], - "label": "DashboardContainerStateWithType", - "description": [], - "signature": [ - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.DashboardContainerStateWithType", - "text": "DashboardContainerStateWithType" - }, - " extends ", - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddableStateWithType", - "text": "EmbeddableStateWithType" - } - ], - "path": "src/plugins/dashboard/common/types.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ - { - "parentPluginId": "dashboard", - "id": "def-common.DashboardContainerStateWithType.panels", - "type": "Object", - "tags": [], - "label": "panels", - "description": [], - "signature": [ - "{ [panelId: string]: ", - "DashboardPanelState", - "<", - { - "pluginId": "embeddable", - "scope": "common", - "docId": "kibEmbeddablePluginApi", - "section": "def-common.EmbeddableInput", - "text": "EmbeddableInput" - }, - " & { [k: string]: unknown; }>; }" - ], - "path": "src/plugins/dashboard/common/types.ts", - "deprecated": false, - "trackAdoption": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.DashboardContainerStateWithType.controlGroupInput", - "type": "Object", - "tags": [], - "label": "controlGroupInput", - "description": [], - "signature": [ - { - "pluginId": "controls", - "scope": "common", - "docId": "kibControlsPluginApi", - "section": "def-common.PersistableControlGroupInput", - "text": "PersistableControlGroupInput" - }, - " | undefined" - ], - "path": "src/plugins/dashboard/common/types.ts", - "deprecated": false, - "trackAdoption": false - } - ], - "initialIsOpen": false - } - ], - "enums": [], - "misc": [ - { - "parentPluginId": "dashboard", - "id": "def-common.DashboardDoc700To720", - "type": "Type", - "tags": [], - "label": "DashboardDoc700To720", - "description": [], - "signature": [ - "Doc" - ], - "path": "src/plugins/dashboard/common/bwc/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.DashboardDoc730ToLatest", - "type": "Type", - "tags": [], - "label": "DashboardDoc730ToLatest", - "description": [], - "signature": [ - "Doc" - ], - "path": "src/plugins/dashboard/common/bwc/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.DashboardDocPre700", - "type": "Type", - "tags": [], - "label": "DashboardDocPre700", - "description": [], - "signature": [ - "DocPre700" - ], - "path": "src/plugins/dashboard/common/bwc/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.GridData", - "type": "Type", - "tags": [], - "label": "GridData", - "description": [], - "signature": [ - "{ w: number; h: number; x: number; y: number; i: string; }" - ], - "path": "src/plugins/dashboard/common/embeddable/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.RawSavedDashboardPanel730ToLatest", - "type": "Type", - "tags": [], - "label": "RawSavedDashboardPanel730ToLatest", - "description": [], - "signature": [ - "Pick<", - "RawSavedDashboardPanel640To720", - ", \"title\" | \"panelIndex\" | \"gridData\" | \"version\" | \"embeddableConfig\"> & { readonly type?: string | undefined; readonly name?: string | undefined; panelIndex: string; panelRefName?: string | undefined; }" - ], - "path": "src/plugins/dashboard/common/bwc/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.SavedDashboardPanel610", - "type": "Type", - "tags": [], - "label": "SavedDashboardPanel610", - "description": [], - "signature": [ - "Pick<", - "RawSavedDashboardPanel610", - ", \"columns\" | \"title\" | \"sort\" | \"panelIndex\" | \"gridData\" | \"version\"> & { readonly id: string; readonly type: string; }" - ], - "path": "src/plugins/dashboard/common/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.SavedDashboardPanel620", - "type": "Type", - "tags": [], - "label": "SavedDashboardPanel620", - "description": [], - "signature": [ - "Pick<", - "RawSavedDashboardPanel620", - ", \"columns\" | \"title\" | \"sort\" | \"panelIndex\" | \"gridData\" | \"version\" | \"embeddableConfig\"> & { readonly id: string; readonly type: string; }" - ], - "path": "src/plugins/dashboard/common/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.SavedDashboardPanel630", - "type": "Type", - "tags": [], - "label": "SavedDashboardPanel630", - "description": [], - "signature": [ - "Pick<", - "RawSavedDashboardPanel620", - ", \"columns\" | \"title\" | \"sort\" | \"panelIndex\" | \"gridData\" | \"version\" | \"embeddableConfig\"> & { readonly id: string; readonly type: string; }" - ], - "path": "src/plugins/dashboard/common/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.SavedDashboardPanel640To720", - "type": "Type", - "tags": [], - "label": "SavedDashboardPanel640To720", - "description": [], - "signature": [ - "Pick<", - "RawSavedDashboardPanel640To720", - ", \"title\" | \"panelIndex\" | \"gridData\" | \"version\" | \"embeddableConfig\"> & { readonly id: string; readonly type: string; }" - ], - "path": "src/plugins/dashboard/common/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.SavedDashboardPanel730ToLatest", - "type": "Type", - "tags": [], - "label": "SavedDashboardPanel730ToLatest", - "description": [], - "signature": [ - "Pick<", - { - "pluginId": "dashboard", - "scope": "common", - "docId": "kibDashboardPluginApi", - "section": "def-common.RawSavedDashboardPanel730ToLatest", - "text": "RawSavedDashboardPanel730ToLatest" - }, - ", \"type\" | \"title\" | \"panelIndex\" | \"gridData\" | \"version\" | \"embeddableConfig\" | \"panelRefName\"> & { readonly id?: string | undefined; readonly type: string; }" - ], - "path": "src/plugins/dashboard/common/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "dashboard", - "id": "def-common.SavedDashboardPanelTo60", - "type": "Type", - "tags": [], - "label": "SavedDashboardPanelTo60", - "description": [], - "signature": [ - "Pick<", - "RawSavedDashboardPanelTo60", - ", \"columns\" | \"title\" | \"sort\" | \"size_x\" | \"size_y\" | \"row\" | \"col\" | \"panelIndex\"> & { readonly id: string; readonly type: string; }" - ], - "path": "src/plugins/dashboard/common/types.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - } - ], "objects": [ { "parentPluginId": "dashboard", diff --git a/api_docs/dashboard.mdx b/api_docs/dashboard.mdx index 609a9e0925333..464789c8cd191 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'dashboard'] --- import dashboardObj from './dashboard.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Kibana Presentation](https://github.com/orgs/elastic/teams/kibana-prese | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 144 | 0 | 139 | 10 | +| 120 | 0 | 113 | 3 | ## Client @@ -37,9 +37,6 @@ Contact [Kibana Presentation](https://github.com/orgs/elastic/teams/kibana-prese ### Functions -### Classes - - ### Interfaces @@ -68,6 +65,3 @@ Contact [Kibana Presentation](https://github.com/orgs/elastic/teams/kibana-prese ### Interfaces -### Consts, variables and types - - diff --git a/api_docs/dashboard_enhanced.mdx b/api_docs/dashboard_enhanced.mdx index ae6e7c69b3a88..5ad9b56b00576 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-28 +date: 2022-10-04 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 b8c91c02caa2d..f88ba52d6af1a 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data'] --- import dataObj from './data.devdocs.json'; diff --git a/api_docs/data_query.devdocs.json b/api_docs/data_query.devdocs.json index 23849f6641368..051270f939554 100644 --- a/api_docs/data_query.devdocs.json +++ b/api_docs/data_query.devdocs.json @@ -1855,14 +1855,6 @@ "plugin": "discover", "path": "src/plugins/discover/public/application/main/services/discover_state.ts" }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/application/lib/sync_dashboard_filter_state.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/application/lib/sync_dashboard_filter_state.ts" - }, { "plugin": "maps", "path": "x-pack/plugins/maps/public/routes/map_page/url_state/global_sync.ts" diff --git a/api_docs/data_query.mdx b/api_docs/data_query.mdx index b81d02840aba1..554f11d22eb36 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'data.query'] --- import dataQueryObj from './data_query.devdocs.json'; diff --git a/api_docs/data_search.devdocs.json b/api_docs/data_search.devdocs.json index 415500b499045..3be2133617864 100644 --- a/api_docs/data_search.devdocs.json +++ b/api_docs/data_search.devdocs.json @@ -2794,9 +2794,9 @@ "label": "options", "description": [], "signature": [ - "{ filter?: any; search?: string | undefined; aggs?: Record | undefined; fields?: string[] | undefined; searchAfter?: string[] | undefined; page?: number | undefined; perPage?: number | undefined; sortField?: string | undefined; sortOrder?: ", + "> | undefined; searchAfter?: string[] | undefined; page?: number | undefined; perPage?: number | undefined; sortField?: string | undefined; sortOrder?: ", "SortOrder", " | undefined; searchFields?: string[] | undefined; rootSearchFields?: string[] | undefined; hasReference?: ", "SavedObjectsFindOptionsReference", @@ -3475,13 +3475,7 @@ "label": "DataRequestHandlerContext", "description": [], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", " & { search: Promise<", { "pluginId": "data", diff --git a/api_docs/data_search.mdx b/api_docs/data_search.mdx index 12e4806b7ea2b..ef1fb301e167d 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-28 +date: 2022-10-04 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 1384a135bfbe8..96deb16679bb1 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-28 +date: 2022-10-04 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 4b95039f7981c..7935fdee2a27e 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-28 +date: 2022-10-04 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 3608114bd15af..18bcd0b3d6185 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-28 +date: 2022-10-04 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 c868634158667..cc6bd0a259d02 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 c6389cc090a71..4f324ce195e16 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-28 +date: 2022-10-04 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 69bcfa932c46f..881f77c01491f 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-28 +date: 2022-10-04 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 b658b5b795600..0f7512a8f4125 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- @@ -24,9 +24,9 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | alerting, discover, securitySolution | - | | | stackAlerts, alerting, securitySolution, inputControlVis | - | | | actions, alerting | - | -| | savedObjects, embeddable, fleet, visualizations, infra, canvas, graph, securitySolution, actions, alerting, enterpriseSearch, taskManager, dashboard, savedSearch, ml, @kbn/core-saved-objects-server-internal | - | -| | savedObjects, embeddable, fleet, visualizations, infra, canvas, graph, securitySolution, actions, alerting, enterpriseSearch, taskManager, dashboard, savedSearch, ml, @kbn/core-saved-objects-server-internal | - | -| | discover, dashboard, maps, monitoring | - | +| | savedObjects, embeddable, fleet, visualizations, dashboard, infra, canvas, graph, securitySolution, actions, alerting, enterpriseSearch, taskManager, savedSearch, ml, @kbn/core-saved-objects-server-internal | - | +| | savedObjects, embeddable, fleet, visualizations, dashboard, infra, canvas, graph, securitySolution, actions, alerting, enterpriseSearch, taskManager, savedSearch, ml, @kbn/core-saved-objects-server-internal | - | +| | discover, maps, monitoring | - | | | unifiedSearch, discover, maps, infra, graph, securitySolution, stackAlerts, inputControlVis, savedObjects | - | | | data, discover, embeddable | - | | | advancedSettings, discover | - | @@ -34,7 +34,6 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | securitySolution | - | | | encryptedSavedObjects, actions, data, cloud, ml, logstash, securitySolution | - | | | dashboard, dataVisualizer, stackAlerts, expressionPartitionVis | - | -| | dashboard | - | | | dataViews, maps | - | | | dataViews, maps | - | | | maps | - | @@ -43,6 +42,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | visTypeTimeseries, graph, dataViewManagement, dataViews | - | | | visTypeTimeseries, graph, dataViewManagement, dataViews | - | | | visTypeTimeseries, graph, dataViewManagement | - | +| | dashboard | - | | | observability, dataVisualizer, fleet, cloudSecurityPosture, discoverEnhanced, osquery, synthetics | - | | | dataViewManagement, dataViews | - | | | dataViews, dataViewManagement | - | @@ -75,10 +75,9 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | apm, security, securitySolution | 8.8.0 | | | visualizations, dashboard, lens, maps, ml, securitySolution, security, @kbn/core-application-browser-internal, @kbn/core-application-browser-mocks | 8.8.0 | | | securitySolution, @kbn/core-application-browser-internal | 8.8.0 | -| | savedObjectsTaggingOss, dashboard | 8.8.0 | -| | dashboard | 8.8.0 | | | maps, dashboard, @kbn/core-saved-objects-migration-server-internal | 8.8.0 | | | monitoring, kibanaUsageCollection, @kbn/core-apps-browser-internal, @kbn/core-metrics-server-internal, @kbn/core-status-server-internal, @kbn/core-usage-data-server-internal | 8.8.0 | +| | savedObjectsTaggingOss, dashboard | 8.8.0 | | | security, fleet | 8.8.0 | | | security, fleet | 8.8.0 | | | security, fleet | 8.8.0 | @@ -131,6 +130,7 @@ Safe to remove. | | expressions | | | expressions | | | kibanaReact | +| | savedObjects | | | savedObjects | | | licensing | | | licensing | diff --git a/api_docs/deprecations_by_plugin.mdx b/api_docs/deprecations_by_plugin.mdx index dabf6a7945b9a..efddd344cdaca 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- @@ -211,16 +211,14 @@ so TS and code-reference navigation might not highlight them. | | Deprecated API | Reference location(s) | Remove By | | ---------------|-----------|-----------| -| | [sync_dashboard_filter_state.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/lib/sync_dashboard_filter_state.ts#:~:text=syncQueryStateWithUrl), [sync_dashboard_filter_state.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/lib/sync_dashboard_filter_state.ts#:~:text=syncQueryStateWithUrl) | - | | | [types.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/data/types.ts#:~:text=fieldFormats), [data_service.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/data/data_service.ts#:~:text=fieldFormats) | - | | | [dashboard_viewport.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx#:~:text=ExitFullScreenButton), [dashboard_viewport.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx#:~:text=ExitFullScreenButton), [dashboard_viewport.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx#:~:text=ExitFullScreenButton) | - | | | [save_modal.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/top_nav/save_modal.tsx#:~:text=SavedObjectSaveModal), [save_modal.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/top_nav/save_modal.tsx#:~:text=SavedObjectSaveModal) | 8.8.0 | -| | [saved_object_loader.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/saved_object_loader.ts#:~:text=SavedObject), [saved_object_loader.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/saved_object_loader.ts#:~:text=SavedObject), [saved_object_loader.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/saved_object_loader.ts#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [saved_dashboard.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts#:~:text=SavedObject), [saved_dashboard.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts#:~:text=SavedObject), [dashboard_tagging.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/lib/dashboard_tagging.ts#:~:text=SavedObject), [dashboard_tagging.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/lib/dashboard_tagging.ts#:~:text=SavedObject) | 8.8.0 | -| | [saved_dashboard.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts#:~:text=SavedObjectClass) | 8.8.0 | +| | [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject) | 8.8.0 | | | [types.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/types.ts#:~:text=onAppLeave), [plugin.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/plugin.tsx#:~:text=onAppLeave) | 8.8.0 | -| | [dashboard_migrations.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts#:~:text=SavedObjectAttributes), [dashboard_migrations.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry.ts#:~:text=SavedObjectAttributes), [find_by_value_embeddables.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/find_by_value_embeddables.ts#:~:text=SavedObjectAttributes), [find_by_value_embeddables.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/find_by_value_embeddables.ts#:~:text=SavedObjectAttributes), [saved_dashboard_references.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/common/saved_dashboard_references.ts#:~:text=SavedObjectAttributes), [saved_dashboard_references.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/common/saved_dashboard_references.ts#:~:text=SavedObjectAttributes)+ 8 more | - | -| | [dashboard_migrations.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts#:~:text=SavedObjectAttributes), [dashboard_migrations.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/dashboard_migrations.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry.ts#:~:text=SavedObjectAttributes), [find_by_value_embeddables.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/find_by_value_embeddables.ts#:~:text=SavedObjectAttributes), [find_by_value_embeddables.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/find_by_value_embeddables.ts#:~:text=SavedObjectAttributes), [saved_dashboard_references.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/common/saved_dashboard_references.ts#:~:text=SavedObjectAttributes), [saved_dashboard_references.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/common/saved_dashboard_references.ts#:~:text=SavedObjectAttributes)+ 8 more | - | -| | [migrations_730.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations_730.ts#:~:text=warning), [migrations_730.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations_730.ts#:~:text=warning) | 8.8.0 | +| | [load_dashboard_state_from_saved_object.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/dashboard_saved_object/lib/load_dashboard_state_from_saved_object.ts#:~:text=SavedObjectAttributes), [load_dashboard_state_from_saved_object.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/dashboard_saved_object/lib/load_dashboard_state_from_saved_object.ts#:~:text=SavedObjectAttributes), [migrate_extract_panel_references.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations/migrate_extract_panel_references.ts#:~:text=SavedObjectAttributes), [migrate_extract_panel_references.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations/migrate_extract_panel_references.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry.ts#:~:text=SavedObjectAttributes), [find_by_value_embeddables.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/find_by_value_embeddables.ts#:~:text=SavedObjectAttributes)+ 11 more | - | +| | [load_dashboard_state_from_saved_object.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/dashboard_saved_object/lib/load_dashboard_state_from_saved_object.ts#:~:text=SavedObjectAttributes), [load_dashboard_state_from_saved_object.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/dashboard_saved_object/lib/load_dashboard_state_from_saved_object.ts#:~:text=SavedObjectAttributes), [migrate_extract_panel_references.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations/migrate_extract_panel_references.ts#:~:text=SavedObjectAttributes), [migrate_extract_panel_references.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations/migrate_extract_panel_references.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry_collection_task.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry_collection_task.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry.ts#:~:text=SavedObjectAttributes), [dashboard_telemetry.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/dashboard_telemetry.ts#:~:text=SavedObjectAttributes), [find_by_value_embeddables.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/usage/find_by_value_embeddables.ts#:~:text=SavedObjectAttributes)+ 11 more | - | +| | [migrations_730.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations/migrate_to_730/migrations_730.ts#:~:text=warning), [migrations_730.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations/migrate_to_730/migrations_730.ts#:~:text=warning) | 8.8.0 | @@ -525,7 +523,7 @@ so TS and code-reference navigation might not highlight them. | | Deprecated API | Reference location(s) | Remove By | | ---------------|-----------|-----------| -| | [pack_queries_status_table.tsx](https://github.com/elastic/kibana/tree/main/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx#:~:text=indexPatternId), [pack_queries_status_table.tsx](https://github.com/elastic/kibana/tree/main/x-pack/plugins/osquery/public/live_queries/form/pack_queries_status_table.tsx#:~:text=indexPatternId), [use_discover_link.tsx](https://github.com/elastic/kibana/tree/main/x-pack/plugins/osquery/public/common/hooks/use_discover_link.tsx#:~:text=indexPatternId) | - | +| | [pack_queries_status_table.tsx](https://github.com/elastic/kibana/tree/main/x-pack/plugins/osquery/public/packs/pack_queries_status_table.tsx#:~:text=indexPatternId), [view_results_in_discover.tsx](https://github.com/elastic/kibana/tree/main/x-pack/plugins/osquery/public/discover/view_results_in_discover.tsx#:~:text=indexPatternId), [use_discover_link.tsx](https://github.com/elastic/kibana/tree/main/x-pack/plugins/osquery/public/common/hooks/use_discover_link.tsx#:~:text=indexPatternId) | - | | | [empty_state.tsx](https://github.com/elastic/kibana/tree/main/x-pack/plugins/osquery/public/components/empty_state.tsx#:~:text=KibanaPageTemplate), [empty_state.tsx](https://github.com/elastic/kibana/tree/main/x-pack/plugins/osquery/public/components/empty_state.tsx#:~:text=KibanaPageTemplate) | - | diff --git a/api_docs/deprecations_by_team.mdx b/api_docs/deprecations_by_team.mdx index 643d002885ef8..a3a41ce841cf8 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- @@ -89,10 +89,9 @@ so TS and code-reference navigation might not highlight them. | | Plugin | Deprecated API | Reference location(s) | Remove By | | --------|-------|-----------|-----------| | dashboard | | [save_modal.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/top_nav/save_modal.tsx#:~:text=SavedObjectSaveModal), [save_modal.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/top_nav/save_modal.tsx#:~:text=SavedObjectSaveModal), [saved_object_save_modal_dashboard.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx#:~:text=SavedObjectSaveModal), [saved_object_save_modal_dashboard.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/presentation_util/public/components/saved_object_save_modal_dashboard.tsx#:~:text=SavedObjectSaveModal) | 8.8.0 | -| dashboard | | [saved_object_loader.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/saved_object_loader.ts#:~:text=SavedObject), [saved_object_loader.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/saved_object_loader.ts#:~:text=SavedObject), [saved_object_loader.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/services/saved_object_loader.ts#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [saved_dashboard.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts#:~:text=SavedObject), [saved_dashboard.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts#:~:text=SavedObject), [dashboard_tagging.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/lib/dashboard_tagging.ts#:~:text=SavedObject), [dashboard_tagging.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/lib/dashboard_tagging.ts#:~:text=SavedObject) | 8.8.0 | -| dashboard | | [saved_dashboard.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts#:~:text=SavedObjectClass) | 8.8.0 | +| dashboard | | [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject), [clone_panel_action.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx#:~:text=SavedObject) | 8.8.0 | | dashboard | | [types.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/types.ts#:~:text=onAppLeave), [plugin.tsx](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/public/plugin.tsx#:~:text=onAppLeave) | 8.8.0 | -| dashboard | | [migrations_730.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations_730.ts#:~:text=warning), [migrations_730.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations_730.ts#:~:text=warning) | 8.8.0 | +| dashboard | | [migrations_730.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations/migrate_to_730/migrations_730.ts#:~:text=warning), [migrations_730.ts](https://github.com/elastic/kibana/tree/main/src/plugins/dashboard/server/saved_objects/migrations/migrate_to_730/migrations_730.ts#:~:text=warning) | 8.8.0 | diff --git a/api_docs/dev_tools.mdx b/api_docs/dev_tools.mdx index ddeb12beb9a7a..d294a02405563 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'devTools'] --- import devToolsObj from './dev_tools.devdocs.json'; diff --git a/api_docs/discover.devdocs.json b/api_docs/discover.devdocs.json index 695319775e984..8c4a6308dd17b 100644 --- a/api_docs/discover.devdocs.json +++ b/api_docs/discover.devdocs.json @@ -346,7 +346,7 @@ }, { "plugin": "osquery", - "path": "x-pack/plugins/osquery/public/live_queries/form/pack_queries_status_table.tsx" + "path": "x-pack/plugins/osquery/public/discover/view_results_in_discover.tsx" }, { "plugin": "osquery", @@ -1101,7 +1101,7 @@ "label": "sharingSavedObjectProps", "description": [], "signature": [ - "{ outcome?: \"exactMatch\" | \"aliasMatch\" | \"conflict\" | undefined; aliasTargetId?: string | undefined; aliasPurpose?: \"savedObjectConversion\" | \"savedObjectImport\" | undefined; errorJSON?: string | undefined; } | undefined" + "{ outcome?: \"conflict\" | \"exactMatch\" | \"aliasMatch\" | undefined; aliasTargetId?: string | undefined; aliasPurpose?: \"savedObjectConversion\" | \"savedObjectImport\" | undefined; errorJSON?: string | undefined; } | undefined" ], "path": "src/plugins/saved_search/public/services/saved_searches/types.ts", "deprecated": false, diff --git a/api_docs/discover.mdx b/api_docs/discover.mdx index 4a2a4abc7d5ef..ddbdd9e335bb0 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-28 +date: 2022-10-04 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 104fc1d5cde65..4cb08ffc96f64 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-28 +date: 2022-10-04 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 3203b4c957545..1559a8abc24e3 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-28 +date: 2022-10-04 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 e5e64a70e8012..ecf61f0f91ce3 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-28 +date: 2022-10-04 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 6d488adbda835..ba3a3d8c876df 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-28 +date: 2022-10-04 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 2d3bbbfe7ad85..276207b2a393d 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-28 +date: 2022-10-04 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 e6eb098f3c9cd..43d88ac7e1ed8 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-28 +date: 2022-10-04 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 54a7269ef5325..73c8ebf1471bd 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'eventAnnotation'] --- import eventAnnotationObj from './event_annotation.devdocs.json'; diff --git a/api_docs/event_log.devdocs.json b/api_docs/event_log.devdocs.json index f821ced3a76e0..b4c0370096cc2 100644 --- a/api_docs/event_log.devdocs.json +++ b/api_docs/event_log.devdocs.json @@ -1312,7 +1312,7 @@ "label": "data", "description": [], "signature": [ - "(Readonly<{ error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; tags?: string[] | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; message?: string | undefined; kibana?: Readonly<{ alert?: Readonly<{ rule?: Readonly<{ consumer?: string | undefined; execution?: Readonly<{ status?: string | undefined; metrics?: Readonly<{ number_of_triggered_actions?: string | number | undefined; number_of_generated_actions?: string | number | undefined; alert_counts?: Readonly<{ recovered?: string | number | undefined; active?: string | number | undefined; new?: string | number | undefined; } & {}> | undefined; number_of_searches?: string | number | undefined; total_indexing_duration_ms?: string | number | undefined; es_search_duration_ms?: string | number | undefined; total_search_duration_ms?: string | number | undefined; execution_gap_duration_s?: string | number | undefined; rule_type_run_duration_ms?: string | number | undefined; process_alerts_duration_ms?: string | number | undefined; trigger_actions_duration_ms?: string | number | undefined; process_rule_duration_ms?: string | number | undefined; claim_to_start_duration_ms?: string | number | undefined; prepare_rule_duration_ms?: string | number | undefined; total_run_duration_ms?: string | number | undefined; } & {}> | undefined; uuid?: string | undefined; status_order?: string | number | undefined; } & {}> | undefined; rule_type_id?: string | undefined; } & {}> | undefined; } & {}> | undefined; version?: string | undefined; alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; server_uuid?: string | undefined; task?: Readonly<{ id?: string | undefined; schedule_delay?: string | number | undefined; scheduled?: string | undefined; } & {}> | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; namespace?: string | undefined; rel?: string | undefined; type_id?: string | undefined; } & {}>[] | undefined; space_ids?: string[] | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; rule?: Readonly<{ name?: string | undefined; description?: string | undefined; category?: string | undefined; id?: string | undefined; version?: string | undefined; license?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; uuid?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; category?: string[] | undefined; type?: string[] | undefined; id?: string | undefined; outcome?: string | undefined; created?: string | undefined; end?: string | undefined; original?: string | undefined; duration?: string | number | undefined; code?: string | undefined; url?: string | undefined; action?: string | undefined; kind?: string | undefined; hash?: string | undefined; severity?: string | number | undefined; dataset?: string | undefined; ingested?: string | undefined; module?: string | undefined; provider?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: string | number | undefined; timezone?: string | undefined; } & {}> | undefined; '@timestamp'?: string | undefined; } & {}> | undefined)[]" + "(Readonly<{ error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; tags?: string[] | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; message?: string | undefined; kibana?: Readonly<{ alert?: Readonly<{ rule?: Readonly<{ consumer?: string | undefined; execution?: Readonly<{ status?: string | undefined; metrics?: Readonly<{ number_of_triggered_actions?: string | number | undefined; number_of_generated_actions?: string | number | undefined; alert_counts?: Readonly<{ active?: string | number | undefined; recovered?: string | number | undefined; new?: string | number | undefined; } & {}> | undefined; number_of_searches?: string | number | undefined; total_indexing_duration_ms?: string | number | undefined; es_search_duration_ms?: string | number | undefined; total_search_duration_ms?: string | number | undefined; execution_gap_duration_s?: string | number | undefined; rule_type_run_duration_ms?: string | number | undefined; process_alerts_duration_ms?: string | number | undefined; trigger_actions_duration_ms?: string | number | undefined; process_rule_duration_ms?: string | number | undefined; claim_to_start_duration_ms?: string | number | undefined; prepare_rule_duration_ms?: string | number | undefined; total_run_duration_ms?: string | number | undefined; total_enrichment_duration_ms?: string | number | undefined; } & {}> | undefined; uuid?: string | undefined; status_order?: string | number | undefined; } & {}> | undefined; rule_type_id?: string | undefined; } & {}> | undefined; } & {}> | undefined; version?: string | undefined; alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; server_uuid?: string | undefined; task?: Readonly<{ id?: string | undefined; schedule_delay?: string | number | undefined; scheduled?: string | undefined; } & {}> | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; namespace?: string | undefined; rel?: string | undefined; type_id?: string | undefined; } & {}>[] | undefined; space_ids?: string[] | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; rule?: Readonly<{ name?: string | undefined; description?: string | undefined; category?: string | undefined; id?: string | undefined; version?: string | undefined; license?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; uuid?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; category?: string[] | undefined; type?: string[] | undefined; id?: string | undefined; created?: string | undefined; outcome?: string | undefined; end?: string | undefined; original?: string | undefined; duration?: string | number | undefined; code?: string | undefined; url?: string | undefined; action?: string | undefined; kind?: string | undefined; hash?: string | undefined; severity?: string | number | undefined; dataset?: string | undefined; ingested?: string | undefined; module?: string | undefined; provider?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: string | number | undefined; timezone?: string | undefined; } & {}> | undefined; '@timestamp'?: string | undefined; } & {}> | undefined)[]" ], "path": "x-pack/plugins/event_log/server/es/cluster_client_adapter.ts", "deprecated": false, @@ -1332,7 +1332,7 @@ "label": "IEvent", "description": [], "signature": [ - "DeepPartial | undefined; tags?: string[] | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; message?: string | undefined; kibana?: Readonly<{ alert?: Readonly<{ rule?: Readonly<{ consumer?: string | undefined; execution?: Readonly<{ status?: string | undefined; metrics?: Readonly<{ number_of_triggered_actions?: string | number | undefined; number_of_generated_actions?: string | number | undefined; alert_counts?: Readonly<{ recovered?: string | number | undefined; active?: string | number | undefined; new?: string | number | undefined; } & {}> | undefined; number_of_searches?: string | number | undefined; total_indexing_duration_ms?: string | number | undefined; es_search_duration_ms?: string | number | undefined; total_search_duration_ms?: string | number | undefined; execution_gap_duration_s?: string | number | undefined; rule_type_run_duration_ms?: string | number | undefined; process_alerts_duration_ms?: string | number | undefined; trigger_actions_duration_ms?: string | number | undefined; process_rule_duration_ms?: string | number | undefined; claim_to_start_duration_ms?: string | number | undefined; prepare_rule_duration_ms?: string | number | undefined; total_run_duration_ms?: string | number | undefined; } & {}> | undefined; uuid?: string | undefined; status_order?: string | number | undefined; } & {}> | undefined; rule_type_id?: string | undefined; } & {}> | undefined; } & {}> | undefined; version?: string | undefined; alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; server_uuid?: string | undefined; task?: Readonly<{ id?: string | undefined; schedule_delay?: string | number | undefined; scheduled?: string | undefined; } & {}> | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; namespace?: string | undefined; rel?: string | undefined; type_id?: string | undefined; } & {}>[] | undefined; space_ids?: string[] | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; rule?: Readonly<{ name?: string | undefined; description?: string | undefined; category?: string | undefined; id?: string | undefined; version?: string | undefined; license?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; uuid?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; category?: string[] | undefined; type?: string[] | undefined; id?: string | undefined; outcome?: string | undefined; created?: string | undefined; end?: string | undefined; original?: string | undefined; duration?: string | number | undefined; code?: string | undefined; url?: string | undefined; action?: string | undefined; kind?: string | undefined; hash?: string | undefined; severity?: string | number | undefined; dataset?: string | undefined; ingested?: string | undefined; module?: string | undefined; provider?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: string | number | undefined; timezone?: string | undefined; } & {}> | undefined; '@timestamp'?: string | undefined; } & {}>>> | undefined" + "DeepPartial | undefined; tags?: string[] | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; message?: string | undefined; kibana?: Readonly<{ alert?: Readonly<{ rule?: Readonly<{ consumer?: string | undefined; execution?: Readonly<{ status?: string | undefined; metrics?: Readonly<{ number_of_triggered_actions?: string | number | undefined; number_of_generated_actions?: string | number | undefined; alert_counts?: Readonly<{ active?: string | number | undefined; recovered?: string | number | undefined; new?: string | number | undefined; } & {}> | undefined; number_of_searches?: string | number | undefined; total_indexing_duration_ms?: string | number | undefined; es_search_duration_ms?: string | number | undefined; total_search_duration_ms?: string | number | undefined; execution_gap_duration_s?: string | number | undefined; rule_type_run_duration_ms?: string | number | undefined; process_alerts_duration_ms?: string | number | undefined; trigger_actions_duration_ms?: string | number | undefined; process_rule_duration_ms?: string | number | undefined; claim_to_start_duration_ms?: string | number | undefined; prepare_rule_duration_ms?: string | number | undefined; total_run_duration_ms?: string | number | undefined; total_enrichment_duration_ms?: string | number | undefined; } & {}> | undefined; uuid?: string | undefined; status_order?: string | number | undefined; } & {}> | undefined; rule_type_id?: string | undefined; } & {}> | undefined; } & {}> | undefined; version?: string | undefined; alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; server_uuid?: string | undefined; task?: Readonly<{ id?: string | undefined; schedule_delay?: string | number | undefined; scheduled?: string | undefined; } & {}> | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; namespace?: string | undefined; rel?: string | undefined; type_id?: string | undefined; } & {}>[] | undefined; space_ids?: string[] | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; rule?: Readonly<{ name?: string | undefined; description?: string | undefined; category?: string | undefined; id?: string | undefined; version?: string | undefined; license?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; uuid?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; category?: string[] | undefined; type?: string[] | undefined; id?: string | undefined; created?: string | undefined; outcome?: string | undefined; end?: string | undefined; original?: string | undefined; duration?: string | number | undefined; code?: string | undefined; url?: string | undefined; action?: string | undefined; kind?: string | undefined; hash?: string | undefined; severity?: string | number | undefined; dataset?: string | undefined; ingested?: string | undefined; module?: string | undefined; provider?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: string | number | undefined; timezone?: string | undefined; } & {}> | undefined; '@timestamp'?: string | undefined; } & {}>>> | undefined" ], "path": "x-pack/plugins/event_log/generated/schemas.ts", "deprecated": false, @@ -1347,7 +1347,7 @@ "label": "IValidatedEvent", "description": [], "signature": [ - "Readonly<{ error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; tags?: string[] | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; message?: string | undefined; kibana?: Readonly<{ alert?: Readonly<{ rule?: Readonly<{ consumer?: string | undefined; execution?: Readonly<{ status?: string | undefined; metrics?: Readonly<{ number_of_triggered_actions?: string | number | undefined; number_of_generated_actions?: string | number | undefined; alert_counts?: Readonly<{ recovered?: string | number | undefined; active?: string | number | undefined; new?: string | number | undefined; } & {}> | undefined; number_of_searches?: string | number | undefined; total_indexing_duration_ms?: string | number | undefined; es_search_duration_ms?: string | number | undefined; total_search_duration_ms?: string | number | undefined; execution_gap_duration_s?: string | number | undefined; rule_type_run_duration_ms?: string | number | undefined; process_alerts_duration_ms?: string | number | undefined; trigger_actions_duration_ms?: string | number | undefined; process_rule_duration_ms?: string | number | undefined; claim_to_start_duration_ms?: string | number | undefined; prepare_rule_duration_ms?: string | number | undefined; total_run_duration_ms?: string | number | undefined; } & {}> | undefined; uuid?: string | undefined; status_order?: string | number | undefined; } & {}> | undefined; rule_type_id?: string | undefined; } & {}> | undefined; } & {}> | undefined; version?: string | undefined; alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; server_uuid?: string | undefined; task?: Readonly<{ id?: string | undefined; schedule_delay?: string | number | undefined; scheduled?: string | undefined; } & {}> | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; namespace?: string | undefined; rel?: string | undefined; type_id?: string | undefined; } & {}>[] | undefined; space_ids?: string[] | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; rule?: Readonly<{ name?: string | undefined; description?: string | undefined; category?: string | undefined; id?: string | undefined; version?: string | undefined; license?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; uuid?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; category?: string[] | undefined; type?: string[] | undefined; id?: string | undefined; outcome?: string | undefined; created?: string | undefined; end?: string | undefined; original?: string | undefined; duration?: string | number | undefined; code?: string | undefined; url?: string | undefined; action?: string | undefined; kind?: string | undefined; hash?: string | undefined; severity?: string | number | undefined; dataset?: string | undefined; ingested?: string | undefined; module?: string | undefined; provider?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: string | number | undefined; timezone?: string | undefined; } & {}> | undefined; '@timestamp'?: string | undefined; } & {}> | undefined" + "Readonly<{ error?: Readonly<{ type?: string | undefined; id?: string | undefined; message?: string | undefined; code?: string | undefined; stack_trace?: string | undefined; } & {}> | undefined; tags?: string[] | undefined; log?: Readonly<{ logger?: string | undefined; level?: string | undefined; } & {}> | undefined; user?: Readonly<{ name?: string | undefined; } & {}> | undefined; message?: string | undefined; kibana?: Readonly<{ alert?: Readonly<{ rule?: Readonly<{ consumer?: string | undefined; execution?: Readonly<{ status?: string | undefined; metrics?: Readonly<{ number_of_triggered_actions?: string | number | undefined; number_of_generated_actions?: string | number | undefined; alert_counts?: Readonly<{ active?: string | number | undefined; recovered?: string | number | undefined; new?: string | number | undefined; } & {}> | undefined; number_of_searches?: string | number | undefined; total_indexing_duration_ms?: string | number | undefined; es_search_duration_ms?: string | number | undefined; total_search_duration_ms?: string | number | undefined; execution_gap_duration_s?: string | number | undefined; rule_type_run_duration_ms?: string | number | undefined; process_alerts_duration_ms?: string | number | undefined; trigger_actions_duration_ms?: string | number | undefined; process_rule_duration_ms?: string | number | undefined; claim_to_start_duration_ms?: string | number | undefined; prepare_rule_duration_ms?: string | number | undefined; total_run_duration_ms?: string | number | undefined; total_enrichment_duration_ms?: string | number | undefined; } & {}> | undefined; uuid?: string | undefined; status_order?: string | number | undefined; } & {}> | undefined; rule_type_id?: string | undefined; } & {}> | undefined; } & {}> | undefined; version?: string | undefined; alerting?: Readonly<{ status?: string | undefined; instance_id?: string | undefined; action_group_id?: string | undefined; action_subgroup?: string | undefined; } & {}> | undefined; server_uuid?: string | undefined; task?: Readonly<{ id?: string | undefined; schedule_delay?: string | number | undefined; scheduled?: string | undefined; } & {}> | undefined; saved_objects?: Readonly<{ type?: string | undefined; id?: string | undefined; namespace?: string | undefined; rel?: string | undefined; type_id?: string | undefined; } & {}>[] | undefined; space_ids?: string[] | undefined; } & {}> | undefined; ecs?: Readonly<{ version?: string | undefined; } & {}> | undefined; rule?: Readonly<{ name?: string | undefined; description?: string | undefined; category?: string | undefined; id?: string | undefined; version?: string | undefined; license?: string | undefined; reference?: string | undefined; author?: string[] | undefined; ruleset?: string | undefined; uuid?: string | undefined; } & {}> | undefined; event?: Readonly<{ start?: string | undefined; category?: string[] | undefined; type?: string[] | undefined; id?: string | undefined; created?: string | undefined; outcome?: string | undefined; end?: string | undefined; original?: string | undefined; duration?: string | number | undefined; code?: string | undefined; url?: string | undefined; action?: string | undefined; kind?: string | undefined; hash?: string | undefined; severity?: string | number | undefined; dataset?: string | undefined; ingested?: string | undefined; module?: string | undefined; provider?: string | undefined; reason?: string | undefined; reference?: string | undefined; risk_score?: number | undefined; risk_score_norm?: number | undefined; sequence?: string | number | undefined; timezone?: string | undefined; } & {}> | undefined; '@timestamp'?: string | undefined; } & {}> | undefined" ], "path": "x-pack/plugins/event_log/generated/schemas.ts", "deprecated": false, diff --git a/api_docs/event_log.mdx b/api_docs/event_log.mdx index dff00025d47a5..140f35dea7cc4 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-28 +date: 2022-10-04 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 ba5e5e742f4c5..5d2d5c6c99e07 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-28 +date: 2022-10-04 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 331af14bbd784..184191c6cd298 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-28 +date: 2022-10-04 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 36ea696e53359..205be987e15e5 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-28 +date: 2022-10-04 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 97052c63f7476..9d60a46814616 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-28 +date: 2022-10-04 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 95950d42e4473..b44d904cdc0e5 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-28 +date: 2022-10-04 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 ee6b2d7e353f4..22fc0e2475ccd 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-28 +date: 2022-10-04 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 c1edcc43088dd..fd1807af21b02 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-28 +date: 2022-10-04 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 672e12f360d34..e0264ca7b2d72 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-28 +date: 2022-10-04 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 7fbd70637ed36..071e730b126d5 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-28 +date: 2022-10-04 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 09f5c55834635..b964071af3c95 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-28 +date: 2022-10-04 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 8414051020d06..3fb4a8e6e6545 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-28 +date: 2022-10-04 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 42b6c0963d951..4c84f9b680739 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-28 +date: 2022-10-04 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 340a2de8e8e21..8b894b45d78d9 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-28 +date: 2022-10-04 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 cf0d00e1dd478..dfc68e39dd9c9 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": [ { @@ -11507,7 +11515,7 @@ "\nThis type represents the `type` of any `DatatableColumn` in a `Datatable`.\nits duplicated from KBN_FIELD_TYPES" ], "signature": [ - "\"string\" | \"number\" | \"boolean\" | \"object\" | \"date\" | \"null\" | \"ip\" | \"nested\" | \"conflict\" | \"_source\" | \"attachment\" | \"geo_point\" | \"geo_shape\" | \"murmur3\" | \"unknown\" | \"histogram\"" + "\"string\" | \"number\" | \"boolean\" | \"object\" | \"date\" | \"null\" | \"ip\" | \"nested\" | \"_source\" | \"attachment\" | \"geo_point\" | \"geo_shape\" | \"murmur3\" | \"unknown\" | \"conflict\" | \"histogram\"" ], "path": "src/plugins/expressions/common/expression_types/specs/datatable.ts", "deprecated": false, @@ -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": [ { @@ -21037,7 +21053,7 @@ "\nThis type represents the `type` of any `DatatableColumn` in a `Datatable`.\nits duplicated from KBN_FIELD_TYPES" ], "signature": [ - "\"string\" | \"number\" | \"boolean\" | \"object\" | \"date\" | \"null\" | \"ip\" | \"nested\" | \"conflict\" | \"_source\" | \"attachment\" | \"geo_point\" | \"geo_shape\" | \"murmur3\" | \"unknown\" | \"histogram\"" + "\"string\" | \"number\" | \"boolean\" | \"object\" | \"date\" | \"null\" | \"ip\" | \"nested\" | \"_source\" | \"attachment\" | \"geo_point\" | \"geo_shape\" | \"murmur3\" | \"unknown\" | \"conflict\" | \"histogram\"" ], "path": "src/plugins/expressions/common/expression_types/specs/datatable.ts", "deprecated": false, @@ -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": [ { @@ -29210,7 +29234,7 @@ "label": "type", "description": [], "signature": [ - "\"string\" | \"number\" | \"boolean\" | \"object\" | \"date\" | \"null\" | \"ip\" | \"nested\" | \"conflict\" | \"_source\" | \"attachment\" | \"geo_point\" | \"geo_shape\" | \"murmur3\" | \"unknown\" | \"histogram\"" + "\"string\" | \"number\" | \"boolean\" | \"object\" | \"date\" | \"null\" | \"ip\" | \"nested\" | \"_source\" | \"attachment\" | \"geo_point\" | \"geo_shape\" | \"murmur3\" | \"unknown\" | \"conflict\" | \"histogram\"" ], "path": "src/plugins/expressions/common/expression_types/specs/datatable.ts", "deprecated": false, @@ -35226,7 +35250,7 @@ "\nThis type represents the `type` of any `DatatableColumn` in a `Datatable`.\nits duplicated from KBN_FIELD_TYPES" ], "signature": [ - "\"string\" | \"number\" | \"boolean\" | \"object\" | \"date\" | \"null\" | \"ip\" | \"nested\" | \"conflict\" | \"_source\" | \"attachment\" | \"geo_point\" | \"geo_shape\" | \"murmur3\" | \"unknown\" | \"histogram\"" + "\"string\" | \"number\" | \"boolean\" | \"object\" | \"date\" | \"null\" | \"ip\" | \"nested\" | \"_source\" | \"attachment\" | \"geo_point\" | \"geo_shape\" | \"murmur3\" | \"unknown\" | \"conflict\" | \"histogram\"" ], "path": "src/plugins/expressions/common/expression_types/specs/datatable.ts", "deprecated": false, diff --git a/api_docs/expressions.mdx b/api_docs/expressions.mdx index 74c3fd828f44f..050f57af12aab 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'expressions'] --- import expressionsObj from './expressions.devdocs.json'; diff --git a/api_docs/features.devdocs.json b/api_docs/features.devdocs.json index a6e9773502284..7f9018f5e89ce 100644 --- a/api_docs/features.devdocs.json +++ b/api_docs/features.devdocs.json @@ -64,7 +64,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; requireAllSpaces?: boolean | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; requireAllSpaces?: boolean | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" ], "path": "x-pack/plugins/features/common/kibana_feature.ts", "deprecated": false, @@ -1193,7 +1193,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; requireAllSpaces?: boolean | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; requireAllSpaces?: boolean | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" ], "path": "x-pack/plugins/features/common/kibana_feature.ts", "deprecated": false, @@ -2872,7 +2872,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; requireAllSpaces?: boolean | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>[] | undefined; privilegesTooltip?: string | undefined; reserved?: Readonly<{ description: string; privileges: readonly Readonly<{ id: string; privilege: Readonly<{ excludeFromBasePrivileges?: boolean | undefined; requireAllSpaces?: boolean | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; api?: readonly string[] | undefined; app?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; ui: readonly string[]; }>; }>[]; }> | undefined; }>" ], "path": "x-pack/plugins/features/common/kibana_feature.ts", "deprecated": false, @@ -3122,7 +3122,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }>" ], "path": "x-pack/plugins/features/common/sub_feature.ts", "deprecated": false, @@ -3159,7 +3159,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]" ], "path": "x-pack/plugins/features/common/sub_feature.ts", "deprecated": false, @@ -3181,7 +3181,7 @@ "section": "def-common.SubFeaturePrivilegeGroupType", "text": "SubFeaturePrivilegeGroupType" }, - "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }" + "; privileges: readonly Readonly<{ id: string; name: string; includeIn: \"none\" | \"all\" | \"read\"; minimumLicense?: \"basic\" | \"standard\" | \"gold\" | \"platinum\" | \"enterprise\" | \"trial\" | undefined; disabled?: boolean | undefined; management?: Readonly<{ [x: string]: readonly string[]; }> | undefined; cases?: Readonly<{ all?: readonly string[] | undefined; push?: readonly string[] | undefined; create?: readonly string[] | undefined; read?: readonly string[] | undefined; update?: readonly string[] | undefined; delete?: readonly string[] | undefined; }> | undefined; catalogue?: readonly string[] | undefined; alerting?: Readonly<{ rule?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; alert?: Readonly<{ all?: readonly string[] | undefined; read?: readonly string[] | undefined; }> | undefined; }> | undefined; ui: readonly string[]; app?: readonly string[] | undefined; requireAllSpaces?: boolean | undefined; api?: readonly string[] | undefined; savedObject: Readonly<{ all: readonly string[]; read: readonly string[]; }>; }>[]; }>[]; }" ], "path": "x-pack/plugins/features/common/sub_feature.ts", "deprecated": false, diff --git a/api_docs/features.mdx b/api_docs/features.mdx index 7b4880c40f8d6..513017f35056a 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-28 +date: 2022-10-04 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 8c4ebd13fe23d..b49361795cb22 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-28 +date: 2022-10-04 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 c0963ced99a2c..c431e9780deb9 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-28 +date: 2022-10-04 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 96ec1e67bf2bf..ee3ba1cdfdacf 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-28 +date: 2022-10-04 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 d068e061e494b..76458c52782a6 100644 --- a/api_docs/fleet.devdocs.json +++ b/api_docs/fleet.devdocs.json @@ -7170,13 +7170,7 @@ "text": "NewPackagePolicy" }, ", context: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", ", request: ", "KibanaRequest", ") => Promise) => Promise<", @@ -7611,13 +7593,7 @@ "label": "context", "description": [], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - } + "RequestHandlerContext" ], "path": "x-pack/plugins/fleet/server/types/extensions.ts", "deprecated": false, @@ -7709,13 +7685,7 @@ "text": "PackagePolicy" }, ", context: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", ", request: ", "KibanaRequest", ") => Promise<", @@ -7761,13 +7731,7 @@ "label": "context", "description": [], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - } + "RequestHandlerContext" ], "path": "x-pack/plugins/fleet/server/types/extensions.ts", "deprecated": false, @@ -7808,13 +7772,7 @@ "text": "UpdatePackagePolicy" }, ", context: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", ", request: ", "KibanaRequest", ") => Promise<", @@ -7860,13 +7818,7 @@ "label": "context", "description": [], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - } + "RequestHandlerContext" ], "path": "x-pack/plugins/fleet/server/types/extensions.ts", "deprecated": false, @@ -8438,7 +8390,7 @@ "label": "status", "description": [], "signature": [ - "\"active\" | \"inactive\"" + "\"inactive\" | \"active\"" ], "path": "x-pack/plugins/fleet/common/types/models/agent_policy.ts", "deprecated": false, @@ -9693,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", @@ -15292,7 +15260,7 @@ "label": "PackageSpecCategory", "description": [], "signature": [ - "\"custom\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\"" + "\"custom\" | \"aws\" | \"azure\" | \"cloud\" | \"config_management\" | \"containers\" | \"crm\" | \"datastore\" | \"elastic_stack\" | \"google_cloud\" | \"infrastructure\" | \"kubernetes\" | \"languages\" | \"message_queue\" | \"monitoring\" | \"network\" | \"notification\" | \"os_system\" | \"productivity\" | \"security\" | \"support\" | \"threat_intel\" | \"ticketing\" | \"version_control\" | \"web\"" ], "path": "x-pack/plugins/fleet/common/types/models/package_spec.ts", "deprecated": false, diff --git a/api_docs/fleet.mdx b/api_docs/fleet.mdx index 6f966dbb5a316..0dc50255cea65 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-28 +date: 2022-10-04 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 63433541ece2b..b4fff902dfabe 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'globalSearch'] --- import globalSearchObj from './global_search.devdocs.json'; diff --git a/api_docs/guided_onboarding.devdocs.json b/api_docs/guided_onboarding.devdocs.json index 27b0b8446a7d8..8b44efa700b66 100644 --- a/api_docs/guided_onboarding.devdocs.json +++ b/api_docs/guided_onboarding.devdocs.json @@ -6,44 +6,111 @@ "interfaces": [ { "parentPluginId": "guidedOnboarding", - "id": "def-public.GuidedOnboardingState", + "id": "def-public.GuideState", "type": "Interface", "tags": [], - "label": "GuidedOnboardingState", + "label": "GuideState", "description": [], - "path": "src/plugins/guided_onboarding/public/types.ts", + "path": "src/plugins/guided_onboarding/common/types.ts", "deprecated": false, "trackAdoption": false, "children": [ { "parentPluginId": "guidedOnboarding", - "id": "def-public.GuidedOnboardingState.activeGuide", + "id": "def-public.GuideState.guideId", "type": "CompoundType", "tags": [], - "label": "activeGuide", + "label": "guideId", "description": [], "signature": [ - { - "pluginId": "guidedOnboarding", - "scope": "public", - "docId": "kibGuidedOnboardingPluginApi", - "section": "def-public.UseCase", - "text": "UseCase" - }, - " | \"unset\"" + "\"search\" | \"security\" | \"observability\"" ], - "path": "src/plugins/guided_onboarding/public/types.ts", + "path": "src/plugins/guided_onboarding/common/types.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "guidedOnboarding", - "id": "def-public.GuidedOnboardingState.activeStep", - "type": "string", + "id": "def-public.GuideState.status", + "type": "CompoundType", + "tags": [], + "label": "status", + "description": [], + "signature": [ + "\"complete\" | \"in_progress\" | \"ready_to_complete\"" + ], + "path": "src/plugins/guided_onboarding/common/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.GuideState.isActive", + "type": "CompoundType", + "tags": [], + "label": "isActive", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "src/plugins/guided_onboarding/common/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.GuideState.steps", + "type": "Array", + "tags": [], + "label": "steps", + "description": [], + "signature": [ + "GuideStep", + "[]" + ], + "path": "src/plugins/guided_onboarding/common/types.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.GuideStep", + "type": "Interface", + "tags": [], + "label": "GuideStep", + "description": [], + "path": "src/plugins/guided_onboarding/common/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.GuideStep.id", + "type": "CompoundType", + "tags": [], + "label": "id", + "description": [], + "signature": [ + "\"add_data\" | \"view_dashboard\" | \"tour_observability\" | \"rules\" | \"alerts\" | \"cases\" | \"browse_docs\" | \"search_experience\"" + ], + "path": "src/plugins/guided_onboarding/common/types.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.GuideStep.status", + "type": "CompoundType", "tags": [], - "label": "activeStep", + "label": "status", "description": [], - "path": "src/plugins/guided_onboarding/public/types.ts", + "signature": [ + "\"complete\" | \"in_progress\" | \"inactive\" | \"active\"" + ], + "path": "src/plugins/guided_onboarding/common/types.ts", "deprecated": false, "trackAdoption": false } @@ -55,21 +122,93 @@ "misc": [ { "parentPluginId": "guidedOnboarding", - "id": "def-public.UseCase", + "id": "def-public.GuideId", "type": "Type", "tags": [], - "label": "UseCase", + "label": "GuideId", "description": [], "signature": [ "\"search\" | \"security\" | \"observability\"" ], - "path": "src/plugins/guided_onboarding/public/types.ts", + "path": "src/plugins/guided_onboarding/common/types.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.GuideStepIds", + "type": "Type", + "tags": [], + "label": "GuideStepIds", + "description": [], + "signature": [ + "\"add_data\" | \"view_dashboard\" | \"tour_observability\" | \"rules\" | \"alerts\" | \"cases\" | \"browse_docs\" | \"search_experience\"" + ], + "path": "src/plugins/guided_onboarding/common/types.ts", "deprecated": false, "trackAdoption": false, "initialIsOpen": false } ], - "objects": [], + "objects": [ + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.guidesConfig", + "type": "Object", + "tags": [], + "label": "guidesConfig", + "description": [], + "path": "src/plugins/guided_onboarding/public/constants/guides_config/index.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.guidesConfig.security", + "type": "Object", + "tags": [], + "label": "security", + "description": [], + "signature": [ + "GuideConfig" + ], + "path": "src/plugins/guided_onboarding/public/constants/guides_config/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.guidesConfig.observability", + "type": "Object", + "tags": [], + "label": "observability", + "description": [], + "signature": [ + "GuideConfig" + ], + "path": "src/plugins/guided_onboarding/public/constants/guides_config/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "guidedOnboarding", + "id": "def-public.guidesConfig.search", + "type": "Object", + "tags": [], + "label": "search", + "description": [], + "signature": [ + "GuideConfig" + ], + "path": "src/plugins/guided_onboarding/public/constants/guides_config/index.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + } + ], "setup": { "parentPluginId": "guidedOnboarding", "id": "def-public.GuidedOnboardingPluginSetup", @@ -156,53 +295,7 @@ "functions": [], "interfaces": [], "enums": [], - "misc": [ - { - "parentPluginId": "guidedOnboarding", - "id": "def-common.API_BASE_PATH", - "type": "string", - "tags": [], - "label": "API_BASE_PATH", - "description": [], - "signature": [ - "\"/api/guided_onboarding\"" - ], - "path": "src/plugins/guided_onboarding/common/index.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "guidedOnboarding", - "id": "def-common.PLUGIN_ID", - "type": "string", - "tags": [], - "label": "PLUGIN_ID", - "description": [], - "signature": [ - "\"guidedOnboarding\"" - ], - "path": "src/plugins/guided_onboarding/common/index.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - }, - { - "parentPluginId": "guidedOnboarding", - "id": "def-common.PLUGIN_NAME", - "type": "string", - "tags": [], - "label": "PLUGIN_NAME", - "description": [], - "signature": [ - "\"guidedOnboarding\"" - ], - "path": "src/plugins/guided_onboarding/common/index.ts", - "deprecated": false, - "trackAdoption": false, - "initialIsOpen": false - } - ], + "misc": [], "objects": [] } } \ No newline at end of file diff --git a/api_docs/guided_onboarding.mdx b/api_docs/guided_onboarding.mdx index c28c8b2fef872..9aa86b82df100 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'guidedOnboarding'] --- import guidedOnboardingObj from './guided_onboarding.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Journey Onboarding](https://github.com/orgs/elastic/teams/platform-onbo | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 12 | 0 | 12 | 1 | +| 19 | 0 | 19 | 3 | ## Client @@ -31,6 +31,9 @@ Contact [Journey Onboarding](https://github.com/orgs/elastic/teams/platform-onbo ### Start +### Objects + + ### Interfaces @@ -45,8 +48,3 @@ Contact [Journey Onboarding](https://github.com/orgs/elastic/teams/platform-onbo ### Start -## Common - -### Consts, variables and types - - diff --git a/api_docs/home.mdx b/api_docs/home.mdx index 8c285e037a355..4c129f6d92a48 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-28 +date: 2022-10-04 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 2d1523f302cb2..d6393f4b44397 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-28 +date: 2022-10-04 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 46b6303673ab9..b7f14de7ee103 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-28 +date: 2022-10-04 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 d86809062de00..ea6ecce3d4d9b 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-28 +date: 2022-10-04 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 0a75d4c550c42..c30aea80c5cb0 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-28 +date: 2022-10-04 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 1b2ce0d5a84c2..f4a2df60fa9ea 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-28 +date: 2022-10-04 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 3ca0d95b596d9..0dcbd76b6b451 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-28 +date: 2022-10-04 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 7e469da7a40b8..ac530589f0fb0 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-28 +date: 2022-10-04 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 9e1d8daed9b7c..c87bec0a9bb9d 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-28 +date: 2022-10-04 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 294c0b5ebb04b..eb196b2621aed 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-28 +date: 2022-10-04 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 e991378eefb61..bc4a0560544de 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-28 +date: 2022-10-04 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 61ec0f495851f..a86d78bf6e573 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-28 +date: 2022-10-04 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 af69ccaa66458..42bf70404bb69 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-28 +date: 2022-10-04 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 c80fb067196d2..a3faccdf22fce 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-28 +date: 2022-10-04 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 c8fd4ef979406..263d6af109410 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-28 +date: 2022-10-04 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 102c627e9ef5e..1f272ffdf3eca 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-28 +date: 2022-10-04 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 88ae4fc21aca0..9137a34ac7cf5 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-28 +date: 2022-10-04 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 951b6896fa528..69b4ee9c3bd01 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-28 +date: 2022-10-04 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 a679b1a252dad..e8948c5151a3e 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-28 +date: 2022-10-04 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 c330c66a3b511..1660f71a7d421 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-28 +date: 2022-10-04 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 4cf5662b020cc..548fc0c4f7426 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-28 +date: 2022-10-04 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 4396f3ffe02e1..b57e2abe5c1d7 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-28 +date: 2022-10-04 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 1857d82ee013a..f8182e50d0e14 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-28 +date: 2022-10-04 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.devdocs.json b/api_docs/kbn_ci_stats_reporter.devdocs.json index f831ac502a939..18389c93d07ca 100644 --- a/api_docs/kbn_ci_stats_reporter.devdocs.json +++ b/api_docs/kbn_ci_stats_reporter.devdocs.json @@ -654,7 +654,7 @@ "\nOverall result of this test group" ], "signature": [ - "\"fail\" | \"pass\" | \"skip\"" + "\"skip\" | \"fail\" | \"pass\"" ], "path": "packages/kbn-ci-stats-reporter/src/ci_stats_test_group_types.ts", "deprecated": false, @@ -755,7 +755,7 @@ "\n\"fail\", \"pass\" or \"skip\", the result of the tests" ], "signature": [ - "\"fail\" | \"pass\" | \"skip\"" + "\"skip\" | \"fail\" | \"pass\"" ], "path": "packages/kbn-ci-stats-reporter/src/ci_stats_test_group_types.ts", "deprecated": false, @@ -1041,7 +1041,7 @@ "label": "CiStatsTestResult", "description": [], "signature": [ - "\"fail\" | \"pass\" | \"skip\"" + "\"skip\" | \"fail\" | \"pass\"" ], "path": "packages/kbn-ci-stats-reporter/src/ci_stats_test_group_types.ts", "deprecated": false, diff --git a/api_docs/kbn_ci_stats_reporter.mdx b/api_docs/kbn_ci_stats_reporter.mdx index f3779a0488fb4..87058eea7d0c7 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-28 +date: 2022-10-04 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 e2d60d46020af..399bb2c474d90 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-28 +date: 2022-10-04 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 e0475bc85ecd2..d3a842a24ce84 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-28 +date: 2022-10-04 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 32514d096d20f..8a6f64ea706cc 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-28 +date: 2022-10-04 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 b93c70c8a0eb5..175a3130aaf9c 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-28 +date: 2022-10-04 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 78d758c0f2fe3..d369d314f87e1 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-28 +date: 2022-10-04 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 812ca543dea50..9dba4bbf3a309 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-28 +date: 2022-10-04 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 c29081c8b626d..3220f4f43ec66 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-28 +date: 2022-10-04 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 739c7e7af5969..bc77e3013d70c 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-28 +date: 2022-10-04 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 2c0999666ff1f..fe9a5a7a8033b 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-28 +date: 2022-10-04 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 f58a16ef732ad..8ba5c5458189a 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-28 +date: 2022-10-04 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 ced023377219a..b32913e076b17 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-28 +date: 2022-10-04 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 cbea4bff1bf86..ad1626e300d32 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-28 +date: 2022-10-04 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 b1580098a3652..cb8729ded12a4 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-28 +date: 2022-10-04 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 f704df4a7f345..01f8418de314e 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-28 +date: 2022-10-04 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 4767d8fa50538..8325f55e3db44 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-28 +date: 2022-10-04 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 7c6ce13416170..bcd417fbc9ede 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-28 +date: 2022-10-04 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 17402d105d5b5..507b0ccfcab40 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-28 +date: 2022-10-04 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 48cb4145874c7..0a3625bef9425 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-28 +date: 2022-10-04 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 28228f4c74761..178a8ff27c8eb 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-28 +date: 2022-10-04 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 09afb9dd896c7..e634f6c30bfca 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-28 +date: 2022-10-04 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 bf845366f8e62..1c4445244f836 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-28 +date: 2022-10-04 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 bf1d2e6b25458..84bb74021f2bd 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-28 +date: 2022-10-04 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 a2eb49783d4be..52fe8e2820310 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-28 +date: 2022-10-04 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 aa1d950326fc9..f2e9fe632436f 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-28 +date: 2022-10-04 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 3d8690f8d6f7d..b2f4b911b54fc 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-28 +date: 2022-10-04 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 78563e898c03a..dd0bc1fd746ea 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-28 +date: 2022-10-04 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 4b44cbfe07571..598dc54038877 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-28 +date: 2022-10-04 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 f8052fad772a5..a5854e8359bc1 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-28 +date: 2022-10-04 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 79da95fae9e67..b189b4cda1ce5 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-28 +date: 2022-10-04 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 ad16ad6aea2e6..89d13dd6c05e3 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-28 +date: 2022-10-04 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 7fe5dba92aa5c..0ca986ec796b5 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-28 +date: 2022-10-04 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 2547deec251f6..54f912532a0f0 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-28 +date: 2022-10-04 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 d96ff821c4365..41e3c5f4eb0d8 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-28 +date: 2022-10-04 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 74dee4cd3fdcc..0511dc3c9909f 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-28 +date: 2022-10-04 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 da6a21361ea25..451bb29fe60c8 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-28 +date: 2022-10-04 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 617a402d35fcc..9d72c4c54543e 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-28 +date: 2022-10-04 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 1217a7b8fa20d..9640ef186485d 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-28 +date: 2022-10-04 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 0ccaad98b392b..f5bb1f42b22ab 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-28 +date: 2022-10-04 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 14eccd7c10c34..efae931fc186b 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-28 +date: 2022-10-04 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 f5f017918ee4a..2af154133867a 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-28 +date: 2022-10-04 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 477917148b690..1454820b8fa46 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-28 +date: 2022-10-04 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 399790680e068..1385f7dc0e1f4 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-28 +date: 2022-10-04 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 318e2f19b36d7..1deae83f65870 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-28 +date: 2022-10-04 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 b4e402b1d85a7..15117157d71df 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-28 +date: 2022-10-04 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 1263eb43812bf..493f5c036f9a1 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-28 +date: 2022-10-04 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 efd3c4dce7d8e..9910a744c62da 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-28 +date: 2022-10-04 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 4b8b92e29d47e..b9c83fd476328 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-28 +date: 2022-10-04 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 12f2b1b89aaa5..e152e5bb83a2f 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-28 +date: 2022-10-04 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 22703ff1d56c5..9392cffe6209d 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-28 +date: 2022-10-04 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 58d7084730b09..3e511fafa9451 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-28 +date: 2022-10-04 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 9f241f79f3092..ec1debc1c012a 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-28 +date: 2022-10-04 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 2d3ce9691dbc3..eed2089898a81 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-28 +date: 2022-10-04 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 db3e364e96ff7..87ae45af703ac 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-28 +date: 2022-10-04 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 cbeb87f2524be..b77bce9a27dbf 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-28 +date: 2022-10-04 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 e838dfc832fd6..bfc781548810f 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-28 +date: 2022-10-04 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 6bdcb4cd9e37a..6f305680273e2 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-28 +date: 2022-10-04 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 afb5974de9a1d..22b6b9c666339 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-28 +date: 2022-10-04 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 8e28ebbe2ff12..579277f0e7c5b 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-28 +date: 2022-10-04 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 463b56f364292..45b83d9e361cd 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-28 +date: 2022-10-04 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 bf4cf64d7a58a..b063b1ec8777e 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-28 +date: 2022-10-04 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 4047f8a6f4847..e42402eeb736e 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-28 +date: 2022-10-04 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.devdocs.json b/api_docs/kbn_core_http_request_handler_context_server.devdocs.json new file mode 100644 index 0000000000000..ebf6567c0a8b4 --- /dev/null +++ b/api_docs/kbn_core_http_request_handler_context_server.devdocs.json @@ -0,0 +1,283 @@ +{ + "id": "@kbn/core-http-request-handler-context-server", + "client": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + }, + "server": { + "classes": [], + "functions": [], + "interfaces": [ + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.CoreRequestHandlerContext", + "type": "Interface", + "tags": [], + "label": "CoreRequestHandlerContext", + "description": [ + "\nThe `core` context provided to route handler.\n\nProvides the following clients and services:\n - {@link SavedObjectsClient | savedObjects.client} - Saved Objects client\n which uses the credentials of the incoming request\n - {@link ISavedObjectTypeRegistry | savedObjects.typeRegistry} - Type registry containing\n all the registered types.\n - {@link IScopedClusterClient | elasticsearch.client} - Elasticsearch\n data client which uses the credentials of the incoming request\n - {@link IUiSettingsClient | uiSettings.client} - uiSettings client\n which uses the credentials of the incoming request" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/request_handler_context.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.CoreRequestHandlerContext.savedObjects", + "type": "Object", + "tags": [], + "label": "savedObjects", + "description": [], + "signature": [ + "SavedObjectsRequestHandlerContext" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/request_handler_context.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.CoreRequestHandlerContext.elasticsearch", + "type": "Object", + "tags": [], + "label": "elasticsearch", + "description": [], + "signature": [ + "ElasticsearchRequestHandlerContext" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/request_handler_context.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.CoreRequestHandlerContext.uiSettings", + "type": "Object", + "tags": [], + "label": "uiSettings", + "description": [], + "signature": [ + "UiSettingsRequestHandlerContext" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/request_handler_context.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.CoreRequestHandlerContext.deprecations", + "type": "Object", + "tags": [], + "label": "deprecations", + "description": [], + "signature": [ + "DeprecationsRequestHandlerContext" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/request_handler_context.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.PrebootCoreRequestHandlerContext", + "type": "Interface", + "tags": [], + "label": "PrebootCoreRequestHandlerContext", + "description": [], + "path": "packages/core/http/core-http-request-handler-context-server/src/preboot_request_handler_context.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.PrebootCoreRequestHandlerContext.uiSettings", + "type": "Object", + "tags": [], + "label": "uiSettings", + "description": [], + "signature": [ + { + "pluginId": "@kbn/core-http-request-handler-context-server", + "scope": "server", + "docId": "kibKbnCoreHttpRequestHandlerContextServerPluginApi", + "section": "def-server.PrebootUiSettingsRequestHandlerContext", + "text": "PrebootUiSettingsRequestHandlerContext" + } + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/preboot_request_handler_context.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.PrebootRequestHandlerContext", + "type": "Interface", + "tags": [], + "label": "PrebootRequestHandlerContext", + "description": [], + "signature": [ + { + "pluginId": "@kbn/core-http-request-handler-context-server", + "scope": "server", + "docId": "kibKbnCoreHttpRequestHandlerContextServerPluginApi", + "section": "def-server.PrebootRequestHandlerContext", + "text": "PrebootRequestHandlerContext" + }, + " extends ", + "RequestHandlerContextBase" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/preboot_request_handler_context.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.PrebootRequestHandlerContext.core", + "type": "Object", + "tags": [], + "label": "core", + "description": [], + "signature": [ + "Promise<", + { + "pluginId": "@kbn/core-http-request-handler-context-server", + "scope": "server", + "docId": "kibKbnCoreHttpRequestHandlerContextServerPluginApi", + "section": "def-server.PrebootCoreRequestHandlerContext", + "text": "PrebootCoreRequestHandlerContext" + }, + ">" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/preboot_request_handler_context.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.PrebootUiSettingsRequestHandlerContext", + "type": "Interface", + "tags": [], + "label": "PrebootUiSettingsRequestHandlerContext", + "description": [], + "path": "packages/core/http/core-http-request-handler-context-server/src/preboot_request_handler_context.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.PrebootUiSettingsRequestHandlerContext.client", + "type": "Object", + "tags": [], + "label": "client", + "description": [], + "signature": [ + "IUiSettingsClient" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/preboot_request_handler_context.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.RequestHandlerContext", + "type": "Interface", + "tags": [], + "label": "RequestHandlerContext", + "description": [ + "\nBase context passed to a route handler, containing the `core` context part.\n" + ], + "signature": [ + { + "pluginId": "@kbn/core-http-request-handler-context-server", + "scope": "server", + "docId": "kibKbnCoreHttpRequestHandlerContextServerPluginApi", + "section": "def-server.RequestHandlerContext", + "text": "RequestHandlerContext" + }, + " extends ", + "RequestHandlerContextBase" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/request_handler_context.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.RequestHandlerContext.core", + "type": "Object", + "tags": [], + "label": "core", + "description": [], + "signature": [ + "Promise<", + { + "pluginId": "@kbn/core-http-request-handler-context-server", + "scope": "server", + "docId": "kibKbnCoreHttpRequestHandlerContextServerPluginApi", + "section": "def-server.CoreRequestHandlerContext", + "text": "CoreRequestHandlerContext" + }, + ">" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/request_handler_context.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + } + ], + "enums": [], + "misc": [ + { + "parentPluginId": "@kbn/core-http-request-handler-context-server", + "id": "def-server.CustomRequestHandlerContext", + "type": "Type", + "tags": [], + "label": "CustomRequestHandlerContext", + "description": [ + "\nMixin allowing plugins to define their own request handler contexts.\n" + ], + "signature": [ + { + "pluginId": "@kbn/core-http-request-handler-context-server", + "scope": "server", + "docId": "kibKbnCoreHttpRequestHandlerContextServerPluginApi", + "section": "def-server.RequestHandlerContext", + "text": "RequestHandlerContext" + }, + " & { [Key in keyof T]: T[Key] extends Promise ? T[Key] : Promise; }" + ], + "path": "packages/core/http/core-http-request-handler-context-server/src/request_handler_context.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + } + ], + "objects": [] + }, + "common": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + } +} \ No newline at end of file diff --git a/api_docs/kbn_core_http_request_handler_context_server.mdx b/api_docs/kbn_core_http_request_handler_context_server.mdx new file mode 100644 index 0000000000000..d636450713c72 --- /dev/null +++ b/api_docs/kbn_core_http_request_handler_context_server.mdx @@ -0,0 +1,33 @@ +--- +#### +#### This document is auto-generated and is meant to be viewed inside our experimental, new docs system. +#### Reach out in #docs-engineering for more info. +#### +id: kibKbnCoreHttpRequestHandlerContextServerPluginApi +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-10-04 +tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-http-request-handler-context-server'] +--- +import kbnCoreHttpRequestHandlerContextServerObj from './kbn_core_http_request_handler_context_server.devdocs.json'; + + + +Contact Kibana Core for questions regarding this plugin. + +**Code health stats** + +| Public API count | Any count | Items lacking comments | Missing exports | +|-------------------|-----------|------------------------|-----------------| +| 14 | 0 | 11 | 0 | + +## Server + +### Interfaces + + +### Consts, variables and types + + diff --git a/api_docs/kbn_core_http_router_server_internal.mdx b/api_docs/kbn_core_http_router_server_internal.mdx index 650426f493570..5691276cc4c86 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-28 +date: 2022-10-04 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 0df0a232ed7e3..5d087fbc12590 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-28 +date: 2022-10-04 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 404f13d3ca12a..87f06ed8d63e4 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-28 +date: 2022-10-04 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 524b236008cfb..266b3696995f8 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-28 +date: 2022-10-04 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 94a0469ff1071..c2e9cef4a3f10 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-28 +date: 2022-10-04 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 aac9e17df421b..23d1612d624c8 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-28 +date: 2022-10-04 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 e83f6e8553d82..2809246ccc670 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-28 +date: 2022-10-04 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 a89d07338f781..d8a8f0c780f5b 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-28 +date: 2022-10-04 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 3575cc0d18a98..34bcc3c6cdcfb 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-28 +date: 2022-10-04 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 ce24eb49860c5..0616e05e00234 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-28 +date: 2022-10-04 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 92e9d0e07cfe5..d494ce28acb14 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-28 +date: 2022-10-04 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 17e4abfa2a1aa..30217e2fc3ff4 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-28 +date: 2022-10-04 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 d8c9f151e2f4f..5e7ba108a654c 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-28 +date: 2022-10-04 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 574ff5014691b..a6e9fb32a00b7 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-28 +date: 2022-10-04 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 62c8d4f2358e5..531b5b53a8295 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-28 +date: 2022-10-04 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 8deee157e3d42..2e32f2efcec21 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-28 +date: 2022-10-04 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 cf1126fe73e2a..15c79e1a0db38 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-28 +date: 2022-10-04 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 bc4d09292edbf..cd7319b284fb7 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-28 +date: 2022-10-04 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 485e124d97e42..93667b80ba7f8 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-28 +date: 2022-10-04 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 4b17dbaac8c84..649123ca8c6a9 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-28 +date: 2022-10-04 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 36c1e8c0f9a42..21c886d8ce972 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-28 +date: 2022-10-04 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 a1a8ce47aed54..a3b481458c975 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-28 +date: 2022-10-04 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 6b4a55f82676d..b78cf2f752e5e 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-28 +date: 2022-10-04 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 d1494db236370..bcb29c53743cb 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-28 +date: 2022-10-04 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 ad35d06977cc0..530ca8138c755 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-28 +date: 2022-10-04 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 5b5b8a9421411..0c5982822b6bd 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-28 +date: 2022-10-04 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 bf95da355c9e9..ce0799c8a57e1 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-28 +date: 2022-10-04 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 3a07f7a676064..ff9aa9bab3b16 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-28 +date: 2022-10-04 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 130bddee31d14..45e5581a7df10 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-28 +date: 2022-10-04 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 fef5e6c2f9a85..4b5730a85899c 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-28 +date: 2022-10-04 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 724251e5e502f..e0dc054651702 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-28 +date: 2022-10-04 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 3837e623f29c4..b8f43851ff074 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-28 +date: 2022-10-04 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 0f7f597d06d38..3f88938a7d71c 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-28 +date: 2022-10-04 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 42846c64f33d6..c0846ed65f58f 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-28 +date: 2022-10-04 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 a52c3697e57dd..70c9fbee9c49a 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-28 +date: 2022-10-04 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 238252f104b3c..4ebd8410d827d 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-28 +date: 2022-10-04 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 d5b97eb1a0cbb..96f2610b0eb18 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-28 +date: 2022-10-04 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 20a753b66ea99..876c2f5e25d90 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-28 +date: 2022-10-04 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 c074d0f80cb88..31744f9615bb9 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-28 +date: 2022-10-04 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_rendering_server_internal.devdocs.json b/api_docs/kbn_core_rendering_server_internal.devdocs.json new file mode 100644 index 0000000000000..d765832debee1 --- /dev/null +++ b/api_docs/kbn_core_rendering_server_internal.devdocs.json @@ -0,0 +1,61 @@ +{ + "id": "@kbn/core-rendering-server-internal", + "client": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + }, + "server": { + "classes": [], + "functions": [ + { + "parentPluginId": "@kbn/core-rendering-server-internal", + "id": "def-server.Fonts", + "type": "Function", + "tags": [], + "label": "Fonts", + "description": [], + "signature": [ + "({ url }: React.PropsWithChildren) => JSX.Element" + ], + "path": "packages/core/rendering/core-rendering-server-internal/src/views/fonts.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/core-rendering-server-internal", + "id": "def-server.Fonts.$1", + "type": "CompoundType", + "tags": [], + "label": "{ url }", + "description": [], + "signature": [ + "React.PropsWithChildren" + ], + "path": "packages/core/rendering/core-rendering-server-internal/src/views/fonts.tsx", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + } + ], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + }, + "common": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + } +} \ No newline at end of file diff --git a/api_docs/kbn_core_rendering_server_internal.mdx b/api_docs/kbn_core_rendering_server_internal.mdx new file mode 100644 index 0000000000000..000dd0d4cedb8 --- /dev/null +++ b/api_docs/kbn_core_rendering_server_internal.mdx @@ -0,0 +1,30 @@ +--- +#### +#### This document is auto-generated and is meant to be viewed inside our experimental, new docs system. +#### Reach out in #docs-engineering for more info. +#### +id: kibKbnCoreRenderingServerInternalPluginApi +slug: /kibana-dev-docs/api/kbn-core-rendering-server-internal +title: "@kbn/core-rendering-server-internal" +image: https://source.unsplash.com/400x175/?github +description: API docs for the @kbn/core-rendering-server-internal plugin +date: 2022-10-04 +tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-rendering-server-internal'] +--- +import kbnCoreRenderingServerInternalObj from './kbn_core_rendering_server_internal.devdocs.json'; + + + +Contact Kibana Core for questions regarding this plugin. + +**Code health stats** + +| Public API count | Any count | Items lacking comments | Missing exports | +|-------------------|-----------|------------------------|-----------------| +| 2 | 0 | 2 | 0 | + +## Server + +### Functions + + diff --git a/api_docs/kbn_core_rendering_server_mocks.devdocs.json b/api_docs/kbn_core_rendering_server_mocks.devdocs.json new file mode 100644 index 0000000000000..fc43829e9518e --- /dev/null +++ b/api_docs/kbn_core_rendering_server_mocks.devdocs.json @@ -0,0 +1,95 @@ +{ + "id": "@kbn/core-rendering-server-mocks", + "client": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + }, + "server": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [ + { + "parentPluginId": "@kbn/core-rendering-server-mocks", + "id": "def-server.renderingServiceMock", + "type": "Object", + "tags": [], + "label": "renderingServiceMock", + "description": [], + "path": "packages/core/rendering/core-rendering-server-mocks/src/rendering_service.mock.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/core-rendering-server-mocks", + "id": "def-server.renderingServiceMock.create", + "type": "Function", + "tags": [], + "label": "create", + "description": [], + "signature": [ + "() => ", + "RenderingServiceMock" + ], + "path": "packages/core/rendering/core-rendering-server-mocks/src/rendering_service.mock.ts", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [] + }, + { + "parentPluginId": "@kbn/core-rendering-server-mocks", + "id": "def-server.renderingServiceMock.createPrebootContract", + "type": "Function", + "tags": [], + "label": "createPrebootContract", + "description": [], + "signature": [ + "() => jest.Mocked<", + "InternalRenderingServiceSetup", + ">" + ], + "path": "packages/core/rendering/core-rendering-server-mocks/src/rendering_service.mock.ts", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [] + }, + { + "parentPluginId": "@kbn/core-rendering-server-mocks", + "id": "def-server.renderingServiceMock.createSetupContract", + "type": "Function", + "tags": [], + "label": "createSetupContract", + "description": [], + "signature": [ + "() => jest.Mocked<", + "InternalRenderingServiceSetup", + ">" + ], + "path": "packages/core/rendering/core-rendering-server-mocks/src/rendering_service.mock.ts", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [] + } + ], + "initialIsOpen": false + } + ] + }, + "common": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + } +} \ No newline at end of file diff --git a/api_docs/kbn_core_rendering_server_mocks.mdx b/api_docs/kbn_core_rendering_server_mocks.mdx new file mode 100644 index 0000000000000..7de298d846759 --- /dev/null +++ b/api_docs/kbn_core_rendering_server_mocks.mdx @@ -0,0 +1,30 @@ +--- +#### +#### This document is auto-generated and is meant to be viewed inside our experimental, new docs system. +#### Reach out in #docs-engineering for more info. +#### +id: kibKbnCoreRenderingServerMocksPluginApi +slug: /kibana-dev-docs/api/kbn-core-rendering-server-mocks +title: "@kbn/core-rendering-server-mocks" +image: https://source.unsplash.com/400x175/?github +description: API docs for the @kbn/core-rendering-server-mocks plugin +date: 2022-10-04 +tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/core-rendering-server-mocks'] +--- +import kbnCoreRenderingServerMocksObj from './kbn_core_rendering_server_mocks.devdocs.json'; + + + +Contact Kibana Core for questions regarding this plugin. + +**Code health stats** + +| Public API count | Any count | Items lacking comments | Missing exports | +|-------------------|-----------|------------------------|-----------------| +| 4 | 0 | 4 | 1 | + +## Server + +### Objects + + diff --git a/api_docs/kbn_core_saved_objects_api_browser.devdocs.json b/api_docs/kbn_core_saved_objects_api_browser.devdocs.json index b12a698b21606..bc6024dea788e 100644 --- a/api_docs/kbn_core_saved_objects_api_browser.devdocs.json +++ b/api_docs/kbn_core_saved_objects_api_browser.devdocs.json @@ -76,7 +76,7 @@ "\nThe outcome for a successful `resolve` call is one of the following values:\n\n * `'exactMatch'` -- One document exactly matched the given ID.\n * `'aliasMatch'` -- One document with a legacy URL alias matched the given ID; in this case the `saved_object.id` field is different\n than the given ID.\n * `'conflict'` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the\n `saved_object` object is the exact match, and the `saved_object.id` field is the same as the given ID." ], "signature": [ - "\"exactMatch\" | \"aliasMatch\" | \"conflict\"" + "\"conflict\" | \"exactMatch\" | \"aliasMatch\"" ], "path": "packages/core/saved-objects/core-saved-objects-api-browser/src/apis/resolve.ts", "deprecated": false, @@ -1974,9 +1974,9 @@ "label": "SavedObjectsFindOptions", "description": [], "signature": [ - "{ type: string | string[]; filter?: any; search?: string | undefined; aggs?: Record | undefined; fields?: string[] | undefined; page?: number | undefined; perPage?: number | undefined; sortField?: string | undefined; searchFields?: string[] | undefined; hasReference?: ", + "> | undefined; page?: number | undefined; perPage?: number | undefined; sortField?: string | undefined; searchFields?: string[] | undefined; hasReference?: ", "SavedObjectsFindOptionsReference", " | ", "SavedObjectsFindOptionsReference", diff --git a/api_docs/kbn_core_saved_objects_api_browser.mdx b/api_docs/kbn_core_saved_objects_api_browser.mdx index 949af62592ecb..51698a7096343 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-28 +date: 2022-10-04 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.devdocs.json b/api_docs/kbn_core_saved_objects_api_server.devdocs.json index 0e040b72d2d3d..1bff25681bdbf 100644 --- a/api_docs/kbn_core_saved_objects_api_server.devdocs.json +++ b/api_docs/kbn_core_saved_objects_api_server.devdocs.json @@ -5949,7 +5949,7 @@ "\nThe outcome for a successful `resolve` call is one of the following values:\n\n * `'exactMatch'` -- One document exactly matched the given ID.\n * `'aliasMatch'` -- One document with a legacy URL alias matched the given ID; in this case the `saved_object.id` field is different\n than the given ID.\n * `'conflict'` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the\n `saved_object` object is the exact match, and the `saved_object.id` field is the same as the given ID." ], "signature": [ - "\"exactMatch\" | \"aliasMatch\" | \"conflict\"" + "\"conflict\" | \"exactMatch\" | \"aliasMatch\"" ], "path": "packages/core/saved-objects/core-saved-objects-api-server/src/apis/resolve.ts", "deprecated": false, @@ -6427,9 +6427,9 @@ "label": "SavedObjectsCreatePointInTimeFinderOptions", "description": [], "signature": [ - "{ type: string | string[]; filter?: any; search?: string | undefined; aggs?: Record | undefined; fields?: string[] | undefined; perPage?: number | undefined; sortField?: string | undefined; sortOrder?: ", + "> | undefined; perPage?: number | undefined; sortField?: string | undefined; sortOrder?: ", "SortOrder", " | undefined; searchFields?: string[] | undefined; rootSearchFields?: string[] | undefined; hasReference?: ", { diff --git a/api_docs/kbn_core_saved_objects_api_server.mdx b/api_docs/kbn_core_saved_objects_api_server.mdx index 6fa09c36e31f1..c8639a4b9c453 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-28 +date: 2022-10-04 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 7c588cdc511e2..f14120830006f 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-28 +date: 2022-10-04 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 447e323f6f6c3..6b0c824029fc3 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-28 +date: 2022-10-04 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 9931b55fa4f21..9e232227f556c 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-28 +date: 2022-10-04 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 deb24928a107a..66a94ba868430 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-28 +date: 2022-10-04 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 3bfa422bdff98..eb654c74cca2e 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-28 +date: 2022-10-04 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 1a306a18a3eb1..f077ed64b63e2 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-28 +date: 2022-10-04 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 a34e632cf249f..29da15ed698f8 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-28 +date: 2022-10-04 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 59d4d1841c7fa..ac4e60624dcb7 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-28 +date: 2022-10-04 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 f0610e31ec803..bebe1281e0ade 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-28 +date: 2022-10-04 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 cd9ba3c71908b..4b0e97d192ea3 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-28 +date: 2022-10-04 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 f2dd4437d43e1..aed14d7466d26 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-28 +date: 2022-10-04 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 88c329e9ae344..8d8eb4b06ad7a 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-28 +date: 2022-10-04 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 df7eaa590f6db..2a8902a1e5184 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-28 +date: 2022-10-04 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 5534b4652be59..9bd945299b18d 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-28 +date: 2022-10-04 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 ccf532e33ba38..6a53d6086266f 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-28 +date: 2022-10-04 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 5b78e21ba58ce..3747e6c419527 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-28 +date: 2022-10-04 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 f4f9cc899056b..093798e431c32 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-28 +date: 2022-10-04 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 86d04a0b4ff7f..3232d2d6e8099 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-28 +date: 2022-10-04 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 52e756da1a554..6dc392f2f16c7 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-28 +date: 2022-10-04 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 432a7d95007ec..b2d57509addeb 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-28 +date: 2022-10-04 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 8ccca542c4b7d..d5e62a33ea077 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-28 +date: 2022-10-04 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 ab86530abfbbd..2341795744ee2 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-28 +date: 2022-10-04 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 9de9031c75db8..1bdb4be978f3b 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-28 +date: 2022-10-04 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 9c59e5a04b8e4..8c1171396e641 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-28 +date: 2022-10-04 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 02d479962f929..38293fb7bd7ed 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-28 +date: 2022-10-04 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 71eada8e5603f..f0b9a5dcf855d 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-28 +date: 2022-10-04 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 b8b744e259c54..b4a0a55091a4f 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-28 +date: 2022-10-04 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 a89cdf92e9ac2..09b0a2dc57320 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-28 +date: 2022-10-04 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 290774ac1f9eb..31d7e5da5da67 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-28 +date: 2022-10-04 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 004e652235478..5b6eb33ecc40a 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-28 +date: 2022-10-04 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 84190ae50348c..812a5a98b6200 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-28 +date: 2022-10-04 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 2f362f1ede3ff..b4098d7a68294 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-28 +date: 2022-10-04 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 e214233f02eb7..6350fd7ee5068 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-28 +date: 2022-10-04 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 b8ac7249cb2af..54fc17cd96f04 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-28 +date: 2022-10-04 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 4f5cca38779c3..7722ffd3f68a5 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-28 +date: 2022-10-04 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 bc10003b1203b..131c2f323331b 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-28 +date: 2022-10-04 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 d95c8ad7295ed..6ca5ba080918c 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-28 +date: 2022-10-04 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 06ce6dd999351..7da4515e5c5da 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-28 +date: 2022-10-04 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 4bcac88980eb1..c0ab47b943fe5 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-28 +date: 2022-10-04 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 42846a27d0d57..81afcdef5fadb 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-28 +date: 2022-10-04 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 5db4302dd4cd2..1e541a024defe 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-28 +date: 2022-10-04 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 968955efd32a8..c9e8aeb0cceea 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-28 +date: 2022-10-04 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 e047906625c28..83bf4e00c6541 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/dev-utils'] --- import kbnDevUtilsObj from './kbn_dev_utils.devdocs.json'; diff --git a/api_docs/kbn_doc_links.devdocs.json b/api_docs/kbn_doc_links.devdocs.json index d74d520ff8430..0cf3b152d8668 100644 --- a/api_docs/kbn_doc_links.devdocs.json +++ b/api_docs/kbn_doc_links.devdocs.json @@ -546,7 +546,7 @@ "label": "securitySolution", "description": [], "signature": [ - "{ readonly trustedApps: string; readonly eventFilters: string; readonly blocklist: string; readonly policyResponseTroubleshooting: { full_disk_access: string; macos_system_ext: string; linux_deadlock: string; }; readonly packageActionTroubleshooting: { es_connection: string; }; readonly threatIntelInt: string; readonly responseActions: string; }" + "{ readonly trustedApps: string; readonly eventFilters: string; readonly blocklist: string; readonly endpointArtifacts: string; readonly policyResponseTroubleshooting: { full_disk_access: string; macos_system_ext: string; linux_deadlock: string; }; readonly packageActionTroubleshooting: { es_connection: string; }; readonly threatIntelInt: string; readonly responseActions: string; }" ], "path": "packages/kbn-doc-links/src/types.ts", "deprecated": false, diff --git a/api_docs/kbn_doc_links.mdx b/api_docs/kbn_doc_links.mdx index c7d4d0fe3d260..f20c5c3e4621f 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-28 +date: 2022-10-04 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 30e9b543d9d8d..c92f20d4e82eb 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-28 +date: 2022-10-04 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 8590060b07965..f301c7fde5a81 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-28 +date: 2022-10-04 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 1e69af86cfda4..1fd6cb7fc92bc 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-28 +date: 2022-10-04 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 695ed989dfe99..0c2ba2f9d4488 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-28 +date: 2022-10-04 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 b329278d82729..7b7bc93b57313 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-28 +date: 2022-10-04 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 9a2cfbe08a28b..fe461a5b010f5 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-28 +date: 2022-10-04 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 2e0b9742678dc..facb9ad743434 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-28 +date: 2022-10-04 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 0373e71bbf94c..af6a78abd324a 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-28 +date: 2022-10-04 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 f0a54f4a6740d..81929ed2bb345 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-28 +date: 2022-10-04 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 a2bfedd08171e..9c5b2b494ed5f 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-28 +date: 2022-10-04 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 2a9f62b4f3f36..cbe8ec573dfd5 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-28 +date: 2022-10-04 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 b1b28470de32e..0958cd3c3ebf7 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-28 +date: 2022-10-04 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 b675d4d8f4da0..2ec2679987952 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-28 +date: 2022-10-04 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 b7abe8b512959..7f42b8a468d7e 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-28 +date: 2022-10-04 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 e7a5d6fe0f7ec..d4e8d54488ba4 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-28 +date: 2022-10-04 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 f716a25e4408f..a0b43f842438b 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-28 +date: 2022-10-04 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 25ba31dee6a69..7b9d043059c71 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-28 +date: 2022-10-04 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 c36a372e85d74..d11c22a74ecda 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-28 +date: 2022-10-04 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 6051ff9b96e16..39f9d65660d07 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-28 +date: 2022-10-04 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 0554879f31ad2..19a46d0750ca6 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-28 +date: 2022-10-04 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 c005d1ea66f6e..7e5e0932af67d 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-28 +date: 2022-10-04 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 b2cd34e94a506..f4c9aec83599f 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-28 +date: 2022-10-04 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 1b91d601c2246..2ab7c2cad23dd 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-28 +date: 2022-10-04 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 13444331d9fcc..4c78e0d66ea73 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-28 +date: 2022-10-04 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 d6db9caa5dd01..5cc97dbc4f9de 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-28 +date: 2022-10-04 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 12ab660fc1764..110b3b19a0fa8 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-28 +date: 2022-10-04 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 a0fbd8c5ef3c9..11c646693dc0b 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-28 +date: 2022-10-04 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 6808dca6dbe35..ccb0243714c5a 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-28 +date: 2022-10-04 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 8da4778d8b81f..9e756982a3c4b 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-28 +date: 2022-10-04 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 e9cf6c1838c51..5a08b38fdc366 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-28 +date: 2022-10-04 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 4ec4c4ef7c9eb..13902cebdc873 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-28 +date: 2022-10-04 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 757c4018832a9..60b2e27c0fc5e 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-28 +date: 2022-10-04 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 11961ef3d602b..805c9413ad27f 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-28 +date: 2022-10-04 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 a980b80bd7a38..a2a0a87619793 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-28 +date: 2022-10-04 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 b1051ed927c86..66b4513e3e93d 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-28 +date: 2022-10-04 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 98d5196dc24f1..d0487d7546b1e 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-28 +date: 2022-10-04 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 a04f5630c37b4..fe379e3b837c0 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-28 +date: 2022-10-04 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 af33c58333e71..d1b5eb542c882 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-28 +date: 2022-10-04 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 2a373248eac93..6d2caad781235 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-28 +date: 2022-10-04 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.devdocs.json b/api_docs/kbn_rule_data_utils.devdocs.json index c30477647a1ce..8db17c376261c 100644 --- a/api_docs/kbn_rule_data_utils.devdocs.json +++ b/api_docs/kbn_rule_data_utils.devdocs.json @@ -912,7 +912,7 @@ "label": "AlertConsumers", "description": [], "signature": [ - "\"observability\" | \"logs\" | \"apm\" | \"uptime\" | \"siem\" | \"infrastructure\"" + "\"infrastructure\" | \"observability\" | \"logs\" | \"apm\" | \"uptime\" | \"siem\"" ], "path": "packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts", "deprecated": false, @@ -942,7 +942,7 @@ "label": "AlertStatus", "description": [], "signature": [ - "\"recovered\" | \"active\"" + "\"active\" | \"recovered\"" ], "path": "packages/kbn-rule-data-utils/src/alerts_as_data_status.ts", "deprecated": false, @@ -1077,7 +1077,7 @@ "label": "TechnicalRuleDataFieldName", "description": [], "signature": [ - "\"tags\" | \"kibana\" | \"@timestamp\" | \"event.action\" | \"kibana.alert.rule.parameters\" | \"kibana.alert.rule.rule_type_id\" | \"kibana.alert.rule.consumer\" | \"kibana.alert.rule.producer\" | \"kibana.space_ids\" | \"kibana.alert.uuid\" | \"kibana.alert.instance.id\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity\" | \"kibana.alert.status\" | \"kibana.version\" | \"ecs.version\" | \"kibana.alert.risk_score\" | \"kibana.alert.workflow_status\" | \"kibana.alert.workflow_user\" | \"kibana.alert.workflow_reason\" | \"kibana.alert.system_status\" | \"kibana.alert.action_group\" | \"kibana.alert.reason\" | \"kibana.alert.rule.author\" | \"kibana.alert.rule.category\" | \"kibana.alert.rule.uuid\" | \"kibana.alert.rule.created_at\" | \"kibana.alert.rule.created_by\" | \"kibana.alert.rule.description\" | \"kibana.alert.rule.enabled\" | \"kibana.alert.rule.execution.uuid\" | \"kibana.alert.rule.from\" | \"kibana.alert.rule.interval\" | \"kibana.alert.rule.license\" | \"kibana.alert.rule.name\" | \"kibana.alert.rule.note\" | \"kibana.alert.rule.references\" | \"kibana.alert.rule.rule_id\" | \"kibana.alert.rule.rule_name_override\" | \"kibana.alert.rule.tags\" | \"kibana.alert.rule.to\" | \"kibana.alert.rule.type\" | \"kibana.alert.rule.updated_at\" | \"kibana.alert.rule.updated_by\" | \"kibana.alert.rule.version\" | \"event.kind\" | \"event.module\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.building_block_type\" | \"kibana.alert.rule.exceptions_list\" | \"kibana.alert.rule.namespace\" | \"kibana.alert\" | \"kibana.alert.rule\"" + "\"tags\" | \"kibana\" | \"@timestamp\" | \"kibana.alert.rule.rule_type_id\" | \"kibana.alert.rule.consumer\" | \"event.action\" | \"kibana.alert.rule.execution.uuid\" | \"kibana.alert.rule.parameters\" | \"kibana.alert.rule.producer\" | \"kibana.space_ids\" | \"kibana.alert.uuid\" | \"kibana.alert.instance.id\" | \"kibana.alert.start\" | \"kibana.alert.end\" | \"kibana.alert.duration.us\" | \"kibana.alert.severity\" | \"kibana.alert.status\" | \"kibana.version\" | \"ecs.version\" | \"kibana.alert.risk_score\" | \"kibana.alert.workflow_status\" | \"kibana.alert.workflow_user\" | \"kibana.alert.workflow_reason\" | \"kibana.alert.system_status\" | \"kibana.alert.action_group\" | \"kibana.alert.reason\" | \"kibana.alert.rule.author\" | \"kibana.alert.rule.category\" | \"kibana.alert.rule.uuid\" | \"kibana.alert.rule.created_at\" | \"kibana.alert.rule.created_by\" | \"kibana.alert.rule.description\" | \"kibana.alert.rule.enabled\" | \"kibana.alert.rule.from\" | \"kibana.alert.rule.interval\" | \"kibana.alert.rule.license\" | \"kibana.alert.rule.name\" | \"kibana.alert.rule.note\" | \"kibana.alert.rule.references\" | \"kibana.alert.rule.rule_id\" | \"kibana.alert.rule.rule_name_override\" | \"kibana.alert.rule.tags\" | \"kibana.alert.rule.to\" | \"kibana.alert.rule.type\" | \"kibana.alert.rule.updated_at\" | \"kibana.alert.rule.updated_by\" | \"kibana.alert.rule.version\" | \"event.kind\" | \"event.module\" | \"kibana.alert.evaluation.threshold\" | \"kibana.alert.evaluation.value\" | \"kibana.alert.building_block_type\" | \"kibana.alert.rule.exceptions_list\" | \"kibana.alert.rule.namespace\" | \"kibana.alert\" | \"kibana.alert.rule\"" ], "path": "packages/kbn-rule-data-utils/src/technical_field_names.ts", "deprecated": false, @@ -1107,7 +1107,7 @@ "label": "ValidFeatureId", "description": [], "signature": [ - "\"observability\" | \"logs\" | \"apm\" | \"uptime\" | \"siem\" | \"infrastructure\"" + "\"infrastructure\" | \"observability\" | \"logs\" | \"apm\" | \"uptime\" | \"siem\"" ], "path": "packages/kbn-rule-data-utils/src/alerts_as_data_rbac.ts", "deprecated": false, diff --git a/api_docs/kbn_rule_data_utils.mdx b/api_docs/kbn_rule_data_utils.mdx index 61d440950cbf3..2e861a2bd3a13 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-28 +date: 2022-10-04 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 4ca4605d2eb99..3d11d856ffe07 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-28 +date: 2022-10-04 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 99858a653681a..4ce360705125a 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-28 +date: 2022-10-04 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.devdocs.json b/api_docs/kbn_securitysolution_exception_list_components.devdocs.json new file mode 100644 index 0000000000000..97b711804af12 --- /dev/null +++ b/api_docs/kbn_securitysolution_exception_list_components.devdocs.json @@ -0,0 +1,1209 @@ +{ + "id": "@kbn/securitysolution-exception-list-components", + "client": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + }, + "server": { + "classes": [], + "functions": [], + "interfaces": [], + "enums": [], + "misc": [], + "objects": [] + }, + "common": { + "classes": [], + "functions": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.EmptyViewerState", + "type": "Function", + "tags": [], + "label": "EmptyViewerState", + "description": [], + "signature": [ + "React.NamedExoticComponent" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/empty_viewer_state.tsx", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.EmptyViewerState.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCard", + "type": "Function", + "tags": [], + "label": "ExceptionItemCard", + "description": [], + "signature": [ + "React.NamedExoticComponent<", + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.ExceptionItemProps", + "text": "ExceptionItemProps" + }, + ">" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCard.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardComments", + "type": "Function", + "tags": [], + "label": "ExceptionItemCardComments", + "description": [], + "signature": [ + "React.NamedExoticComponent<", + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.ExceptionItemCardCommentsProps", + "text": "ExceptionItemCardCommentsProps" + }, + ">" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.tsx", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardComments.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardConditions", + "type": "Function", + "tags": [], + "label": "ExceptionItemCardConditions", + "description": [], + "signature": [ + "React.NamedExoticComponent<", + "CriteriaConditionsProps", + ">" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.tsx", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardConditions.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardHeader", + "type": "Function", + "tags": [], + "label": "ExceptionItemCardHeader", + "description": [], + "signature": [ + "React.NamedExoticComponent<", + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.ExceptionItemCardHeaderProps", + "text": "ExceptionItemCardHeaderProps" + }, + ">" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.tsx", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardHeader.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardMetaInfo", + "type": "Function", + "tags": [], + "label": "ExceptionItemCardMetaInfo", + "description": [], + "signature": [ + "React.NamedExoticComponent<", + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.ExceptionItemCardMetaInfoProps", + "text": "ExceptionItemCardMetaInfoProps" + }, + ">" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardMetaInfo.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItems", + "type": "Function", + "tags": [], + "label": "ExceptionItems", + "description": [], + "signature": [ + "React.NamedExoticComponent" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_items/exception_items.tsx", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItems.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.Pagination", + "type": "Function", + "tags": [], + "label": "Pagination", + "description": [], + "signature": [ + "React.NamedExoticComponent<", + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.PaginationProps", + "text": "PaginationProps" + }, + ">" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.tsx", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.Pagination.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.SearchBar", + "type": "Function", + "tags": [], + "label": "SearchBar", + "description": [], + "signature": [ + "React.NamedExoticComponent" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/search_bar/search_bar.tsx", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.SearchBar.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ValueWithSpaceWarning", + "type": "Function", + "tags": [], + "label": "ValueWithSpaceWarning", + "description": [], + "signature": [ + "({ value, tooltipIconType, tooltipIconText, }: React.PropsWithChildren) => JSX.Element | null" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/value_with_space_warning.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ValueWithSpaceWarning.$1", + "type": "CompoundType", + "tags": [], + "label": "{\n value,\n tooltipIconType = 'iInCircle',\n tooltipIconText,\n}", + "description": [], + "signature": [ + "React.PropsWithChildren" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/value_with_space_warning.tsx", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + } + ], + "interfaces": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardCommentsProps", + "type": "Interface", + "tags": [], + "label": "ExceptionItemCardCommentsProps", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardCommentsProps.comments", + "type": "Array", + "tags": [], + "label": "comments", + "description": [], + "signature": [ + "EuiCommentProps", + "[]" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.tsx", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardHeaderProps", + "type": "Interface", + "tags": [], + "label": "ExceptionItemCardHeaderProps", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardHeaderProps.item", + "type": "Object", + "tags": [], + "label": "item", + "description": [], + "signature": [ + "{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"keyword\" | \"ip\" | \"text\" | \"geo_point\" | \"geo_shape\" | \"date_nanos\" | \"long\" | \"double\" | \"date_range\" | \"ip_range\" | \"shape\" | \"short\" | \"binary\" | \"float\" | \"half_float\" | \"integer\" | \"byte\" | \"long_range\" | \"integer_range\" | \"float_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; })[]; field: string; type: \"nested\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"wildcard\"; value: string; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardHeaderProps.actions", + "type": "Array", + "tags": [], + "label": "actions", + "description": [], + "signature": [ + "{ key: string; icon: string; label: string | boolean; onClick: () => void; }[]" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardHeaderProps.disableActions", + "type": "CompoundType", + "tags": [], + "label": "disableActions", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardHeaderProps.dataTestSubj", + "type": "string", + "tags": [], + "label": "dataTestSubj", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.tsx", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardMetaInfoProps", + "type": "Interface", + "tags": [], + "label": "ExceptionItemCardMetaInfoProps", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardMetaInfoProps.item", + "type": "Object", + "tags": [], + "label": "item", + "description": [], + "signature": [ + "{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"keyword\" | \"ip\" | \"text\" | \"geo_point\" | \"geo_shape\" | \"date_nanos\" | \"long\" | \"double\" | \"date_range\" | \"ip_range\" | \"shape\" | \"short\" | \"binary\" | \"float\" | \"half_float\" | \"integer\" | \"byte\" | \"long_range\" | \"integer_range\" | \"float_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; })[]; field: string; type: \"nested\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"wildcard\"; value: string; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardMetaInfoProps.references", + "type": "Array", + "tags": [], + "label": "references", + "description": [], + "signature": [ + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.RuleReference", + "text": "RuleReference" + }, + "[]" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardMetaInfoProps.dataTestSubj", + "type": "string", + "tags": [], + "label": "dataTestSubj", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardMetaInfoProps.formattedDateComponent", + "type": "CompoundType", + "tags": [], + "label": "formattedDateComponent", + "description": [], + "signature": [ + "\"symbol\" | \"object\" | React.ComponentType | \"body\" | \"path\" | \"circle\" | \"filter\" | \"data\" | \"line\" | \"area\" | \"time\" | \"label\" | \"legend\" | \"image\" | \"link\" | \"menu\" | \"stop\" | \"base\" | \"text\" | \"title\" | \"s\" | \"small\" | \"svg\" | \"meta\" | \"script\" | \"summary\" | \"source\" | \"desc\" | \"q\" | \"pattern\" | \"mask\" | \"input\" | \"slot\" | \"style\" | \"head\" | \"section\" | \"big\" | \"sub\" | \"sup\" | \"animate\" | \"progress\" | \"view\" | \"output\" | \"var\" | \"map\" | \"html\" | \"a\" | \"img\" | \"audio\" | \"form\" | \"main\" | \"abbr\" | \"address\" | \"article\" | \"aside\" | \"b\" | \"bdi\" | \"bdo\" | \"blockquote\" | \"br\" | \"button\" | \"canvas\" | \"caption\" | \"cite\" | \"code\" | \"col\" | \"colgroup\" | \"datalist\" | \"dd\" | \"del\" | \"details\" | \"dfn\" | \"dialog\" | \"div\" | \"dl\" | \"dt\" | \"em\" | \"embed\" | \"fieldset\" | \"figcaption\" | \"figure\" | \"footer\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"header\" | \"hgroup\" | \"hr\" | \"i\" | \"iframe\" | \"ins\" | \"kbd\" | \"keygen\" | \"li\" | \"mark\" | \"menuitem\" | \"meter\" | \"nav\" | \"noindex\" | \"noscript\" | \"ol\" | \"optgroup\" | \"option\" | \"p\" | \"param\" | \"picture\" | \"pre\" | \"rp\" | \"rt\" | \"ruby\" | \"samp\" | \"select\" | \"span\" | \"strong\" | \"table\" | \"template\" | \"tbody\" | \"td\" | \"textarea\" | \"tfoot\" | \"th\" | \"thead\" | \"tr\" | \"track\" | \"u\" | \"ul\" | \"video\" | \"wbr\" | \"webview\" | \"animateMotion\" | \"animateTransform\" | \"clipPath\" | \"defs\" | \"ellipse\" | \"feBlend\" | \"feColorMatrix\" | \"feComponentTransfer\" | \"feComposite\" | \"feConvolveMatrix\" | \"feDiffuseLighting\" | \"feDisplacementMap\" | \"feDistantLight\" | \"feDropShadow\" | \"feFlood\" | \"feFuncA\" | \"feFuncB\" | \"feFuncG\" | \"feFuncR\" | \"feGaussianBlur\" | \"feImage\" | \"feMerge\" | \"feMergeNode\" | \"feMorphology\" | \"feOffset\" | \"fePointLight\" | \"feSpecularLighting\" | \"feSpotLight\" | \"feTile\" | \"feTurbulence\" | \"foreignObject\" | \"g\" | \"linearGradient\" | \"marker\" | \"metadata\" | \"mpath\" | \"polygon\" | \"polyline\" | \"radialGradient\" | \"rect\" | \"switch\" | \"textPath\" | \"tspan\" | \"use\"" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemCardMetaInfoProps.securityLinkAnchorComponent", + "type": "CompoundType", + "tags": [], + "label": "securityLinkAnchorComponent", + "description": [], + "signature": [ + "\"symbol\" | \"object\" | React.ComponentType | \"body\" | \"path\" | \"circle\" | \"filter\" | \"data\" | \"line\" | \"area\" | \"time\" | \"label\" | \"legend\" | \"image\" | \"link\" | \"menu\" | \"stop\" | \"base\" | \"text\" | \"title\" | \"s\" | \"small\" | \"svg\" | \"meta\" | \"script\" | \"summary\" | \"source\" | \"desc\" | \"q\" | \"pattern\" | \"mask\" | \"input\" | \"slot\" | \"style\" | \"head\" | \"section\" | \"big\" | \"sub\" | \"sup\" | \"animate\" | \"progress\" | \"view\" | \"output\" | \"var\" | \"map\" | \"html\" | \"a\" | \"img\" | \"audio\" | \"form\" | \"main\" | \"abbr\" | \"address\" | \"article\" | \"aside\" | \"b\" | \"bdi\" | \"bdo\" | \"blockquote\" | \"br\" | \"button\" | \"canvas\" | \"caption\" | \"cite\" | \"code\" | \"col\" | \"colgroup\" | \"datalist\" | \"dd\" | \"del\" | \"details\" | \"dfn\" | \"dialog\" | \"div\" | \"dl\" | \"dt\" | \"em\" | \"embed\" | \"fieldset\" | \"figcaption\" | \"figure\" | \"footer\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"header\" | \"hgroup\" | \"hr\" | \"i\" | \"iframe\" | \"ins\" | \"kbd\" | \"keygen\" | \"li\" | \"mark\" | \"menuitem\" | \"meter\" | \"nav\" | \"noindex\" | \"noscript\" | \"ol\" | \"optgroup\" | \"option\" | \"p\" | \"param\" | \"picture\" | \"pre\" | \"rp\" | \"rt\" | \"ruby\" | \"samp\" | \"select\" | \"span\" | \"strong\" | \"table\" | \"template\" | \"tbody\" | \"td\" | \"textarea\" | \"tfoot\" | \"th\" | \"thead\" | \"tr\" | \"track\" | \"u\" | \"ul\" | \"video\" | \"wbr\" | \"webview\" | \"animateMotion\" | \"animateTransform\" | \"clipPath\" | \"defs\" | \"ellipse\" | \"feBlend\" | \"feColorMatrix\" | \"feComponentTransfer\" | \"feComposite\" | \"feConvolveMatrix\" | \"feDiffuseLighting\" | \"feDisplacementMap\" | \"feDistantLight\" | \"feDropShadow\" | \"feFlood\" | \"feFuncA\" | \"feFuncB\" | \"feFuncG\" | \"feFuncR\" | \"feGaussianBlur\" | \"feImage\" | \"feMerge\" | \"feMergeNode\" | \"feMorphology\" | \"feOffset\" | \"fePointLight\" | \"feSpecularLighting\" | \"feSpotLight\" | \"feTile\" | \"feTurbulence\" | \"foreignObject\" | \"g\" | \"linearGradient\" | \"marker\" | \"metadata\" | \"mpath\" | \"polygon\" | \"polyline\" | \"radialGradient\" | \"rect\" | \"switch\" | \"textPath\" | \"tspan\" | \"use\"" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps", + "type": "Interface", + "tags": [], + "label": "ExceptionItemProps", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.dataTestSubj", + "type": "string", + "tags": [], + "label": "dataTestSubj", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.disableActions", + "type": "CompoundType", + "tags": [], + "label": "disableActions", + "description": [], + "signature": [ + "boolean | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.exceptionItem", + "type": "Object", + "tags": [], + "label": "exceptionItem", + "description": [], + "signature": [ + "{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"keyword\" | \"ip\" | \"text\" | \"geo_point\" | \"geo_shape\" | \"date_nanos\" | \"long\" | \"double\" | \"date_range\" | \"ip_range\" | \"shape\" | \"short\" | \"binary\" | \"float\" | \"half_float\" | \"integer\" | \"byte\" | \"long_range\" | \"integer_range\" | \"float_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; })[]; field: string; type: \"nested\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"wildcard\"; value: string; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.listType", + "type": "Enum", + "tags": [], + "label": "listType", + "description": [], + "signature": [ + "ExceptionListTypeEnum" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.ruleReferences", + "type": "Array", + "tags": [], + "label": "ruleReferences", + "description": [], + "signature": [ + "any[]" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.editActionLabel", + "type": "string", + "tags": [], + "label": "editActionLabel", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.deleteActionLabel", + "type": "string", + "tags": [], + "label": "deleteActionLabel", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.securityLinkAnchorComponent", + "type": "CompoundType", + "tags": [], + "label": "securityLinkAnchorComponent", + "description": [], + "signature": [ + "\"symbol\" | \"object\" | React.ComponentType | \"body\" | \"path\" | \"circle\" | \"filter\" | \"data\" | \"line\" | \"area\" | \"time\" | \"label\" | \"legend\" | \"image\" | \"link\" | \"menu\" | \"stop\" | \"base\" | \"text\" | \"title\" | \"s\" | \"small\" | \"svg\" | \"meta\" | \"script\" | \"summary\" | \"source\" | \"desc\" | \"q\" | \"pattern\" | \"mask\" | \"input\" | \"slot\" | \"style\" | \"head\" | \"section\" | \"big\" | \"sub\" | \"sup\" | \"animate\" | \"progress\" | \"view\" | \"output\" | \"var\" | \"map\" | \"html\" | \"a\" | \"img\" | \"audio\" | \"form\" | \"main\" | \"abbr\" | \"address\" | \"article\" | \"aside\" | \"b\" | \"bdi\" | \"bdo\" | \"blockquote\" | \"br\" | \"button\" | \"canvas\" | \"caption\" | \"cite\" | \"code\" | \"col\" | \"colgroup\" | \"datalist\" | \"dd\" | \"del\" | \"details\" | \"dfn\" | \"dialog\" | \"div\" | \"dl\" | \"dt\" | \"em\" | \"embed\" | \"fieldset\" | \"figcaption\" | \"figure\" | \"footer\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"header\" | \"hgroup\" | \"hr\" | \"i\" | \"iframe\" | \"ins\" | \"kbd\" | \"keygen\" | \"li\" | \"mark\" | \"menuitem\" | \"meter\" | \"nav\" | \"noindex\" | \"noscript\" | \"ol\" | \"optgroup\" | \"option\" | \"p\" | \"param\" | \"picture\" | \"pre\" | \"rp\" | \"rt\" | \"ruby\" | \"samp\" | \"select\" | \"span\" | \"strong\" | \"table\" | \"template\" | \"tbody\" | \"td\" | \"textarea\" | \"tfoot\" | \"th\" | \"thead\" | \"tr\" | \"track\" | \"u\" | \"ul\" | \"video\" | \"wbr\" | \"webview\" | \"animateMotion\" | \"animateTransform\" | \"clipPath\" | \"defs\" | \"ellipse\" | \"feBlend\" | \"feColorMatrix\" | \"feComponentTransfer\" | \"feComposite\" | \"feConvolveMatrix\" | \"feDiffuseLighting\" | \"feDisplacementMap\" | \"feDistantLight\" | \"feDropShadow\" | \"feFlood\" | \"feFuncA\" | \"feFuncB\" | \"feFuncG\" | \"feFuncR\" | \"feGaussianBlur\" | \"feImage\" | \"feMerge\" | \"feMergeNode\" | \"feMorphology\" | \"feOffset\" | \"fePointLight\" | \"feSpecularLighting\" | \"feSpotLight\" | \"feTile\" | \"feTurbulence\" | \"foreignObject\" | \"g\" | \"linearGradient\" | \"marker\" | \"metadata\" | \"mpath\" | \"polygon\" | \"polyline\" | \"radialGradient\" | \"rect\" | \"switch\" | \"textPath\" | \"tspan\" | \"use\"" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.formattedDateComponent", + "type": "CompoundType", + "tags": [], + "label": "formattedDateComponent", + "description": [], + "signature": [ + "\"symbol\" | \"object\" | React.ComponentType | \"body\" | \"path\" | \"circle\" | \"filter\" | \"data\" | \"line\" | \"area\" | \"time\" | \"label\" | \"legend\" | \"image\" | \"link\" | \"menu\" | \"stop\" | \"base\" | \"text\" | \"title\" | \"s\" | \"small\" | \"svg\" | \"meta\" | \"script\" | \"summary\" | \"source\" | \"desc\" | \"q\" | \"pattern\" | \"mask\" | \"input\" | \"slot\" | \"style\" | \"head\" | \"section\" | \"big\" | \"sub\" | \"sup\" | \"animate\" | \"progress\" | \"view\" | \"output\" | \"var\" | \"map\" | \"html\" | \"a\" | \"img\" | \"audio\" | \"form\" | \"main\" | \"abbr\" | \"address\" | \"article\" | \"aside\" | \"b\" | \"bdi\" | \"bdo\" | \"blockquote\" | \"br\" | \"button\" | \"canvas\" | \"caption\" | \"cite\" | \"code\" | \"col\" | \"colgroup\" | \"datalist\" | \"dd\" | \"del\" | \"details\" | \"dfn\" | \"dialog\" | \"div\" | \"dl\" | \"dt\" | \"em\" | \"embed\" | \"fieldset\" | \"figcaption\" | \"figure\" | \"footer\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\" | \"header\" | \"hgroup\" | \"hr\" | \"i\" | \"iframe\" | \"ins\" | \"kbd\" | \"keygen\" | \"li\" | \"mark\" | \"menuitem\" | \"meter\" | \"nav\" | \"noindex\" | \"noscript\" | \"ol\" | \"optgroup\" | \"option\" | \"p\" | \"param\" | \"picture\" | \"pre\" | \"rp\" | \"rt\" | \"ruby\" | \"samp\" | \"select\" | \"span\" | \"strong\" | \"table\" | \"template\" | \"tbody\" | \"td\" | \"textarea\" | \"tfoot\" | \"th\" | \"thead\" | \"tr\" | \"track\" | \"u\" | \"ul\" | \"video\" | \"wbr\" | \"webview\" | \"animateMotion\" | \"animateTransform\" | \"clipPath\" | \"defs\" | \"ellipse\" | \"feBlend\" | \"feColorMatrix\" | \"feComponentTransfer\" | \"feComposite\" | \"feConvolveMatrix\" | \"feDiffuseLighting\" | \"feDisplacementMap\" | \"feDistantLight\" | \"feDropShadow\" | \"feFlood\" | \"feFuncA\" | \"feFuncB\" | \"feFuncG\" | \"feFuncR\" | \"feGaussianBlur\" | \"feImage\" | \"feMerge\" | \"feMergeNode\" | \"feMorphology\" | \"feOffset\" | \"fePointLight\" | \"feSpecularLighting\" | \"feSpotLight\" | \"feTile\" | \"feTurbulence\" | \"foreignObject\" | \"g\" | \"linearGradient\" | \"marker\" | \"metadata\" | \"mpath\" | \"polygon\" | \"polyline\" | \"radialGradient\" | \"rect\" | \"switch\" | \"textPath\" | \"tspan\" | \"use\"" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.getFormattedComments", + "type": "Function", + "tags": [], + "label": "getFormattedComments", + "description": [], + "signature": [ + "(comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]) => ", + "EuiCommentProps", + "[]" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.getFormattedComments.$1", + "type": "Array", + "tags": [], + "label": "comments", + "description": [], + "signature": [ + "({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.onDeleteException", + "type": "Function", + "tags": [], + "label": "onDeleteException", + "description": [], + "signature": [ + "(arg: ", + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.ExceptionListItemIdentifiers", + "text": "ExceptionListItemIdentifiers" + }, + ") => void" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.onDeleteException.$1", + "type": "Object", + "tags": [], + "label": "arg", + "description": [], + "signature": [ + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.ExceptionListItemIdentifiers", + "text": "ExceptionListItemIdentifiers" + } + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.onEditException", + "type": "Function", + "tags": [], + "label": "onEditException", + "description": [], + "signature": [ + "(item: { _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"keyword\" | \"ip\" | \"text\" | \"geo_point\" | \"geo_shape\" | \"date_nanos\" | \"long\" | \"double\" | \"date_range\" | \"ip_range\" | \"shape\" | \"short\" | \"binary\" | \"float\" | \"half_float\" | \"integer\" | \"byte\" | \"long_range\" | \"integer_range\" | \"float_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; })[]; field: string; type: \"nested\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"wildcard\"; value: string; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }) => void" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionItemProps.onEditException.$1", + "type": "Object", + "tags": [], + "label": "item", + "description": [], + "signature": [ + "{ _version: string | undefined; comments: ({ comment: string; created_at: string; created_by: string; id: string; } & { updated_at?: string | undefined; updated_by?: string | undefined; })[]; created_at: string; created_by: string; description: string; entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; } | { field: string; list: { id: string; type: \"boolean\" | \"date\" | \"keyword\" | \"ip\" | \"text\" | \"geo_point\" | \"geo_shape\" | \"date_nanos\" | \"long\" | \"double\" | \"date_range\" | \"ip_range\" | \"shape\" | \"short\" | \"binary\" | \"float\" | \"half_float\" | \"integer\" | \"byte\" | \"long_range\" | \"integer_range\" | \"float_range\" | \"double_range\"; }; operator: \"excluded\" | \"included\"; type: \"list\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { entries: ({ field: string; operator: \"excluded\" | \"included\"; type: \"exists\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match\"; value: string; } | { field: string; operator: \"excluded\" | \"included\"; type: \"match_any\"; value: string[]; })[]; field: string; type: \"nested\"; } | { field: string; operator: \"excluded\" | \"included\"; type: \"wildcard\"; value: string; })[]; id: string; item_id: string; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"simple\"; updated_at: string; updated_by: string; }" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionListItemIdentifiers", + "type": "Interface", + "tags": [], + "label": "ExceptionListItemIdentifiers", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionListItemIdentifiers.id", + "type": "string", + "tags": [], + "label": "id", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionListItemIdentifiers.name", + "type": "string", + "tags": [], + "label": "name", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionListItemIdentifiers.namespaceType", + "type": "CompoundType", + "tags": [], + "label": "namespaceType", + "description": [], + "signature": [ + "\"single\" | \"agnostic\"" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionListSummaryProps", + "type": "Interface", + "tags": [], + "label": "ExceptionListSummaryProps", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionListSummaryProps.pagination", + "type": "Object", + "tags": [], + "label": "pagination", + "description": [], + "signature": [ + "Pagination" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ExceptionListSummaryProps.lastUpdated", + "type": "CompoundType", + "tags": [], + "label": "lastUpdated", + "description": [], + "signature": [ + "string | number | null" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.GetExceptionItemProps", + "type": "Interface", + "tags": [], + "label": "GetExceptionItemProps", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.GetExceptionItemProps.pagination", + "type": "Object", + "tags": [], + "label": "pagination", + "description": [], + "signature": [ + "Pagination", + " | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.GetExceptionItemProps.search", + "type": "string", + "tags": [], + "label": "search", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.GetExceptionItemProps.filters", + "type": "string", + "tags": [], + "label": "filters", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.PaginationProps", + "type": "Interface", + "tags": [], + "label": "PaginationProps", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.PaginationProps.dataTestSubj", + "type": "string", + "tags": [], + "label": "dataTestSubj", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.PaginationProps.ariaLabel", + "type": "string", + "tags": [], + "label": "ariaLabel", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.PaginationProps.pagination", + "type": "Object", + "tags": [], + "label": "pagination", + "description": [], + "signature": [ + "Pagination" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.PaginationProps.onPaginationChange", + "type": "Function", + "tags": [], + "label": "onPaginationChange", + "description": [], + "signature": [ + "(arg: ", + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.GetExceptionItemProps", + "text": "GetExceptionItemProps" + }, + ") => void" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.PaginationProps.onPaginationChange.$1", + "type": "Object", + "tags": [], + "label": "arg", + "description": [], + "signature": [ + { + "pluginId": "@kbn/securitysolution-exception-list-components", + "scope": "common", + "docId": "kibKbnSecuritysolutionExceptionListComponentsPluginApi", + "section": "def-common.GetExceptionItemProps", + "text": "GetExceptionItemProps" + } + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [] + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.RuleReference", + "type": "Interface", + "tags": [], + "label": "RuleReference", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.RuleReference.name", + "type": "string", + "tags": [], + "label": "name", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.RuleReference.id", + "type": "string", + "tags": [], + "label": "id", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.RuleReference.ruleId", + "type": "string", + "tags": [], + "label": "ruleId", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.RuleReference.exceptionLists", + "type": "Array", + "tags": [], + "label": "exceptionLists", + "description": [], + "signature": [ + "{ _version: string | undefined; created_at: string; created_by: string; description: string; id: string; immutable: boolean; list_id: string; meta: object | undefined; name: string; namespace_type: \"single\" | \"agnostic\"; os_types: (\"windows\" | \"linux\" | \"macos\")[]; tags: string[]; tie_breaker_id: string; type: \"endpoint\" | \"detection\" | \"rule_default\" | \"endpoint_trusted_apps\" | \"endpoint_events\" | \"endpoint_host_isolation_exceptions\" | \"endpoint_blocklists\"; updated_at: string; updated_by: string; version: number; }[]" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.RuleReferences", + "type": "Interface", + "tags": [], + "label": "RuleReferences", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.RuleReferences.Unnamed", + "type": "IndexSignature", + "tags": [], + "label": "[key: string]: any[]", + "description": [], + "signature": [ + "[key: string]: any[]" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + } + ], + "enums": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ListTypeText", + "type": "Enum", + "tags": [], + "label": "ListTypeText", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ViewerStatus", + "type": "Enum", + "tags": [], + "label": "ViewerStatus", + "description": [], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + } + ], + "misc": [ + { + "parentPluginId": "@kbn/securitysolution-exception-list-components", + "id": "def-common.ViewerFlyoutName", + "type": "Type", + "tags": [], + "label": "ViewerFlyoutName", + "description": [], + "signature": [ + "\"addException\" | \"editException\" | null" + ], + "path": "packages/kbn-securitysolution-exception-list-components/src/types/index.ts", + "deprecated": false, + "trackAdoption": false, + "initialIsOpen": false + } + ], + "objects": [] + } +} \ No newline at end of file diff --git a/api_docs/kbn_securitysolution_exception_list_components.mdx b/api_docs/kbn_securitysolution_exception_list_components.mdx new file mode 100644 index 0000000000000..fe34878dde867 --- /dev/null +++ b/api_docs/kbn_securitysolution_exception_list_components.mdx @@ -0,0 +1,39 @@ +--- +#### +#### This document is auto-generated and is meant to be viewed inside our experimental, new docs system. +#### Reach out in #docs-engineering for more info. +#### +id: kibKbnSecuritysolutionExceptionListComponentsPluginApi +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-10-04 +tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/securitysolution-exception-list-components'] +--- +import kbnSecuritysolutionExceptionListComponentsObj from './kbn_securitysolution_exception_list_components.devdocs.json'; + + + +Contact [Owner missing] for questions regarding this plugin. + +**Code health stats** + +| Public API count | Any count | Items lacking comments | Missing exports | +|-------------------|-----------|------------------------|-----------------| +| 76 | 0 | 67 | 1 | + +## Common + +### Functions + + +### Interfaces + + +### Enums + + +### Consts, variables and types + + diff --git a/api_docs/kbn_securitysolution_hook_utils.mdx b/api_docs/kbn_securitysolution_hook_utils.mdx index c74046c4b1fa8..b7857cb66e9ec 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-28 +date: 2022-10-04 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 5f200ca33cd52..9f0b39175cdd0 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-28 +date: 2022-10-04 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 75beb67b94d03..bf6b60393ec53 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-28 +date: 2022-10-04 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 2525d36a83930..ccbb90b450959 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-28 +date: 2022-10-04 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 1729eb1e31923..2b3c7663b879f 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-28 +date: 2022-10-04 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 e7ea35711a930..a5e08ee825fae 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-28 +date: 2022-10-04 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 061d996305ac9..7b169ce42760c 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-28 +date: 2022-10-04 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 19a2ed45a48ba..5c977abb1b280 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-28 +date: 2022-10-04 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 247718cc1d2a7..768c6cf059b57 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-28 +date: 2022-10-04 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 53f33ec3d564b..3496eef3b6346 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-28 +date: 2022-10-04 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 0be9d3e0886f9..2d25ede3c66ec 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-28 +date: 2022-10-04 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 b3d353cc6987e..26c6aa46ba082 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-28 +date: 2022-10-04 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 aefc65e7066a3..16eac1230f6d8 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-28 +date: 2022-10-04 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 25cf89691a720..675a4f7818c66 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-28 +date: 2022-10-04 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 aaf7c6592481a..bda0bfc9746fa 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-28 +date: 2022-10-04 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 b12d28f86530e..23abaffe3cc78 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-28 +date: 2022-10-04 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 4fafd24671035..e553b3a2c6c5f 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-28 +date: 2022-10-04 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 401b8763ce31c..6465028feeb17 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-28 +date: 2022-10-04 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 25b21295a4ebd..c570628e0e331 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-28 +date: 2022-10-04 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 5867910e33d25..82c15083cc996 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-28 +date: 2022-10-04 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 757324760d8eb..56afa671aa65c 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-28 +date: 2022-10-04 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 19d3fcf3f0acc..557e698f2e512 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-28 +date: 2022-10-04 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 f75c2846a0475..352a0014b2cc0 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-28 +date: 2022-10-04 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 89d4d761d558c..b28052e80a11d 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-28 +date: 2022-10-04 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 2056f2314bce9..15a591c9aecdf 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-28 +date: 2022-10-04 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 495d91eac2545..4c476350996e4 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-28 +date: 2022-10-04 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 7767a12066d24..2e4fc87798604 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-28 +date: 2022-10-04 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 e0d65073b737e..f22caeb920fc5 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-28 +date: 2022-10-04 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 8c798dd34a9a4..0f95fd61f2579 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-28 +date: 2022-10-04 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 243de44838e10..80f6cf9b8f34d 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-28 +date: 2022-10-04 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 38664c4b62fdf..fadea535b8245 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-28 +date: 2022-10-04 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 3f237d268f073..aa9686f1314b2 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-28 +date: 2022-10-04 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 3ff43ae1b6263..95295947ea4c3 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-28 +date: 2022-10-04 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 48e497a99004b..a136219cf2d8c 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-28 +date: 2022-10-04 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 15f626088ad23..cbcc71d025c8b 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-28 +date: 2022-10-04 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 2e0d73cc43623..40896d72b0dc8 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-28 +date: 2022-10-04 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 e9accf72f5a02..133cbe3bb9994 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-28 +date: 2022-10-04 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 6309733dc1bab..443625c76310c 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-28 +date: 2022-10-04 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 c770dd8671956..1182906621731 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-28 +date: 2022-10-04 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 4b531126964e6..ea558aa9e073b 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-28 +date: 2022-10-04 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 8073cadd73d80..e3a9c03528b20 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-28 +date: 2022-10-04 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 c05c4d734c490..e5c5d241941bd 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-28 +date: 2022-10-04 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 660e36ef4374e..1d5e0e3792587 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-28 +date: 2022-10-04 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 93828baf05442..49592c87fc217 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-28 +date: 2022-10-04 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 fc2ed806bd5a7..548085afb06a6 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-28 +date: 2022-10-04 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 fe8a35b282802..130c68213d1dc 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-28 +date: 2022-10-04 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 b072b928a5fee..c9b070d08edf9 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-28 +date: 2022-10-04 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 2cc7dbb077e4d..e93c241e2cdac 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-28 +date: 2022-10-04 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 4c380a6aada55..da5f83dd7a47b 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-28 +date: 2022-10-04 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 4658f66ec9f02..9ce0e8072dec2 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-28 +date: 2022-10-04 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 5c785be7541a2..d6c96609eee48 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-28 +date: 2022-10-04 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 058bbf15a8534..365d565746dbc 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-28 +date: 2022-10-04 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 ffad848d71c2b..d8a381bf82680 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-28 +date: 2022-10-04 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.devdocs.json b/api_docs/kbn_user_profile_components.devdocs.json index d8cd0cfd94f9e..55ddd03b7d6d4 100644 --- a/api_docs/kbn_user_profile_components.devdocs.json +++ b/api_docs/kbn_user_profile_components.devdocs.json @@ -121,6 +121,57 @@ "returnComment": [], "initialIsOpen": false }, + { + "parentPluginId": "@kbn/user-profile-components", + "id": "def-common.UserAvatarTip", + "type": "Function", + "tags": [], + "label": "UserAvatarTip", + "description": [ + "\nRenders a user avatar with tooltip" + ], + "signature": [ + "({ user, avatar, ...rest }: React.PropsWithChildren<", + { + "pluginId": "@kbn/user-profile-components", + "scope": "common", + "docId": "kibKbnUserProfileComponentsPluginApi", + "section": "def-common.UserAvatarProps", + "text": "UserAvatarProps" + }, + ">) => JSX.Element" + ], + "path": "packages/kbn-user-profile-components/src/user_avatar_tip.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/user-profile-components", + "id": "def-common.UserAvatarTip.$1", + "type": "CompoundType", + "tags": [], + "label": "{ user, avatar, ...rest }", + "description": [], + "signature": [ + "React.PropsWithChildren<", + { + "pluginId": "@kbn/user-profile-components", + "scope": "common", + "docId": "kibKbnUserProfileComponentsPluginApi", + "section": "def-common.UserAvatarProps", + "text": "UserAvatarProps" + }, + ">" + ], + "path": "packages/kbn-user-profile-components/src/user_avatar_tip.tsx", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false + }, { "parentPluginId": "@kbn/user-profile-components", "id": "def-common.UserProfilesPopover", @@ -236,6 +287,57 @@ ], "returnComment": [], "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/user-profile-components", + "id": "def-common.UserToolTip", + "type": "Function", + "tags": [], + "label": "UserToolTip", + "description": [ + "\nRenders a tooltip with user information" + ], + "signature": [ + "({ user, avatar, ...rest }: React.PropsWithChildren<", + { + "pluginId": "@kbn/user-profile-components", + "scope": "common", + "docId": "kibKbnUserProfileComponentsPluginApi", + "section": "def-common.UserToolTipProps", + "text": "UserToolTipProps" + }, + ">) => JSX.Element" + ], + "path": "packages/kbn-user-profile-components/src/user_tooltip.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/user-profile-components", + "id": "def-common.UserToolTip.$1", + "type": "CompoundType", + "tags": [], + "label": "{ user, avatar, ...rest }", + "description": [], + "signature": [ + "React.PropsWithChildren<", + { + "pluginId": "@kbn/user-profile-components", + "scope": "common", + "docId": "kibKbnUserProfileComponentsPluginApi", + "section": "def-common.UserToolTipProps", + "text": "UserToolTipProps" + }, + ">" + ], + "path": "packages/kbn-user-profile-components/src/user_tooltip.tsx", + "deprecated": false, + "trackAdoption": false, + "isRequired": true + } + ], + "returnComment": [], + "initialIsOpen": false } ], "interfaces": [ @@ -938,6 +1040,79 @@ } ], "initialIsOpen": false + }, + { + "parentPluginId": "@kbn/user-profile-components", + "id": "def-common.UserToolTipProps", + "type": "Interface", + "tags": [], + "label": "UserToolTipProps", + "description": [ + "\nProps of {@link UserToolTip} component" + ], + "signature": [ + { + "pluginId": "@kbn/user-profile-components", + "scope": "common", + "docId": "kibKbnUserProfileComponentsPluginApi", + "section": "def-common.UserToolTipProps", + "text": "UserToolTipProps" + }, + " extends Omit<", + "EuiToolTipProps", + ", \"title\" | \"content\">" + ], + "path": "packages/kbn-user-profile-components/src/user_tooltip.tsx", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "@kbn/user-profile-components", + "id": "def-common.UserToolTipProps.user", + "type": "Object", + "tags": [], + "label": "user", + "description": [ + "\nUser to be rendered" + ], + "signature": [ + { + "pluginId": "@kbn/user-profile-components", + "scope": "common", + "docId": "kibKbnUserProfileComponentsPluginApi", + "section": "def-common.UserProfileUserInfo", + "text": "UserProfileUserInfo" + } + ], + "path": "packages/kbn-user-profile-components/src/user_tooltip.tsx", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "@kbn/user-profile-components", + "id": "def-common.UserToolTipProps.avatar", + "type": "Object", + "tags": [], + "label": "avatar", + "description": [ + "\nAvatar data of user to be rendered" + ], + "signature": [ + { + "pluginId": "@kbn/user-profile-components", + "scope": "common", + "docId": "kibKbnUserProfileComponentsPluginApi", + "section": "def-common.UserProfileAvatarData", + "text": "UserProfileAvatarData" + }, + " | undefined" + ], + "path": "packages/kbn-user-profile-components/src/user_tooltip.tsx", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false } ], "enums": [], diff --git a/api_docs/kbn_user_profile_components.mdx b/api_docs/kbn_user_profile_components.mdx index b7a7e0d49898e..1fb9abaf0ee8b 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', '@kbn/user-profile-components'] --- import kbnUserProfileComponentsObj from './kbn_user_profile_components.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Owner missing] for questions regarding this plugin. | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 48 | 0 | 3 | 0 | +| 55 | 0 | 5 | 0 | ## Common diff --git a/api_docs/kbn_utility_types.mdx b/api_docs/kbn_utility_types.mdx index 9c4fac9fc2223..1dd233e2b3c7c 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-28 +date: 2022-10-04 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 a08a1f8c35b21..ffc882e7050cf 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-28 +date: 2022-10-04 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 484f22d4d3fad..32d4e0b6f4f27 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-28 +date: 2022-10-04 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 86360f220dc24..8321d021b0720 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-28 +date: 2022-10-04 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 db2dd293c3e4b..6ea90bb2df76a 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-28 +date: 2022-10-04 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 a8b6bbd605637..1a43fddabf34d 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-28 +date: 2022-10-04 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 e8b72f7cee2d1..7658f6b8dfa6c 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-28 +date: 2022-10-04 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 fc9a2e294a610..f51fe23a0772a 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-28 +date: 2022-10-04 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 4d4561547ed2a..d29c21bc24d31 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 75d2cd54a2d8b..e930504ffaee4 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-28 +date: 2022-10-04 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.devdocs.json b/api_docs/license_api_guard.devdocs.json index a554c2c4b7895..03acec45780d4 100644 --- a/api_docs/license_api_guard.devdocs.json +++ b/api_docs/license_api_guard.devdocs.json @@ -94,13 +94,7 @@ "description": [], "signature": [ "(handler: ", { "pluginId": "core", diff --git a/api_docs/license_api_guard.mdx b/api_docs/license_api_guard.mdx index 42f4d0805fc3c..14b1e5c6f4612 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-28 +date: 2022-10-04 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 ca3e9e1a23c12..b71a0f65fbba0 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-28 +date: 2022-10-04 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 67cd87e28a5ce..914e71d3130cf 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-28 +date: 2022-10-04 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 c0fba6cbabbb7..014535d3acb8d 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-28 +date: 2022-10-04 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 7a332ae0f68be..de79c0505493d 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-28 +date: 2022-10-04 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 c821d5118393a..0c1d388602858 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-28 +date: 2022-10-04 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 30e6fc5864b60..82536b7c87b8d 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-28 +date: 2022-10-04 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 83e81edff74a4..9d94398a882da 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-28 +date: 2022-10-04 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 8b27dbc3d7849..c76aac1bd57ad 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-28 +date: 2022-10-04 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 d0c0e4b930125..e59f472f07ee4 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-28 +date: 2022-10-04 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 c8d4e9b1fbf7c..0dccfeb623a38 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-28 +date: 2022-10-04 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 79f080105b7b9..08394f81d45d8 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'newsfeed'] --- import newsfeedObj from './newsfeed.devdocs.json'; diff --git a/api_docs/observability.devdocs.json b/api_docs/observability.devdocs.json index d4d3483ef247c..08f23a62393da 100644 --- a/api_docs/observability.devdocs.json +++ b/api_docs/observability.devdocs.json @@ -738,7 +738,7 @@ }, " | undefined; list: () => string[]; }; selectedAlertId?: string | undefined; } & ", "CommonProps", - " & { as?: \"div\" | undefined; } & _EuiFlyoutProps & Omit, HTMLDivElement>, keyof _EuiFlyoutProps> & Omit, HTMLDivElement>, \"key\" | keyof React.HTMLAttributes | \"css\"> & { ref?: React.RefObject | ((instance: HTMLDivElement | null) => void) | null | undefined; }, \"children\" | \"ref\" | \"type\" | \"onError\" | \"hidden\" | \"color\" | \"id\" | \"className\" | \"size\" | \"title\" | \"onChange\" | \"onKeyDown\" | \"onClick\" | \"security\" | \"key\" | \"defaultValue\" | \"lang\" | \"defaultChecked\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"placeholder\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"onClose\" | \"data-test-subj\" | \"css\" | \"as\" | \"paddingSize\" | \"focusTrapProps\" | \"ownFocus\" | \"maxWidth\" | \"hideCloseButton\" | \"closeButtonAriaLabel\" | \"closeButtonProps\" | \"closeButtonPosition\" | \"maskProps\" | \"outsideClickCloses\" | \"side\" | \"pushMinBreakpoint\">, \"children\" | \"type\" | \"onError\" | \"hidden\" | \"color\" | \"id\" | \"alert\" | \"className\" | \"size\" | \"title\" | \"onChange\" | \"onKeyDown\" | \"onClick\" | \"security\" | \"key\" | \"defaultValue\" | \"lang\" | \"defaultChecked\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"placeholder\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"onClose\" | \"data-test-subj\" | \"css\" | \"as\" | \"paddingSize\" | \"focusTrapProps\" | \"ownFocus\" | \"alerts\" | \"maxWidth\" | \"hideCloseButton\" | \"closeButtonAriaLabel\" | \"closeButtonProps\" | \"closeButtonPosition\" | \"maskProps\" | \"outsideClickCloses\" | \"side\" | \"pushMinBreakpoint\" | \"isInApp\" | \"observabilityRuleTypeRegistry\" | \"selectedAlertId\"> & { ref?: React.RefObject | ((instance: HTMLDivElement | null) => void) | null | undefined; }> & { readonly _result: ({ alert, alerts, isInApp, observabilityRuleTypeRegistry, onClose, selectedAlertId, }: AlertsFlyoutProps) => JSX.Element | null; }" + " & { as?: \"div\" | undefined; } & _EuiFlyoutProps & Omit, HTMLDivElement>, keyof _EuiFlyoutProps> & Omit, HTMLDivElement>, \"key\" | keyof React.HTMLAttributes | \"css\"> & { ref?: React.RefObject | ((instance: HTMLDivElement | null) => void) | null | undefined; }, \"children\" | \"ref\" | \"type\" | \"onError\" | \"hidden\" | \"color\" | \"id\" | \"className\" | \"size\" | \"title\" | \"onChange\" | \"onKeyDown\" | \"onClick\" | \"security\" | \"key\" | \"defaultValue\" | \"lang\" | \"defaultChecked\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"placeholder\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"onClose\" | \"data-test-subj\" | \"css\" | \"as\" | \"paddingSize\" | \"focusTrapProps\" | \"ownFocus\" | \"maxWidth\" | \"hideCloseButton\" | \"closeButtonAriaLabel\" | \"closeButtonProps\" | \"closeButtonPosition\" | \"maskProps\" | \"outsideClickCloses\" | \"side\" | \"pushMinBreakpoint\">, \"children\" | \"type\" | \"onError\" | \"hidden\" | \"color\" | \"id\" | \"alert\" | \"className\" | \"size\" | \"title\" | \"onChange\" | \"onKeyDown\" | \"onClick\" | \"security\" | \"key\" | \"defaultValue\" | \"lang\" | \"defaultChecked\" | \"suppressContentEditableWarning\" | \"suppressHydrationWarning\" | \"accessKey\" | \"contentEditable\" | \"contextMenu\" | \"dir\" | \"draggable\" | \"placeholder\" | \"slot\" | \"spellCheck\" | \"style\" | \"tabIndex\" | \"translate\" | \"radioGroup\" | \"role\" | \"about\" | \"datatype\" | \"inlist\" | \"prefix\" | \"property\" | \"resource\" | \"typeof\" | \"vocab\" | \"autoCapitalize\" | \"autoCorrect\" | \"autoSave\" | \"itemProp\" | \"itemScope\" | \"itemType\" | \"itemID\" | \"itemRef\" | \"results\" | \"unselectable\" | \"inputMode\" | \"is\" | \"aria-activedescendant\" | \"aria-atomic\" | \"aria-autocomplete\" | \"aria-busy\" | \"aria-checked\" | \"aria-colcount\" | \"aria-colindex\" | \"aria-colspan\" | \"aria-controls\" | \"aria-current\" | \"aria-describedby\" | \"aria-details\" | \"aria-disabled\" | \"aria-dropeffect\" | \"aria-errormessage\" | \"aria-expanded\" | \"aria-flowto\" | \"aria-grabbed\" | \"aria-haspopup\" | \"aria-hidden\" | \"aria-invalid\" | \"aria-keyshortcuts\" | \"aria-label\" | \"aria-labelledby\" | \"aria-level\" | \"aria-live\" | \"aria-modal\" | \"aria-multiline\" | \"aria-multiselectable\" | \"aria-orientation\" | \"aria-owns\" | \"aria-placeholder\" | \"aria-posinset\" | \"aria-pressed\" | \"aria-readonly\" | \"aria-relevant\" | \"aria-required\" | \"aria-roledescription\" | \"aria-rowcount\" | \"aria-rowindex\" | \"aria-rowspan\" | \"aria-selected\" | \"aria-setsize\" | \"aria-sort\" | \"aria-valuemax\" | \"aria-valuemin\" | \"aria-valuenow\" | \"aria-valuetext\" | \"dangerouslySetInnerHTML\" | \"onCopy\" | \"onCopyCapture\" | \"onCut\" | \"onCutCapture\" | \"onPaste\" | \"onPasteCapture\" | \"onCompositionEnd\" | \"onCompositionEndCapture\" | \"onCompositionStart\" | \"onCompositionStartCapture\" | \"onCompositionUpdate\" | \"onCompositionUpdateCapture\" | \"onFocus\" | \"onFocusCapture\" | \"onBlur\" | \"onBlurCapture\" | \"onChangeCapture\" | \"onBeforeInput\" | \"onBeforeInputCapture\" | \"onInput\" | \"onInputCapture\" | \"onReset\" | \"onResetCapture\" | \"onSubmit\" | \"onSubmitCapture\" | \"onInvalid\" | \"onInvalidCapture\" | \"onLoad\" | \"onLoadCapture\" | \"onErrorCapture\" | \"onKeyDownCapture\" | \"onKeyPress\" | \"onKeyPressCapture\" | \"onKeyUp\" | \"onKeyUpCapture\" | \"onAbort\" | \"onAbortCapture\" | \"onCanPlay\" | \"onCanPlayCapture\" | \"onCanPlayThrough\" | \"onCanPlayThroughCapture\" | \"onDurationChange\" | \"onDurationChangeCapture\" | \"onEmptied\" | \"onEmptiedCapture\" | \"onEncrypted\" | \"onEncryptedCapture\" | \"onEnded\" | \"onEndedCapture\" | \"onLoadedData\" | \"onLoadedDataCapture\" | \"onLoadedMetadata\" | \"onLoadedMetadataCapture\" | \"onLoadStart\" | \"onLoadStartCapture\" | \"onPause\" | \"onPauseCapture\" | \"onPlay\" | \"onPlayCapture\" | \"onPlaying\" | \"onPlayingCapture\" | \"onProgress\" | \"onProgressCapture\" | \"onRateChange\" | \"onRateChangeCapture\" | \"onSeeked\" | \"onSeekedCapture\" | \"onSeeking\" | \"onSeekingCapture\" | \"onStalled\" | \"onStalledCapture\" | \"onSuspend\" | \"onSuspendCapture\" | \"onTimeUpdate\" | \"onTimeUpdateCapture\" | \"onVolumeChange\" | \"onVolumeChangeCapture\" | \"onWaiting\" | \"onWaitingCapture\" | \"onAuxClick\" | \"onAuxClickCapture\" | \"onClickCapture\" | \"onContextMenu\" | \"onContextMenuCapture\" | \"onDoubleClick\" | \"onDoubleClickCapture\" | \"onDrag\" | \"onDragCapture\" | \"onDragEnd\" | \"onDragEndCapture\" | \"onDragEnter\" | \"onDragEnterCapture\" | \"onDragExit\" | \"onDragExitCapture\" | \"onDragLeave\" | \"onDragLeaveCapture\" | \"onDragOver\" | \"onDragOverCapture\" | \"onDragStart\" | \"onDragStartCapture\" | \"onDrop\" | \"onDropCapture\" | \"onMouseDown\" | \"onMouseDownCapture\" | \"onMouseEnter\" | \"onMouseLeave\" | \"onMouseMove\" | \"onMouseMoveCapture\" | \"onMouseOut\" | \"onMouseOutCapture\" | \"onMouseOver\" | \"onMouseOverCapture\" | \"onMouseUp\" | \"onMouseUpCapture\" | \"onSelect\" | \"onSelectCapture\" | \"onTouchCancel\" | \"onTouchCancelCapture\" | \"onTouchEnd\" | \"onTouchEndCapture\" | \"onTouchMove\" | \"onTouchMoveCapture\" | \"onTouchStart\" | \"onTouchStartCapture\" | \"onPointerDown\" | \"onPointerDownCapture\" | \"onPointerMove\" | \"onPointerMoveCapture\" | \"onPointerUp\" | \"onPointerUpCapture\" | \"onPointerCancel\" | \"onPointerCancelCapture\" | \"onPointerEnter\" | \"onPointerEnterCapture\" | \"onPointerLeave\" | \"onPointerLeaveCapture\" | \"onPointerOver\" | \"onPointerOverCapture\" | \"onPointerOut\" | \"onPointerOutCapture\" | \"onGotPointerCapture\" | \"onGotPointerCaptureCapture\" | \"onLostPointerCapture\" | \"onLostPointerCaptureCapture\" | \"onScroll\" | \"onScrollCapture\" | \"onWheel\" | \"onWheelCapture\" | \"onAnimationStart\" | \"onAnimationStartCapture\" | \"onAnimationEnd\" | \"onAnimationEndCapture\" | \"onAnimationIteration\" | \"onAnimationIterationCapture\" | \"onTransitionEnd\" | \"onTransitionEndCapture\" | \"onClose\" | \"data-test-subj\" | \"css\" | \"as\" | \"alerts\" | \"paddingSize\" | \"focusTrapProps\" | \"ownFocus\" | \"maxWidth\" | \"hideCloseButton\" | \"closeButtonAriaLabel\" | \"closeButtonProps\" | \"closeButtonPosition\" | \"maskProps\" | \"outsideClickCloses\" | \"side\" | \"pushMinBreakpoint\" | \"isInApp\" | \"observabilityRuleTypeRegistry\" | \"selectedAlertId\"> & { ref?: React.RefObject | ((instance: HTMLDivElement | null) => void) | null | undefined; }> & { readonly _result: ({ alert, alerts, isInApp, observabilityRuleTypeRegistry, onClose, selectedAlertId, }: AlertsFlyoutProps) => JSX.Element | null; }" ], "path": "x-pack/plugins/observability/public/index.ts", "deprecated": false, @@ -7613,13 +7613,7 @@ "label": "context", "description": [], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", " & { licensing: Promise<", { "pluginId": "licensing", @@ -7637,13 +7631,7 @@ "text": "AlertingApiRequestHandlerContext" }, ">; core: Promise<", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.CoreRequestHandlerContext", - "text": "CoreRequestHandlerContext" - }, + "CoreRequestHandlerContext", ">; }" ], "path": "x-pack/plugins/observability/server/routes/types.ts", @@ -7944,7 +7932,7 @@ "label": "ObservabilityConfig", "description": [], "signature": [ - "{ readonly unsafe: Readonly<{} & { slo: Readonly<{} & { enabled: boolean; }>; alertDetails: Readonly<{} & { enabled: boolean; }>; }>; readonly annotations: Readonly<{} & { index: string; enabled: boolean; }>; }" + "{ readonly unsafe: Readonly<{} & { slo: Readonly<{} & { enabled: boolean; }>; alertDetails: Readonly<{} & { enabled: boolean; }>; }>; readonly annotations: Readonly<{} & { enabled: boolean; index: string; }>; }" ], "path": "x-pack/plugins/observability/server/index.ts", "deprecated": false, @@ -9798,13 +9786,7 @@ "description": [], "signature": [ "{ getScopedAnnotationsClient: (requestContext: ", - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", " & { licensing: Promise<", { "pluginId": "licensing", diff --git a/api_docs/observability.mdx b/api_docs/observability.mdx index 4c2ca8b17a13f..aaa79beceb7aa 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-28 +date: 2022-10-04 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 942900853abdb..e79c8673975d0 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-28 +date: 2022-10-04 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 bcddc85faf5c2..655626fbdb653 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana'] --- @@ -15,13 +15,13 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | Count | Plugins or Packages with a
public API | Number of teams | |--------------|----------|------------------------| -| 474 | 395 | 38 | +| 480 | 399 | 38 | ### Public API health stats | API Count | Any Count | Missing comments | Missing exports | |--------------|----------|-----------------|--------| -| 31860 | 179 | 21432 | 1007 | +| 32043 | 179 | 21580 | 1010 | ## Plugin Directory @@ -30,7 +30,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [Response Ops](https://github.com/orgs/elastic/teams/response-ops) | - | 214 | 0 | 209 | 19 | | | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 36 | 1 | 32 | 2 | | | [Machine Learning UI](https://github.com/orgs/elastic/teams/ml-ui) | AIOps plugin maintained by ML team. | 9 | 0 | 0 | 2 | -| | [Response Ops](https://github.com/orgs/elastic/teams/response-ops) | - | 370 | 0 | 361 | 22 | +| | [Response Ops](https://github.com/orgs/elastic/teams/response-ops) | - | 379 | 0 | 370 | 24 | | | [APM UI](https://github.com/orgs/elastic/teams/apm-ui) | The user interface for Elastic APM | 38 | 0 | 38 | 52 | | | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 9 | 0 | 9 | 0 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Considering using bfetch capabilities when fetching large amounts of data. This services supports batching HTTP requests and streaming responses back. | 80 | 1 | 71 | 2 | @@ -42,16 +42,16 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [Cloud Security Posture](https://github.com/orgs/elastic/teams/cloud-posture-security) | The cloud security posture plugin | 18 | 0 | 2 | 3 | | | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 13 | 0 | 13 | 1 | | | [Kibana Presentation](https://github.com/orgs/elastic/teams/kibana-presentation) | The Controls Plugin contains embeddable components intended to create a simple query interface for end users, and a powerful editing suite that allows dashboard authors to build controls | 212 | 0 | 204 | 7 | -| | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 2684 | 0 | 35 | 0 | +| | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 2686 | 0 | 29 | 0 | | crossClusterReplication | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 0 | 0 | 0 | 0 | -| | [Fleet](https://github.com/orgs/elastic/teams/fleet) | Add custom data integrations so they can be displayed in the Fleet integrations app | 103 | 0 | 84 | 1 | -| | [Kibana Presentation](https://github.com/orgs/elastic/teams/kibana-presentation) | Adds the Dashboard app to Kibana | 144 | 0 | 139 | 10 | +| | [Fleet](https://github.com/orgs/elastic/teams/fleet) | Add custom data integrations so they can be displayed in the Fleet integrations app | 104 | 0 | 85 | 1 | +| | [Kibana Presentation](https://github.com/orgs/elastic/teams/kibana-presentation) | Adds the Dashboard app to Kibana | 120 | 0 | 113 | 3 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | - | 52 | 0 | 51 | 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. | 3213 | 33 | 2509 | 23 | | | [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,13 +81,13 @@ 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 | | graph | [Data Discovery](https://github.com/orgs/elastic/teams/kibana-data-discovery) | - | 0 | 0 | 0 | 0 | | grokdebugger | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 0 | 0 | 0 | 0 | -| | [Journey Onboarding](https://github.com/orgs/elastic/teams/platform-onboarding) | Guided onboarding framework | 12 | 0 | 12 | 1 | +| | [Journey Onboarding](https://github.com/orgs/elastic/teams/platform-onboarding) | Guided onboarding framework | 19 | 0 | 19 | 3 | | | [Kibana Core](https://github.com/orgs/elastic/teams/kibana-core) | - | 143 | 0 | 104 | 0 | | | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 4 | 0 | 4 | 0 | | | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 177 | 0 | 172 | 3 | @@ -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 | @@ -134,7 +134,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | - | 32 | 0 | 13 | 0 | | | [Kibana Reporting Services](https://github.com/orgs/elastic/teams/kibana-reporting-services) | Kibana Screenshotting Plugin | 27 | 0 | 8 | 4 | | searchprofiler | [Stack Management](https://github.com/orgs/elastic/teams/kibana-stack-management) | - | 0 | 0 | 0 | 0 | -| | [Platform Security](https://github.com/orgs/elastic/teams/kibana-security) | This plugin provides authentication and authorization features, and exposes functionality to understand the capabilities of the currently authenticated user. | 247 | 0 | 90 | 0 | +| | [Platform Security](https://github.com/orgs/elastic/teams/kibana-security) | This plugin provides authentication and authorization features, and exposes functionality to understand the capabilities of the currently authenticated user. | 250 | 0 | 90 | 0 | | | [Security solution](https://github.com/orgs/elastic/teams/security-solution) | - | 55 | 0 | 54 | 23 | | | [Security Team](https://github.com/orgs/elastic/teams/security-team) | - | 3 | 0 | 3 | 1 | | | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Adds URL Service and sharing capabilities to Kibana | 114 | 0 | 55 | 10 | @@ -148,15 +148,15 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [Kibana Telemetry](https://github.com/orgs/elastic/teams/kibana-telemetry) | - | 31 | 0 | 26 | 6 | | | [Kibana Telemetry](https://github.com/orgs/elastic/teams/kibana-telemetry) | - | 1 | 0 | 1 | 0 | | | [Kibana Telemetry](https://github.com/orgs/elastic/teams/kibana-telemetry) | - | 11 | 0 | 10 | 0 | -| | [Protections Experience Team](https://github.com/orgs/elastic/teams/protections-experience) | Elastic threat intelligence helps you see if you are open to or have been subject to current or historical known threats | 20 | 0 | 4 | 3 | +| | [Protections Experience Team](https://github.com/orgs/elastic/teams/protections-experience) | Elastic threat intelligence helps you see if you are open to or have been subject to current or historical known threats | 26 | 0 | 8 | 3 | | | [Security solution](https://github.com/orgs/elastic/teams/security-solution) | - | 452 | 1 | 346 | 33 | | | [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) | - | 513 | 1 | 486 | 48 | -| | [App Services](https://github.com/orgs/elastic/teams/kibana-app-services) | Adds UI Actions service to Kibana | 132 | 0 | 91 | 11 | +| | [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 | 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. | 679 | 12 | 649 | 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 @@ -261,6 +261,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | Kibana Core | - | 16 | 0 | 16 | 0 | | | Kibana Core | - | 4 | 0 | 0 | 0 | | | Kibana Core | - | 10 | 1 | 10 | 0 | +| | Kibana Core | - | 14 | 0 | 11 | 0 | | | Kibana Core | - | 25 | 5 | 25 | 1 | | | Kibana Core | - | 7 | 0 | 7 | 1 | | | Kibana Core | - | 392 | 1 | 154 | 0 | @@ -300,6 +301,8 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | Kibana Core | - | 5 | 0 | 0 | 0 | | | Kibana Core | - | 6 | 0 | 6 | 0 | | | Kibana Core | - | 2 | 0 | 2 | 0 | +| | Kibana Core | - | 2 | 0 | 2 | 0 | +| | Kibana Core | - | 4 | 0 | 4 | 1 | | | Kibana Core | - | 106 | 1 | 75 | 0 | | | Kibana Core | - | 308 | 1 | 137 | 0 | | | Kibana Core | - | 71 | 0 | 51 | 0 | @@ -388,6 +391,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [Owner missing] | - | 74 | 0 | 71 | 0 | | | [Owner missing] | Security Solution auto complete | 56 | 1 | 41 | 1 | | | [Owner missing] | security solution elastic search utilities to use across plugins such lists, security_solution, cases, etc... | 67 | 0 | 61 | 1 | +| | [Owner missing] | - | 76 | 0 | 67 | 1 | | | [Owner missing] | Security Solution utilities for React hooks | 15 | 0 | 7 | 0 | | | [Owner missing] | io ts utilities and types to be shared with plugins from the security solution project | 145 | 0 | 127 | 0 | | | [Owner missing] | io ts utilities and types to be shared with plugins from the security solution project | 505 | 1 | 492 | 0 | @@ -441,7 +445,7 @@ tags: ['contributor', 'dev', 'apidocs', 'kibana'] | | [Owner missing] | - | 113 | 1 | 65 | 0 | | | [Owner missing] | - | 83 | 0 | 83 | 1 | | | [Owner missing] | - | 7 | 0 | 6 | 0 | -| | [Owner missing] | - | 48 | 0 | 3 | 0 | +| | [Owner missing] | - | 55 | 0 | 5 | 0 | | | [Owner missing] | - | 34 | 0 | 14 | 1 | | | [Owner missing] | - | 2 | 0 | 2 | 0 | | | [Owner missing] | - | 30 | 0 | 20 | 0 | diff --git a/api_docs/presentation_util.mdx b/api_docs/presentation_util.mdx index 191e4e563cb34..7e399db93218d 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-28 +date: 2022-10-04 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 fb048ac82442b..7efed272b7261 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-28 +date: 2022-10-04 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 c0b505ed6394d..f59d7c397918a 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-28 +date: 2022-10-04 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 4088e39f97108..dbd1e74d06cd4 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-28 +date: 2022-10-04 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 4f8cf9c8e8dbf..397ea6ae4dc91 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'rollup'] --- import rollupObj from './rollup.devdocs.json'; diff --git a/api_docs/rule_registry.devdocs.json b/api_docs/rule_registry.devdocs.json index 424057fd0db70..089f973bc0bf0 100644 --- a/api_docs/rule_registry.devdocs.json +++ b/api_docs/rule_registry.devdocs.json @@ -1917,7 +1917,7 @@ "\nID of the Kibana feature associated with the index.\nUsed by alerts-as-data RBAC.\n\nNote from @dhurley14\nThe purpose of the `feature` param is to force the user to update\nthe data structure which contains the mapping of consumers to alerts\nas data indices. The idea is it is typed such that it forces the\nuser to go to the code and modify it. At least until a better system\nis put in place or we move the alerts as data client out of rule registry.\n" ], "signature": [ - "\"observability\" | \"logs\" | \"apm\" | \"uptime\" | \"siem\" | \"infrastructure\"" + "\"infrastructure\" | \"observability\" | \"logs\" | \"apm\" | \"uptime\" | \"siem\"" ], "path": "x-pack/plugins/rule_registry/server/rule_data_plugin_service/index_options.ts", "deprecated": false, @@ -4270,7 +4270,7 @@ "label": "ParsedTechnicalFields", "description": [], "signature": [ - "{ readonly '@timestamp': string; readonly \"kibana.alert.rule.rule_type_id\": string; readonly \"kibana.alert.rule.consumer\": string; readonly \"kibana.alert.rule.producer\": string; readonly \"kibana.space_ids\": string[]; readonly \"kibana.alert.uuid\": string; readonly \"kibana.alert.instance.id\": string; readonly \"kibana.alert.status\": string; readonly \"kibana.alert.rule.category\": string; readonly \"kibana.alert.rule.uuid\": string; readonly \"kibana.alert.rule.name\": string; readonly tags?: string[] | undefined; readonly 'event.action'?: string | undefined; readonly \"kibana.alert.rule.parameters\"?: { [key: string]: unknown; } | undefined; readonly \"kibana.alert.start\"?: string | undefined; readonly \"kibana.alert.end\"?: string | undefined; readonly \"kibana.alert.duration.us\"?: number | undefined; readonly \"kibana.alert.severity\"?: string | undefined; readonly \"kibana.version\"?: string | undefined; readonly \"ecs.version\"?: string | undefined; readonly \"kibana.alert.risk_score\"?: number | undefined; readonly \"kibana.alert.workflow_status\"?: string | undefined; readonly \"kibana.alert.workflow_user\"?: string | undefined; readonly \"kibana.alert.workflow_reason\"?: string | undefined; readonly \"kibana.alert.system_status\"?: string | undefined; readonly \"kibana.alert.action_group\"?: string | undefined; readonly \"kibana.alert.reason\"?: string | undefined; readonly \"kibana.alert.rule.author\"?: string | undefined; readonly \"kibana.alert.rule.created_at\"?: string | undefined; readonly \"kibana.alert.rule.created_by\"?: string | undefined; readonly \"kibana.alert.rule.description\"?: string | undefined; readonly \"kibana.alert.rule.enabled\"?: string | undefined; readonly \"kibana.alert.rule.execution.uuid\"?: string | undefined; readonly \"kibana.alert.rule.from\"?: string | undefined; readonly \"kibana.alert.rule.interval\"?: string | undefined; readonly \"kibana.alert.rule.license\"?: string | undefined; readonly \"kibana.alert.rule.note\"?: string | undefined; readonly \"kibana.alert.rule.references\"?: string[] | undefined; readonly \"kibana.alert.rule.rule_id\"?: string | undefined; readonly \"kibana.alert.rule.rule_name_override\"?: string | undefined; readonly \"kibana.alert.rule.tags\"?: string[] | undefined; readonly \"kibana.alert.rule.to\"?: string | undefined; readonly \"kibana.alert.rule.type\"?: string | undefined; readonly \"kibana.alert.rule.updated_at\"?: string | undefined; readonly \"kibana.alert.rule.updated_by\"?: string | undefined; readonly \"kibana.alert.rule.version\"?: string | undefined; readonly 'event.kind'?: string | undefined; }" + "{ readonly '@timestamp': string; readonly \"kibana.alert.rule.rule_type_id\": string; readonly \"kibana.alert.rule.consumer\": string; readonly \"kibana.alert.rule.producer\": string; readonly \"kibana.space_ids\": string[]; readonly \"kibana.alert.uuid\": string; readonly \"kibana.alert.instance.id\": string; readonly \"kibana.alert.status\": string; readonly \"kibana.alert.rule.category\": string; readonly \"kibana.alert.rule.uuid\": string; readonly \"kibana.alert.rule.name\": string; readonly tags?: string[] | undefined; readonly 'event.action'?: string | undefined; readonly \"kibana.alert.rule.execution.uuid\"?: string | undefined; readonly \"kibana.alert.rule.parameters\"?: { [key: string]: unknown; } | undefined; readonly \"kibana.alert.start\"?: string | undefined; readonly \"kibana.alert.end\"?: string | undefined; readonly \"kibana.alert.duration.us\"?: number | undefined; readonly \"kibana.alert.severity\"?: string | undefined; readonly \"kibana.version\"?: string | undefined; readonly \"ecs.version\"?: string | undefined; readonly \"kibana.alert.risk_score\"?: number | undefined; readonly \"kibana.alert.workflow_status\"?: string | undefined; readonly \"kibana.alert.workflow_user\"?: string | undefined; readonly \"kibana.alert.workflow_reason\"?: string | undefined; readonly \"kibana.alert.system_status\"?: string | undefined; readonly \"kibana.alert.action_group\"?: string | undefined; readonly \"kibana.alert.reason\"?: string | undefined; readonly \"kibana.alert.rule.author\"?: string | undefined; readonly \"kibana.alert.rule.created_at\"?: string | undefined; readonly \"kibana.alert.rule.created_by\"?: string | undefined; readonly \"kibana.alert.rule.description\"?: string | undefined; readonly \"kibana.alert.rule.enabled\"?: string | undefined; readonly \"kibana.alert.rule.from\"?: string | undefined; readonly \"kibana.alert.rule.interval\"?: string | undefined; readonly \"kibana.alert.rule.license\"?: string | undefined; readonly \"kibana.alert.rule.note\"?: string | undefined; readonly \"kibana.alert.rule.references\"?: string[] | undefined; readonly \"kibana.alert.rule.rule_id\"?: string | undefined; readonly \"kibana.alert.rule.rule_name_override\"?: string | undefined; readonly \"kibana.alert.rule.tags\"?: string[] | undefined; readonly \"kibana.alert.rule.to\"?: string | undefined; readonly \"kibana.alert.rule.type\"?: string | undefined; readonly \"kibana.alert.rule.updated_at\"?: string | undefined; readonly \"kibana.alert.rule.updated_by\"?: string | undefined; readonly \"kibana.alert.rule.version\"?: string | undefined; readonly 'event.kind'?: string | undefined; }" ], "path": "x-pack/plugins/rule_registry/common/parse_technical_fields.ts", "deprecated": false, diff --git a/api_docs/rule_registry.mdx b/api_docs/rule_registry.mdx index 15c672f3f6fee..f48194ae5bd14 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-28 +date: 2022-10-04 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 001d245e9adf3..2be7beb68c708 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'runtimeFields'] --- import runtimeFieldsObj from './runtime_fields.devdocs.json'; diff --git a/api_docs/saved_objects.devdocs.json b/api_docs/saved_objects.devdocs.json index 6d40e242e3cd5..71d53634b7540 100644 --- a/api_docs/saved_objects.devdocs.json +++ b/api_docs/saved_objects.devdocs.json @@ -1557,18 +1557,6 @@ "plugin": "savedObjectsTaggingOss", "path": "src/plugins/saved_objects_tagging_oss/public/api.ts" }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/services/saved_object_loader.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/services/saved_object_loader.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/services/saved_object_loader.ts" - }, { "plugin": "dashboard", "path": "src/plugins/dashboard/public/application/actions/clone_panel_action.tsx" @@ -1580,22 +1568,6 @@ { "plugin": "dashboard", "path": "src/plugins/dashboard/public/application/actions/clone_panel_action.tsx" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/application/lib/dashboard_tagging.ts" - }, - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/application/lib/dashboard_tagging.ts" } ], "children": [ @@ -3121,12 +3093,7 @@ "deprecated": true, "removeBy": "8.8.0", "trackAdoption": false, - "references": [ - { - "plugin": "dashboard", - "path": "src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts" - } - ] + "references": [] }, { "parentPluginId": "savedObjects", diff --git a/api_docs/saved_objects.mdx b/api_docs/saved_objects.mdx index 51bc9b36316c4..d582458137cf9 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-28 +date: 2022-10-04 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 3a6b9b0a9e738..4e6d34158bb84 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-28 +date: 2022-10-04 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 8fb7925eb7808..7722b187a54d7 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-28 +date: 2022-10-04 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 9a0469a70f642..c112fd930e4de 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-28 +date: 2022-10-04 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 8abc78f1fdc7e..5299c1ca0eaca 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedObjectsTaggingOss'] --- import savedObjectsTaggingOssObj from './saved_objects_tagging_oss.devdocs.json'; diff --git a/api_docs/saved_search.devdocs.json b/api_docs/saved_search.devdocs.json index df52fe959fea2..8e6b2e5503d3c 100644 --- a/api_docs/saved_search.devdocs.json +++ b/api_docs/saved_search.devdocs.json @@ -661,7 +661,7 @@ "label": "sharingSavedObjectProps", "description": [], "signature": [ - "{ outcome?: \"exactMatch\" | \"aliasMatch\" | \"conflict\" | undefined; aliasTargetId?: string | undefined; aliasPurpose?: \"savedObjectConversion\" | \"savedObjectImport\" | undefined; errorJSON?: string | undefined; } | undefined" + "{ outcome?: \"conflict\" | \"exactMatch\" | \"aliasMatch\" | undefined; aliasTargetId?: string | undefined; aliasPurpose?: \"savedObjectConversion\" | \"savedObjectImport\" | undefined; errorJSON?: string | undefined; } | undefined" ], "path": "src/plugins/saved_search/public/services/saved_searches/types.ts", "deprecated": false, diff --git a/api_docs/saved_search.mdx b/api_docs/saved_search.mdx index a39c3adbc8200..06e4379d4afd9 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'savedSearch'] --- import savedSearchObj from './saved_search.devdocs.json'; diff --git a/api_docs/screenshot_mode.devdocs.json b/api_docs/screenshot_mode.devdocs.json index c6be83e928479..ab834dfc733bc 100644 --- a/api_docs/screenshot_mode.devdocs.json +++ b/api_docs/screenshot_mode.devdocs.json @@ -139,13 +139,7 @@ "label": "ScreenshotModeRequestHandlerContext", "description": [], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.RequestHandlerContext", - "text": "RequestHandlerContext" - }, + "RequestHandlerContext", " & { screenshotMode: Promise<{ isScreenshot: boolean; }>; }" ], "path": "src/plugins/screenshot_mode/server/types.ts", diff --git a/api_docs/screenshot_mode.mdx b/api_docs/screenshot_mode.mdx index 6eaf962f670fa..fda8615811c46 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-28 +date: 2022-10-04 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 8cb0692d0c854..f4735a3d7a260 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'screenshotting'] --- import screenshottingObj from './screenshotting.devdocs.json'; diff --git a/api_docs/security.devdocs.json b/api_docs/security.devdocs.json index d400f91576d7d..1b69dcaad6959 100644 --- a/api_docs/security.devdocs.json +++ b/api_docs/security.devdocs.json @@ -125,6 +125,22 @@ "path": "x-pack/plugins/security/common/model/authenticated_user.ts", "deprecated": false, "trackAdoption": false + }, + { + "parentPluginId": "security", + "id": "def-public.AuthenticatedUser.profile_uid", + "type": "string", + "tags": [], + "label": "profile_uid", + "description": [ + "\nUser profile ID of this user." + ], + "signature": [ + "string | undefined" + ], + "path": "x-pack/plugins/security/common/model/authenticated_user.ts", + "deprecated": false, + "trackAdoption": false } ], "initialIsOpen": false @@ -1522,6 +1538,22 @@ "path": "x-pack/plugins/security/common/model/authenticated_user.ts", "deprecated": false, "trackAdoption": false + }, + { + "parentPluginId": "security", + "id": "def-server.AuthenticatedUser.profile_uid", + "type": "string", + "tags": [], + "label": "profile_uid", + "description": [ + "\nUser profile ID of this user." + ], + "signature": [ + "string | undefined" + ], + "path": "x-pack/plugins/security/common/model/authenticated_user.ts", + "deprecated": false, + "trackAdoption": false } ], "initialIsOpen": false @@ -3077,6 +3109,22 @@ "path": "x-pack/plugins/security/common/model/authenticated_user.ts", "deprecated": false, "trackAdoption": false + }, + { + "parentPluginId": "security", + "id": "def-common.AuthenticatedUser.profile_uid", + "type": "string", + "tags": [], + "label": "profile_uid", + "description": [ + "\nUser profile ID of this user." + ], + "signature": [ + "string | undefined" + ], + "path": "x-pack/plugins/security/common/model/authenticated_user.ts", + "deprecated": false, + "trackAdoption": false } ], "initialIsOpen": false diff --git a/api_docs/security.mdx b/api_docs/security.mdx index e6f2900462223..2800db424ba6e 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'security'] --- import securityObj from './security.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Platform Security](https://github.com/orgs/elastic/teams/kibana-securit | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 247 | 0 | 90 | 0 | +| 250 | 0 | 90 | 0 | ## Client diff --git a/api_docs/security_solution.devdocs.json b/api_docs/security_solution.devdocs.json index 8ad8f2f5fe218..c3ab461b2eb22 100644 --- a/api_docs/security_solution.devdocs.json +++ b/api_docs/security_solution.devdocs.json @@ -768,13 +768,7 @@ "label": "core", "description": [], "signature": [ - { - "pluginId": "core", - "scope": "server", - "docId": "kibCorePluginApi", - "section": "def-server.CoreRequestHandlerContext", - "text": "CoreRequestHandlerContext" - } + "CoreRequestHandlerContext" ], "path": "x-pack/plugins/security_solution/server/types.ts", "deprecated": false, diff --git a/api_docs/security_solution.mdx b/api_docs/security_solution.mdx index c59c106fce254..3ddca540a2d16 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-28 +date: 2022-10-04 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 ad4253bd0d7e5..e54037feb3552 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-28 +date: 2022-10-04 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 e6f9de45dbb58..976c243de6395 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-28 +date: 2022-10-04 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 8a45ec4089ad2..f83be535a94bc 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-28 +date: 2022-10-04 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 94f8821728343..7b751efc3d1dc 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-28 +date: 2022-10-04 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 cb3df93effb09..7c124256a7976 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-28 +date: 2022-10-04 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 a71b61831fb69..7bf19fb25c36b 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-28 +date: 2022-10-04 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 b84502a5d8c55..3cabbc8a83828 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-28 +date: 2022-10-04 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 dfdbd20746f57..e3220b9e593a8 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-28 +date: 2022-10-04 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 edb998b57d6f5..03d8bceec41f2 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-28 +date: 2022-10-04 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 c23dd99eb95e3..a3721f57358da 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-28 +date: 2022-10-04 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 5e8ae624dfe82..5c29d491cf1d1 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'telemetryManagementSection'] --- import telemetryManagementSectionObj from './telemetry_management_section.devdocs.json'; diff --git a/api_docs/threat_intelligence.devdocs.json b/api_docs/threat_intelligence.devdocs.json index a29de53bf77a5..d5d35c60068c4 100644 --- a/api_docs/threat_intelligence.devdocs.json +++ b/api_docs/threat_intelligence.devdocs.json @@ -274,6 +274,103 @@ } ], "returnComment": [] + }, + { + "parentPluginId": "threatIntelligence", + "id": "def-public.SecuritySolutionPluginContext.useQuery", + "type": "Function", + "tags": [], + "label": "useQuery", + "description": [], + "signature": [ + "() => ", + "Query" + ], + "path": "x-pack/plugins/threat_intelligence/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "returnComment": [] + }, + { + "parentPluginId": "threatIntelligence", + "id": "def-public.SecuritySolutionPluginContext.useFilters", + "type": "Function", + "tags": [], + "label": "useFilters", + "description": [], + "signature": [ + "() => ", + "Filter", + "[]" + ], + "path": "x-pack/plugins/threat_intelligence/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "returnComment": [] + }, + { + "parentPluginId": "threatIntelligence", + "id": "def-public.SecuritySolutionPluginContext.useGlobalTime", + "type": "Function", + "tags": [], + "label": "useGlobalTime", + "description": [], + "signature": [ + "() => ", + "TimeRange" + ], + "path": "x-pack/plugins/threat_intelligence/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "children": [], + "returnComment": [] + }, + { + "parentPluginId": "threatIntelligence", + "id": "def-public.SecuritySolutionPluginContext.SiemSearchBar", + "type": "Function", + "tags": [], + "label": "SiemSearchBar", + "description": [], + "signature": [ + "React.VoidFunctionComponent" + ], + "path": "x-pack/plugins/threat_intelligence/public/types.ts", + "deprecated": false, + "trackAdoption": false, + "returnComment": [], + "children": [ + { + "parentPluginId": "threatIntelligence", + "id": "def-public.SecuritySolutionPluginContext.SiemSearchBar.$1", + "type": "Uncategorized", + "tags": [], + "label": "props", + "description": [], + "signature": [ + "P" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "threatIntelligence", + "id": "def-public.SecuritySolutionPluginContext.SiemSearchBar.$2", + "type": "Any", + "tags": [], + "label": "context", + "description": [], + "signature": [ + "any" + ], + "path": "node_modules/@types/react/index.d.ts", + "deprecated": false, + "trackAdoption": false + } + ] } ], "initialIsOpen": false diff --git a/api_docs/threat_intelligence.mdx b/api_docs/threat_intelligence.mdx index 80ac38a8ed990..5834a118d4c1e 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'threatIntelligence'] --- import threatIntelligenceObj from './threat_intelligence.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Protections Experience Team](https://github.com/orgs/elastic/teams/prot | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 20 | 0 | 4 | 3 | +| 26 | 0 | 8 | 3 | ## Client diff --git a/api_docs/timelines.devdocs.json b/api_docs/timelines.devdocs.json index 5875aa47c1309..4b5ec5ce28970 100644 --- a/api_docs/timelines.devdocs.json +++ b/api_docs/timelines.devdocs.json @@ -3192,7 +3192,7 @@ "IFieldSubType", " | undefined; type?: string | undefined; })[]; id: string; title: string; filters?: ", "Filter", - "[] | undefined; dataViewId: string | null; sort: ", + "[] | undefined; dataViewId: string | null; savedObjectId: string | null; sort: ", "SortColumnTimeline", "[]; version: string | null; filterManager?: ", { @@ -3218,7 +3218,7 @@ }, "; description?: string | null | undefined; esTypes?: string[] | undefined; example?: string | number | null | undefined; format?: string | undefined; linkField?: string | undefined; placeholder?: string | undefined; subType?: ", "IFieldSubType", - " | undefined; type?: string | undefined; })[]; savedObjectId: string | null; isLoading: boolean; dataProviders: ", + " | undefined; type?: string | undefined; })[]; isLoading: boolean; dataProviders: ", { "pluginId": "timelines", "scope": "common", diff --git a/api_docs/timelines.mdx b/api_docs/timelines.mdx index ecb0a115ea511..f33b1267f8f43 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-28 +date: 2022-10-04 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 70b733e2c869e..3237f674591f6 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'transform'] --- import transformObj from './transform.devdocs.json'; diff --git a/api_docs/triggers_actions_ui.devdocs.json b/api_docs/triggers_actions_ui.devdocs.json index 316d5941b9d23..d6351e414ae46 100644 --- a/api_docs/triggers_actions_ui.devdocs.json +++ b/api_docs/triggers_actions_ui.devdocs.json @@ -3139,7 +3139,7 @@ "description": [], "signature": [ "BasicFields", - " & { tags?: string[] | undefined; kibana?: string[] | undefined; \"@timestamp\"?: string[] | undefined; \"event.action\"?: string[] | undefined; \"kibana.alert.rule.parameters\"?: string[] | undefined; \"kibana.alert.rule.rule_type_id\"?: string[] | undefined; \"kibana.alert.rule.consumer\"?: string[] | undefined; \"kibana.alert.rule.producer\"?: string[] | undefined; \"kibana.space_ids\"?: string[] | undefined; \"kibana.alert.uuid\"?: string[] | undefined; \"kibana.alert.instance.id\"?: string[] | undefined; \"kibana.alert.start\"?: string[] | undefined; \"kibana.alert.end\"?: string[] | undefined; \"kibana.alert.duration.us\"?: string[] | undefined; \"kibana.alert.severity\"?: string[] | undefined; \"kibana.alert.status\"?: string[] | undefined; \"kibana.version\"?: string[] | undefined; \"ecs.version\"?: string[] | undefined; \"kibana.alert.risk_score\"?: string[] | undefined; \"kibana.alert.workflow_status\"?: string[] | undefined; \"kibana.alert.workflow_user\"?: string[] | undefined; \"kibana.alert.workflow_reason\"?: string[] | undefined; \"kibana.alert.system_status\"?: string[] | undefined; \"kibana.alert.action_group\"?: string[] | undefined; \"kibana.alert.reason\"?: string[] | undefined; \"kibana.alert.rule.author\"?: string[] | undefined; \"kibana.alert.rule.category\"?: string[] | undefined; \"kibana.alert.rule.uuid\"?: string[] | undefined; \"kibana.alert.rule.created_at\"?: string[] | undefined; \"kibana.alert.rule.created_by\"?: string[] | undefined; \"kibana.alert.rule.description\"?: string[] | undefined; \"kibana.alert.rule.enabled\"?: string[] | undefined; \"kibana.alert.rule.execution.uuid\"?: string[] | undefined; \"kibana.alert.rule.from\"?: string[] | undefined; \"kibana.alert.rule.interval\"?: string[] | undefined; \"kibana.alert.rule.license\"?: string[] | undefined; \"kibana.alert.rule.name\"?: string[] | undefined; \"kibana.alert.rule.note\"?: string[] | undefined; \"kibana.alert.rule.references\"?: string[] | undefined; \"kibana.alert.rule.rule_id\"?: string[] | undefined; \"kibana.alert.rule.rule_name_override\"?: string[] | undefined; \"kibana.alert.rule.tags\"?: string[] | undefined; \"kibana.alert.rule.to\"?: string[] | undefined; \"kibana.alert.rule.type\"?: string[] | undefined; \"kibana.alert.rule.updated_at\"?: string[] | undefined; \"kibana.alert.rule.updated_by\"?: string[] | undefined; \"kibana.alert.rule.version\"?: string[] | undefined; \"event.kind\"?: string[] | undefined; \"event.module\"?: string[] | undefined; \"kibana.alert.evaluation.threshold\"?: string[] | undefined; \"kibana.alert.evaluation.value\"?: string[] | undefined; \"kibana.alert.building_block_type\"?: string[] | undefined; \"kibana.alert.rule.exceptions_list\"?: string[] | undefined; \"kibana.alert.rule.namespace\"?: string[] | undefined; \"kibana.alert\"?: string[] | undefined; \"kibana.alert.rule\"?: string[] | undefined; } & { [x: string]: unknown[]; }" + " & { tags?: string[] | undefined; kibana?: string[] | undefined; \"@timestamp\"?: string[] | undefined; \"kibana.alert.rule.rule_type_id\"?: string[] | undefined; \"kibana.alert.rule.consumer\"?: string[] | undefined; \"event.action\"?: string[] | undefined; \"kibana.alert.rule.execution.uuid\"?: string[] | undefined; \"kibana.alert.rule.parameters\"?: string[] | undefined; \"kibana.alert.rule.producer\"?: string[] | undefined; \"kibana.space_ids\"?: string[] | undefined; \"kibana.alert.uuid\"?: string[] | undefined; \"kibana.alert.instance.id\"?: string[] | undefined; \"kibana.alert.start\"?: string[] | undefined; \"kibana.alert.end\"?: string[] | undefined; \"kibana.alert.duration.us\"?: string[] | undefined; \"kibana.alert.severity\"?: string[] | undefined; \"kibana.alert.status\"?: string[] | undefined; \"kibana.version\"?: string[] | undefined; \"ecs.version\"?: string[] | undefined; \"kibana.alert.risk_score\"?: string[] | undefined; \"kibana.alert.workflow_status\"?: string[] | undefined; \"kibana.alert.workflow_user\"?: string[] | undefined; \"kibana.alert.workflow_reason\"?: string[] | undefined; \"kibana.alert.system_status\"?: string[] | undefined; \"kibana.alert.action_group\"?: string[] | undefined; \"kibana.alert.reason\"?: string[] | undefined; \"kibana.alert.rule.author\"?: string[] | undefined; \"kibana.alert.rule.category\"?: string[] | undefined; \"kibana.alert.rule.uuid\"?: string[] | undefined; \"kibana.alert.rule.created_at\"?: string[] | undefined; \"kibana.alert.rule.created_by\"?: string[] | undefined; \"kibana.alert.rule.description\"?: string[] | undefined; \"kibana.alert.rule.enabled\"?: string[] | undefined; \"kibana.alert.rule.from\"?: string[] | undefined; \"kibana.alert.rule.interval\"?: string[] | undefined; \"kibana.alert.rule.license\"?: string[] | undefined; \"kibana.alert.rule.name\"?: string[] | undefined; \"kibana.alert.rule.note\"?: string[] | undefined; \"kibana.alert.rule.references\"?: string[] | undefined; \"kibana.alert.rule.rule_id\"?: string[] | undefined; \"kibana.alert.rule.rule_name_override\"?: string[] | undefined; \"kibana.alert.rule.tags\"?: string[] | undefined; \"kibana.alert.rule.to\"?: string[] | undefined; \"kibana.alert.rule.type\"?: string[] | undefined; \"kibana.alert.rule.updated_at\"?: string[] | undefined; \"kibana.alert.rule.updated_by\"?: string[] | undefined; \"kibana.alert.rule.version\"?: string[] | undefined; \"event.kind\"?: string[] | undefined; \"event.module\"?: string[] | undefined; \"kibana.alert.evaluation.threshold\"?: string[] | undefined; \"kibana.alert.evaluation.value\"?: string[] | undefined; \"kibana.alert.building_block_type\"?: string[] | undefined; \"kibana.alert.rule.exceptions_list\"?: string[] | undefined; \"kibana.alert.rule.namespace\"?: string[] | undefined; \"kibana.alert\"?: string[] | undefined; \"kibana.alert.rule\"?: string[] | undefined; } & { [x: string]: unknown[]; }" ], "path": "x-pack/plugins/triggers_actions_ui/public/types.ts", "deprecated": false, @@ -3585,20 +3585,6 @@ "deprecated": false, "trackAdoption": false }, - { - "parentPluginId": "triggersActionsUi", - "id": "def-public.AlertStatus.actionSubgroup", - "type": "string", - "tags": [], - "label": "actionSubgroup", - "description": [], - "signature": [ - "string | undefined" - ], - "path": "x-pack/plugins/alerting/common/alert_summary.ts", - "deprecated": false, - "trackAdoption": false - }, { "parentPluginId": "triggersActionsUi", "id": "def-public.AlertStatus.activeStartDate", diff --git a/api_docs/triggers_actions_ui.mdx b/api_docs/triggers_actions_ui.mdx index cfa8f8965332e..5146401d1a6e8 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-28 +date: 2022-10-04 tags: ['contributor', 'dev', 'apidocs', 'kibana', 'triggersActionsUi'] --- import triggersActionsUiObj from './triggers_actions_ui.devdocs.json'; @@ -21,7 +21,7 @@ Contact [Response Ops](https://github.com/orgs/elastic/teams/response-ops) for q | Public API count | Any count | Items lacking comments | Missing exports | |-------------------|-----------|------------------------|-----------------| -| 513 | 1 | 486 | 48 | +| 512 | 1 | 485 | 48 | ## Client diff --git a/api_docs/ui_actions.devdocs.json b/api_docs/ui_actions.devdocs.json index 293aa53e4d804..d224e96cb9e8a 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 25fd9d32aac51..3997d6297067a 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-28 +date: 2022-10-04 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 f85563ce18a73..0644b977bc92c 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-28 +date: 2022-10-04 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 2aae0fbddf27b..bfb157318d95b 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-28 +date: 2022-10-04 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 8a490ca91dd2b..5678db92f00cd 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 261ef25b80e9b..7ea6ab07192c7 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-28 +date: 2022-10-04 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 1e75d7da1deb9..76e6013841c75 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-28 +date: 2022-10-04 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 d2cdaf4d89c84..bc3da076b5916 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-28 +date: 2022-10-04 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 5f6baf6d86c5f..b67acbd363bf0 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-28 +date: 2022-10-04 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 470423b8266a7..1c83be4e34381 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-28 +date: 2022-10-04 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 ff57731114146..7c1cb5bae3809 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-28 +date: 2022-10-04 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 1da13d1fcc094..4b95ba2b035fd 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-28 +date: 2022-10-04 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 d30f1b6a560aa..1ea7a1e4b9250 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-28 +date: 2022-10-04 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 f8d894bdaa7de..3ffea5a4f58e6 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-28 +date: 2022-10-04 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 deb819de77df3..414b4de0b2363 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-28 +date: 2022-10-04 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 042fb74b10af4..9306f4a52fd35 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-28 +date: 2022-10-04 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 2458fbb4d9dee..8d5ffda6491b3 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-28 +date: 2022-10-04 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 606b4dcf05e16..9a7a8eb698283 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-28 +date: 2022-10-04 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 e56cd5d8f509d..443abb630d8da 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-28 +date: 2022-10-04 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 9ac63dfe30ccc..958b60a5150f5 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-28 +date: 2022-10-04 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 adc8f3022cb1a..befca8a834867 100644 --- a/api_docs/visualizations.devdocs.json +++ b/api_docs/visualizations.devdocs.json @@ -3042,7 +3042,7 @@ "label": "sharingSavedObjectProps", "description": [], "signature": [ - "{ outcome?: \"exactMatch\" | \"aliasMatch\" | \"conflict\" | undefined; aliasTargetId?: string | undefined; aliasPurpose?: \"savedObjectConversion\" | \"savedObjectImport\" | undefined; errorJSON?: string | undefined; } | undefined" + "{ outcome?: \"conflict\" | \"exactMatch\" | \"aliasMatch\" | undefined; aliasTargetId?: string | undefined; aliasPurpose?: \"savedObjectConversion\" | \"savedObjectImport\" | undefined; errorJSON?: string | undefined; } | undefined" ], "path": "src/plugins/visualizations/public/types.ts", "deprecated": false, @@ -9284,6 +9284,203 @@ ], "initialIsOpen": false }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration", + "type": "Interface", + "tags": [], + "label": "MetricVisConfiguration", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.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.MetricVisConfiguration.layerType", + "type": "string", + "tags": [], + "label": "layerType", + "description": [], + "signature": [ + "\"data\"" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.metricAccessor", + "type": "string", + "tags": [], + "label": "metricAccessor", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.secondaryMetricAccessor", + "type": "string", + "tags": [], + "label": "secondaryMetricAccessor", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.maxAccessor", + "type": "string", + "tags": [], + "label": "maxAccessor", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.breakdownByAccessor", + "type": "string", + "tags": [], + "label": "breakdownByAccessor", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.collapseFn", + "type": "string", + "tags": [], + "label": "collapseFn", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.subtitle", + "type": "string", + "tags": [], + "label": "subtitle", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.secondaryPrefix", + "type": "string", + "tags": [], + "label": "secondaryPrefix", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.progressDirection", + "type": "CompoundType", + "tags": [], + "label": "progressDirection", + "description": [], + "signature": [ + "LayoutDirection", + " | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.color", + "type": "string", + "tags": [], + "label": "color", + "description": [], + "signature": [ + "string | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.palette", + "type": "Object", + "tags": [], + "label": "palette", + "description": [], + "signature": [ + "PaletteOutput", + "<", + "CustomPaletteParams", + "> | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.MetricVisConfiguration.maxCols", + "type": "number", + "tags": [], + "label": "maxCols", + "description": [], + "signature": [ + "number | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, { "parentPluginId": "visualizations", "id": "def-common.MovingAverageParams", @@ -9332,100 +9529,393 @@ "children": [ { "parentPluginId": "visualizations", - "id": "def-common.NavigateToLensContext.layers", - "type": "Array", + "id": "def-common.NavigateToLensContext.layers", + "type": "Array", + "tags": [], + "label": "layers", + "description": [], + "signature": [ + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.Layer", + "text": "Layer" + }, + "[]" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/context.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.NavigateToLensContext.type", + "type": "string", + "tags": [], + "label": "type", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/context.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.NavigateToLensContext.configuration", + "type": "Uncategorized", + "tags": [], + "label": "configuration", + "description": [], + "signature": [ + "T" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/context.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.NavigateToLensContext.indexPatternIds", + "type": "Array", + "tags": [], + "label": "indexPatternIds", + "description": [], + "signature": [ + "string[]" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/context.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.NumberValueFormat", + "type": "Interface", + "tags": [], + "label": "NumberValueFormat", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/common.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-common.NumberValueFormat.id", + "type": "string", + "tags": [], + "label": "id", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/common.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.NumberValueFormat.params", + "type": "Object", + "tags": [], + "label": "params", + "description": [], + "signature": [ + "{ decimals: number; suffix?: string | undefined; } | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/common.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "initialIsOpen": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PagingState", + "type": "Interface", + "tags": [], + "label": "PagingState", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false, + "children": [ + { + "parentPluginId": "visualizations", + "id": "def-common.PagingState.size", + "type": "number", + "tags": [], + "label": "size", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + }, + { + "parentPluginId": "visualizations", + "id": "def-common.PagingState.enabled", + "type": "boolean", + "tags": [], + "label": "enabled", + "description": [], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", + "deprecated": false, + "trackAdoption": false + } + ], + "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": "layers", + "label": "nestedLegend", "description": [], "signature": [ - { - "pluginId": "visualizations", - "scope": "common", - "docId": "kibVisualizationsPluginApi", - "section": "def-common.Layer", - "text": "Layer" - }, - "[]" + "boolean | undefined" ], - "path": "src/plugins/visualizations/common/convert_to_lens/types/context.ts", + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "visualizations", - "id": "def-common.NavigateToLensContext.type", - "type": "string", + "id": "def-common.PartitionLayerState.percentDecimals", + "type": "number", "tags": [], - "label": "type", + "label": "percentDecimals", "description": [], - "path": "src/plugins/visualizations/common/convert_to_lens/types/context.ts", + "signature": [ + "number | undefined" + ], + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "visualizations", - "id": "def-common.NavigateToLensContext.configuration", - "type": "Uncategorized", + "id": "def-common.PartitionLayerState.emptySizeRatio", + "type": "number", "tags": [], - "label": "configuration", + "label": "emptySizeRatio", "description": [], "signature": [ - "T" + "number | undefined" ], - "path": "src/plugins/visualizations/common/convert_to_lens/types/context.ts", + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", "deprecated": false, "trackAdoption": false }, { "parentPluginId": "visualizations", - "id": "def-common.NavigateToLensContext.indexPatternIds", - "type": "Array", + "id": "def-common.PartitionLayerState.legendMaxLines", + "type": "number", "tags": [], - "label": "indexPatternIds", + "label": "legendMaxLines", "description": [], "signature": [ - "string[]" + "number | undefined" ], - "path": "src/plugins/visualizations/common/convert_to_lens/types/context.ts", + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", "deprecated": false, "trackAdoption": false - } - ], - "initialIsOpen": false - }, - { - "parentPluginId": "visualizations", - "id": "def-common.NumberValueFormat", - "type": "Interface", - "tags": [], - "label": "NumberValueFormat", - "description": [], - "path": "src/plugins/visualizations/common/convert_to_lens/types/common.ts", - "deprecated": false, - "trackAdoption": false, - "children": [ + }, { "parentPluginId": "visualizations", - "id": "def-common.NumberValueFormat.id", - "type": "string", + "id": "def-common.PartitionLayerState.legendSize", + "type": "CompoundType", "tags": [], - "label": "id", + "label": "legendSize", "description": [], - "path": "src/plugins/visualizations/common/convert_to_lens/types/common.ts", + "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.NumberValueFormat.params", - "type": "Object", + "id": "def-common.PartitionLayerState.truncateLegend", + "type": "CompoundType", "tags": [], - "label": "params", + "label": "truncateLegend", "description": [], "signature": [ - "{ decimals: number; suffix?: string | undefined; } | undefined" + "boolean | undefined" ], - "path": "src/plugins/visualizations/common/convert_to_lens/types/common.ts", + "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", "deprecated": false, "trackAdoption": false } @@ -9434,10 +9924,10 @@ }, { "parentPluginId": "visualizations", - "id": "def-common.PagingState", + "id": "def-common.PartitionVisConfiguration", "type": "Interface", "tags": [], - "label": "PagingState", + "label": "PartitionVisConfiguration", "description": [], "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", "deprecated": false, @@ -9445,22 +9935,50 @@ "children": [ { "parentPluginId": "visualizations", - "id": "def-common.PagingState.size", - "type": "number", + "id": "def-common.PartitionVisConfiguration.shape", + "type": "CompoundType", "tags": [], - "label": "size", + "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.PagingState.enabled", - "type": "boolean", + "id": "def-common.PartitionVisConfiguration.layers", + "type": "Array", "tags": [], - "label": "enabled", + "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 @@ -11810,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", @@ -11891,6 +12424,22 @@ "docId": "kibVisualizationsPluginApi", "section": "def-common.TableVisConfiguration", "text": "TableVisConfiguration" + }, + " | ", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.PartitionVisConfiguration", + "text": "PartitionVisConfiguration" + }, + " | ", + { + "pluginId": "visualizations", + "scope": "common", + "docId": "kibVisualizationsPluginApi", + "section": "def-common.MetricVisConfiguration", + "text": "MetricVisConfiguration" } ], "path": "src/plugins/visualizations/common/convert_to_lens/types/configurations.ts", @@ -12327,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", @@ -12510,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", @@ -12555,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", @@ -13005,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", @@ -13015,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 @@ -13035,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", @@ -13080,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", @@ -13105,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 @@ -13120,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 @@ -13135,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 e5907aaf8a8a5..4c4afd430bceb 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-28 +date: 2022-10-04 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 | |-------------------|-----------|------------------------|-----------------| -| 679 | 12 | 649 | 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 3482109d4ab3e..60aff48267f0c 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 691557bfb9634..0000000000000 --- 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 f4a01cad94206..0000000000000 --- 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 0000000000000..af4f797ade1f2 --- /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/management/connectors/action-types/servicenow-itom.asciidoc b/docs/management/connectors/action-types/servicenow-itom.asciidoc index 07ede3ef0d3cb..609ac85c931b6 100644 --- a/docs/management/connectors/action-types/servicenow-itom.asciidoc +++ b/docs/management/connectors/action-types/servicenow-itom.asciidoc @@ -6,7 +6,7 @@ The {sn-itom} connector uses the https://docs.servicenow.com/bundle/rome-it-operations-management/page/product/event-management/task/send-events-via-web-service.html[event API] -to create {sn} events. +to create {sn} events. You can use the connector for rule actions. [float] [[servicenow-itom-connector-prerequisites]] diff --git a/docs/management/connectors/action-types/servicenow-sir.asciidoc b/docs/management/connectors/action-types/servicenow-sir.asciidoc index 06639a077bf89..44c034cd35f61 100644 --- a/docs/management/connectors/action-types/servicenow-sir.asciidoc +++ b/docs/management/connectors/action-types/servicenow-sir.asciidoc @@ -6,7 +6,7 @@ The {sn-sir} connector uses the https://developer.servicenow.com/dev.do#!/reference/api/sandiego/rest/c_ImportSetAPI[import set API] -to create {sn} security incidents. +to create {sn} security incidents. You can use the connector for rule actions and cases. [float] [[servicenow-sir-connector-prerequisites]] diff --git a/docs/management/connectors/action-types/servicenow.asciidoc b/docs/management/connectors/action-types/servicenow.asciidoc index 613935a7ac4d0..658532d1226f9 100644 --- a/docs/management/connectors/action-types/servicenow.asciidoc +++ b/docs/management/connectors/action-types/servicenow.asciidoc @@ -6,7 +6,7 @@ The {sn-itsm} connector uses the https://developer.servicenow.com/dev.do#!/reference/api/sandiego/rest/c_ImportSetAPI[import set API] -to create {sn} incidents. +to create {sn} incidents. You can use the connector for rule actions and cases. [float] [[servicenow-itsm-connector-prerequisites]] diff --git a/docs/osquery/images/live-query-check-results.png b/docs/osquery/images/live-query-check-results.png index cd1362e7e977d..6b84a3bf9f7ca 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 66edbc95526eb..e854904b6baf4 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 5c12048315dec..fe1f3b9521cf2 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/alerting/alerting-setup.asciidoc b/docs/user/alerting/alerting-setup.asciidoc index 819f20005d7a4..36c8b46e7b801 100644 --- a/docs/user/alerting/alerting-setup.asciidoc +++ b/docs/user/alerting/alerting-setup.asciidoc @@ -98,3 +98,10 @@ user without those privileges updates the rule, the rule will no longer function. Conversely, if a user with greater or administrator privileges modifies the rule, it will begin running with increased privileges. ============================================== + +[float] +[[alerting-ccs-setup]] +=== {ccs-cap} + +If you want to use alerting rules with {ccs}, you must configure +{ref}/remote-clusters-privileges.html#clusters-privileges-ccs-kibana[privileges for {ccs-init} and {kib}]. \ No newline at end of file diff --git a/docs/user/api.asciidoc b/docs/user/api.asciidoc index 8f55645e5b910..aa567487b296a 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/dashboard/images/dashboard_timeSliderControl_8.5.0.gif b/docs/user/dashboard/images/dashboard_timeSliderControl_8.5.0.gif new file mode 100644 index 0000000000000..89ca09dccc71e Binary files /dev/null and b/docs/user/dashboard/images/dashboard_timeSliderControl_8.5.0.gif differ diff --git a/docs/user/dashboard/images/dashboard_timeSliderControl_advanceBackward_8.5.0.png b/docs/user/dashboard/images/dashboard_timeSliderControl_advanceBackward_8.5.0.png new file mode 100644 index 0000000000000..e1c2e9921f687 Binary files /dev/null and b/docs/user/dashboard/images/dashboard_timeSliderControl_advanceBackward_8.5.0.png differ diff --git a/docs/user/dashboard/images/dashboard_timeSliderControl_advanceForward_8.5.0.png b/docs/user/dashboard/images/dashboard_timeSliderControl_advanceForward_8.5.0.png new file mode 100644 index 0000000000000..788621037cb07 Binary files /dev/null and b/docs/user/dashboard/images/dashboard_timeSliderControl_advanceForward_8.5.0.png differ diff --git a/docs/user/dashboard/images/dashboard_timeSliderControl_animate_8.5.0.png b/docs/user/dashboard/images/dashboard_timeSliderControl_animate_8.5.0.png new file mode 100644 index 0000000000000..63a93323d6a36 Binary files /dev/null and b/docs/user/dashboard/images/dashboard_timeSliderControl_animate_8.5.0.png differ diff --git a/docs/user/dashboard/make-dashboards-interactive.asciidoc b/docs/user/dashboard/make-dashboards-interactive.asciidoc index 7c80fa8588538..127c0a4a79e05 100644 --- a/docs/user/dashboard/make-dashboards-interactive.asciidoc +++ b/docs/user/dashboard/make-dashboards-interactive.asciidoc @@ -28,7 +28,7 @@ data-type="inline" *Controls* are interactive panels you add to your dashboards to filter and display only the data you want to explore. -There are two types of controls: +There are three types of controls: * *Options list* — Adds a dropdown that allows you to filter the data with one or more options that you select. + @@ -44,11 +44,17 @@ For example, if you are using the *[Logs] Web Traffic* dashboard from the sample [role="screenshot"] image::images/dashboard_controlsRangeSlider_8.3.0.png[Range slider control for the `hour_of_day` field with a range of `9` to `17` selected] +* *Time slider* — Adds a time range slider that allows you to filter the data within a specified range of time, advance the time range backward and forward, and animate your change in data over the specified time range. ++ +For example, you are using the *[Logs] Web Traffic* dashboard from the sample web logs data, and the global time filter is *Last 7 days*. When you add the time slider, you can click the previous and next buttons to advance the time range backward or forward, and click the play button to watch how the data changes over the last 7 days. +[role="screenshot"] +image::images/dashboard_timeSliderControl_8.5.0.gif[Time slider control for the the Last 7 days] + [float] -[[create-and-add-controls]] -==== Create and add controls +[[create-and-add-options-list-and-range-slider-controls]] +==== Create and add Options list and Range slider controls -To add interactive filters, create controls, then add them to your dashboard. +To add interactive Options list and Range slider controls, create the controls, then add them to your dashboard. . Open or create a new dashboard. @@ -79,8 +85,22 @@ The *Control type* is automatically applied for the field you selected. . Click *Save and close*. [float] -[[filter-the-data-with-options-lists]] -==== Filter the data with Options lists +[[add-time-slider-controls]] +==== Add time slider controls + +To add interactive time slider controls, create the control, then add it to your dashboard. + +. Open or create a new dashboard. + +. In the dashboard toolbar, click *Controls*, then select *Add time slider control*. + +. The time slider control uses the time range from the global time filter. To change the time range in the time slider control, <>. + +. Save the dashboard. + +[float] +[[filter-the-data-with-options-list-controls]] +==== Filter the data with Options list controls Filter the data with one or more options that you select. . Open the Options list dropdown. @@ -94,8 +114,8 @@ The dashboard displays only the data for the options you selected. . To display only the options you selected in the dropdown, click image:images/dashboard_showOnlySelectedOptions_8.3.0.png[The icon to display only the options you have selected in the Options list]. [float] -[[filter-the-data-with-range-sliders]] -==== Filter the data with Range sliders +[[filter-the-data-with-range-slider-controls]] +==== Filter the data with Range slider controls Filter the data within a specified range of values. . On the Range slider, click a value. @@ -106,6 +126,21 @@ The dashboard displays only the data for the range of values you specified. . To clear the specified values, click image:images/dashboard_controlsClearSelections_8.3.0.png[The icon to clear all specified values in the Range slider]. +[float] +[[filter-the-data-with-time-slider-controls]] +==== Filter the data with time slider controls +Filter the data within a specified range of time. + +. To view a different time range, click the time slider, then move the sliders to specify the time range you want to display. + +. To advance the time range forward, click image:images/dashboard_timeSliderControl_advanceForward_8.5.0.png[The icon to advance the time range forward]. + +. To advance the time range backward, click image:images/dashboard_timeSliderControl_advanceBackward_8.5.0.png[The icon to advance the time range backward]. + +. To animate the data changes over time, click image:images/dashboard_timeSliderControl_animate_8.5.0.png[The icon to clear all specified values in the Range slider]. + +. To clear the specified values, click image:images/dashboard_controlsClearSelections_8.3.0.png[The icon to clear all specified values in the Range slider]. + [float] [[configure-controls-settings]] ==== Configure the controls settings @@ -126,9 +161,9 @@ The dashboard displays only the data for the range of values you specified. [float] [[edit-controls]] -==== Edit controls +==== Edit Options list and Range slider control settings -Change the settings for a control. +Change the settings for the Options list and Range slider controls. . Hover over the control you want to edit, then click image:images/dashboard_controlsEditControl_8.3.0.png[The Edit control icon that opens the Edit control flyout]. 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 0000000000000..0cf16105a11e9 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 c58408d85d37b..7467d99ca22ef 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/docs/user/security/audit-logging.asciidoc b/docs/user/security/audit-logging.asciidoc index ce1e63c20d1c6..5f6fe746814e5 100644 --- a/docs/user/security/audit-logging.asciidoc +++ b/docs/user/security/audit-logging.asciidoc @@ -325,6 +325,9 @@ Possible values: | *Field* | *Description* +| `user.id` +| Unique identifier of the user across sessions (See {ref}/user-profile.html[user profiles]). + | `user.name` | Login name of the user. diff --git a/examples/guided_onboarding_example/public/components/app.tsx b/examples/guided_onboarding_example/public/components/app.tsx index dc8cbbdcfac83..a5252920c27fa 100755 --- a/examples/guided_onboarding_example/public/components/app.tsx +++ b/examples/guided_onboarding_example/public/components/app.tsx @@ -23,6 +23,7 @@ import { CoreStart, ScopedHistory } from '@kbn/core/public'; import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public/types'; import { StepTwo } from './step_two'; import { StepOne } from './step_one'; +import { StepThree } from './step_three'; import { Main } from './main'; interface GuidedOnboardingExampleAppDeps { @@ -60,6 +61,9 @@ export const GuidedOnboardingExampleApp = (props: GuidedOnboardingExampleAppDeps + + + diff --git a/examples/guided_onboarding_example/public/components/main.tsx b/examples/guided_onboarding_example/public/components/main.tsx index 157b13f1276c0..59e6fa3192402 100644 --- a/examples/guided_onboarding_example/public/components/main.tsx +++ b/examples/guided_onboarding_example/public/components/main.tsx @@ -25,45 +25,50 @@ import { EuiText, EuiTitle, } from '@elastic/eui'; -import { +import type { GuidedOnboardingPluginStart, - GuidedOnboardingState, - UseCase, + GuideState, + GuideStepIds, + GuideId, + GuideStep, } from '@kbn/guided-onboarding-plugin/public'; +import { guidesConfig } from '@kbn/guided-onboarding-plugin/public'; interface MainProps { guidedOnboarding: GuidedOnboardingPluginStart; notifications: CoreStart['notifications']; } + export const Main = (props: MainProps) => { const { guidedOnboarding: { guidedOnboardingApi }, notifications, } = props; const history = useHistory(); - const [guideState, setGuideState] = useState(undefined); + const [guidesState, setGuidesState] = useState(undefined); + const [activeGuide, setActiveGuide] = useState(undefined); - const [selectedGuide, setSelectedGuide] = useState< - GuidedOnboardingState['activeGuide'] | undefined - >(undefined); - const [selectedStep, setSelectedStep] = useState( - undefined - ); + const [selectedGuide, setSelectedGuide] = useState(undefined); + const [selectedStep, setSelectedStep] = useState(undefined); useEffect(() => { - const subscription = guidedOnboardingApi - ?.fetchGuideState$() - .subscribe((newState: GuidedOnboardingState) => { - setGuideState(newState); - }); - return () => subscription?.unsubscribe(); + const fetchGuidesState = async () => { + const newGuidesState = await guidedOnboardingApi?.fetchAllGuidesState(); + setGuidesState(newGuidesState ? newGuidesState.state : []); + }; + + fetchGuidesState(); }, [guidedOnboardingApi]); - const startGuide = async (guide: UseCase) => { - const response = await guidedOnboardingApi?.updateGuideState({ - activeGuide: guide, - activeStep: 'add_data', - }); + useEffect(() => { + const newActiveGuide = guidesState?.find((guide) => guide.isActive === true); + if (newActiveGuide) { + setActiveGuide(newActiveGuide); + } + }, [guidesState, setActiveGuide]); + + const activateGuide = async (guideId: GuideId, guideState?: GuideState) => { + const response = await guidedOnboardingApi?.activateGuide(guideId, guideState); if (response) { notifications.toasts.addSuccess( @@ -75,11 +80,45 @@ export const Main = (props: MainProps) => { }; const updateGuideState = async () => { - const response = await guidedOnboardingApi?.updateGuideState({ - activeGuide: selectedGuide!, - activeStep: selectedStep!, + const selectedGuideConfig = guidesConfig[selectedGuide!]; + const selectedStepIndex = selectedGuideConfig.steps.findIndex( + (step) => step.id === selectedStep! + ); + + // Noop if the selected step is invalid + if (selectedStepIndex === -1) { + return; + } + + const updatedSteps: GuideStep[] = selectedGuideConfig.steps.map((step, stepIndex) => { + if (selectedStepIndex > stepIndex) { + return { + id: step.id, + status: 'complete', + }; + } + + if (selectedStepIndex < stepIndex) { + return { + id: step.id, + status: 'inactive', + }; + } + + return { + id: step.id, + status: 'active', + }; }); + const updatedGuideState: GuideState = { + isActive: true, + status: 'in_progress', + steps: updatedSteps, + guideId: selectedGuide!, + }; + + const response = await guidedOnboardingApi?.updateGuideState(updatedGuideState, true); if (response) { notifications.toasts.addSuccess( i18n.translate('guidedOnboardingExample.updateGuideState.toastLabel', { @@ -116,7 +155,7 @@ export const Main = (props: MainProps) => { so there is no need to 'load' the state from the server." />

- {guideState ? ( + {activeGuide ? (
{ defaultMessage="Active guide" />
-
{guideState.activeGuide ?? 'undefined'}
+
{activeGuide.guideId}
-
{guideState.activeStep ?? 'undefined'}
+
+ {activeGuide.steps.map((step) => { + return ( + <> + {`Step "${step.id}": ${step.status}`}
+ + ); + })} +
- ) : undefined} + ) : ( +

+ +

+ )}

- - startGuide('search')} fill> - - - - - startGuide('observability')} fill> - - - - - startGuide('security')} fill> - - - + {(Object.keys(guidesConfig) as GuideId[]).map((guideId) => { + const guideState = guidesState?.find((guide) => guide.guideId === guideId); + return ( + + activateGuide(guideId, guideState)} + fill + disabled={guideState?.status === 'complete'} + > + {guideState === undefined && ( + + )} + {(guideState?.isActive === true || + guideState?.status === 'in_progress' || + guideState?.status === 'ready_to_complete') && ( + + )} + {guideState?.status === 'complete' && ( + + )} + + + ); + })} @@ -187,16 +259,15 @@ export const Main = (props: MainProps) => { { - const value = e.target.value as UseCase; + const value = e.target.value as GuideId; const shouldResetState = value.trim().length === 0; if (shouldResetState) { setSelectedGuide(undefined); @@ -209,10 +280,10 @@ export const Main = (props: MainProps) => { - + setSelectedStep(e.target.value)} + onChange={(e) => setSelectedStep(e.target.value as GuideStepIds)} /> diff --git a/examples/guided_onboarding_example/public/components/step_three.tsx b/examples/guided_onboarding_example/public/components/step_three.tsx new file mode 100644 index 0000000000000..ffe9d87993611 --- /dev/null +++ b/examples/guided_onboarding_example/public/components/step_three.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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { useEffect, useState } from 'react'; + +import { EuiButton, EuiSpacer, EuiText, EuiTitle, EuiTourStep } from '@elastic/eui'; + +import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public/types'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { + EuiPageContentHeader_Deprecated as EuiPageContentHeader, + EuiPageContentBody_Deprecated as EuiPageContentBody, +} from '@elastic/eui'; + +interface StepThreeProps { + guidedOnboarding: GuidedOnboardingPluginStart; +} + +export const StepThree = (props: StepThreeProps) => { + const { + guidedOnboarding: { guidedOnboardingApi }, + } = props; + + const [isTourStepOpen, setIsTourStepOpen] = useState(false); + + useEffect(() => { + const subscription = guidedOnboardingApi + ?.isGuideStepActive$('search', 'search_experience') + .subscribe((isStepActive) => { + setIsTourStepOpen(isStepActive); + }); + return () => subscription?.unsubscribe(); + }, [guidedOnboardingApi]); + + return ( + <> + + +

+ +

+
+
+ + +

+ +

+
+ + +

Click this button to complete step 3.

+ + } + isStepOpen={isTourStepOpen} + minWidth={300} + onFinish={() => { + setIsTourStepOpen(false); + }} + step={1} + stepsTotal={1} + title="Step Build search experience" + anchorPosition="rightUp" + > + { + await guidedOnboardingApi?.completeGuideStep('search', 'search_experience'); + }} + > + Complete step 3 + +
+
+ + ); +}; diff --git a/examples/guided_onboarding_example/public/components/step_two.tsx b/examples/guided_onboarding_example/public/components/step_two.tsx index a79ce2329351e..07f4fd7e63e0c 100644 --- a/examples/guided_onboarding_example/public/components/step_two.tsx +++ b/examples/guided_onboarding_example/public/components/step_two.tsx @@ -55,7 +55,7 @@ export const StepTwo = (props: StepTwoProps) => {

@@ -73,7 +73,7 @@ export const StepTwo = (props: StepTwoProps) => { }} step={1} stepsTotal={1} - title="Step Search experience" + title="Step Browse documents" anchorPosition="rightUp" > - ); diff --git a/examples/user_profile_examples/public/plugin.tsx b/examples/user_profile_examples/public/plugin.tsx index e821ebebcd7d9..1b6dd5db267c6 100755 --- a/examples/user_profile_examples/public/plugin.tsx +++ b/examples/user_profile_examples/public/plugin.tsx @@ -14,6 +14,7 @@ import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; import { AvatarDemo } from './avatar_demo'; import { PopoverDemo } from './popover_demo'; import { SelectableDemo } from './selectable_demo'; +import { ToolTipDemo } from './tooltip_demo'; interface SetupDeps { developerExamples: DeveloperExamplesSetup; @@ -38,14 +39,20 @@ export class UserProfilesPlugin implements Plugin - - - + + + + + + + + + + + + + + , element ); diff --git a/examples/user_profile_examples/public/tooltip_demo.tsx b/examples/user_profile_examples/public/tooltip_demo.tsx new file mode 100644 index 0000000000000..beed3401c0451 --- /dev/null +++ b/examples/user_profile_examples/public/tooltip_demo.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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ +import React, { FunctionComponent } from 'react'; +import { UserAvatarTip, UserToolTip } from '@kbn/user-profile-components'; +import type { UserProfile, UserProfileAvatarData } from '@kbn/user-profile-components'; +import { EuiCommentList, EuiComment } from '@elastic/eui'; +import { PanelWithCodeBlock } from './panel_with_code_block'; + +export const ToolTipDemo: FunctionComponent = () => { + const userProfile: UserProfile<{ avatar: UserProfileAvatarData }> = { + uid: 'u_9xDEQqUqoYCnFnPPLq5mIRHKL8gBTo_NiKgOnd5gGk0_0', + enabled: true, + user: { + username: 'wet_dingo', + email: 'wet_dingo@elastic.co', + full_name: 'Wet Dingo', + }, + data: { + avatar: { + color: '#09e8ca', + initials: 'WD', + imageUrl: 'https://source.unsplash.com/64x64/?dingo', + }, + }, + }; + + return ( + + + + } + username={ + + {userProfile.user.full_name} + + } + event="pushed incident X0Z235 on Jan 3, 2020" + /> + + + ); +}; + +const code = `import { UserToolTip, UserAvatarTip } from '@kbn/user-profile-components'; + + + + + +`; diff --git a/package.json b/package.json index ebbff20d91733..f122f532d5274 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", @@ -335,6 +338,7 @@ "@kbn/safer-lodash-set": "link:bazel-bin/packages/kbn-safer-lodash-set", "@kbn/securitysolution-autocomplete": "link:bazel-bin/packages/kbn-securitysolution-autocomplete", "@kbn/securitysolution-es-utils": "link:bazel-bin/packages/kbn-securitysolution-es-utils", + "@kbn/securitysolution-exception-list-components": "link:bazel-bin/packages/kbn-securitysolution-exception-list-components", "@kbn/securitysolution-hook-utils": "link:bazel-bin/packages/kbn-securitysolution-hook-utils", "@kbn/securitysolution-io-ts-alerting-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-alerting-types", "@kbn/securitysolution-io-ts-list-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-list-types", @@ -575,7 +579,7 @@ "react-fast-compare": "^2.0.4", "react-focus-on": "^3.6.0", "react-grid-layout": "^1.3.4", - "react-hook-form": "^7.35.0", + "react-hook-form": "^7.36.1", "react-intl": "^2.8.0", "react-is": "^17.0.2", "react-markdown": "^6.0.3", @@ -641,7 +645,7 @@ "uuid": "3.3.2", "vega": "^5.22.1", "vega-interpreter": "^1.0.4", - "vega-lite": "^5.3.0", + "vega-lite": "^5.5.0", "vega-schema-url-parser": "^2.2.0", "vega-spec-injector": "^0.0.2", "vega-tooltip": "^0.28.0", @@ -977,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", @@ -986,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", @@ -1086,6 +1093,7 @@ "@types/kbn__rule-data-utils": "link:bazel-bin/packages/kbn-rule-data-utils/npm_module_types", "@types/kbn__securitysolution-autocomplete": "link:bazel-bin/packages/kbn-securitysolution-autocomplete/npm_module_types", "@types/kbn__securitysolution-es-utils": "link:bazel-bin/packages/kbn-securitysolution-es-utils/npm_module_types", + "@types/kbn__securitysolution-exception-list-components": "link:bazel-bin/packages/kbn-securitysolution-exception-list-components/npm_module_types", "@types/kbn__securitysolution-hook-utils": "link:bazel-bin/packages/kbn-securitysolution-hook-utils/npm_module_types", "@types/kbn__securitysolution-io-ts-alerting-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-alerting-types/npm_module_types", "@types/kbn__securitysolution-io-ts-list-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-list-types/npm_module_types", @@ -1284,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 455b851a4936f..0d5ecd4bc4cfc 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", @@ -251,6 +254,7 @@ filegroup( "//packages/kbn-safer-lodash-set:build", "//packages/kbn-securitysolution-autocomplete:build", "//packages/kbn-securitysolution-es-utils:build", + "//packages/kbn-securitysolution-exception-list-components:build", "//packages/kbn-securitysolution-hook-utils:build", "//packages/kbn-securitysolution-io-ts-alerting-types:build", "//packages/kbn-securitysolution-io-ts-list-types:build", @@ -453,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", @@ -461,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", @@ -574,6 +581,7 @@ filegroup( "//packages/kbn-safer-lodash-set:build_types", "//packages/kbn-securitysolution-autocomplete:build_types", "//packages/kbn-securitysolution-es-utils:build_types", + "//packages/kbn-securitysolution-exception-list-components:build_types", "//packages/kbn-securitysolution-hook-utils:build_types", "//packages/kbn-securitysolution-io-ts-alerting-types:build_types", "//packages/kbn-securitysolution-io-ts-list-types: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 0000000000000..7e4d73b638a75 --- /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 0000000000000..565082ebccc04 --- /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/src/plugins/dashboard/public/saved_dashboards/index.ts b/packages/core/plugins/core-plugins-base-server-internal/index.ts similarity index 73% rename from src/plugins/dashboard/public/saved_dashboards/index.ts rename to packages/core/plugins/core-plugins-base-server-internal/index.ts index 7a17aa6f2c0e0..3052f46e9fe7a 100644 --- a/src/plugins/dashboard/public/saved_dashboards/index.ts +++ b/packages/core/plugins/core-plugins-base-server-internal/index.ts @@ -6,6 +6,4 @@ * Side Public License, v 1. */ -export * from '../../common/saved_dashboard_references'; -export * from './saved_dashboard'; -export * from './saved_dashboards'; +export type { UiPlugins, InternalPluginInfo } from './src'; diff --git a/src/plugins/dashboard/common/embeddable/types.ts b/packages/core/plugins/core-plugins-base-server-internal/jest.config.js similarity index 68% rename from src/plugins/dashboard/common/embeddable/types.ts rename to packages/core/plugins/core-plugins-base-server-internal/jest.config.js index d786078766f78..9a9b5aa5ec9bf 100644 --- a/src/plugins/dashboard/common/embeddable/types.ts +++ b/packages/core/plugins/core-plugins-base-server-internal/jest.config.js @@ -6,11 +6,8 @@ * Side Public License, v 1. */ -// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -export type GridData = { - w: number; - h: number; - x: number; - y: number; - i: string; +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 0000000000000..a593530ab5fc4 --- /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 0000000000000..6af3453f1a29b --- /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 0000000000000..ade9e77fc1783 --- /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 0000000000000..d0afcce5dba5c --- /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 0000000000000..71bb40fe57f3f --- /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 0000000000000..b02ff09264699 --- /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 0000000000000..629ac2047de02 --- /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 0000000000000..7ddc442a74253 --- /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 0000000000000..48ca2e89b9763 --- /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 0000000000000..2ce227d70528f --- /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 0000000000000..ef29d29e9fa2f --- /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 a1ed415f72c42..af9de3fbd6ff1 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 4c20f8d3d799a..8424bb3e68a1d 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 e3746eeb17a00..619765cdc7b6a 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 e5a9ed9fdd3d0..ad9f3edb4aa51 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 fc013b4be0d07..096e0cc57b1f6 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 d3ca102a35758..e1be7719bfea7 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 6cf0e2a74aa1f..e1cac45f7765c 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 424bcd8a6533b..48196717c6f9f 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 c5b56a06782bc..653768c83d784 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 c75353b87a65d..51dfab71efd22 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 7068d2a9b789d..e2f7797ac5c42 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 1aa6e658e3d29..01f395261eccf 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 0000000000000..73c8a6666ff7e --- /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 0000000000000..9ec36da1a1f67 --- /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 0000000000000..72df549319198 --- /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 0000000000000..e7ce72ce797fb --- /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 0000000000000..5dc1ae51c50b0 --- /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 0000000000000..a04eae9cadc20 --- /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 0000000000000..572e1d5530587 --- /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 0000000000000..d56794e3e9ac6 --- /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 3d8213da62c6d..5cdf5c92f9237 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 0000000000000..71bb40fe57f3f --- /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 614c9e3680acc..fed06cbf2f740 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 1f663ea5dbc56..27fbb09a37018 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 487622877e25c..551ba3989e527 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/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap index 4c21ba704fe48..39ff3c4c5700a 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/__snapshots__/migrations_state_action_machine.test.ts.snap @@ -71,6 +71,11 @@ Object { "type": "fleet-enrollment-api-keys", }, }, + Object { + "term": Object { + "type": "guided-setup-state", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -246,6 +251,11 @@ Object { "type": "fleet-enrollment-api-keys", }, }, + Object { + "term": Object { + "type": "guided-setup-state", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -425,6 +435,11 @@ Object { "type": "fleet-enrollment-api-keys", }, }, + Object { + "term": Object { + "type": "guided-setup-state", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -608,6 +623,11 @@ Object { "type": "fleet-enrollment-api-keys", }, }, + Object { + "term": Object { + "type": "guided-setup-state", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -833,6 +853,11 @@ Object { "type": "fleet-enrollment-api-keys", }, }, + Object { + "term": Object { + "type": "guided-setup-state", + }, + }, Object { "term": Object { "type": "ml-telemetry", @@ -1019,6 +1044,11 @@ Object { "type": "fleet-enrollment-api-keys", }, }, + Object { + "term": Object { + "type": "guided-setup-state", + }, + }, Object { "term": Object { "type": "ml-telemetry", diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts index 480395241c278..7dbcf2c270ba4 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/core/unused_types.ts @@ -22,6 +22,8 @@ export const REMOVED_TYPES: string[] = [ 'fleet-agents', 'fleet-agent-actions', 'fleet-enrollment-api-keys', + // replaced by guided-onboarding-guide-state in 8.6 + 'guided-setup-state', // Was removed in 7.12 'ml-telemetry', 'server', diff --git a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts index 2b0e9a7c7f1a4..d1c19aa7d212e 100644 --- a/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts +++ b/packages/core/saved-objects/core-saved-objects-migration-server-internal/src/initial_state.test.ts @@ -107,6 +107,11 @@ describe('createInitialState', () => { "type": "fleet-enrollment-api-keys", }, }, + Object { + "term": Object { + "type": "guided-setup-state", + }, + }, Object { "term": Object { "type": "ml-telemetry", diff --git a/packages/kbn-doc-links/src/get_doc_links.ts b/packages/kbn-doc-links/src/get_doc_links.ts index 721fc431a3c2e..8ef5a68a3f98c 100644 --- a/packages/kbn-doc-links/src/get_doc_links.ts +++ b/packages/kbn-doc-links/src/get_doc_links.ts @@ -31,6 +31,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => { const ENTERPRISE_SEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/enterprise-search/${DOC_LINK_VERSION}/`; const WORKPLACE_SEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/workplace-search/${DOC_LINK_VERSION}/`; const SEARCH_UI_DOCS = `${DOCS_WEBSITE_URL}search-ui/`; + const MACHINE_LEARNING_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/`; return deepFreeze({ settings: `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/settings.html`, @@ -362,6 +363,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => { eventFilters: `${SECURITY_SOLUTION_DOCS}event-filters.html`, blocklist: `${SECURITY_SOLUTION_DOCS}blocklist.html`, threatIntelInt: `${SECURITY_SOLUTION_DOCS}es-threat-intel-integrations.html`, + endpointArtifacts: `${SECURITY_SOLUTION_DOCS}endpoint-artifacts.html`, policyResponseTroubleshooting: { full_disk_access: `${SECURITY_SOLUTION_DOCS}deploy-elastic-endpoint.html#enable-fda-endpoint`, macos_system_ext: `${SECURITY_SOLUTION_DOCS}deploy-elastic-endpoint.html#system-extension-endpoint`, @@ -398,39 +400,39 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => { savedObjectsApiList: `${KIBANA_DOCS}saved-objects-api.html#saved-objects-api`, }, ml: { - guide: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/index.html`, - aggregations: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-aggregation.html`, - anomalyDetection: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-overview.html`, - anomalyDetectionJobs: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-finding-anomalies.html`, - anomalyDetectionConfiguringCategories: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-categories.html`, - anomalyDetectionBucketSpan: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-run-jobs.html#ml-ad-bucket-span`, - anomalyDetectionCardinality: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-run-jobs.html#ml-ad-cardinality`, - anomalyDetectionCreateJobs: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-run-jobs.html#ml-ad-create-job`, - anomalyDetectionDetectors: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-run-jobs.html#ml-ad-detectors`, - anomalyDetectionInfluencers: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-run-jobs.html#ml-ad-influencers`, + guide: `${MACHINE_LEARNING_DOCS}index.html`, + aggregations: `${MACHINE_LEARNING_DOCS}ml-configuring-aggregation.html`, + anomalyDetection: `${MACHINE_LEARNING_DOCS}ml-ad-overview.html`, + anomalyDetectionJobs: `${MACHINE_LEARNING_DOCS}ml-ad-finding-anomalies.html`, + anomalyDetectionConfiguringCategories: `${MACHINE_LEARNING_DOCS}ml-configuring-categories.html`, + anomalyDetectionBucketSpan: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-bucket-span`, + anomalyDetectionCardinality: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-cardinality`, + anomalyDetectionCreateJobs: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-create-job`, + anomalyDetectionDetectors: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-detectors`, + anomalyDetectionInfluencers: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-influencers`, anomalyDetectionJobResource: `${ELASTICSEARCH_DOCS}ml-put-job.html#ml-put-job-path-parms`, anomalyDetectionJobResourceAnalysisConfig: `${ELASTICSEARCH_DOCS}ml-put-job.html#put-analysisconfig`, - anomalyDetectionJobTips: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-run-jobs.html#ml-ad-job-tips`, - alertingRules: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-alerts.html`, - anomalyDetectionModelMemoryLimits: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-run-jobs.html#ml-ad-model-memory-limits`, - calendars: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-run-jobs.html#ml-ad-calendars`, - classificationEvaluation: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-classification.html#ml-dfanalytics-classification-evaluation`, - customRules: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-ad-run-jobs.html#ml-ad-rules`, - customUrls: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-url.html`, - dataFrameAnalytics: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfanalytics.html`, - dFAPrepareData: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-overview.html#prepare-transform-data`, - featureImportance: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-feature-importance.html`, - outlierDetectionRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-finding-outliers.html#ml-dfanalytics-roc`, - regressionEvaluation: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-regression.html#ml-dfanalytics-regression-evaluation`, - classificationAucRoc: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-dfa-classification.html#ml-dfanalytics-class-aucroc`, + anomalyDetectionJobTips: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-job-tips`, + alertingRules: `${MACHINE_LEARNING_DOCS}ml-configuring-alerts.html`, + anomalyDetectionModelMemoryLimits: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-model-memory-limits`, + calendars: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-calendars`, + classificationEvaluation: `${MACHINE_LEARNING_DOCS}ml-dfa-classification.html#ml-dfanalytics-classification-evaluation`, + customRules: `${MACHINE_LEARNING_DOCS}ml-ad-run-jobs.html#ml-ad-rules`, + customUrls: `${MACHINE_LEARNING_DOCS}ml-configuring-url.html`, + dataFrameAnalytics: `${MACHINE_LEARNING_DOCS}ml-dfanalytics.html`, + dFAPrepareData: `${MACHINE_LEARNING_DOCS}ml-dfa-overview.html#prepare-transform-data`, + featureImportance: `${MACHINE_LEARNING_DOCS}ml-feature-importance.html`, + outlierDetectionRoc: `${MACHINE_LEARNING_DOCS}ml-dfa-finding-outliers.html#ml-dfanalytics-roc`, + regressionEvaluation: `${MACHINE_LEARNING_DOCS}ml-dfa-regression.html#ml-dfanalytics-regression-evaluation`, + classificationAucRoc: `${MACHINE_LEARNING_DOCS}ml-dfa-classification.html#ml-dfanalytics-class-aucroc`, setUpgradeMode: `${ELASTICSEARCH_DOCS}ml-set-upgrade-mode.html`, - trainedModels: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-trained-models.html`, - startTrainedModelsDeployment: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-nlp-deploy-models.html#ml-nlp-deploy-model`, + trainedModels: `${MACHINE_LEARNING_DOCS}ml-trained-models.html`, + startTrainedModelsDeployment: `${MACHINE_LEARNING_DOCS}ml-nlp-deploy-models.html#ml-nlp-deploy-model`, }, transforms: { guide: `${ELASTICSEARCH_DOCS}transforms.html`, // TODO add valid docs URL - alertingRules: `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-configuring-alerts.html`, + alertingRules: `${MACHINE_LEARNING_DOCS}ml-configuring-alerts.html`, }, visualize: { guide: `${KIBANA_DOCS}dashboard.html`, diff --git a/packages/kbn-doc-links/src/types.ts b/packages/kbn-doc-links/src/types.ts index 7cd785ee194fa..aed1b552bdb30 100644 --- a/packages/kbn-doc-links/src/types.ts +++ b/packages/kbn-doc-links/src/types.ts @@ -265,6 +265,7 @@ export interface DocLinks { readonly trustedApps: string; readonly eventFilters: string; readonly blocklist: string; + readonly endpointArtifacts: string; readonly policyResponseTroubleshooting: { full_disk_access: string; macos_system_ext: string; 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 4f3defc21d296..832b4d2e3c67e 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 440ff3ce2b12c..5cd1458028626 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 89d66092737b4..a7f7100ba959f 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 05eef7105a717..cd13adf0cb824 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/BUILD.bazel b/packages/kbn-securitysolution-exception-list-components/BUILD.bazel new file mode 100644 index 0000000000000..6436793fa5f30 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/BUILD.bazel @@ -0,0 +1,163 @@ +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 = "kbn-securitysolution-exception-list-components" +PKG_REQUIRE_NAME = "@kbn/securitysolution-exception-list-components" + +SOURCE_FILES = glob( + [ + "**/*.ts", + "**/*.tsx", + "**/*.svg", + "**/*.d.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", + "jest.config.js" +] + +# In this array place runtime dependencies, including other packages and NPM packages +# which must be available for this code to run. +# +# To reference other packages use: +# "//repo/relative/path/to/package" +# eg. "//packages/kbn-utils" +# +# To reference a NPM package use: +# "@npm//name-of-package" +# eg. "@npm//lodash" +RUNTIME_DEPS = [ + "@npm//react", + "//packages/kbn-securitysolution-io-ts-list-types", + "//packages/kbn-securitysolution-autocomplete", + "//packages/kbn-ui-theme", + "//packages/kbn-i18n-react", + "//packages/kbn-i18n", + "@npm//@elastic/eui", + "@npm//@emotion/css", + "@npm//@emotion/react", + "@npm//@testing-library/jest-dom", + "@npm//jest", +] + +# In this array place dependencies necessary to build the types, which will include the +# :npm_module_types target of other packages and packages from NPM, including @types/* +# packages. +# +# To reference the types for another package use: +# "//repo/relative/path/to/package:npm_module_types" +# eg. "//packages/kbn-utils:npm_module_types" +# +# References to NPM packages work the same as RUNTIME_DEPS +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//@types/react", + "//packages/kbn-securitysolution-io-ts-list-types:npm_module_types", + "//packages/kbn-securitysolution-autocomplete:npm_module_types", + "//packages/kbn-ui-theme:npm_module_types", + "//packages/kbn-i18n-react:npm_module_types", + "@npm//@elastic/eui", + "@npm//@emotion/css", + "@npm//@emotion/react", + "@npm//jest", + +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), + additional_args = [ + "--copy-files" + ], +) + +jsts_transpiler( + name = "target_web", + srcs = SRCS, + build_pkg_name = package_name(), + web = True, + additional_args = [ + "--copy-files" + ], +) + +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", ":target_web"], + 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/kbn-securitysolution-exception-list-components/README.md b/packages/kbn-securitysolution-exception-list-components/README.md new file mode 100644 index 0000000000000..e23b85e409960 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/README.md @@ -0,0 +1,27 @@ +# @kbn/securitysolution-exception-list-components + +This is where the building UI components of the Exception-List live +Most of the components here are imported from `x-pack/plugins/security_solutions/public/detection_engine` + +# Aim + +TODO + +# Pattern used + +``` +component + index.tsx + index.styles.ts <-- to hold styles if the component has many custom styles + use_component.ts <-- for logic if the Presentational Component has logic + index.test.tsx + use_component.test.tsx +``` + +# Next + +- Now the `ExceptionItems, ExceptionItemCard +and ExceptionItemCardMetaInfo + ` receive `securityLinkAnchorComponent, exceptionsUtilityComponent +, and exceptionsUtilityComponent +` as props to avoid moving all the `common` components under the `x-pack` at once, later we should move all building blocks to this `kbn-package` diff --git a/packages/kbn-securitysolution-exception-list-components/index.ts b/packages/kbn-securitysolution-exception-list-components/index.ts new file mode 100644 index 0000000000000..f5001ff35fd33 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/index.ts @@ -0,0 +1,16 @@ +/* + * 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 * from './src/search_bar/search_bar'; +export * from './src/empty_viewer_state/empty_viewer_state'; +export * from './src/pagination/pagination'; +// export * from './src/exceptions_utility/exceptions_utility'; +export * from './src/exception_items/exception_items'; +export * from './src/exception_item_card'; +export * from './src/value_with_space_warning'; +export * from './src/types'; diff --git a/packages/kbn-securitysolution-exception-list-components/jest.config.js b/packages/kbn-securitysolution-exception-list-components/jest.config.js new file mode 100644 index 0000000000000..37a11c23c75ba --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/jest.config.js @@ -0,0 +1,21 @@ +/* + * 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', + rootDir: '../..', + roots: ['/packages/kbn-securitysolution-exception-list-components'], + coverageReporters: ['text', 'html'], + collectCoverageFrom: [ + '/packages/kbn-securitysolution-exception-list-components/**/*.{ts,tsx}', + '!/packages/kbn-securitysolution-exception-list-components/**/*.test', + ], + setupFilesAfterEnv: [ + '/packages/kbn-securitysolution-exception-list-components/setup_test.ts', + ], +}; diff --git a/packages/kbn-securitysolution-exception-list-components/kibana.jsonc b/packages/kbn-securitysolution-exception-list-components/kibana.jsonc new file mode 100644 index 0000000000000..081c50d35af0d --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/kibana.jsonc @@ -0,0 +1,7 @@ +{ + "type": "shared-common", + "id": "@kbn/securitysolution-exception-list-components", + "owner": "@elastic/security-solution-platform", + "runtimeDeps": [], + "typeDeps": [], +} diff --git a/packages/kbn-securitysolution-exception-list-components/package.json b/packages/kbn-securitysolution-exception-list-components/package.json new file mode 100644 index 0000000000000..263863d725c1e --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/securitysolution-exception-list-components", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "browser": "./target_web/index.js", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/kbn-securitysolution-exception-list-components/setup_test.ts b/packages/kbn-securitysolution-exception-list-components/setup_test.ts new file mode 100644 index 0000000000000..bb55d97ec9302 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/setup_test.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. + */ +// eslint-disable-next-line import/no-extraneous-dependencies +import '@testing-library/jest-dom'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/assets/images/illustration_product_no_results_magnifying_glass.svg b/packages/kbn-securitysolution-exception-list-components/src/assets/images/illustration_product_no_results_magnifying_glass.svg new file mode 100644 index 0000000000000..b9a0df1630b20 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/assets/images/illustration_product_no_results_magnifying_glass.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/plugins/dashboard/public/services/saved_objects/types.ts b/packages/kbn-securitysolution-exception-list-components/src/custom.d.ts similarity index 70% rename from src/plugins/dashboard/public/services/saved_objects/types.ts rename to packages/kbn-securitysolution-exception-list-components/src/custom.d.ts index d7d06131f32cb..9169166fe7af9 100644 --- a/src/plugins/dashboard/public/services/saved_objects/types.ts +++ b/packages/kbn-securitysolution-exception-list-components/src/custom.d.ts @@ -6,8 +6,8 @@ * Side Public License, v 1. */ -import type { CoreStart } from '@kbn/core/public'; - -export interface DashboardSavedObjectsService { - client: CoreStart['savedObjects']['client']; +declare module '*.svg' { + const content: string; + // eslint-disable-next-line import/no-default-export + export default content; } diff --git a/packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/empty_viewer_state.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/empty_viewer_state.test.tsx new file mode 100644 index 0000000000000..43943e0e8fb97 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/empty_viewer_state.test.tsx @@ -0,0 +1,138 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { render } from '@testing-library/react'; + +import { EmptyViewerState } from './empty_viewer_state'; +import { ListTypeText, ViewerStatus } from '../types'; + +describe('EmptyViewerState', () => { + it('it should render "error" with the default title and body', () => { + const wrapper = render( + + ); + + expect(wrapper.getByTestId('errorViewerState')).toBeTruthy(); + expect(wrapper.getByTestId('errorTitle')).toHaveTextContent('Unable to load exception items'); + expect(wrapper.getByTestId('errorBody')).toHaveTextContent( + 'There was an error loading the exception items. Contact your administrator for help.' + ); + }); + it('it should render "error" when sending the title and body props', () => { + const wrapper = render( + + ); + + expect(wrapper.getByTestId('errorViewerState')).toBeTruthy(); + expect(wrapper.getByTestId('errorTitle')).toHaveTextContent('Error title'); + expect(wrapper.getByTestId('errorBody')).toHaveTextContent('Error body'); + }); + it('it should render loading', () => { + const wrapper = render( + + ); + + expect(wrapper.getByTestId('loadingViewerState')).toBeTruthy(); + }); + it('it should render empty search with the default title and body', () => { + const wrapper = render( + + ); + + expect(wrapper.getByTestId('emptySearchViewerState')).toBeTruthy(); + expect(wrapper.getByTestId('emptySearchTitle')).toHaveTextContent( + 'No results match your search criteria' + ); + expect(wrapper.getByTestId('emptySearchBody')).toHaveTextContent('Try modifying your search'); + }); + it('it should render empty search when sending title and body props', () => { + const wrapper = render( + + ); + + expect(wrapper.getByTestId('emptySearchViewerState')).toBeTruthy(); + expect(wrapper.getByTestId('emptySearchTitle')).toHaveTextContent('Empty search title'); + expect(wrapper.getByTestId('emptySearchBody')).toHaveTextContent('Empty search body'); + }); + it('it should render no items screen when sending title and body props', () => { + const wrapper = render( + + ); + + const { getByTestId } = wrapper; + expect(getByTestId('emptyBody')).toHaveTextContent('There are no endpoint exceptions.'); + expect(getByTestId('emptyStateButton')).toHaveTextContent('Add endpoint exception'); + expect(getByTestId('emptyViewerState')).toBeTruthy(); + }); + it('it should render no items with default title and body props', () => { + const wrapper = render( + + ); + + const { getByTestId } = wrapper; + expect(getByTestId('emptyViewerState')).toBeTruthy(); + expect(getByTestId('emptyTitle')).toHaveTextContent('Add exceptions to this rule'); + expect(getByTestId('emptyBody')).toHaveTextContent( + 'There is no exception in your rule. Create your first rule exception.' + ); + expect(getByTestId('emptyStateButton')).toHaveTextContent('Create rule exception'); + }); + it('it should render no items screen with default title and body props and listType endPoint', () => { + const wrapper = render( + + ); + + const { getByTestId } = wrapper; + expect(getByTestId('emptyViewerState')).toBeTruthy(); + expect(getByTestId('emptyTitle')).toHaveTextContent('Add exceptions to this rule'); + expect(getByTestId('emptyBody')).toHaveTextContent( + 'There is no exception in your rule. Create your first rule exception.' + ); + expect(getByTestId('emptyStateButton')).toHaveTextContent('Create endpoint exception'); + }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/empty_viewer_state.tsx b/packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/empty_viewer_state.tsx new file mode 100644 index 0000000000000..060d2ecc15061 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/empty_viewer_state/empty_viewer_state.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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { useMemo } from 'react'; +import type { FC } from 'react'; +import { css } from '@emotion/react'; +import { + EuiLoadingContent, + EuiImage, + EuiEmptyPrompt, + EuiButton, + useEuiTheme, + EuiPanel, +} from '@elastic/eui'; +import type { ExpressionColor } from '@elastic/eui/src/components/expression/expression'; +import type { EuiFacetGroupLayout } from '@elastic/eui/src/components/facet/facet_group'; +import { euiThemeVars } from '@kbn/ui-theme'; +import { ListTypeText, ViewerStatus } from '../types'; +import * as i18n from '../translations'; +import illustration from '../assets/images/illustration_product_no_results_magnifying_glass.svg'; + +interface EmptyViewerStateProps { + title?: string; + body?: string; + buttonText?: string; + listType?: ListTypeText; + isReadOnly: boolean; + viewerStatus: ViewerStatus; + onCreateExceptionListItem?: () => void | null; +} + +const panelCss = css` + margin: ${euiThemeVars.euiSizeL} 0; + padding: ${euiThemeVars.euiSizeL} 0; +`; +const EmptyViewerStateComponent: FC = ({ + title, + body, + buttonText, + listType, + isReadOnly, + viewerStatus, + onCreateExceptionListItem, +}) => { + const { euiTheme } = useEuiTheme(); + + const euiEmptyPromptProps = useMemo(() => { + switch (viewerStatus) { + case ViewerStatus.ERROR: { + return { + color: 'danger' as ExpressionColor, + iconType: 'alert', + title: ( +

{title || i18n.EMPTY_VIEWER_STATE_ERROR_TITLE}

+ ), + body:

{body || i18n.EMPTY_VIEWER_STATE_ERROR_BODY}

, + 'data-test-subj': 'errorViewerState', + }; + } + case ViewerStatus.EMPTY: + return { + color: 'subdued' as ExpressionColor, + iconType: 'plusInCircle', + iconColor: euiTheme.colors.darkestShade, + title: ( +

{title || i18n.EMPTY_VIEWER_STATE_EMPTY_TITLE}

+ ), + body:

{body || i18n.EMPTY_VIEWER_STATE_EMPTY_BODY}

, + 'data-test-subj': 'emptyViewerState', + actions: [ + + {buttonText || i18n.EMPTY_VIEWER_STATE_EMPTY_VIEWER_BUTTON(listType || 'rule')} + , + ], + }; + case ViewerStatus.EMPTY_SEARCH: + return { + color: 'plain' as ExpressionColor, + layout: 'horizontal' as EuiFacetGroupLayout, + hasBorder: true, + hasShadow: false, + icon: , + title: ( +

+ {title || i18n.EMPTY_VIEWER_STATE_EMPTY_SEARCH_TITLE} +

+ ), + body: ( +

+ {body || i18n.EMPTY_VIEWER_STATE_EMPTY_SEARCH_BODY} +

+ ), + 'data-test-subj': 'emptySearchViewerState', + }; + } + }, [ + viewerStatus, + euiTheme.colors.darkestShade, + title, + body, + onCreateExceptionListItem, + isReadOnly, + buttonText, + listType, + ]); + + if (viewerStatus === ViewerStatus.LOADING || viewerStatus === ViewerStatus.SEARCHING) + return ; + + return ( + + + + ); +}; + +export const EmptyViewerState = React.memo(EmptyViewerStateComponent); + +EmptyViewerState.displayName = 'EmptyViewerState'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.tsx new file mode 100644 index 0000000000000..ca08d10f0a049 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/comments/comments.tsx @@ -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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { memo } from 'react'; +import type { EuiCommentProps } from '@elastic/eui'; +import { EuiAccordion, EuiCommentList, EuiFlexItem, EuiPanel, EuiText } from '@elastic/eui'; +import { css } from '@emotion/react'; +import { euiThemeVars } from '@kbn/ui-theme'; +import * as i18n from '../translations'; + +const accordionCss = css` + color: ${euiThemeVars.euiColorPrimary}; +`; + +export interface ExceptionItemCardCommentsProps { + comments: EuiCommentProps[]; +} + +export const ExceptionItemCardComments = memo(({ comments }) => { + return ( + + + {i18n.exceptionItemCardCommentsAccordion(comments.length)} + + } + arrowDisplay="none" + data-test-subj="exceptionsViewerCommentAccordion" + > + + + + + + ); +}); + +ExceptionItemCardComments.displayName = 'ExceptionItemCardComments'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.config.ts b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.config.ts new file mode 100644 index 0000000000000..08514a64feac0 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.config.ts @@ -0,0 +1,34 @@ +/* + * 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 { ListOperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; +import * as i18n from '../translations'; + +export const OS_LABELS = Object.freeze({ + linux: i18n.OS_LINUX, + mac: i18n.OS_MAC, + macos: i18n.OS_MAC, + windows: i18n.OS_WINDOWS, +}); + +export const OPERATOR_TYPE_LABELS_INCLUDED = Object.freeze({ + [ListOperatorTypeEnum.NESTED]: i18n.CONDITION_OPERATOR_TYPE_NESTED, + [ListOperatorTypeEnum.MATCH_ANY]: i18n.CONDITION_OPERATOR_TYPE_MATCH_ANY, + [ListOperatorTypeEnum.MATCH]: i18n.CONDITION_OPERATOR_TYPE_MATCH, + [ListOperatorTypeEnum.WILDCARD]: i18n.CONDITION_OPERATOR_TYPE_WILDCARD_MATCHES, + [ListOperatorTypeEnum.EXISTS]: i18n.CONDITION_OPERATOR_TYPE_EXISTS, + [ListOperatorTypeEnum.LIST]: i18n.CONDITION_OPERATOR_TYPE_LIST, +}); + +export const OPERATOR_TYPE_LABELS_EXCLUDED = Object.freeze({ + [ListOperatorTypeEnum.MATCH_ANY]: i18n.CONDITION_OPERATOR_TYPE_NOT_MATCH_ANY, + [ListOperatorTypeEnum.MATCH]: i18n.CONDITION_OPERATOR_TYPE_NOT_MATCH, + [ListOperatorTypeEnum.WILDCARD]: i18n.CONDITION_OPERATOR_TYPE_WILDCARD_DOES_NOT_MATCH, + [ListOperatorTypeEnum.EXISTS]: i18n.CONDITION_OPERATOR_TYPE_DOES_NOT_EXIST, + [ListOperatorTypeEnum.LIST]: i18n.CONDITION_OPERATOR_TYPE_NOT_IN_LIST, +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.styles.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.styles.tsx new file mode 100644 index 0000000000000..3ad2d7ef21fba --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.styles.tsx @@ -0,0 +1,36 @@ +/* + * 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 { cx } from '@emotion/css'; +import { css } from '@emotion/react'; +import { euiThemeVars } from '@kbn/ui-theme'; + +// TODO check font Roboto Mono +export const nestedGroupSpaceCss = css` + margin-left: ${euiThemeVars.euiSizeXL}; + margin-bottom: ${euiThemeVars.euiSizeXS}; + padding-top: ${euiThemeVars.euiSizeXS}; +`; + +export const borderCss = cx( + 'eui-xScroll', + ` + border: 1px; + border-color: #d3dae6; + border-style: solid; +` +); + +export const valueContainerCss = css` + display: flex; + align-items: center; + margin-left: ${euiThemeVars.euiSizeS}; +`; +export const expressionContainerCss = css` + display: flex; + align-items: center; +`; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.test.tsx new file mode 100644 index 0000000000000..ae4b76a4a7dc0 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.test.tsx @@ -0,0 +1,350 @@ +/* + * 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 { render } from '@testing-library/react'; +import React from 'react'; + +import { ExceptionItemCardConditions } from './conditions'; + +interface TestEntry { + field: string; + operator: 'included' | 'excluded'; + type: unknown; + value?: string | string[]; + entries?: TestEntry[]; + list?: { id: string; type: string }; +} +const getEntryKey = ( + entry: TestEntry, + index: string, + list?: { id: string; type: string } | null +) => { + if (list && Object.keys(list)) { + const { field, type, list: entryList } = entry; + const { id } = entryList || {}; + return `${field}${type}${id || ''}${index}`; + } + const { field, type, value } = entry; + return `${field}${type}${value || ''}${index}`; +}; + +describe('ExceptionItemCardConditions', () => { + beforeEach(() => { + jest.clearAllMocks(); + jest.resetAllMocks(); + }); + it('it includes os condition if one exists', () => { + const entries: TestEntry[] = [ + { + field: 'host.name', + operator: 'included', + type: 'match', + value: 'host', + }, + { + field: 'threat.indicator.port', + operator: 'included', + type: 'exists', + }, + { + entries: [ + { + field: 'valid', + operator: 'included', + type: 'match', + value: 'true', + }, + ], + field: 'file.Ext.code_signature', + type: 'nested', + operator: 'included', + }, + ]; + const wrapper = render( + + ); + expect(wrapper.getByTestId('exceptionItemConditionsOs')).toHaveTextContent('OSIS Linux'); + + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[0], '0')}EntryContent`) + ).toHaveTextContent('host.nameIS host'); + + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[1], '1')}EntryContent`) + ).toHaveTextContent('AND threat.indicator.portexists'); + + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[2], '2')}EntryContent`) + ).toHaveTextContent('AND file.Ext.code_signature'); + + if (entries[2] && entries[2].entries) { + expect( + wrapper.getByTestId( + `exceptionItemConditions${getEntryKey(entries[2].entries[0], '0')}EntryContent` + ) + ).toHaveTextContent('validIS true'); + } + }); + + it('it renders item conditions', () => { + const entries: TestEntry[] = [ + { + field: 'host.name', + operator: 'included', + type: 'match', + value: 'host', + }, + { + field: 'host.name', + operator: 'excluded', + type: 'match', + value: 'host', + }, + { + field: 'host.name', + operator: 'included', + type: 'match_any', + value: ['foo', 'bar'], + }, + { + field: 'host.name', + operator: 'excluded', + type: 'match_any', + value: ['foo', 'bar'], + }, + { + field: 'user.name', + operator: 'included', + type: 'wildcard', + value: 'foo*', + }, + { + field: 'user.name', + operator: 'excluded', + type: 'wildcard', + value: 'foo*', + }, + { + field: 'threat.indicator.port', + operator: 'included', + type: 'exists', + }, + { + field: 'threat.indicator.port', + operator: 'excluded', + type: 'exists', + }, + { + entries: [ + { + field: 'valid', + operator: 'included', + type: 'match', + value: 'true', + }, + ], + field: 'file.Ext.code_signature', + type: 'nested', + operator: 'included', + }, + ]; + const wrapper = render( + + ); + expect(wrapper.queryByTestId('exceptionItemConditionsOs')).not.toBeInTheDocument(); + + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[0], '0')}EntryContent`) + ).toHaveTextContent('host.nameIS host'); + // Match; + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[1], '1')}EntryContent`) + ).toHaveTextContent('AND host.nameIS NOT host'); + // MATCH_ANY; + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[2], '2')}EntryContent`) + ).toHaveTextContent('AND host.nameis one of foobar'); + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[3], '3')}EntryContent`) + ).toHaveTextContent('AND host.nameis not one of foobar'); + // WILDCARD; + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[4], '4')}EntryContent`) + ).toHaveTextContent('AND user.nameMATCHES foo*'); + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[5], '5')}EntryContent`) + ).toHaveTextContent('AND user.nameDOES NOT MATCH foo*'); + // EXISTS; + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[6], '6')}EntryContent`) + ).toHaveTextContent('AND threat.indicator.portexists'); + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[7], '7')}EntryContent`) + ).toHaveTextContent('AND threat.indicator.portdoes not exist'); + // NESTED; + expect( + wrapper.getByTestId(`exceptionItemConditions${getEntryKey(entries[8], '8')}EntryContent`) + ).toHaveTextContent('AND file.Ext.code_signature'); + if (entries[8] && entries[8].entries) { + expect( + wrapper.getByTestId( + `exceptionItemConditions${getEntryKey(entries[8].entries[0], '0')}EntryContent` + ) + ).toHaveTextContent('validIS true'); + } + }); + it('it renders list conditions', () => { + const entries: TestEntry[] = [ + { + field: 'host.name', + list: { + id: 'ips.txt', + type: 'keyword', + }, + operator: 'included', + type: 'list', + }, + { + field: 'host.name', + list: { + id: 'ips.txt', + type: 'keyword', + }, + operator: 'excluded', + type: 'list', + }, + ]; + const wrapper = render( + + ); + // /exceptionItemConditionshost.namelist0EntryContent + expect( + wrapper.getByTestId( + `exceptionItemConditions${getEntryKey(entries[0], '0', entries[0].list)}EntryContent` + ) + ).toHaveTextContent('host.nameincluded in ips.txt'); + + expect( + wrapper.getByTestId( + `exceptionItemConditions${getEntryKey(entries[1], '1', entries[1].list)}EntryContent` + ) + ).toHaveTextContent('AND host.nameis not included in ips.txt'); + }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.tsx new file mode 100644 index 0000000000000..8b85a7343afc1 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/conditions.tsx @@ -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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { memo } from 'react'; +import { EuiPanel } from '@elastic/eui'; + +import { borderCss } from './conditions.styles'; +import { EntryContent } from './entry_content/entry_content'; +import { OsCondition } from './os_conditions/os_conditions'; +import type { CriteriaConditionsProps, Entry } from './types'; + +export const ExceptionItemCardConditions = memo( + ({ os, entries, dataTestSubj }) => { + return ( + + {os?.length ? : null} + {entries.map((entry: Entry, index: number) => { + const nestedEntries = 'entries' in entry ? entry.entries : []; + return ( +
+ + {nestedEntries?.length + ? nestedEntries.map((nestedEntry: Entry, nestedIndex: number) => ( + + )) + : null} +
+ ); + })} +
+ ); + } +); +ExceptionItemCardConditions.displayName = 'ExceptionItemCardConditions'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.helper.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.helper.tsx new file mode 100644 index 0000000000000..6a64bcc810c08 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.helper.tsx @@ -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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { EuiExpression, EuiBadge } from '@elastic/eui'; +import type { ListOperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; +import { ValueWithSpaceWarning } from '../../../..'; +import { OPERATOR_TYPE_LABELS_EXCLUDED, OPERATOR_TYPE_LABELS_INCLUDED } from '../conditions.config'; +import type { Entry } from '../types'; + +const getEntryValue = (type: string, value?: string | string[]) => { + if (type === 'match_any' && Array.isArray(value)) { + return value.map((currentValue) => {currentValue}); + } + return value ?? ''; +}; + +export const getEntryOperator = (type: ListOperatorTypeEnum, operator: string) => { + if (type === 'nested') return ''; + return operator === 'included' + ? OPERATOR_TYPE_LABELS_INCLUDED[type] ?? type + : OPERATOR_TYPE_LABELS_EXCLUDED[type] ?? type; +}; + +export const getValue = (entry: Entry) => { + if (entry.type === 'list') return entry.list.id; + + return 'value' in entry ? entry.value : ''; +}; + +export const getValueExpression = ( + type: ListOperatorTypeEnum, + operator: string, + value: string | string[] +) => ( + <> + + + +); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.tsx new file mode 100644 index 0000000000000..6c321a6d0ce04 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/entry_content/entry_content.tsx @@ -0,0 +1,71 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { memo } from 'react'; +import { EuiExpression, EuiToken, EuiFlexGroup } from '@elastic/eui'; +import { ListOperatorTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; +import { + nestedGroupSpaceCss, + valueContainerCss, + expressionContainerCss, +} from '../conditions.styles'; +import type { Entry } from '../types'; +import * as i18n from '../../translations'; +import { getValue, getValueExpression } from './entry_content.helper'; + +export const EntryContent = memo( + ({ + entry, + index, + isNestedEntry = false, + dataTestSubj, + }: { + entry: Entry; + index: number; + isNestedEntry?: boolean; + dataTestSubj?: string; + }) => { + const { field, type } = entry; + const value = getValue(entry); + const operator = 'operator' in entry ? entry.operator : ''; + + const entryKey = `${field}${type}${value}${index}`; + return ( +
+
+ {isNestedEntry ? ( + + + +
+ + {getValueExpression(type as ListOperatorTypeEnum, operator, value)} +
+
+ ) : ( + <> + + + {getValueExpression(type as ListOperatorTypeEnum, operator, value)} + + )} +
+
+ ); + } +); +EntryContent.displayName = 'EntryContent'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/os_conditions.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/os_conditions.tsx new file mode 100644 index 0000000000000..701529ae6717d --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/os_conditions/os_conditions.tsx @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { memo, useMemo } from 'react'; +import { EuiExpression } from '@elastic/eui'; + +import { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; +import { OS_LABELS } from '../conditions.config'; +import * as i18n from '../../translations'; + +export interface OsConditionsProps { + dataTestSubj: string; + os: ExceptionListItemSchema['os_types']; +} + +export const OsCondition = memo(({ os, dataTestSubj }) => { + const osLabel = useMemo(() => { + return os.map((osValue) => OS_LABELS[osValue] ?? osValue).join(', '); + }, [os]); + return osLabel ? ( +
+ + + + +
+ ) : null; +}); +OsCondition.displayName = 'OsCondition'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/types.ts b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/types.ts new file mode 100644 index 0000000000000..09067e84cafc7 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/conditions/types.ts @@ -0,0 +1,32 @@ +/* + * 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 { + EntryExists, + EntryList, + EntryMatch, + EntryMatchAny, + EntryMatchWildcard, + EntryNested, + ExceptionListItemSchema, +} from '@kbn/securitysolution-io-ts-list-types'; + +export type Entry = + | EntryExists + | EntryList + | EntryMatch + | EntryMatchAny + | EntryMatchWildcard + | EntryNested; + +export type Entries = ExceptionListItemSchema['entries']; +export interface CriteriaConditionsProps { + entries: Entries; + dataTestSubj: string; + os?: ExceptionListItemSchema['os_types']; +} diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx new file mode 100644 index 0000000000000..c3705750d015d --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/exception_item_card.tsx @@ -0,0 +1,136 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { useMemo, useCallback, FC } from 'react'; +import { EuiPanel, EuiFlexGroup, EuiFlexItem, EuiCommentProps } from '@elastic/eui'; +import type { + CommentsArray, + ExceptionListItemSchema, + ExceptionListTypeEnum, +} from '@kbn/securitysolution-io-ts-list-types'; + +import * as i18n from './translations'; +import { + ExceptionItemCardHeader, + ExceptionItemCardConditions, + ExceptionItemCardMetaInfo, + ExceptionItemCardComments, +} from '.'; + +import type { ExceptionListItemIdentifiers } from '../types'; + +export interface ExceptionItemProps { + dataTestSubj?: string; + disableActions?: boolean; + exceptionItem: ExceptionListItemSchema; + listType: ExceptionListTypeEnum; + ruleReferences: any[]; // rulereferences + editActionLabel?: string; + deleteActionLabel?: string; + securityLinkAnchorComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common + formattedDateComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common + getFormattedComments: (comments: CommentsArray) => EuiCommentProps[]; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common + onDeleteException: (arg: ExceptionListItemIdentifiers) => void; + onEditException: (item: ExceptionListItemSchema) => void; +} + +const ExceptionItemCardComponent: FC = ({ + disableActions = false, + exceptionItem, + listType, + ruleReferences, + dataTestSubj, + editActionLabel, + deleteActionLabel, + securityLinkAnchorComponent, + formattedDateComponent, + getFormattedComments, + onDeleteException, + onEditException, +}) => { + const handleDelete = useCallback((): void => { + onDeleteException({ + id: exceptionItem.id, + name: exceptionItem.name, + namespaceType: exceptionItem.namespace_type, + }); + }, [onDeleteException, exceptionItem.id, exceptionItem.name, exceptionItem.namespace_type]); + + const handleEdit = useCallback((): void => { + onEditException(exceptionItem); + }, [onEditException, exceptionItem]); + + const formattedComments = useMemo((): EuiCommentProps[] => { + return getFormattedComments(exceptionItem.comments); + }, [exceptionItem.comments, getFormattedComments]); + + const actions: Array<{ + key: string; + icon: string; + label: string | boolean; + onClick: () => void; + }> = useMemo( + () => [ + { + key: 'edit', + icon: 'controlsHorizontal', + label: editActionLabel || i18n.exceptionItemCardEditButton(listType), + onClick: handleEdit, + }, + { + key: 'delete', + icon: 'trash', + label: deleteActionLabel || listType === i18n.exceptionItemCardDeleteButton(listType), + onClick: handleDelete, + }, + ], + [editActionLabel, listType, deleteActionLabel, handleDelete, handleEdit] + ); + return ( + + + + + + + + + + + + {formattedComments.length > 0 && ( + + )} + + + ); +}; + +ExceptionItemCardComponent.displayName = 'ExceptionItemCardComponent'; + +export const ExceptionItemCard = React.memo(ExceptionItemCardComponent); + +ExceptionItemCard.displayName = 'ExceptionItemCard'; 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 new file mode 100644 index 0000000000000..7f7f20dfc234d --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.test.tsx @@ -0,0 +1,76 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; + +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'; +import { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; + +const handleEdit = jest.fn(); +const handleDelete = jest.fn(); +const actions = [ + { + key: 'edit', + icon: 'pencil', + label: i18n.exceptionItemCardEditButton(ExceptionListTypeEnum.DETECTION), + onClick: handleEdit, + }, + { + key: 'delete', + icon: 'trash', + label: i18n.exceptionItemCardDeleteButton(ExceptionListTypeEnum.DETECTION), + onClick: handleDelete, + }, +]; +describe('ExceptionItemCardHeader', () => { + it('it renders item name', () => { + const wrapper = render( + + ); + + expect(wrapper.getByTestId('exceptionItemHeaderTitle')).toHaveTextContent('some name'); + }); + + it('it displays actions', () => { + const wrapper = render( + + ); + + // click on popover + fireEvent.click(wrapper.getByTestId('exceptionItemHeaderActionButton')); + fireEvent.click(wrapper.getByTestId('exceptionItemHeaderActionItemedit')); + expect(handleEdit).toHaveBeenCalled(); + + fireEvent.click(wrapper.getByTestId('exceptionItemHeaderActionItemdelete')); + expect(handleDelete).toHaveBeenCalled(); + }); + + it('it disables actions if disableActions is true', () => { + const wrapper = render( + + ); + + expect(wrapper.getByTestId('exceptionItemHeaderActionButton')).toBeDisabled(); + }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.tsx new file mode 100644 index 0000000000000..d58cb8d99b7a1 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/header/header.tsx @@ -0,0 +1,83 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { memo, useMemo, useState } from 'react'; +import type { EuiContextMenuPanelProps } from '@elastic/eui'; +import { + EuiButtonIcon, + EuiContextMenuPanel, + EuiFlexGroup, + EuiFlexItem, + EuiPopover, + EuiTitle, + EuiContextMenuItem, +} from '@elastic/eui'; +import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; + +export interface ExceptionItemCardHeaderProps { + item: ExceptionListItemSchema; + actions: Array<{ key: string; icon: string; label: string | boolean; onClick: () => void }>; + disableActions?: boolean; + dataTestSubj: string; +} + +export const ExceptionItemCardHeader = memo( + ({ item, actions, disableActions = false, dataTestSubj }) => { + const [isPopoverOpen, setIsPopoverOpen] = useState(false); + + const onItemActionsClick = () => setIsPopoverOpen((isOpen) => !isOpen); + const onClosePopover = () => setIsPopoverOpen(false); + + const itemActions = useMemo((): EuiContextMenuPanelProps['items'] => { + return actions.map((action) => ( + { + onClosePopover(); + action.onClick(); + }} + > + {action.label} + + )); + }, [dataTestSubj, actions]); + + return ( + + + +

{item.name}

+
+
+ + + } + panelPaddingSize="none" + isOpen={isPopoverOpen} + closePopover={onClosePopover} + data-test-subj={`${dataTestSubj}Items`} + > + + + +
+ ); + } +); + +ExceptionItemCardHeader.displayName = 'ExceptionItemCardHeader'; 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 new file mode 100644 index 0000000000000..87a8a3bd3b527 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.test.tsx @@ -0,0 +1,172 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { fireEvent, render } from '@testing-library/react'; + +import { ExceptionItemCard } from '.'; +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[] = [ + { + exception_lists: [ + { + id: '123', + list_id: 'i_exist', + namespace_type: 'single', + type: 'detection', + }, + { + id: '456', + list_id: 'i_exist_2', + namespace_type: 'single', + type: 'detection', + }, + ], + id: '1a2b3c', + name: 'Simple Rule Query', + rule_id: 'rule-2', + }, +]; +describe('ExceptionItemCard', () => { + it('it renders header, item meta information and conditions', () => { + const exceptionItem = { ...getExceptionListItemSchemaMock(), comments: [] }; + + const wrapper = render( + null} + formattedDateComponent={() => null} + getFormattedComments={() => []} + /> + ); + + expect(wrapper.getByTestId('exceptionItemCardHeaderContainer')).toBeInTheDocument(); + // expect(wrapper.getByTestId('exceptionItemCardMetaInfo')).toBeInTheDocument(); + expect(wrapper.getByTestId('exceptionItemCardConditions')).toBeInTheDocument(); + // expect(wrapper.queryByTestId('exceptionsViewerCommentAccordion')).not.toBeInTheDocument(); + }); + + it('it renders header, item meta information, conditions, and comments if any exist', () => { + const exceptionItem = { ...getExceptionListItemSchemaMock(), comments: getCommentsArrayMock() }; + + const wrapper = render( + null} + formattedDateComponent={() => null} + getFormattedComments={() => []} + /> + ); + + expect(wrapper.getByTestId('exceptionItemCardHeaderContainer')).toBeInTheDocument(); + // expect(wrapper.getByTestId('exceptionItemCardMetaInfo')).toBeInTheDocument(); + expect(wrapper.getByTestId('exceptionItemCardConditions')).toBeInTheDocument(); + // expect(wrapper.getByTestId('exceptionsViewerCommentAccordion')).toBeInTheDocument(); + }); + + it('it does not render edit or delete action buttons when "disableActions" is "true"', () => { + const exceptionItem = getExceptionListItemSchemaMock(); + + const wrapper = render( + null} + formattedDateComponent={() => null} + getFormattedComments={() => []} + /> + ); + expect(wrapper.queryByTestId('itemActionButton')).not.toBeInTheDocument(); + }); + + it('it invokes "onEditException" when edit button clicked', () => { + const mockOnEditException = jest.fn(); + const exceptionItem = getExceptionListItemSchemaMock(); + + const wrapper = render( + null} + formattedDateComponent={() => null} + getFormattedComments={() => []} + /> + ); + + fireEvent.click(wrapper.getByTestId('exceptionItemCardHeaderActionButton')); + fireEvent.click(wrapper.getByTestId('exceptionItemCardHeaderActionItemedit')); + expect(mockOnEditException).toHaveBeenCalledWith(getExceptionListItemSchemaMock()); + }); + + it('it invokes "onDeleteException" when delete button clicked', () => { + const mockOnDeleteException = jest.fn(); + const exceptionItem = getExceptionListItemSchemaMock(); + + const wrapper = render( + null} + formattedDateComponent={() => null} + getFormattedComments={() => []} + /> + ); + fireEvent.click(wrapper.getByTestId('exceptionItemCardHeaderActionButton')); + fireEvent.click(wrapper.getByTestId('exceptionItemCardHeaderActionItemdelete')); + + expect(mockOnDeleteException).toHaveBeenCalledWith({ + id: '1', + name: 'some name', + namespaceType: 'single', + }); + }); + + // TODO Fix this Test + // it('it renders comment accordion closed to begin with', () => { + // const exceptionItem = getExceptionListItemSchemaMock(); + // exceptionItem.comments = getCommentsArrayMock(); + // const wrapper = render( + // + // ); + + // expect(wrapper.queryByTestId('accordion-comment-list')).not.toBeVisible(); + // }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.ts b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.ts new file mode 100644 index 0000000000000..c0fd3fafc86d5 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/index.ts @@ -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. + */ + +export * from './conditions/conditions'; +export * from './header/header'; +export * from './meta/meta'; +export * from './comments/comments'; +export * from './exception_item_card'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.tsx new file mode 100644 index 0000000000000..3d075f50096d0 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/details_info/details_info.tsx @@ -0,0 +1,59 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { memo } from 'react'; +import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; +import { css } from '@emotion/react'; +import { euiThemeVars } from '@kbn/ui-theme'; +import * as i18n from '../../translations'; + +interface MetaInfoDetailsProps { + fieldName: string; + label: string; + lastUpdate: JSX.Element | string; + lastUpdateValue: string; + dataTestSubj: string; +} + +const euiBadgeFontFamily = css` + font-family: ${euiThemeVars.euiFontFamily}; +`; +export const MetaInfoDetails = memo( + ({ label, lastUpdate, lastUpdateValue, dataTestSubj }) => { + return ( + + + + {label} + + + + + {lastUpdate} + + + + + {i18n.EXCEPTION_ITEM_CARD_META_BY} + + + + + + + {lastUpdateValue} + + + + + + ); + } +); + +MetaInfoDetails.displayName = 'MetaInfoDetails'; 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 new file mode 100644 index 0000000000000..c5ad9bd7af313 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.test.tsx @@ -0,0 +1,155 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { render } from '@testing-library/react'; +import { getExceptionListItemSchemaMock } from '../../test_helpers/exception_list_item_schema.mock'; + +import { ExceptionItemCardMetaInfo } from './meta'; +import { RuleReference } from '../../types'; + +const ruleReferences = [ + { + exception_lists: [ + { + id: '123', + list_id: 'i_exist', + namespace_type: 'single', + type: 'detection', + }, + { + id: '456', + list_id: 'i_exist_2', + namespace_type: 'single', + type: 'detection', + }, + ], + id: '1a2b3c', + name: 'Simple Rule Query', + rule_id: 'rule-2', + }, +]; +describe('ExceptionItemCardMetaInfo', () => { + it('it should render creation info with sending custom formattedDateComponent', () => { + const wrapper = render( + null} + formattedDateComponent={({ fieldName, value }) => ( + <> +

{new Date(value).toDateString()}

+ + )} + /> + ); + + expect(wrapper.getByTestId('exceptionItemMetaCreatedBylastUpdate')).toHaveTextContent( + 'Mon Apr 20 2020' + ); + expect(wrapper.getByTestId('exceptionItemMetaCreatedBylastUpdateValue')).toHaveTextContent( + 'some user' + ); + }); + + it('it should render udate info with sending custom formattedDateComponent', () => { + const wrapper = render( + null} + formattedDateComponent={({ fieldName, value }) => ( + <> +

{new Date(value).toDateString()}

+ + )} + /> + ); + expect(wrapper.getByTestId('exceptionItemMetaUpdatedBylastUpdate')).toHaveTextContent( + 'Mon Apr 20 2020' + ); + expect(wrapper.getByTestId('exceptionItemMetaUpdatedBylastUpdateValue')).toHaveTextContent( + 'some user' + ); + }); + + it('it should render references info', () => { + const wrapper = render( + null} + formattedDateComponent={() => null} + /> + ); + + expect(wrapper.getByTestId('exceptionItemMetaAffectedRulesButton')).toHaveTextContent( + 'Affects 1 rule' + ); + }); + + it('it renders references info when multiple references exist', () => { + const wrapper = render( + null} + formattedDateComponent={() => null} + /> + ); + + expect(wrapper.getByTestId('exceptionItemMetaAffectedRulesButton')).toHaveTextContent( + 'Affects 2 rules' + ); + }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx new file mode 100644 index 0000000000000..91e0a9cdd19b8 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/meta/meta.tsx @@ -0,0 +1,123 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { memo, useMemo, useState } from 'react'; +import type { EuiContextMenuPanelProps } from '@elastic/eui'; +import { + EuiContextMenuItem, + EuiContextMenuPanel, + EuiFlexGroup, + EuiFlexItem, + EuiToolTip, + EuiButtonEmpty, + EuiPopover, +} from '@elastic/eui'; +import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; + +import { css } from '@emotion/react'; +import * as i18n from '../translations'; +import type { RuleReference } from '../../types'; +import { MetaInfoDetails } from './details_info/details_info'; + +const itemCss = css` + border-right: 1px solid #d3dae6; + padding: 4px 12px 4px 0; +`; + +export interface ExceptionItemCardMetaInfoProps { + item: ExceptionListItemSchema; + references: RuleReference[]; + dataTestSubj: string; + formattedDateComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common + securityLinkAnchorComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common +} + +export const ExceptionItemCardMetaInfo = memo( + ({ item, references, dataTestSubj, securityLinkAnchorComponent, formattedDateComponent }) => { + const [isPopoverOpen, setIsPopoverOpen] = useState(false); + + const onAffectedRulesClick = () => setIsPopoverOpen((isOpen) => !isOpen); + const onClosePopover = () => setIsPopoverOpen(false); + + const FormattedDateComponent = formattedDateComponent; + const itemActions = useMemo((): EuiContextMenuPanelProps['items'] => { + if (references == null || securityLinkAnchorComponent === null) { + return []; + } + + const SecurityLinkAnchor = securityLinkAnchorComponent; + return references.map((reference) => ( + + + + + + )); + }, [references, securityLinkAnchorComponent, dataTestSubj]); + + return ( + + {FormattedDateComponent !== null && ( + <> + + + } + lastUpdateValue={item.created_by} + dataTestSubj={`${dataTestSubj}CreatedBy`} + /> + + + + + } + lastUpdateValue={item.updated_by} + dataTestSubj={`${dataTestSubj}UpdatedBy`} + /> + + + )} + + + {i18n.AFFECTED_RULES(references.length)} + + } + panelPaddingSize="none" + isOpen={isPopoverOpen} + closePopover={onClosePopover} + data-test-subj={`${dataTestSubj}Items`} + > + + + + + ); + } +); +ExceptionItemCardMetaInfo.displayName = 'ExceptionItemCardMetaInfo'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/translations.ts b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/translations.ts new file mode 100644 index 0000000000000..2fa7524291025 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_item_card/translations.ts @@ -0,0 +1,166 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { i18n } from '@kbn/i18n'; + +export const exceptionItemCardEditButton = (listType: string) => + i18n.translate('exceptionList-components.exceptions.exceptionItem.card.editItemButton', { + values: { listType }, + defaultMessage: 'Edit {listType} exception', + }); + +export const exceptionItemCardDeleteButton = (listType: string) => + i18n.translate('exceptionList-components.exceptions.exceptionItem.card.deleteItemButton', { + values: { listType }, + defaultMessage: 'Delete {listType} exception', + }); + +export const EXCEPTION_ITEM_CARD_CREATED_LABEL = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.createdLabel', + { + defaultMessage: 'Created', + } +); + +export const EXCEPTION_ITEM_CARD_UPDATED_LABEL = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.updatedLabel', + { + defaultMessage: 'Updated', + } +); + +export const EXCEPTION_ITEM_CARD_META_BY = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.metaDetailsBy', + { + defaultMessage: 'by', + } +); + +export const exceptionItemCardCommentsAccordion = (comments: number) => + i18n.translate('exceptionList-components.exceptions.exceptionItem.card.showCommentsLabel', { + values: { comments }, + defaultMessage: 'Show {comments, plural, =1 {comment} other {comments}} ({comments})', + }); + +export const CONDITION_OPERATOR_TYPE_MATCH = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.matchOperator', + { + defaultMessage: 'IS', + } +); + +export const CONDITION_OPERATOR_TYPE_NOT_MATCH = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.matchOperator.not', + { + defaultMessage: 'IS NOT', + } +); + +export const CONDITION_OPERATOR_TYPE_WILDCARD_MATCHES = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.wildcardMatchesOperator', + { + defaultMessage: 'MATCHES', + } +); + +export const CONDITION_OPERATOR_TYPE_WILDCARD_DOES_NOT_MATCH = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.wildcardDoesNotMatchOperator', + { + defaultMessage: 'DOES NOT MATCH', + } +); + +export const CONDITION_OPERATOR_TYPE_NESTED = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.nestedOperator', + { + defaultMessage: 'has', + } +); + +export const CONDITION_OPERATOR_TYPE_MATCH_ANY = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.matchAnyOperator', + { + defaultMessage: 'is one of', + } +); + +export const CONDITION_OPERATOR_TYPE_NOT_MATCH_ANY = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.matchAnyOperator.not', + { + defaultMessage: 'is not one of', + } +); + +export const CONDITION_OPERATOR_TYPE_EXISTS = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.existsOperator', + { + defaultMessage: 'exists', + } +); + +export const CONDITION_OPERATOR_TYPE_DOES_NOT_EXIST = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.existsOperator.not', + { + defaultMessage: 'does not exist', + } +); + +export const CONDITION_OPERATOR_TYPE_LIST = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.listOperator', + { + defaultMessage: 'included in', + } +); + +export const CONDITION_OPERATOR_TYPE_NOT_IN_LIST = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.listOperator.not', + { + defaultMessage: 'is not included in', + } +); + +export const CONDITION_AND = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.and', + { + defaultMessage: 'AND', + } +); + +export const CONDITION_OS = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.os', + { + defaultMessage: 'OS', + } +); + +export const OS_WINDOWS = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.windows', + { + defaultMessage: 'Windows', + } +); + +export const OS_LINUX = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.linux', + { + defaultMessage: 'Linux', + } +); + +export const OS_MAC = i18n.translate( + 'exceptionList-components.exceptions.exceptionItem.card.conditions.macos', + { + defaultMessage: 'Mac', + } +); + +export const AFFECTED_RULES = (numRules: number) => + i18n.translate('exceptionList-components.exceptions.card.exceptionItem.affectedRules', { + values: { numRules }, + defaultMessage: 'Affects {numRules} {numRules, plural, =1 {rule} other {rules}}', + }); 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 new file mode 100644 index 0000000000000..39c429dd1f1dd --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_items/exception_items.test.tsx @@ -0,0 +1,103 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; + +import { getExceptionListItemSchemaMock } from '../test_helpers/exception_list_item_schema.mock'; +import { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; + +import { ExceptionItems } from './exception_items'; + +import { ViewerStatus } from '../types'; +import { render } from '@testing-library/react'; + +const onCreateExceptionListItem = jest.fn(); +const onDeleteException = jest.fn(); +const onEditExceptionItem = jest.fn(); +const onPaginationChange = jest.fn(); + +const pagination = { pageIndex: 0, pageSize: 0, totalItemCount: 0 }; + +describe('ExceptionsViewerItems', () => { + describe('Viewing EmptyViewerState', () => { + it('it renders empty prompt if "viewerStatus" is "empty"', () => { + const wrapper = render( + null} + formattedDateComponent={() => null} + exceptionsUtilityComponent={() => null} + getFormattedComments={() => []} + /> + ); + // expect(wrapper).toMatchSnapshot(); + expect(wrapper.getByTestId('emptyViewerState')).toBeInTheDocument(); + expect(wrapper.queryByTestId('exceptionsContainer')).not.toBeInTheDocument(); + }); + + it('it renders no search results found prompt if "viewerStatus" is "empty_search"', () => { + const wrapper = render( + null} + formattedDateComponent={() => null} + exceptionsUtilityComponent={() => null} + getFormattedComments={() => []} + /> + ); + // expect(wrapper).toMatchSnapshot(); + expect(wrapper.getByTestId('emptySearchViewerState')).toBeInTheDocument(); + expect(wrapper.queryByTestId('exceptionsContainer')).not.toBeInTheDocument(); + }); + + it('it renders exceptions if "viewerStatus" and "null"', () => { + const wrapper = render( + null} + formattedDateComponent={() => null} + exceptionsUtilityComponent={() => null} + getFormattedComments={() => []} + /> + ); + // expect(wrapper).toMatchSnapshot(); + expect(wrapper.getByTestId('exceptionsContainer')).toBeTruthy(); + }); + }); + // TODO Add Exception Items and Pagination interactions +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/exception_items/exception_items.tsx b/packages/kbn-securitysolution-exception-list-components/src/exception_items/exception_items.tsx new file mode 100644 index 0000000000000..80ab3d99f6eb8 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/exception_items/exception_items.tsx @@ -0,0 +1,139 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { css } from '@emotion/react'; +import type { FC } from 'react'; +import { EuiCommentProps, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; + +import type { Pagination as PaginationType } from '@elastic/eui'; + +import type { + CommentsArray, + ExceptionListItemSchema, + ExceptionListTypeEnum, +} from '@kbn/securitysolution-io-ts-list-types'; + +import { euiThemeVars } from '@kbn/ui-theme'; +import { EmptyViewerState, ExceptionItemCard, Pagination } from '../..'; + +import type { + RuleReferences, + ExceptionListItemIdentifiers, + ViewerStatus, + GetExceptionItemProps, +} from '../types'; + +const exceptionItemCss = css` + margin: ${euiThemeVars.euiSize} 0; + &div:first-child { + margin: ${euiThemeVars.euiSizeXS} 0 ${euiThemeVars.euiSize}; + } +`; + +interface ExceptionItemsProps { + lastUpdated: string | number | null; + viewerStatus: ViewerStatus; + isReadOnly: boolean; + emptyViewerTitle?: string; + emptyViewerBody?: string; + emptyViewerButtonText?: string; + exceptions: ExceptionListItemSchema[]; + listType: ExceptionListTypeEnum; + ruleReferences: RuleReferences; + pagination: PaginationType; + securityLinkAnchorComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common + formattedDateComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common + exceptionsUtilityComponent: React.ElementType; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common + getFormattedComments: (comments: CommentsArray) => EuiCommentProps[]; // This property needs to be removed to avoid the Prop Drilling, once we move all the common components from x-pack/security-solution/common + onCreateExceptionListItem?: () => void; + onDeleteException: (arg: ExceptionListItemIdentifiers) => void; + onEditExceptionItem: (item: ExceptionListItemSchema) => void; + onPaginationChange: (arg: GetExceptionItemProps) => void; +} + +const ExceptionItemsComponent: FC = ({ + lastUpdated, + viewerStatus, + isReadOnly, + exceptions, + listType, + ruleReferences, + emptyViewerTitle, + emptyViewerBody, + emptyViewerButtonText, + pagination, + securityLinkAnchorComponent, + exceptionsUtilityComponent, + formattedDateComponent, + getFormattedComments, + onPaginationChange, + onDeleteException, + onEditExceptionItem, + onCreateExceptionListItem, +}) => { + const ExceptionsUtility = exceptionsUtilityComponent; + if (!exceptions.length || viewerStatus) + return ( + + ); + return ( + <> + + + + + {exceptions.map((exception) => ( + + + + ))} + + + + + + ); +}; + +ExceptionItemsComponent.displayName = 'ExceptionItemsComponent'; + +export const ExceptionItems = React.memo(ExceptionItemsComponent); + +ExceptionItems.displayName = 'ExceptionsItems'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.test.tsx new file mode 100644 index 0000000000000..4d97f198aa2b9 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.test.tsx @@ -0,0 +1,78 @@ +/* + * 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 { fireEvent, render } from '@testing-library/react'; +import React from 'react'; + +import { Pagination } from './pagination'; + +describe('Pagination', () => { + it('it invokes "onPaginationChange" when per page item is clicked', () => { + const mockOnPaginationChange = jest.fn(); + const wrapper = render( + + ); + + fireEvent.click(wrapper.getByTestId('tablePaginationPopoverButton')); + fireEvent.click(wrapper.getByTestId('tablePagination-50-rows')); + + expect(mockOnPaginationChange).toHaveBeenCalledWith({ + pagination: { pageIndex: 0, pageSize: 50, totalItemCount: 1 }, + }); + }); + + it('it invokes "onPaginationChange" when next clicked', () => { + const mockOnPaginationChange = jest.fn(); + const wrapper = render( + + ); + + fireEvent.click(wrapper.getByTestId('pagination-button-next')); + + expect(mockOnPaginationChange).toHaveBeenCalledWith({ + pagination: { pageIndex: 1, pageSize: 5, totalItemCount: 160 }, + }); + }); + + it('it invokes "onPaginationChange" when page clicked', () => { + const mockOnPaginationChange = jest.fn(); + const wrapper = render( + + ); + + fireEvent.click(wrapper.getByTestId('pagination-button-2')); + + expect(mockOnPaginationChange).toHaveBeenCalledWith({ + pagination: { pageIndex: 2, pageSize: 50, totalItemCount: 160 }, + }); + }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.tsx b/packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.tsx new file mode 100644 index 0000000000000..30b029480e173 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/pagination/pagination.tsx @@ -0,0 +1,50 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import type { FC } from 'react'; +import { EuiTablePagination } from '@elastic/eui'; + +import type { PaginationProps } from '../types'; +import { usePagination } from './use_pagination'; + +const PaginationComponent: FC = ({ + dataTestSubj, + ariaLabel, + pagination, + onPaginationChange, +}) => { + const { + pageIndex, + pageCount, + pageSize, + pageSizeOptions, + + handleItemsPerPageChange, + handlePageIndexChange, + } = usePagination({ pagination, onPaginationChange }); + + return ( + + ); +}; + +PaginationComponent.displayName = 'PaginationComponent'; + +export const Pagination = React.memo(PaginationComponent); + +Pagination.displayName = 'Pagination'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/pagination/use_pagination.test.ts b/packages/kbn-securitysolution-exception-list-components/src/pagination/use_pagination.test.ts new file mode 100644 index 0000000000000..d190c88f10617 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/pagination/use_pagination.test.ts @@ -0,0 +1,67 @@ +/* + * 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 { act, renderHook } from '@testing-library/react-hooks'; +import { usePagination } from './use_pagination'; + +const onPaginationChange = jest.fn(); + +describe('usePagination', () => { + test('should return the correct EuiTablePagination props when all the pagination object properties are falsy', () => { + const pagination = { pageIndex: 0, pageSize: 0, totalItemCount: 0 }; + + const { result } = renderHook(() => usePagination({ pagination, onPaginationChange })); + const { pageCount, pageIndex, pageSize, pageSizeOptions } = result.current; + expect(pageCount).toEqual(0); + expect(pageIndex).toEqual(0); + expect(pageSize).toEqual(0); + expect(pageSizeOptions).toEqual(undefined); + }); + test('should return the correct pageCount when pagination properties are invalid', () => { + const pagination = { pageIndex: 0, pageSize: 10, totalItemCount: 0 }; + + const { result } = renderHook(() => usePagination({ pagination, onPaginationChange })); + const { pageCount } = result.current; + expect(pageCount).toEqual(0); + }); + test('should return the correct EuiTablePagination props when all the pagination object properties are turthy', () => { + const pagination = { pageIndex: 0, pageSize: 10, totalItemCount: 100 }; + + const { result } = renderHook(() => usePagination({ pagination, onPaginationChange })); + const { pageCount, pageIndex, pageSize } = result.current; + expect(pageCount).toEqual(10); + expect(pageIndex).toEqual(0); + expect(pageSize).toEqual(10); + }); + test('should call onPaginationChange with correct pageIndex when the Page changes', () => { + const pagination = { pageIndex: 0, pageSize: 10, totalItemCount: 100 }; + + const { result } = renderHook(() => usePagination({ pagination, onPaginationChange })); + const { handlePageIndexChange } = result.current; + + act(() => { + handlePageIndexChange(2); + }); + expect(onPaginationChange).toHaveBeenCalledWith({ + pagination: { pageIndex: 2, pageSize: 10, totalItemCount: 100 }, + }); + }); + test('should call onPaginationChange with correct pageSize when the number of items per change changes', () => { + const pagination = { pageIndex: 0, pageSize: 10, totalItemCount: 100 }; + + const { result } = renderHook(() => usePagination({ pagination, onPaginationChange })); + const { handleItemsPerPageChange } = result.current; + + act(() => { + handleItemsPerPageChange(100); + }); + expect(onPaginationChange).toHaveBeenCalledWith({ + pagination: { pageIndex: 0, pageSize: 100, totalItemCount: 100 }, + }); + }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/pagination/use_pagination.ts b/packages/kbn-securitysolution-exception-list-components/src/pagination/use_pagination.ts new file mode 100644 index 0000000000000..d235658263687 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/pagination/use_pagination.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 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 { useCallback, useMemo } from 'react'; +import type { PaginationProps } from '../types'; + +export const usePagination = ({ pagination, onPaginationChange }: PaginationProps) => { + const { pageIndex, totalItemCount, pageSize, pageSizeOptions } = pagination; + + const pageCount = useMemo( + () => (isFinite(totalItemCount / pageSize) ? Math.ceil(totalItemCount / pageSize) : 0), + [pageSize, totalItemCount] + ); + + const handleItemsPerPageChange = useCallback( + (nextPageSize: number) => { + onPaginationChange({ + pagination: { + pageIndex, + pageSize: nextPageSize, + totalItemCount, + }, + }); + }, + [pageIndex, totalItemCount, onPaginationChange] + ); + + const handlePageIndexChange = useCallback( + (nextPageIndex: number) => { + onPaginationChange({ + pagination: { + pageIndex: nextPageIndex, + pageSize, + totalItemCount, + }, + }); + }, + [pageSize, totalItemCount, onPaginationChange] + ); + + return { + pageCount, + pageIndex, + pageSize, + pageSizeOptions, + + handleItemsPerPageChange, + handlePageIndexChange, + }; +}; diff --git a/packages/kbn-securitysolution-exception-list-components/src/search_bar/search_bar.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/search_bar/search_bar.test.tsx new file mode 100644 index 0000000000000..ac82bb3b6e850 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/search_bar/search_bar.test.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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { fireEvent, render } from '@testing-library/react'; + +import { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; + +import { SearchBar } from './search_bar'; + +describe('SearchBar', () => { + it('it does not display add exception button if user is read only', () => { + const wrapper = render( + + ); + + expect(wrapper.queryByTestId('searchBarButton')).not.toBeInTheDocument(); + }); + + it('it invokes "onAddExceptionClick" when user selects to add an exception item', () => { + const mockOnAddExceptionClick = jest.fn(); + const wrapper = render( + + ); + + const searchBtn = wrapper.getByTestId('searchBarButton'); + + fireEvent.click(searchBtn); + expect(searchBtn).toHaveTextContent('Add rule exception'); + expect(mockOnAddExceptionClick).toHaveBeenCalledWith('detection'); + }); + + it('it invokes "onAddExceptionClick" when user selects to add an endpoint exception item', () => { + const mockOnAddExceptionClick = jest.fn(); + const wrapper = render( + + ); + + const searchBtn = wrapper.getByTestId('searchBarButton'); + + fireEvent.click(searchBtn); + expect(searchBtn).toHaveTextContent('Add endpoint exception'); + expect(mockOnAddExceptionClick).toHaveBeenCalledWith('endpoint'); + }); + it('it invokes the "handlOnSearch" when the user add search query', () => { + const mockHandleOnSearch = jest.fn(); + const wrapper = render( + + ); + + const searchInput = wrapper.getByTestId('searchBar'); + fireEvent.change(searchInput, { target: { value: 'query' } }); + expect(mockHandleOnSearch).toBeCalledWith({ search: 'query' }); + }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/search_bar/search_bar.tsx b/packages/kbn-securitysolution-exception-list-components/src/search_bar/search_bar.tsx new file mode 100644 index 0000000000000..bb8dc6ee62559 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/search_bar/search_bar.tsx @@ -0,0 +1,118 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React, { useCallback } from 'react'; +import type { FC } from 'react'; + +import type { SearchFilterConfig } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiButton, EuiSearchBar } from '@elastic/eui'; +import type { ExceptionListTypeEnum } from '@kbn/securitysolution-io-ts-list-types'; +import type { GetExceptionItemProps } from '../types'; + +const ITEMS_SCHEMA = { + strict: true, + fields: { + created_by: { + type: 'string', + }, + description: { + type: 'string', + }, + id: { + type: 'string', + }, + item_id: { + type: 'string', + }, + list_id: { + type: 'string', + }, + name: { + type: 'string', + }, + os_types: { + type: 'string', + }, + tags: { + type: 'string', + }, + }, +}; +interface SearchBarProps { + addExceptionButtonText?: string; + placeholdertext?: string; + canAddException?: boolean; // TODO what is the default value + + // TODO: REFACTOR: not to send the listType and handle it in the Parent + // Exception list type used to determine what type of item is + // being created when "onAddExceptionClick" is invoked + listType: ExceptionListTypeEnum; + isSearching?: boolean; + dataTestSubj?: string; + filters?: SearchFilterConfig[]; // TODO about filters + onSearch: (arg: GetExceptionItemProps) => void; + onAddExceptionClick: (type: ExceptionListTypeEnum) => void; +} +const SearchBarComponent: FC = ({ + addExceptionButtonText, + placeholdertext, + canAddException, + listType, + isSearching, + dataTestSubj, + filters = [], + onSearch, + onAddExceptionClick, +}) => { + const handleOnSearch = useCallback( + ({ queryText }): void => { + onSearch({ search: queryText }); + }, + [onSearch] + ); + + const handleAddException = useCallback(() => { + // TODO: ASK YARA why we need to send the listType + onAddExceptionClick(listType); + }, [onAddExceptionClick, listType]); + + return ( + + + + + {!canAddException && ( + + + {addExceptionButtonText} + + + )} + + ); +}; + +SearchBarComponent.displayName = 'SearchBarComponent'; + +export const SearchBar = React.memo(SearchBarComponent); + +SearchBar.displayName = 'SearchBar'; 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 0000000000000..3e83aa53f0f23 --- /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 0000000000000..40f6d5292f317 --- /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-securitysolution-exception-list-components/src/translations.ts b/packages/kbn-securitysolution-exception-list-components/src/translations.ts new file mode 100644 index 0000000000000..c919ef423c545 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/translations.ts @@ -0,0 +1,57 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { i18n } from '@kbn/i18n'; + +export const EMPTY_VIEWER_STATE_EMPTY_TITLE = i18n.translate( + 'exceptionList-components.empty.viewer.state.empty.title', + { + defaultMessage: 'Add exceptions to this rule', + } +); + +export const EMPTY_VIEWER_STATE_EMPTY_BODY = i18n.translate( + 'exceptionList-components.empty.viewer.state.empty.body', + { + defaultMessage: 'There is no exception in your rule. Create your first rule exception.', + } +); +export const EMPTY_VIEWER_STATE_EMPTY_SEARCH_TITLE = i18n.translate( + 'exceptionList-components.empty.viewer.state.empty_search.search.title', + { + defaultMessage: 'No results match your search criteria', + } +); + +export const EMPTY_VIEWER_STATE_EMPTY_SEARCH_BODY = i18n.translate( + 'exceptionList-components.empty.viewer.state.empty_search.body', + { + defaultMessage: 'Try modifying your search', + } +); + +export const EMPTY_VIEWER_STATE_EMPTY_VIEWER_BUTTON = (exceptionType: string) => + i18n.translate('exceptionList-components.empty.viewer.state.empty.viewer_button', { + values: { exceptionType }, + defaultMessage: 'Create {exceptionType} exception', + }); + +export const EMPTY_VIEWER_STATE_ERROR_TITLE = i18n.translate( + 'exceptionList-components.empty.viewer.state.error_title', + { + defaultMessage: 'Unable to load exception items', + } +); + +export const EMPTY_VIEWER_STATE_ERROR_BODY = i18n.translate( + 'exceptionList-components.empty.viewer.state.error_body', + { + defaultMessage: + 'There was an error loading the exception items. Contact your administrator for help.', + } +); diff --git a/packages/kbn-securitysolution-exception-list-components/src/types/index.ts b/packages/kbn-securitysolution-exception-list-components/src/types/index.ts new file mode 100644 index 0000000000000..dbb402ca78451 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/types/index.ts @@ -0,0 +1,65 @@ +/* + * 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 { ExceptionListSchema } from '@kbn/securitysolution-io-ts-list-types'; + +import type { Pagination } from '@elastic/eui'; +import type { NamespaceType } from '@kbn/securitysolution-io-ts-list-types'; + +export interface GetExceptionItemProps { + pagination?: Pagination; + search?: string; + filters?: string; +} + +export interface PaginationProps { + dataTestSubj?: string; + ariaLabel?: string; + pagination: Pagination; + onPaginationChange: (arg: GetExceptionItemProps) => void; +} + +export enum ViewerStatus { + ERROR = 'error', + EMPTY = 'empty', + EMPTY_SEARCH = 'empty_search', + LOADING = 'loading', + SEARCHING = 'searching', + DELETING = 'deleting', +} + +export interface ExceptionListSummaryProps { + pagination: Pagination; + // Corresponds to last time exception items were fetched + lastUpdated: string | number | null; +} + +export type ViewerFlyoutName = 'addException' | 'editException' | null; + +export interface RuleReferences { + [key: string]: any[]; // TODO fix +} + +export interface ExceptionListItemIdentifiers { + id: string; + name: string; + namespaceType: NamespaceType; +} + +export enum ListTypeText { + ENDPOINT = 'endpoint', + DETECTION = 'empty', + RULE_DEFAULT = 'empty_search', +} + +export interface RuleReference { + name: string; + id: string; + ruleId: string; + exceptionLists: ExceptionListSchema[]; +} diff --git a/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/index.ts b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/index.ts new file mode 100644 index 0000000000000..472a80575f27d --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/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 { ValueWithSpaceWarning } from './value_with_space_warning'; diff --git a/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/use_value_with_space_warning.test.ts b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/use_value_with_space_warning.test.ts new file mode 100644 index 0000000000000..8f6788d710a19 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/use_value_with_space_warning.test.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 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 { renderHook } from '@testing-library/react-hooks'; +import { useValueWithSpaceWarning } from './use_value_with_space_warning'; + +describe('useValueWithSpaceWarning', () => { + it('should return true when value is string and contains space', () => { + const { result } = renderHook(() => useValueWithSpaceWarning({ value: ' space before' })); + + const { showSpaceWarningIcon, warningText } = result.current; + expect(showSpaceWarningIcon).toBeTruthy(); + expect(warningText).toBeTruthy(); + }); + it('should return true when value is string and does not contain space', () => { + const { result } = renderHook(() => useValueWithSpaceWarning({ value: 'no space' })); + + const { showSpaceWarningIcon, warningText } = result.current; + expect(showSpaceWarningIcon).toBeFalsy(); + expect(warningText).toBeTruthy(); + }); + it('should return true when value is array and one of the elements contains space', () => { + const { result } = renderHook(() => + useValueWithSpaceWarning({ value: [' space before', 'no space'] }) + ); + + const { showSpaceWarningIcon, warningText } = result.current; + expect(showSpaceWarningIcon).toBeTruthy(); + expect(warningText).toBeTruthy(); + }); + it('should return true when value is array and none contains space', () => { + const { result } = renderHook(() => + useValueWithSpaceWarning({ value: ['no space', 'no space'] }) + ); + + const { showSpaceWarningIcon, warningText } = result.current; + expect(showSpaceWarningIcon).toBeFalsy(); + expect(warningText).toBeTruthy(); + }); + it('should return the tooltipIconText', () => { + const { result } = renderHook(() => + useValueWithSpaceWarning({ value: ' space before', tooltipIconText: 'Warning Text' }) + ); + + const { showSpaceWarningIcon, warningText } = result.current; + expect(showSpaceWarningIcon).toBeTruthy(); + expect(warningText).toEqual('Warning Text'); + }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/use_value_with_space_warning.ts b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/use_value_with_space_warning.ts new file mode 100644 index 0000000000000..bf407d2798c78 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/use_value_with_space_warning.ts @@ -0,0 +1,32 @@ +/* + * 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 { paramContainsSpace, autoCompletei18n } from '@kbn/securitysolution-autocomplete'; + +interface UseValueWithSpaceWarningResult { + showSpaceWarningIcon: boolean; + warningText: string; +} +interface UseValueWithSpaceWarningProps { + value: string | string[]; + tooltipIconText?: string; +} + +export const useValueWithSpaceWarning = ({ + value, + tooltipIconText, +}: UseValueWithSpaceWarningProps): UseValueWithSpaceWarningResult => { + const showSpaceWarningIcon = Array.isArray(value) + ? value.find(paramContainsSpace) + : paramContainsSpace(value); + + return { + showSpaceWarningIcon: !!showSpaceWarningIcon, + warningText: tooltipIconText || autoCompletei18n.FIELD_SPACE_WARNING, + }; +}; diff --git a/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/value_with_space_warning.test.tsx b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/value_with_space_warning.test.tsx new file mode 100644 index 0000000000000..e19a54be48aa4 --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/value_with_space_warning.test.tsx @@ -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 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import { fireEvent, render } from '@testing-library/react'; + +import { ValueWithSpaceWarning } from '.'; + +import * as useValueWithSpaceWarningMock from './use_value_with_space_warning'; + +jest.mock('./use_value_with_space_warning'); + +describe('ValueWithSpaceWarning', () => { + beforeEach(() => { + // @ts-ignore + useValueWithSpaceWarningMock.useValueWithSpaceWarning = jest + .fn() + .mockReturnValue({ showSpaceWarningIcon: true, warningText: 'Warning Text' }); + }); + it('should not render if value is falsy', () => { + const container = render(); + expect(container.queryByTestId('valueWithSpaceWarningTooltip')).toBeFalsy(); + }); + it('should not render if showSpaceWarning is falsy', () => { + // @ts-ignore + useValueWithSpaceWarningMock.useValueWithSpaceWarning = jest + .fn() + .mockReturnValue({ showSpaceWarningIcon: false, warningText: '' }); + + const container = render(); + expect(container.queryByTestId('valueWithSpaceWarningTooltip')).toBeFalsy(); + }); + it('should render if showSpaceWarning is truthy', () => { + const container = render(); + expect(container.getByTestId('valueWithSpaceWarningTooltip')).toBeInTheDocument(); + }); + it('should show the tooltip when the icon is clicked', async () => { + const container = render(); + + fireEvent.mouseOver(container.getByTestId('valueWithSpaceWarningTooltip')); + expect(await container.findByText('Warning Text')).toBeInTheDocument(); + }); +}); diff --git a/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/value_with_space_warning.tsx b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/value_with_space_warning.tsx new file mode 100644 index 0000000000000..9cff0649efb9e --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/src/value_with_space_warning/value_with_space_warning.tsx @@ -0,0 +1,47 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import React from 'react'; +import type { FC } from 'react'; +import { css } from '@emotion/css'; +import { euiThemeVars } from '@kbn/ui-theme'; + +import { EuiIcon, EuiToolTip } from '@elastic/eui'; +import { useValueWithSpaceWarning } from './use_value_with_space_warning'; + +interface ValueWithSpaceWarningProps { + value: string[] | string; + tooltipIconType?: string; + tooltipIconText?: string; +} +const containerCss = css` + display: inline; + margin-left: ${euiThemeVars.euiSizeXS}; +`; +export const ValueWithSpaceWarning: FC = ({ + value, + tooltipIconType = 'iInCircle', + tooltipIconText, +}) => { + const { showSpaceWarningIcon, warningText } = useValueWithSpaceWarning({ + value, + tooltipIconText, + }); + if (!showSpaceWarningIcon || !value) return null; + return ( +
+ + + +
+ ); +}; diff --git a/packages/kbn-securitysolution-exception-list-components/tsconfig.json b/packages/kbn-securitysolution-exception-list-components/tsconfig.json new file mode 100644 index 0000000000000..412652e0a8f9d --- /dev/null +++ b/packages/kbn-securitysolution-exception-list-components/tsconfig.json @@ -0,0 +1,21 @@ +{ + "extends": "../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "stripInternal": false, + "types": [ + "jest", + "node", + "react", + "@emotion/react/types/css-prop" + ] + }, + "include": [ + "**/*.ts", + "**/*.tsx", + "**/*.d.ts" + ] +} diff --git a/packages/kbn-test/jest_integration/jest-preset.js b/packages/kbn-test/jest_integration/jest-preset.js index b039329893d37..d150f8bd9e45d 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/packages/kbn-user-profile-components/index.ts b/packages/kbn-user-profile-components/index.ts index 8489a9eb3b35a..5f8d1db6fcf62 100644 --- a/packages/kbn-user-profile-components/index.ts +++ b/packages/kbn-user-profile-components/index.ts @@ -7,9 +7,12 @@ */ export type { UserAvatarProps, UserProfileWithAvatar } from './src/user_avatar'; +export type { UserToolTipProps } from './src/user_tooltip'; export type { UserProfilesSelectableProps } from './src/user_profiles_selectable'; export type { UserProfilesPopoverProps } from './src/user_profiles_popover'; export { UserAvatar } from './src/user_avatar'; +export { UserAvatarTip } from './src/user_avatar_tip'; +export { UserToolTip } from './src/user_tooltip'; export { UserProfilesSelectable } from './src/user_profiles_selectable'; export { UserProfilesPopover } from './src/user_profiles_popover'; export { getUserDisplayName } from './src/user_profile'; diff --git a/packages/kbn-user-profile-components/src/user_avatar_tip.test.tsx b/packages/kbn-user-profile-components/src/user_avatar_tip.test.tsx new file mode 100644 index 0000000000000..108015c3bae60 --- /dev/null +++ b/packages/kbn-user-profile-components/src/user_avatar_tip.test.tsx @@ -0,0 +1,73 @@ +/* + * 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 { shallow } from 'enzyme'; +import React from 'react'; + +import { UserAvatarTip } from './user_avatar_tip'; + +describe('UserAvatarTip', () => { + it('should render `UserToolTip` correctly with `UserAvatar`', () => { + const wrapper = shallow( + + ); + expect(wrapper).toMatchInlineSnapshot(` + + + + `); + }); + + it('should not render `UserToolTip` when user is not set', () => { + const wrapper = shallow(); + expect(wrapper).toMatchInlineSnapshot(``); + }); +}); diff --git a/packages/kbn-user-profile-components/src/user_avatar_tip.tsx b/packages/kbn-user-profile-components/src/user_avatar_tip.tsx new file mode 100644 index 0000000000000..6bb3d342aa38f --- /dev/null +++ b/packages/kbn-user-profile-components/src/user_avatar_tip.tsx @@ -0,0 +1,29 @@ +/* + * 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 { FunctionComponent } from 'react'; +import React from 'react'; + +import type { UserAvatarProps } from './user_avatar'; +import { UserAvatar } from './user_avatar'; +import { UserToolTip } from './user_tooltip'; + +/** + * Renders a user avatar with tooltip + */ +export const UserAvatarTip: FunctionComponent = ({ user, avatar, ...rest }) => { + if (!user) { + return ; + } + + return ( + + + + ); +}; diff --git a/packages/kbn-user-profile-components/src/user_profiles_selectable.tsx b/packages/kbn-user-profile-components/src/user_profiles_selectable.tsx index 76b9b9ea6d556..904e5ac2896c1 100644 --- a/packages/kbn-user-profile-components/src/user_profiles_selectable.tsx +++ b/packages/kbn-user-profile-components/src/user_profiles_selectable.tsx @@ -301,7 +301,7 @@ export const UserProfilesSelectable =
- } - isOpen={isMenuOpen} - closePopover={closeMenu} - panelPaddingSize="none" - anchorPosition="downLeft" + + - - - - - ) : ( - - )} + + + } + isOpen={isMenuOpen} + closePopover={closeMenu} + panelPaddingSize="none" + anchorPosition="downLeft" + > + + + ); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.test.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.test.tsx similarity index 67% rename from x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.test.tsx rename to x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.test.tsx index 71e673fd30e19..33fd16419a1bd 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/bulk_actions.test.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.test.tsx @@ -20,8 +20,7 @@ import { FleetStatusProvider, ConfigContext, KibanaVersionContext } from '../../ import { getMockTheme } from '../../../../../../mocks'; -import { AgentBulkActions } from './bulk_actions'; -import type { Props } from './bulk_actions'; +import { SearchAndFilterBar } from './search_and_filter_bar'; const mockTheme = getMockTheme({ eui: { @@ -29,13 +28,19 @@ const mockTheme = getMockTheme({ }, }); -const TestComponent = (props: Props) => ( +jest.mock('../../../../components', () => { + return { + SearchBar: () =>
, + }; +}); + +const TestComponent = (props: any) => ( - + @@ -43,10 +48,10 @@ const TestComponent = (props: Props) => ( ); -describe('AgentBulkActions', () => { +describe('SearchAndFilterBar', () => { it('should show no Actions button when no agent is selected', async () => { const selectedAgents: Agent[] = []; - const props: Props = { + const props: any = { totalAgents: 10, totalInactiveAgents: 2, selectionMode: 'manual', @@ -54,8 +59,12 @@ describe('AgentBulkActions', () => { selectedAgents, refreshAgents: () => undefined, visibleAgents: [], - allTags: [], + tags: [], agentPolicies: [], + selectedStatus: [], + selectedTags: [], + selectedAgentPolicies: [], + showAgentActivityTour: {}, }; const testBed = registerTestBed(TestComponent)(props); const { exists } = testBed; @@ -76,7 +85,7 @@ describe('AgentBulkActions', () => { local_metadata: {}, }, ]; - const props: Props = { + const props: any = { totalAgents: 10, totalInactiveAgents: 2, selectionMode: 'manual', @@ -84,8 +93,34 @@ describe('AgentBulkActions', () => { selectedAgents, refreshAgents: () => undefined, visibleAgents: [], - allTags: [], + tags: [], + agentPolicies: [], + selectedStatus: [], + selectedTags: [], + selectedAgentPolicies: [], + showAgentActivityTour: {}, + }; + const testBed = registerTestBed(TestComponent)(props); + const { exists } = testBed; + + expect(exists('agentBulkActionsButton')).not.toBeNull(); + }); + + it('should show an Actions button when agents selected in query mode', async () => { + const props: any = { + totalAgents: 10, + totalInactiveAgents: 2, + selectionMode: 'query', + currentQuery: '', + selectedAgents: [], + refreshAgents: () => undefined, + visibleAgents: [], + tags: [], agentPolicies: [], + selectedStatus: [], + selectedTags: [], + selectedAgentPolicies: [], + showAgentActivityTour: {}, }; const testBed = registerTestBed(TestComponent)(props); const { exists } = testBed; diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx index e90e1ae713227..9b16136df2d96 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agents/agent_list_page/components/search_and_filter_bar.tsx @@ -69,6 +69,10 @@ const ClearAllTagsFilterItem = styled(EuiFilterSelectItem)` padding: ${(props) => props.theme.eui.euiSizeS}; `; +const FlexEndEuiFlexItem = styled(EuiFlexItem)` + align-self: flex-end; +`; + export const SearchAndFilterBar: React.FunctionComponent<{ agentPolicies: AgentPolicy[]; draftKuery: string; @@ -151,7 +155,51 @@ export const SearchAndFilterBar: React.FunctionComponent<{ return ( <> {/* Search and filter bar */} - + + + + + + + + + } + > + + + + + + + + } + > + + + + + + + @@ -328,63 +376,22 @@ export const SearchAndFilterBar: React.FunctionComponent<{ - {selectedAgents.length === 0 && ( - - - } - > - - - - + {(selectionMode === 'manual' && selectedAgents.length) || + (selectionMode === 'query' && totalAgents > 0) ? ( + + - )} - - - - {selectedAgents.length === 0 && ( - - - } - > - - - - - - )} - - - + ) : null} 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 70b4da44dad68..8307bc3467cc2 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 b2c03ba745d7b..93091ff726258 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/public/applications/integrations/sections/epm/screens/detail/custom_languages_overview.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/custom_languages_overview.tsx index 93e7c6e0fac22..c8c1914599f08 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/custom_languages_overview.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/custom_languages_overview.tsx @@ -6,9 +6,10 @@ */ import React from 'react'; import { useParams, Redirect } from 'react-router-dom'; +import { capitalize } from 'lodash'; import { getCustomIntegrationsStart } from '../../../../../../services/custom_integrations'; -import { useLink } from '../../../../../../hooks'; +import { useLink, useBreadcrumbs } from '../../../../hooks'; export interface CustomLanguageClientsParams { pkgkey: string; } @@ -20,10 +21,9 @@ export interface CustomLanguageClientsParams { export const CustomLanguagesOverview = () => { const { pkgkey } = useParams(); const { getPath } = useLink(); + useBreadcrumbs('integration_details_overview', { pkgTitle: capitalize(pkgkey) }); - const Component = getCustomIntegrationsStart().languageClientsUiComponents.get( - `language_client.${pkgkey}` - ); + const Component = getCustomIntegrationsStart().languageClientsUiComponents[pkgkey]; return Component ? : ; }; diff --git a/x-pack/plugins/fleet/server/services/agent_policy_create.test.ts b/x-pack/plugins/fleet/server/services/agent_policy_create.test.ts index 1231e99f2865f..45d42ba373a7d 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy_create.test.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy_create.test.ts @@ -13,6 +13,7 @@ import { agentPolicyService, packagePolicyService } from '.'; import { createAgentPolicyWithPackages } from './agent_policy_create'; import { bulkInstallPackages } from './epm/packages'; import { incrementPackageName } from './package_policies'; +import { ensureDefaultEnrollmentAPIKeyForAgentPolicy } from './api_keys'; const mockedAgentPolicyService = agentPolicyService as jest.Mocked; const mockedPackagePolicyService = packagePolicyService as jest.Mocked; @@ -20,6 +21,11 @@ const mockIncrementPackageName = incrementPackageName as jest.MockedFunction< typeof incrementPackageName >; +const mockEnsureDefaultEnrollmentAPIKeyForAgentPolicy = + ensureDefaultEnrollmentAPIKeyForAgentPolicy as jest.MockedFunction< + typeof ensureDefaultEnrollmentAPIKeyForAgentPolicy + >; + jest.mock('./epm/packages', () => { return { bulkInstallPackages: jest.fn(), @@ -28,9 +34,9 @@ jest.mock('./epm/packages', () => { const mockedBulkInstallPackages = bulkInstallPackages as jest.Mocked; -jest.mock('./setup', () => { +jest.mock('./api_keys', () => { return { - ensureDefaultEnrollmentAPIKeysExists: jest.fn(), + ensureDefaultEnrollmentAPIKeyForAgentPolicy: jest.fn(), }; }); @@ -222,6 +228,25 @@ describe('createAgentPolicyWithPackages', () => { expect(response.id).toEqual('policy-1'); }); + it('should create an enrollment token', async () => { + const response = await createAgentPolicyWithPackages({ + esClient: esClientMock, + soClient: soClientMock, + newPolicy: { id: 'policy-1', name: 'Agent policy 1', namespace: 'default' }, + withSysMonitoring: false, + spaceId: 'default', + monitoringEnabled: [], + }); + + expect(response.id).toEqual('policy-1'); + + expect(mockEnsureDefaultEnrollmentAPIKeyForAgentPolicy).toBeCalledWith( + expect.anything(), + expect.anything(), + 'policy-1' + ); + }); + it('should create policy with fleet_server and id', async () => { const response = await createAgentPolicyWithPackages({ esClient: esClientMock, diff --git a/x-pack/plugins/fleet/server/services/agent_policy_create.ts b/x-pack/plugins/fleet/server/services/agent_policy_create.ts index 888dd3eb34df2..5f3d6d14822c9 100644 --- a/x-pack/plugins/fleet/server/services/agent_policy_create.ts +++ b/x-pack/plugins/fleet/server/services/agent_policy_create.ts @@ -20,7 +20,7 @@ import type { AgentPolicy, NewAgentPolicy } from '../types'; import { agentPolicyService, packagePolicyService } from '.'; import { incrementPackageName } from './package_policies'; import { bulkInstallPackages } from './epm/packages'; -import { ensureDefaultEnrollmentAPIKeysExists } from './setup'; +import { ensureDefaultEnrollmentAPIKeyForAgentPolicy } from './api_keys'; const FLEET_SERVER_POLICY_ID = 'fleet-server-policy'; @@ -143,7 +143,7 @@ export async function createAgentPolicyWithPackages({ }); } - await ensureDefaultEnrollmentAPIKeysExists(soClient, esClient); + await ensureDefaultEnrollmentAPIKeyForAgentPolicy(soClient, esClient, agentPolicy.id); await agentPolicyService.deployPolicy(soClient, agentPolicy.id); return agentPolicy; 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 8489c25e3fd8d..a057af185a066 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 97d7c73035e6d..7c88b4885b843 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 17c745bfd285f..8f9302bd31acd 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 305bf2b6bacb4..d62bbf4c414bb 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,16 +395,18 @@ 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 }) => [ { update: { _id: agentId, + retry_on_conflict: 3, }, }, { @@ -418,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.test.ts b/x-pack/plugins/fleet/server/services/agents/reassign.test.ts index a54c2cb56c944..3fb9d2ee1f33b 100644 --- a/x-pack/plugins/fleet/server/services/agents/reassign.test.ts +++ b/x-pack/plugins/fleet/server/services/agents/reassign.test.ts @@ -96,4 +96,29 @@ describe('reassignAgents (plural)', () => { }); expect(calledWithActionResults.body?.[1] as any).toEqual(expectedObject); }); + + it('should report errors from ES agent update call', async () => { + const { soClient, esClient, agentInRegularDoc, regularAgentPolicySO2 } = createClientMock(); + esClient.bulk.mockResponse({ + items: [ + { + update: { + _id: agentInRegularDoc._id, + error: new Error('version conflict'), + }, + }, + ], + } as any); + const idsToReassign = [agentInRegularDoc._id]; + await reassignAgents(soClient, esClient, { agentIds: idsToReassign }, regularAgentPolicySO2.id); + + const calledWithActionResults = esClient.bulk.mock.calls[1][0] as estypes.BulkRequest; + const expectedObject = expect.objectContaining({ + '@timestamp': expect.anything(), + action_id: expect.anything(), + agent_id: agentInRegularDoc._id, + error: 'version conflict', + }); + expect(calledWithActionResults.body?.[1] as any).toEqual(expectedObject); + }); }); 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 55c0e00728d16..c15857bb4ae32 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'; @@ -80,12 +80,12 @@ export async function reassignBatch( policy_id: options.newAgentPolicyId, policy_revision: null, }, - })) + })), + 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; const now = new Date().toISOString(); await createAgentAction(esClient, { @@ -99,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 79612b0bcbf06..5beb5c0a9ac00 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 dd5b4e023c2a3..c735254f18256 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 48f7b455d36b7..11d42bc76e39a 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 db880f56ef474..8b888126ce114 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 a34f189871a39..c6794de6e2dcb 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/api_keys/enrollment_api_key.ts b/x-pack/plugins/fleet/server/services/api_keys/enrollment_api_key.ts index 8823e769540b1..4ef3a009c5d94 100644 --- a/x-pack/plugins/fleet/server/services/api_keys/enrollment_api_key.ts +++ b/x-pack/plugins/fleet/server/services/api_keys/enrollment_api_key.ts @@ -270,6 +270,24 @@ export async function generateEnrollmentAPIKey( }; } +export async function ensureDefaultEnrollmentAPIKeyForAgentPolicy( + soClient: SavedObjectsClientContract, + esClient: ElasticsearchClient, + agentPolicyId: string +) { + const hasKey = await hasEnrollementAPIKeysForPolicy(esClient, agentPolicyId); + + if (hasKey) { + return; + } + + return generateEnrollmentAPIKey(soClient, esClient, { + name: `Default`, + agentPolicyId, + forceRecreate: true, // Always generate a new enrollment key when Fleet is being set up + }); +} + function getQueryForExistingKeyNameOnPolicy(agentPolicyId: string, providedKeyName: string) { const query = { bool: { 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 df1c87105bcf2..bb2be99b868bc 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 5accf7b120f9e..b15eb01117825 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 e970a2fea1459..b8af566463896 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/fleet/server/services/preconfiguration/outputs.test.ts b/x-pack/plugins/fleet/server/services/preconfiguration/outputs.test.ts index a8eaa39d427df..e6fa2e008e4bb 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration/outputs.test.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration/outputs.test.ts @@ -112,6 +112,33 @@ describe('output preconfiguration', () => { expect(spyAgentPolicyServicBumpAllAgentPoliciesForOutput).not.toBeCalled(); }); + it('should create a preconfigured output with ca_trusted_fingerprint that does not exists', async () => { + const soClient = savedObjectsClientMock.create(); + const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; + await createOrUpdatePreconfiguredOutputs(soClient, esClient, [ + { + id: 'non-existing-output-1', + name: 'Output 1', + type: 'elasticsearch', + is_default: false, + is_default_monitoring: false, + hosts: ['http://test.fr'], + ca_trusted_fingerprint: 'testfingerprint', + }, + ]); + + expect(mockedOutputService.create).toBeCalled(); + expect(mockedOutputService.create).toBeCalledWith( + expect.anything(), + expect.objectContaining({ + ca_trusted_fingerprint: 'testfingerprint', + }), + expect.anything() + ); + expect(mockedOutputService.update).not.toBeCalled(); + expect(spyAgentPolicyServicBumpAllAgentPoliciesForOutput).not.toBeCalled(); + }); + it('should create preconfigured logstash output that does not exist', async () => { const soClient = savedObjectsClientMock.create(); const esClient = elasticsearchServiceMock.createClusterClient().asInternalUser; diff --git a/x-pack/plugins/fleet/server/services/preconfiguration/outputs.ts b/x-pack/plugins/fleet/server/services/preconfiguration/outputs.ts index a61d8316dcc5f..d7f43ce181a42 100644 --- a/x-pack/plugins/fleet/server/services/preconfiguration/outputs.ts +++ b/x-pack/plugins/fleet/server/services/preconfiguration/outputs.ts @@ -78,7 +78,7 @@ export async function createOrUpdatePreconfiguredOutputs( config_yaml: configYaml ?? null, // Set value to null to update these fields on update ca_sha256: outputData.ca_sha256 ?? null, - ca_trusted_fingerprint: outputData.ca_sha256 ?? null, + ca_trusted_fingerprint: outputData.ca_trusted_fingerprint ?? null, ssl: outputData.ssl ?? null, }; diff --git a/x-pack/plugins/fleet/server/services/setup.ts b/x-pack/plugins/fleet/server/services/setup.ts index f536125e054a2..eb4a9313e169f 100644 --- a/x-pack/plugins/fleet/server/services/setup.ts +++ b/x-pack/plugins/fleet/server/services/setup.ts @@ -32,7 +32,7 @@ import { import { outputService } from './output'; import { downloadSourceService } from './download_source'; -import { generateEnrollmentAPIKey, hasEnrollementAPIKeysForPolicy } from './api_keys'; +import { ensureDefaultEnrollmentAPIKeyForAgentPolicy } from './api_keys'; import { getRegistryUrl, settingsService } from '.'; import { awaitIfPending } from './setup_utils'; import { ensureFleetFinalPipelineIsInstalled } from './epm/elasticsearch/ingest_pipeline/install'; @@ -205,7 +205,7 @@ export async function ensureFleetGlobalEsAssets( } } -export async function ensureDefaultEnrollmentAPIKeysExists( +async function ensureDefaultEnrollmentAPIKeysExists( soClient: SavedObjectsClientContract, esClient: ElasticsearchClient, options?: { forceRecreate?: boolean } @@ -223,20 +223,13 @@ export async function ensureDefaultEnrollmentAPIKeysExists( perPage: SO_SEARCH_LIMIT, }); - await Promise.all( - agentPolicies.map(async (agentPolicy) => { - const hasKey = await hasEnrollementAPIKeysForPolicy(esClient, agentPolicy.id); - - if (hasKey) { - return; - } - - return generateEnrollmentAPIKey(soClient, esClient, { - name: `Default`, - agentPolicyId: agentPolicy.id, - forceRecreate: true, // Always generate a new enrollment key when Fleet is being set up - }); - }) + await pMap( + agentPolicies, + (agentPolicy) => + ensureDefaultEnrollmentAPIKeyForAgentPolicy(soClient, esClient, agentPolicy.id), + { + concurrency: 20, + } ); } diff --git a/x-pack/plugins/graph/kibana.json b/x-pack/plugins/graph/kibana.json index 641e595893c0a..6db4ca194d7d1 100644 --- a/x-pack/plugins/graph/kibana.json +++ b/x-pack/plugins/graph/kibana.json @@ -9,7 +9,8 @@ "data", "navigation", "savedObjects", - "unifiedSearch" + "unifiedSearch", + "inspector" ], "optionalPlugins": [ "home", diff --git a/x-pack/plugins/graph/public/application.tsx b/x-pack/plugins/graph/public/application.tsx index 1976b12621f4f..bbb14a96ac5eb 100644 --- a/x-pack/plugins/graph/public/application.tsx +++ b/x-pack/plugins/graph/public/application.tsx @@ -27,6 +27,7 @@ import { LicensingPluginStart } from '@kbn/licensing-plugin/public'; import { NavigationPublicPluginStart as NavigationStart } from '@kbn/navigation-plugin/public'; import { Storage } from '@kbn/kibana-utils-plugin/public'; import { FormattedRelative } from '@kbn/i18n-react'; +import { Start as InspectorPublicPluginStart } from '@kbn/inspector-plugin/public'; import { TableListViewKibanaProvider } from '@kbn/content-management-table-list'; import './index.scss'; @@ -70,6 +71,7 @@ export interface GraphDependencies { uiSettings: IUiSettingsClient; history: ScopedHistory; spaces?: SpacesApi; + inspect: InspectorPublicPluginStart; } export type GraphServices = Omit; diff --git a/x-pack/plugins/graph/public/apps/workspace_route.tsx b/x-pack/plugins/graph/public/apps/workspace_route.tsx index 051c0fa66ab89..9b1fde2e7cb25 100644 --- a/x-pack/plugins/graph/public/apps/workspace_route.tsx +++ b/x-pack/plugins/graph/public/apps/workspace_route.tsx @@ -43,6 +43,7 @@ export const WorkspaceRoute = ({ setHeaderActionMenu, spaces, indexPatterns: getIndexPatternProvider, + inspect, }, }: WorkspaceRouteProps) => { /** @@ -64,11 +65,6 @@ export const WorkspaceRoute = ({ [getIndexPatternProvider.get] ); - const { loading, callNodeProxy, callSearchNodeProxy, handleSearchQueryError } = useGraphLoader({ - toastNotifications, - coreStart, - }); - const services = useMemo( () => ({ appName: 'graph', @@ -80,6 +76,12 @@ export const WorkspaceRoute = ({ [coreStart, data, storage, unifiedSearch] ); + const { loading, requestAdapter, callNodeProxy, callSearchNodeProxy, handleSearchQueryError } = + useGraphLoader({ + toastNotifications, + coreStart, + }); + const [store] = useState(() => createGraphStore({ basePath: getBasePath(), @@ -150,6 +152,8 @@ export const WorkspaceRoute = ({ overlays={overlays} savedWorkspace={savedWorkspace} indexPatternProvider={indexPatternProvider} + inspect={inspect} + requestAdapter={requestAdapter} /> diff --git a/x-pack/plugins/graph/public/components/inspect_panel.tsx b/x-pack/plugins/graph/public/components/inspect_panel.tsx deleted file mode 100644 index e6197bac16ba7..0000000000000 --- a/x-pack/plugins/graph/public/components/inspect_panel.tsx +++ /dev/null @@ -1,98 +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, { useMemo, useState } from 'react'; -import { EuiTab, EuiTabs, EuiText } from '@elastic/eui'; -import { monaco, XJsonLang } from '@kbn/monaco'; -import { FormattedMessage } from '@kbn/i18n-react'; -import { CodeEditor } from '@kbn/kibana-react-plugin/public'; -import type { DataView } from '@kbn/data-views-plugin/public'; - -interface InspectPanelProps { - showInspect: boolean; - indexPattern?: DataView; - lastRequest?: string; - lastResponse?: string; -} - -const CODE_EDITOR_OPTIONS: monaco.editor.IStandaloneEditorConstructionOptions = { - automaticLayout: true, - fontSize: 12, - lineNumbers: 'on', - minimap: { - enabled: false, - }, - overviewRulerBorder: false, - readOnly: true, - scrollbar: { - alwaysConsumeMouseWheel: false, - }, - scrollBeyondLastLine: false, - wordWrap: 'on', - wrappingIndent: 'indent', -}; - -const dummyCallback = () => {}; - -export const InspectPanel = ({ - showInspect, - lastRequest, - lastResponse, - indexPattern, -}: InspectPanelProps) => { - const [selectedTabId, setSelectedTabId] = useState('request'); - - const onRequestClick = () => setSelectedTabId('request'); - const onResponseClick = () => setSelectedTabId('response'); - - const editorContent = useMemo( - () => (selectedTabId === 'request' ? lastRequest : lastResponse), - [lastRequest, lastResponse, selectedTabId] - ); - - if (showInspect) { - return ( -
-
-
- -
- -
- - http://host:port/{indexPattern?.id}/_graph/explore - - - - - - - - - - -
-
-
- ); - } - - return null; -}; diff --git a/x-pack/plugins/graph/public/components/settings/url_template_form.tsx b/x-pack/plugins/graph/public/components/settings/url_template_form.tsx index 57e69d0912a7f..4509a003e839d 100644 --- a/x-pack/plugins/graph/public/components/settings/url_template_form.tsx +++ b/x-pack/plugins/graph/public/components/settings/url_template_form.tsx @@ -261,7 +261,15 @@ export function UrlTemplateForm(props: UrlTemplateFormProps) { defaultMessage: 'Toolbar icon', })} > -
+
{urlTemplateIconChoices.map((icon) => ( { aliasTargetId: '', } as SharingSavedObjectProps, spaces: spacesPluginMock.createStartContract(), + inspect: { open: jest.fn() } as unknown as InspectorStart, + requestAdapter: { + start: () => ({ + stats: jest.fn(), + json: jest.fn(), + }), + reset: jest.fn(), + } as unknown as RequestAdapter, workspace: {} as unknown as Workspace, }; it('should display conflict notification if outcome is conflict', () => { diff --git a/x-pack/plugins/graph/public/components/workspace_layout/workspace_layout.tsx b/x-pack/plugins/graph/public/components/workspace_layout/workspace_layout.tsx index 3eede479bd801..5de95636a61dd 100644 --- a/x-pack/plugins/graph/public/components/workspace_layout/workspace_layout.tsx +++ b/x-pack/plugins/graph/public/components/workspace_layout/workspace_layout.tsx @@ -11,6 +11,7 @@ import { EuiSpacer } from '@elastic/eui'; import { connect } from 'react-redux'; import { useLocation } from 'react-router-dom'; import type { DataView } from '@kbn/data-views-plugin/public'; +import { RequestAdapter } from '@kbn/inspector-plugin/common'; import { SearchBar } from '../search_bar'; import { GraphState, @@ -20,7 +21,6 @@ import { import { FieldManager } from '../field_manager'; import { ControlType, IndexPatternProvider, TermIntersect, WorkspaceNode } from '../../types'; import { WorkspaceTopNavMenu } from './workspace_top_nav_menu'; -import { InspectPanel } from '../inspect_panel'; import { GuidancePanel } from '../guidance_panel'; import { GraphTitle } from '../graph_title'; import { GraphWorkspaceSavedObject, Workspace } from '../../types'; @@ -49,6 +49,7 @@ type WorkspaceLayoutProps = Pick< | 'canEditDrillDownUrls' | 'overlays' | 'spaces' + | 'inspect' > & { renderCounter: number; workspace?: Workspace; @@ -56,6 +57,7 @@ type WorkspaceLayoutProps = Pick< savedWorkspace: GraphWorkspaceSavedObject; indexPatternProvider: IndexPatternProvider; sharingSavedObjectProps?: SharingSavedObjectProps; + requestAdapter: RequestAdapter; }; interface WorkspaceLayoutStateProps { @@ -80,9 +82,10 @@ export const WorkspaceLayoutComponent = ({ setHeaderActionMenu, sharingSavedObjectProps, spaces, + inspect, + requestAdapter, }: WorkspaceLayoutProps & WorkspaceLayoutStateProps) => { const [currentIndexPattern, setCurrentIndexPattern] = useState(); - const [showInspect, setShowInspect] = useState(false); const [pickerOpen, setPickerOpen] = useState(false); const [mergeCandidates, setMergeCandidates] = useState([]); const [control, setControl] = useState('none'); @@ -188,20 +191,15 @@ export const WorkspaceLayoutComponent = ({ graphSavePolicy={graphSavePolicy} navigation={navigation} capabilities={capabilities} + inspect={inspect} + requestAdapter={requestAdapter} coreStart={coreStart} canEditDrillDownUrls={canEditDrillDownUrls} - setShowInspect={setShowInspect} confirmWipeWorkspace={confirmWipeWorkspace} setHeaderActionMenu={setHeaderActionMenu} isInitialized={isInitialized} /> - {isInitialized && }
>; confirmWipeWorkspace: ( onConfirm: () => void, text?: string, @@ -30,9 +31,11 @@ interface WorkspaceTopNavMenuProps { graphSavePolicy: GraphSavePolicy; navigation: NavigationStart; capabilities: Capabilities; + inspect: InspectorPublicPluginStart; coreStart: CoreStart; canEditDrillDownUrls: boolean; isInitialized: boolean; + requestAdapter: RequestAdapter; } export const WorkspaceTopNavMenu = (props: WorkspaceTopNavMenuProps) => { @@ -40,6 +43,12 @@ export const WorkspaceTopNavMenu = (props: WorkspaceTopNavMenuProps) => { const location = useLocation(); const history = useHistory(); const allSavingDisabled = props.graphSavePolicy === 'none'; + const isInspectDisabled = !props.workspace?.lastRequest || !props.workspace.lastRequest; + + const { onOpenInspector } = useInspector({ + inspect: props.inspect, + requestAdapter: props.requestAdapter, + }); // ===== Menubar configuration ========= const { TopNavMenu } = props.navigation.ui; @@ -107,7 +116,7 @@ export const WorkspaceTopNavMenu = (props: WorkspaceTopNavMenuProps) => { topNavMenu.push({ key: 'inspect', disableButton() { - return props.workspace === null; + return isInspectDisabled; }, label: i18n.translate('xpack.graph.topNavMenu.inspectLabel', { defaultMessage: 'Inspect', @@ -116,7 +125,14 @@ export const WorkspaceTopNavMenu = (props: WorkspaceTopNavMenuProps) => { defaultMessage: 'Inspect', }), run: () => { - props.setShowInspect((prevShowInspect) => !prevShowInspect); + onOpenInspector(); + }, + tooltip: () => { + if (isInspectDisabled) { + return i18n.translate('xpack.graph.topNavMenu.inspectButton.disabledTooltip', { + defaultMessage: 'Perform a search or expand a node to enable Inspect', + }); + } }, testId: 'graphInspectButton', }); @@ -162,6 +178,9 @@ export const WorkspaceTopNavMenu = (props: WorkspaceTopNavMenuProps) => { ownFocus: true, className: 'gphSettingsFlyout', maxWidth: 520, + 'aria-label': i18n.translate('xpack.graph.settings.ariaLabel', { + defaultMessage: 'Settings', + }), } ); }, diff --git a/x-pack/plugins/graph/public/helpers/use_graph_loader.ts b/x-pack/plugins/graph/public/helpers/use_graph_loader.ts index 5b4f3bbbf1e47..0d50039ab9797 100644 --- a/x-pack/plugins/graph/public/helpers/use_graph_loader.ts +++ b/x-pack/plugins/graph/public/helpers/use_graph_loader.ts @@ -5,10 +5,12 @@ * 2.0. */ -import { useCallback, useState } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import type { CoreStart, ToastsStart } from '@kbn/core/public'; import type { IHttpFetchError, ResponseErrorBody } from '@kbn/core-http-browser'; import { i18n } from '@kbn/i18n'; +import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { RequestAdapter } from '@kbn/inspector-plugin/public'; import type { ExploreRequest, GraphExploreCallback, @@ -24,6 +26,7 @@ interface UseGraphLoaderProps { export const useGraphLoader = ({ toastNotifications, coreStart }: UseGraphLoaderProps) => { const [loading, setLoading] = useState(false); + const requestAdapter = useMemo(() => new RequestAdapter(), []); const handleHttpError = useCallback( (error: IHttpFetchError) => { @@ -52,21 +55,56 @@ export const useGraphLoader = ({ toastNotifications, coreStart }: UseGraphLoader [toastNotifications] ); + const getRequestInspector = useCallback( + (indexName: string) => { + const inspectRequest = requestAdapter.start( + i18n.translate('xpack.graph.inspectAdapter.graphExploreRequest.name', { + defaultMessage: 'Data', + }), + { + description: i18n.translate( + 'xpack.graph.inspectAdapter.graphExploreRequest.description', + { + defaultMessage: 'This request queries Elasticsearch to fetch the data for the Graph.', + } + ), + } + ); + inspectRequest.stats({ + indexPattern: { + label: i18n.translate( + 'xpack.graph.inspectAdapter.graphExploreRequest.dataView.description.label', + { defaultMessage: 'Data view' } + ), + value: indexName, + description: i18n.translate( + 'xpack.graph.inspectAdapter.graphExploreRequest.dataView.description', + { defaultMessage: 'The data view that connected to the Elasticsearch indices.' } + ), + }, + }); + return inspectRequest; + }, + [requestAdapter] + ); + // Replacement function for graphClientWorkspace's comms so // that it works with Kibana. const callNodeProxy = useCallback( (indexName: string, query: ExploreRequest, responseHandler: GraphExploreCallback) => { - const request = { - body: JSON.stringify({ - index: indexName, - query, - }), - }; + const dsl = { index: indexName, query }; + const request = { body: JSON.stringify(dsl) }; setLoading(true); + + requestAdapter.reset(); + const inspectRequest = getRequestInspector(indexName); + inspectRequest.json(dsl); + return coreStart.http - .post<{ resp: { timed_out: unknown } }>('../api/graph/graphExplore', request) + .post<{ resp: estypes.GraphExploreResponse }>('../api/graph/graphExplore', request) .then(function (data) { const response = data.resp; + if (response?.timed_out) { toastNotifications.addWarning( i18n.translate('xpack.graph.exploreGraph.timedOutWarningText', { @@ -74,38 +112,48 @@ export const useGraphLoader = ({ toastNotifications, coreStart }: UseGraphLoader }) ); } + inspectRequest.stats({}).ok({ json: response }); responseHandler(response); }) - .catch(handleHttpError) + .catch((e) => { + inspectRequest.error({ json: e }); + handleHttpError(e); + }) .finally(() => setLoading(false)); }, - [coreStart.http, handleHttpError, toastNotifications] + [coreStart.http, getRequestInspector, handleHttpError, requestAdapter, toastNotifications] ); // Helper function for the graphClientWorkspace to perform a query const callSearchNodeProxy = useCallback( (indexName: string, query: SearchRequest, responseHandler: GraphSearchCallback) => { - const request = { - body: JSON.stringify({ - index: indexName, - body: query, - }), - }; + const dsl = { index: indexName, body: query }; + const request = { body: JSON.stringify(dsl) }; setLoading(true); + + requestAdapter.reset(); + const inspectRequest = getRequestInspector(indexName); + inspectRequest.json(dsl); + coreStart.http - .post<{ resp: unknown }>('../api/graph/searchProxy', request) + .post<{ resp: estypes.GraphExploreResponse }>('../api/graph/searchProxy', request) .then(function (data) { const response = data.resp; + inspectRequest.stats({}).ok({ json: response }); responseHandler(response); }) - .catch(handleHttpError) + .catch((e) => { + inspectRequest.error({ json: e }); + handleHttpError(e); + }) .finally(() => setLoading(false)); }, - [coreStart.http, handleHttpError] + [coreStart.http, getRequestInspector, handleHttpError, requestAdapter] ); return { loading, + requestAdapter, callNodeProxy, callSearchNodeProxy, handleSearchQueryError, diff --git a/x-pack/plugins/graph/public/helpers/use_inspector.ts b/x-pack/plugins/graph/public/helpers/use_inspector.ts new file mode 100644 index 0000000000000..d6f237e625c3d --- /dev/null +++ b/x-pack/plugins/graph/public/helpers/use_inspector.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { useCallback, useEffect, useState } from 'react'; +import { + Start as InspectorPublicPluginStart, + InspectorSession, + RequestAdapter, +} from '@kbn/inspector-plugin/public'; + +export const useInspector = ({ + inspect, + requestAdapter, +}: { + inspect: InspectorPublicPluginStart; + requestAdapter: RequestAdapter; +}) => { + const [inspectorSession, setInspectorSession] = useState(); + + useEffect(() => { + return () => { + if (inspectorSession) { + inspectorSession.close(); + } + }; + }, [inspectorSession]); + + const onOpenInspector = useCallback(() => { + const session = inspect.open({ requests: requestAdapter }, {}); + setInspectorSession(session); + }, [inspect, requestAdapter]); + + return { onOpenInspector }; +}; diff --git a/x-pack/plugins/graph/public/plugin.ts b/x-pack/plugins/graph/public/plugin.ts index d4f8471426cc5..96dac017eeabb 100644 --- a/x-pack/plugins/graph/public/plugin.ts +++ b/x-pack/plugins/graph/public/plugin.ts @@ -19,6 +19,7 @@ import { DEFAULT_APP_CATEGORIES, } from '@kbn/core/public'; +import { Start as InspectorPublicPluginStart } from '@kbn/inspector-plugin/public'; import { Storage } from '@kbn/kibana-utils-plugin/public'; import { NavigationPublicPluginStart as NavigationStart } from '@kbn/navigation-plugin/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; @@ -40,6 +41,7 @@ export interface GraphPluginStartDependencies { data: DataPublicPluginStart; unifiedSearch: UnifiedSearchPublicPluginStart; savedObjects: SavedObjectsStart; + inspector: InspectorPublicPluginStart; home?: HomePublicPluginStart; spaces?: SpacesApi; } @@ -110,6 +112,7 @@ export class GraphPlugin savedObjects: pluginsStart.savedObjects, uiSettings: core.uiSettings, spaces: pluginsStart.spaces, + inspect: pluginsStart.inspector, }); }, }); diff --git a/x-pack/plugins/index_lifecycle_management/README.md b/x-pack/plugins/index_lifecycle_management/README.md index 35c2aa063ec23..912b19295790f 100644 --- a/x-pack/plugins/index_lifecycle_management/README.md +++ b/x-pack/plugins/index_lifecycle_management/README.md @@ -115,4 +115,8 @@ this by running: ```bash yarn es snapshot --license=trial -``` \ No newline at end of file +``` + +## Integration tests + +See `./integration_tests/README.md` \ No newline at end of file diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx index ecefe8132c499..246de6e8ed25b 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/extend_index_management.test.tsx @@ -7,7 +7,7 @@ import moment from 'moment-timezone'; -import { init } from './client_integration/helpers/http_requests'; +import { init } from '../integration_tests/helpers/http_requests'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { usageCollectionPluginMock } from '@kbn/usage-collection-plugin/public/mocks'; import { Index } from '../common/types'; diff --git a/x-pack/plugins/index_lifecycle_management/integration_tests/README.md b/x-pack/plugins/index_lifecycle_management/integration_tests/README.md new file mode 100644 index 0000000000000..5e4bf4360cb72 --- /dev/null +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/README.md @@ -0,0 +1,14 @@ +Most plugins of the deployment management team follow +the similar testing infrastructure where integration tests are located in `__jest__` and run as unit tests. + +The `index_lifecycle_management` tests [were refactored](https://github.com/elastic/kibana/pull/141750) to be run as integration tests because they [became flaky hitting the 5 seconds timeout](https://github.com/elastic/kibana/issues/115307#issuecomment-1238417474) for a jest unit test. + +Jest integration tests are just sit in a different directory and have two main differences: +- They never use parallelism, this allows them to access file system resources, launch services, etc. without needing to worry about conflicts with other tests +- They are allowed to take their sweet time, the default timeout is currently 10 minutes. + +To run these tests use: + +``` +node scripts/jest_integration x-pack/plugins/index_lifecycle_management/ +``` \ No newline at end of file diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/app/app.helpers.ts similarity index 97% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/app/app.helpers.ts index df64fbce3fa1d..66810ebb1e546 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.helpers.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/app/app.helpers.ts @@ -8,7 +8,7 @@ import { act } from 'react-dom/test-utils'; import { HttpSetup } from '@kbn/core/public'; import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test-jest-helpers'; -import { App } from '../../../public/application/app'; +import { App } from '../../public/application/app'; import { WithAppDependencies } from '../helpers'; const getTestBedConfig = (initialEntries: string[]): TestBedConfig => ({ diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/app/app.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/app/app.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/app/app.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/constants.ts similarity index 97% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/constants.ts index 620cb9d6f8dde..a41bea1cb8415 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/constants.ts @@ -7,9 +7,9 @@ import moment from 'moment-timezone'; -import { PolicyFromES } from '../../../common/types'; +import { PolicyFromES } from '../../common/types'; -import { defaultRolloverAction } from '../../../public/application/constants'; +import { defaultRolloverAction } from '../../public/application/constants'; export const POLICY_NAME = 'my_policy'; export const SNAPSHOT_POLICY_NAME = 'my_snapshot_policy'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/delete_phase.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/delete_phase.helpers.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/delete_phase.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/delete_phase.helpers.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/delete_phase.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/delete_phase.test.ts similarity index 98% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/delete_phase.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/delete_phase.test.ts index d877f05d06ae1..df6dd516c8a58 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/delete_phase.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/delete_phase.test.ts @@ -6,7 +6,7 @@ */ import { act } from 'react-dom/test-utils'; -import { API_BASE_PATH } from '../../../../common/constants'; +import { API_BASE_PATH } from '../../../common/constants'; import { setupEnvironment } from '../../helpers'; import { DELETE_PHASE_POLICY, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/downsample.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/downsample.helpers.ts similarity index 95% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/downsample.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/downsample.helpers.ts index be96aaabe4a71..1e6ed336a5f03 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/downsample.helpers.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/downsample.helpers.ts @@ -14,7 +14,7 @@ import { createTogglePhaseAction, } from '../../helpers'; import { initTestBed } from '../init_test_bed'; -import { AppServicesContext } from '../../../../public/types'; +import { AppServicesContext } from '../../../public/types'; type SetupReturn = ReturnType; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/downsample.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/downsample.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/downsample.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/downsample.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/edit_warning.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/edit_warning.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/edit_warning.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/edit_warning.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/frozen_phase.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/frozen_phase.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/frozen_phase.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/frozen_phase.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts similarity index 94% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts index 7092d52289de9..b41075c6b6b68 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/cloud_aware_behavior.helpers.ts @@ -8,7 +8,7 @@ import { HttpSetup } from '@kbn/core/public'; import { TestBedConfig } from '@kbn/test-jest-helpers'; -import { AppServicesContext } from '../../../../../public/types'; +import { AppServicesContext } from '../../../../public/types'; import { createTogglePhaseAction, createNodeAllocationActions } from '../../../helpers'; import { initTestBed } from '../../init_test_bed'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cloud_aware_behavior.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/cloud_aware_behavior.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cloud_aware_behavior.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/cloud_aware_behavior.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cold_phase.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/cold_phase.helpers.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cold_phase.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/cold_phase.helpers.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cold_phase.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/cold_phase.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/cold_phase.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/cold_phase.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/general_behavior.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/general_behavior.helpers.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/general_behavior.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/general_behavior.helpers.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/general_behavior.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/general_behavior.test.ts similarity index 98% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/general_behavior.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/general_behavior.test.ts index 1eecd5207664f..4830cee8ee237 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/general_behavior.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/general_behavior.test.ts @@ -17,7 +17,7 @@ import { POLICY_WITH_NODE_ATTR_AND_OFF_ALLOCATION, POLICY_WITH_NODE_ROLE_ALLOCATION, } from '../../constants'; -import { API_BASE_PATH } from '../../../../../common/constants'; +import { API_BASE_PATH } from '../../../../common/constants'; describe(' node allocation general behavior', () => { let testBed: GeneralNodeAllocationTestBed; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/warm_phase.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/warm_phase.helpers.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/warm_phase.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/warm_phase.helpers.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/warm_phase.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/warm_phase.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/node_allocation/warm_phase.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/node_allocation/warm_phase.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/request_flyout.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/request_flyout.helpers.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/request_flyout.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/request_flyout.helpers.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/request_flyout.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/request_flyout.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/request_flyout.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/request_flyout.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/rollover.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/rollover.helpers.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/rollover.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/rollover.helpers.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/rollover.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/rollover.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/rollover.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/rollover.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/searchable_snapshots.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/searchable_snapshots.helpers.ts similarity index 97% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/searchable_snapshots.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/searchable_snapshots.helpers.ts index e70f721a48075..d3b68ffc6a13e 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/searchable_snapshots.helpers.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/searchable_snapshots.helpers.ts @@ -18,7 +18,7 @@ import { createTogglePhaseAction, } from '../../helpers'; import { initTestBed } from '../init_test_bed'; -import { AppServicesContext } from '../../../../public/types'; +import { AppServicesContext } from '../../../public/types'; type SetupReturn = ReturnType; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/searchable_snapshots.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/searchable_snapshots.test.ts similarity index 99% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/searchable_snapshots.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/searchable_snapshots.test.ts index 03b7670c1eac5..68e74e23a781c 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/searchable_snapshots.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/searchable_snapshots.test.ts @@ -10,7 +10,7 @@ import { licensingMock } from '@kbn/licensing-plugin/public/mocks'; import { HttpFetchOptionsWithPath } from '@kbn/core/public'; import { setupEnvironment } from '../../helpers'; import { getDefaultHotPhasePolicy } from '../constants'; -import { API_BASE_PATH } from '../../../../common/constants'; +import { API_BASE_PATH } from '../../../common/constants'; import { SearchableSnapshotsTestBed, setupSearchableSnapshotsTestBed, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timeline.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timeline.helpers.ts similarity index 94% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timeline.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timeline.helpers.ts index 496b27330c931..202388a844464 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timeline.helpers.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timeline.helpers.ts @@ -8,7 +8,7 @@ import { HttpSetup } from '@kbn/core/public'; import { createTogglePhaseAction } from '../../helpers'; import { initTestBed } from '../init_test_bed'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; type SetupReturn = ReturnType; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timeline.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timeline.test.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timeline.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timeline.test.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timing.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timing.helpers.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timing.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timing.helpers.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timing.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timing.test.ts similarity index 95% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timing.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timing.test.ts index 0aee8eb5f0be1..72c6a2a4e789c 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/features/timing.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/features/timing.test.ts @@ -8,7 +8,7 @@ import { act } from 'react-dom/test-utils'; import { setupEnvironment } from '../../helpers'; import { setupTimingTestBed, TimingTestBed } from './timing.helpers'; -import { PhaseWithTiming } from '../../../../common/types'; +import { PhaseWithTiming } from '../../../common/types'; describe(' timing', () => { let testBed: TimingTestBed; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/cold_phase_validation.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/cold_phase_validation.test.ts similarity index 91% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/cold_phase_validation.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/cold_phase_validation.test.ts index ef2fc67002c14..e75d2cb72ab28 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/cold_phase_validation.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/cold_phase_validation.test.ts @@ -6,12 +6,11 @@ */ import { act } from 'react-dom/test-utils'; -import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts'; +import { i18nTexts } from '../../../public/application/sections/edit_policy/i18n_texts'; import { setupEnvironment } from '../../helpers'; import { setupValidationTestBed, ValidationTestBed } from './validation.helpers'; -// FLAKY: https://github.com/elastic/kibana/issues/141645 -describe.skip(' cold phase validation', () => { +describe(' cold phase validation', () => { let testBed: ValidationTestBed; const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/downsample_interval.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/downsample_interval.test.ts similarity index 93% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/downsample_interval.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/downsample_interval.test.ts index 79f5fdc6e2840..d2f9943eba68a 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/downsample_interval.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/downsample_interval.test.ts @@ -6,14 +6,13 @@ */ import { act } from 'react-dom/test-utils'; -import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts'; +import { i18nTexts } from '../../../public/application/sections/edit_policy/i18n_texts'; -import { PhaseWithDownsample } from '../../../../common/types'; +import { PhaseWithDownsample } from '../../../common/types'; import { setupEnvironment } from '../../helpers'; import { setupValidationTestBed, ValidationTestBed } from './validation.helpers'; -// FLAKY: https://github.com/elastic/kibana/issues/141160 -describe.skip(' downsample interval validation', () => { +describe(' downsample interval validation', () => { let testBed: ValidationTestBed; let actions: ValidationTestBed['actions']; const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/error_indicators.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/error_indicators.test.ts similarity index 97% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/error_indicators.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/error_indicators.test.ts index 349f98766620d..bd4a2caec0be5 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/error_indicators.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/error_indicators.test.ts @@ -9,8 +9,7 @@ import { act } from 'react-dom/test-utils'; import { setupEnvironment } from '../../helpers'; import { setupValidationTestBed, ValidationTestBed } from './validation.helpers'; -// FLAKY: https://github.com/elastic/kibana/issues/141645 -describe.skip(' error indicators', () => { +describe(' error indicators', () => { let testBed: ValidationTestBed; const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/hot_phase_validation.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/hot_phase_validation.test.ts similarity index 97% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/hot_phase_validation.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/hot_phase_validation.test.ts index 82b3568d39ce7..71f83a59360d6 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/hot_phase_validation.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/hot_phase_validation.test.ts @@ -6,12 +6,11 @@ */ import { act } from 'react-dom/test-utils'; -import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts'; +import { i18nTexts } from '../../../public/application/sections/edit_policy/i18n_texts'; import { setupEnvironment } from '../../helpers'; import { setupValidationTestBed, ValidationTestBed } from './validation.helpers'; -// FLAKY: https://github.com/elastic/kibana/issues/141645 -describe.skip(' hot phase validation', () => { +describe(' hot phase validation', () => { let testBed: ValidationTestBed; let actions: ValidationTestBed['actions']; const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/policy_name_validation.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/policy_name_validation.test.ts similarity index 93% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/policy_name_validation.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/policy_name_validation.test.ts index 928380e3d1eac..c530f73a66c11 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/policy_name_validation.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/policy_name_validation.test.ts @@ -6,13 +6,12 @@ */ import { act } from 'react-dom/test-utils'; -import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts'; +import { i18nTexts } from '../../../public/application/sections/edit_policy/i18n_texts'; import { setupEnvironment } from '../../helpers'; import { getGeneratedPolicies } from '../constants'; import { setupValidationTestBed, ValidationTestBed } from './validation.helpers'; -// FLAKY: https://github.com/elastic/kibana/issues/141645 -describe.skip(' policy name validation', () => { +describe(' policy name validation', () => { let testBed: ValidationTestBed; let actions: ValidationTestBed['actions']; const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/timing.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/timing.test.ts similarity index 93% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/timing.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/timing.test.ts index 7db483d6d0ef2..5838f04ba70e9 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/timing.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/timing.test.ts @@ -6,14 +6,13 @@ */ import { act } from 'react-dom/test-utils'; -import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts'; +import { i18nTexts } from '../../../public/application/sections/edit_policy/i18n_texts'; -import { PhaseWithTiming } from '../../../../common/types'; +import { PhaseWithTiming } from '../../../common/types'; import { setupEnvironment } from '../../helpers'; import { setupValidationTestBed, ValidationTestBed } from './validation.helpers'; -// FLAKY: https://github.com/elastic/kibana/issues/115307 -describe.skip(' timing validation', () => { +describe(' timing validation', () => { let testBed: ValidationTestBed; let actions: ValidationTestBed['actions']; const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/validation.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/validation.helpers.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/validation.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/validation.helpers.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/warm_phase_validation.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/warm_phase_validation.test.ts similarity index 95% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/warm_phase_validation.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/warm_phase_validation.test.ts index df0607a0a0e65..47917b1f8e3d7 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/form_validation/warm_phase_validation.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/form_validation/warm_phase_validation.test.ts @@ -6,12 +6,11 @@ */ import { act } from 'react-dom/test-utils'; -import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts'; +import { i18nTexts } from '../../../public/application/sections/edit_policy/i18n_texts'; import { setupEnvironment } from '../../helpers'; import { setupValidationTestBed, ValidationTestBed } from './validation.helpers'; -// FLAKY: https://github.com/elastic/kibana/issues/141645 -describe.skip(' warm phase validation', () => { +describe(' warm phase validation', () => { let testBed: ValidationTestBed; const { httpSetup, httpRequestsMockHelpers } = setupEnvironment(); diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/init_test_bed.ts similarity index 89% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/init_test_bed.ts index 875bf9db36264..56bed7a6e50aa 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/init_test_bed.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/init_test_bed.ts @@ -5,12 +5,12 @@ * 2.0. */ +import { HttpSetup } from '@kbn/core/public'; import { registerTestBed, TestBedConfig } from '@kbn/test-jest-helpers'; -import { HttpSetup } from '@kbn/core/public'; import { WithAppDependencies } from '../helpers'; -import { EditPolicy } from '../../../public/application/sections/edit_policy'; -import { AppServicesContext } from '../../../public/types'; +import { EditPolicy } from '../../public/application/sections/edit_policy'; +import { AppServicesContext } from '../../public/types'; import { POLICY_NAME } from './constants'; const getTestBedConfig = (testBedConfig?: Partial): TestBedConfig => { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.helpers.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/serialization/policy_serialization.helpers.ts similarity index 95% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.helpers.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/serialization/policy_serialization.helpers.ts index 417f53c63a20c..e439fca0de512 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.helpers.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/serialization/policy_serialization.helpers.ts @@ -6,7 +6,7 @@ */ import { HttpSetup } from '@kbn/core/public'; -import { AppServicesContext } from '../../../../public/types'; +import { AppServicesContext } from '../../../public/types'; import { createColdPhaseActions, createDeletePhaseActions, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.test.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/serialization/policy_serialization.test.ts similarity index 99% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.test.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/serialization/policy_serialization.test.ts index 983cfbadfa017..05aa66fcc5f25 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.test.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/edit_policy/serialization/policy_serialization.test.ts @@ -9,7 +9,7 @@ import { act } from 'react-dom/test-utils'; import { licensingMock } from '@kbn/licensing-plugin/public/mocks'; import { HttpFetchOptionsWithPath } from '@kbn/core/public'; import { setupEnvironment } from '../../helpers'; -import { API_BASE_PATH } from '../../../../common/constants'; +import { API_BASE_PATH } from '../../../common/constants'; import { getDefaultHotPhasePolicy, POLICY_WITH_INCLUDE_EXCLUDE, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/downsample_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/downsample_actions.ts similarity index 96% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/downsample_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/downsample_actions.ts index 315ed3d58520a..a389a9deebe32 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/downsample_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/downsample_actions.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { TestBed } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; -import { Phase } from '../../../../common/types'; +import { TestBed } from '@kbn/test-jest-helpers'; +import { Phase } from '../../../common/types'; import { createFormToggleAction } from '..'; const createSetDownsampleIntervalAction = diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/errors_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/errors_actions.ts similarity index 96% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/errors_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/errors_actions.ts index 4b863071e191c..18f07734fadee 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/errors_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/errors_actions.ts @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; import { TestBed } from '@kbn/test-jest-helpers'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; const createWaitForValidationAction = (testBed: TestBed) => () => { const { component } = testBed; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/forcemerge_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/forcemerge_actions.ts similarity index 96% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/forcemerge_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/forcemerge_actions.ts index b6ed40de36ca9..619d6bd8be85f 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/forcemerge_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/forcemerge_actions.ts @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; import { TestBed } from '@kbn/test-jest-helpers'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; import { createFormToggleAction } from './form_toggle_action'; import { createFormSetValueAction } from './form_set_value_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_set_value_action.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/form_set_value_action.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_set_value_action.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/form_set_value_action.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_action.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/form_toggle_action.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_action.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/form_toggle_action.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_and_set_value_action.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/form_toggle_and_set_value_action.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/form_toggle_and_set_value_action.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/form_toggle_and_set_value_action.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/index.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/index.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/index.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/index.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/index_priority_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/index_priority_actions.ts similarity index 94% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/index_priority_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/index_priority_actions.ts index 79fb77e53cc59..4c6e4604be7d4 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/index_priority_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/index_priority_actions.ts @@ -6,7 +6,7 @@ */ import { TestBed } from '@kbn/test-jest-helpers'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; import { createFormToggleAction } from './form_toggle_action'; import { createFormToggleAndSetValueAction } from './form_toggle_and_set_value_action'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/min_age_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/min_age_actions.ts similarity index 94% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/min_age_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/min_age_actions.ts index ef00fdc8d7757..8b4fa2e5f6179 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/min_age_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/min_age_actions.ts @@ -6,7 +6,7 @@ */ import { TestBed } from '@kbn/test-jest-helpers'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; import { createFormSetValueAction } from './form_set_value_action'; export const createMinAgeActions = (testBed: TestBed, phase: Phase) => { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/node_allocation_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/node_allocation_actions.ts similarity index 95% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/node_allocation_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/node_allocation_actions.ts index 2a680590654a8..a3cb607b60f99 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/node_allocation_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/node_allocation_actions.ts @@ -8,8 +8,8 @@ import { act } from 'react-dom/test-utils'; import { TestBed } from '@kbn/test-jest-helpers'; -import { DataTierAllocationType } from '../../../../public/application/sections/edit_policy/types'; -import { Phase } from '../../../../common/types'; +import { DataTierAllocationType } from '../../../public/application/sections/edit_policy/types'; +import { Phase } from '../../../common/types'; import { createFormSetValueAction } from './form_set_value_action'; export const createNodeAllocationActions = (testBed: TestBed, phase: Phase) => { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/phases.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/phases.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/phases.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/phases.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/readonly_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/readonly_actions.ts similarity index 92% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/readonly_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/readonly_actions.ts index 1a7ec56815b00..fe4c71d76265a 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/readonly_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/readonly_actions.ts @@ -6,7 +6,7 @@ */ import { TestBed } from '@kbn/test-jest-helpers'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; import { createFormToggleAction } from './form_toggle_action'; export const createReadonlyActions = (testBed: TestBed, phase: Phase) => { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/replicas_action.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/replicas_action.ts similarity index 92% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/replicas_action.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/replicas_action.ts index 43eca26a4e1ce..35c3afc607513 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/replicas_action.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/replicas_action.ts @@ -6,7 +6,7 @@ */ import { TestBed } from '@kbn/test-jest-helpers'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; import { createFormToggleAndSetValueAction } from './form_toggle_and_set_value_action'; export const createReplicasAction = (testBed: TestBed, phase: Phase) => { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/request_flyout_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/request_flyout_actions.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/request_flyout_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/request_flyout_actions.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/rollover_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/rollover_actions.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/rollover_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/rollover_actions.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/save_policy_action.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/save_policy_action.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/save_policy_action.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/save_policy_action.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/searchable_snapshot_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/searchable_snapshot_actions.ts similarity index 96% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/searchable_snapshot_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/searchable_snapshot_actions.ts index 3efffcddbece6..c9a019c2bc842 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/searchable_snapshot_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/searchable_snapshot_actions.ts @@ -7,7 +7,7 @@ import { act } from 'react-dom/test-utils'; import { TestBed } from '@kbn/test-jest-helpers'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; import { createFormToggleAction } from './form_toggle_action'; export const createSearchableSnapshotActions = (testBed: TestBed, phase: Phase) => { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/shrink_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/shrink_actions.ts similarity index 97% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/shrink_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/shrink_actions.ts index def20f73b82fe..4bf39185b8c03 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/shrink_actions.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/shrink_actions.ts @@ -7,7 +7,7 @@ import { TestBed } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; import { createFormSetValueAction } from './form_set_value_action'; export const createShrinkActions = (testBed: TestBed, phase: Phase) => { diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/snapshot_policy_actions.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/snapshot_policy_actions.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/snapshot_policy_actions.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/snapshot_policy_actions.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/toggle_phase_action.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/toggle_phase_action.ts similarity index 96% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/toggle_phase_action.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/toggle_phase_action.ts index c22efae87d5ac..fc89332e47a67 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/actions/toggle_phase_action.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/actions/toggle_phase_action.ts @@ -8,7 +8,7 @@ import { TestBed } from '@kbn/test-jest-helpers'; import { act } from 'react-dom/test-utils'; -import { Phase } from '../../../../common/types'; +import { Phase } from '../../../common/types'; const toggleDeletePhase = async (testBed: TestBed) => { const { find, component } = testBed; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/global_mocks.tsx b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/global_mocks.tsx similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/global_mocks.tsx rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/global_mocks.tsx diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/http_requests.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/http_requests.ts similarity index 97% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/http_requests.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/http_requests.ts index 7ddcd5358404f..70e85c8bc5df4 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/http_requests.ts +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/http_requests.ts @@ -6,12 +6,12 @@ */ import { httpServiceMock } from '@kbn/core/public/mocks'; -import { API_BASE_PATH } from '../../../common/constants'; +import { API_BASE_PATH } from '../../common/constants'; import { ListNodesRouteResponse, ListSnapshotReposResponse, NodesDetailsResponse, -} from '../../../common/types'; +} from '../../common/types'; import { getDefaultHotPhasePolicy } from '../edit_policy/constants'; type HttpMethod = 'GET' | 'PUT' | 'DELETE' | 'POST'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/index.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/index.ts rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/index.ts diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/setup_environment.tsx similarity index 80% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/setup_environment.tsx rename to x-pack/plugins/index_lifecycle_management/integration_tests/helpers/setup_environment.tsx index 055097c883e94..91aebb485ea7f 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/helpers/setup_environment.tsx +++ b/x-pack/plugins/index_lifecycle_management/integration_tests/helpers/setup_environment.tsx @@ -19,12 +19,12 @@ import { executionContextServiceMock, } from '@kbn/core/public/mocks'; import { licensingMock } from '@kbn/licensing-plugin/public/mocks'; -import { init as initHttp } from '../../../public/application/services/http'; +import { init as initHttp } from '../../public/application/services/http'; import { init as initHttpRequests } from './http_requests'; -import { init as initUiMetric } from '../../../public/application/services/ui_metric'; -import { init as initNotification } from '../../../public/application/services/notification'; -import { KibanaContextProvider } from '../../../public/shared_imports'; -import { createBreadcrumbsMock } from '../../../public/application/services/breadcrumbs.mock'; +import { init as initUiMetric } from '../../public/application/services/ui_metric'; +import { init as initNotification } from '../../public/application/services/notification'; +import { KibanaContextProvider } from '../../public/shared_imports'; +import { createBreadcrumbsMock } from '../../public/application/services/breadcrumbs.mock'; const breadcrumbService = createBreadcrumbsMock(); const appContextMock = { diff --git a/x-pack/plugins/index_lifecycle_management/jest.integration.config.js b/x-pack/plugins/index_lifecycle_management/jest.integration.config.js new file mode 100644 index 0000000000000..6d1ac5ec2fd8a --- /dev/null +++ b/x-pack/plugins/index_lifecycle_management/jest.integration.config.js @@ -0,0 +1,19 @@ +/* + * 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/index_lifecycle_management'], + testMatch: ['/**/integration_tests/**/*.test.{js,mjs,ts,tsx}'], + coverageDirectory: + '/target/kibana-coverage/jest/x-pack/plugins/index_lifecycle_management', + coverageReporters: ['text', 'html'], + collectCoverageFrom: [ + '/x-pack/plugins/index_lifecycle_management/{common,public,server}/**/*.{ts,tsx}', + ], +}; diff --git a/x-pack/plugins/index_lifecycle_management/tsconfig.json b/x-pack/plugins/index_lifecycle_management/tsconfig.json index d3a342e110211..4b5d7657ed9f6 100644 --- a/x-pack/plugins/index_lifecycle_management/tsconfig.json +++ b/x-pack/plugins/index_lifecycle_management/tsconfig.json @@ -8,6 +8,7 @@ }, "include": [ "__jest__/**/*", + "integration_tests/**/*", "common/**/*", "public/**/*", "server/**/*", diff --git a/x-pack/plugins/infra/public/apps/metrics_app.tsx b/x-pack/plugins/infra/public/apps/metrics_app.tsx index fdeb7173d5cee..ce8123b5f2223 100644 --- a/x-pack/plugins/infra/public/apps/metrics_app.tsx +++ b/x-pack/plugins/infra/public/apps/metrics_app.tsx @@ -45,6 +45,7 @@ export const renderApp = ( ); return () => { + core.chrome.docTitle.reset(); ReactDOM.unmountComponentAtNode(element); plugins.data.search.session.clear(); }; diff --git a/x-pack/plugins/infra/public/components/document_title.tsx b/x-pack/plugins/infra/public/components/document_title.tsx deleted file mode 100644 index 20e482d9df5b5..0000000000000 --- a/x-pack/plugins/infra/public/components/document_title.tsx +++ /dev/null @@ -1,72 +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'; - -type TitleProp = string | ((previousTitle: string) => string); - -interface DocumentTitleProps { - title: TitleProp; -} - -interface DocumentTitleState { - index: number; -} - -const wrapWithSharedState = () => { - const titles: string[] = []; - const TITLE_SUFFIX = ' - Kibana'; - - return class extends React.Component { - public componentDidMount() { - this.setState( - () => { - return { index: titles.push('') - 1 }; - }, - () => { - this.pushTitle(this.getTitle(this.props.title)); - this.updateDocumentTitle(); - } - ); - } - - public componentDidUpdate() { - this.pushTitle(this.getTitle(this.props.title)); - this.updateDocumentTitle(); - } - - public componentWillUnmount() { - this.removeTitle(); - this.updateDocumentTitle(); - } - - public render() { - return null; - } - - public getTitle(title: TitleProp) { - return typeof title === 'function' ? title(titles[this.state.index - 1]) : title; - } - - public pushTitle(title: string) { - titles[this.state.index] = title; - } - - public removeTitle() { - titles.pop(); - } - - public updateDocumentTitle() { - const title = (titles[titles.length - 1] || '') + TITLE_SUFFIX; - if (title !== document.title) { - document.title = title; - } - } - }; -}; - -export const DocumentTitle = wrapWithSharedState(); diff --git a/x-pack/plugins/infra/public/hooks/use_breadcrumbs.ts b/x-pack/plugins/infra/public/hooks/use_breadcrumbs.ts index 37801c16bcf1f..97f737380022d 100644 --- a/x-pack/plugins/infra/public/hooks/use_breadcrumbs.ts +++ b/x-pack/plugins/infra/public/hooks/use_breadcrumbs.ts @@ -22,7 +22,7 @@ export const useBreadcrumbs = (app: AppId, appTitle: string, extraCrumbs: Chrome const appLinkProps = useLinkProps({ app }); useEffect(() => { - chrome?.setBreadcrumbs?.([ + const breadcrumbs = [ { ...observabilityLinkProps, text: observabilityTitle, @@ -32,6 +32,11 @@ export const useBreadcrumbs = (app: AppId, appTitle: string, extraCrumbs: Chrome text: appTitle, }, ...extraCrumbs, - ]); + ]; + + const docTitle = [...breadcrumbs].reverse().map((breadcrumb) => breadcrumb.text as string); + + chrome.docTitle.change(docTitle); + chrome.setBreadcrumbs(breadcrumbs); }, [appLinkProps, appTitle, chrome, extraCrumbs, observabilityLinkProps]); }; diff --git a/x-pack/plugins/infra/public/hooks/use_document_title.tsx b/x-pack/plugins/infra/public/hooks/use_document_title.tsx new file mode 100644 index 0000000000000..82fb5a669eb91 --- /dev/null +++ b/x-pack/plugins/infra/public/hooks/use_document_title.tsx @@ -0,0 +1,25 @@ +/* + * 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 { ChromeBreadcrumb } from '@kbn/core/public'; +import { useEffect } from 'react'; +import { observabilityTitle } from '../translations'; +import { useKibanaContextForPlugin } from './use_kibana'; + +export const useDocumentTitle = (extraTitles: ChromeBreadcrumb[]) => { + const { + services: { chrome }, + } = useKibanaContextForPlugin(); + + useEffect(() => { + const docTitle = [{ text: observabilityTitle }, ...extraTitles] + .reverse() + .map((breadcrumb) => breadcrumb.text as string); + + chrome.docTitle.change(docTitle); + }, [chrome, extraTitles]); +}; diff --git a/x-pack/plugins/infra/public/pages/logs/page_content.tsx b/x-pack/plugins/infra/public/pages/logs/page_content.tsx index e42cfc2d7c54a..8acd4004603e9 100644 --- a/x-pack/plugins/infra/public/pages/logs/page_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/page_content.tsx @@ -12,7 +12,6 @@ import { Route, Switch } from 'react-router-dom'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { HeaderMenuPortal, useLinkProps } from '@kbn/observability-plugin/public'; import { AlertDropdown } from '../../alerting/log_threshold'; -import { DocumentTitle } from '../../components/document_title'; import { HelpCenterContent } from '../../components/help_center_content'; import { useReadOnlyBadge } from '../../hooks/use_readonly_badge'; import { HeaderActionMenuContext } from '../../utils/header_action_menu_provider'; @@ -62,8 +61,6 @@ export const LogsPageContent: React.FunctionComponent = () => { return ( <> - - {setHeaderActionMenu && theme$ && ( diff --git a/x-pack/plugins/infra/public/pages/logs/stream/page.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page.tsx index bb8e4307fe3b9..19f098a6721bc 100644 --- a/x-pack/plugins/infra/public/pages/logs/stream/page.tsx +++ b/x-pack/plugins/infra/public/pages/logs/stream/page.tsx @@ -10,7 +10,6 @@ import React from 'react'; import { useTrackPageview } from '@kbn/observability-plugin/public'; import { useLogsBreadcrumbs } from '../../../hooks/use_logs_breadcrumbs'; import { StreamPageContent } from './page_content'; -import { StreamPageHeader } from './page_header'; import { LogsPageProviders } from './page_providers'; import { streamTitle } from '../../../translations'; @@ -26,7 +25,6 @@ export const StreamPage = () => { return ( - diff --git a/x-pack/plugins/infra/public/pages/logs/stream/page_header.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_header.tsx deleted file mode 100644 index f6c4ad8c8c139..0000000000000 --- a/x-pack/plugins/infra/public/pages/logs/stream/page_header.tsx +++ /dev/null @@ -1,28 +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'; -import React from 'react'; - -import { DocumentTitle } from '../../../components/document_title'; - -export const StreamPageHeader = () => { - return ( - <> - - i18n.translate('xpack.infra.logs.streamPage.documentTitle', { - defaultMessage: '{previousTitle} | Stream', - values: { - previousTitle, - }, - }) - } - /> - - ); -}; diff --git a/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx b/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx index 57b3ab0e683ac..74f2468eb4c45 100644 --- a/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/hosts/components/hosts_table.tsx @@ -93,16 +93,24 @@ const getLensHostsTable = ( }, customLabel: true, }, - '0a9bd0fa-9966-489b-8c95-70997a7aad4cX0': { - label: 'Part of Memory Total (avg)', + '3eca2307-228e-4842-a023-57e15c8c364d': { + label: 'Disk latency (avg.)', dataType: 'number', - operationType: 'average', - sourceField: 'system.memory.total', + operationType: 'formula', isBucketed: false, scale: 'ratio', params: { - emptyAsNull: false, + formula: 'average(system.diskio.io.time) / 1000', + isFormulaBroken: false, + format: { + id: 'number', + params: { + decimals: 0, + suffix: 'ms', + }, + }, }, + references: ['3eca2307-228e-4842-a023-57e15c8c364dX1'], customLabel: true, }, '0a9bd0fa-9966-489b-8c95-70997a7aad4c': { @@ -124,18 +132,6 @@ const getLensHostsTable = ( references: ['0a9bd0fa-9966-489b-8c95-70997a7aad4cX0'], customLabel: true, }, - 'fe5a4d7d-6f48-45ab-974c-96bc864ac36fX0': { - label: 'Part of Memory Usage (avg)', - dataType: 'number', - operationType: 'average', - sourceField: 'system.memory.used.pct', - isBucketed: false, - scale: 'ratio', - params: { - emptyAsNull: false, - }, - customLabel: true, - }, 'fe5a4d7d-6f48-45ab-974c-96bc864ac36f': { label: 'Memory usage (avg.)', dataType: 'number', @@ -155,6 +151,30 @@ const getLensHostsTable = ( references: ['fe5a4d7d-6f48-45ab-974c-96bc864ac36fX0'], customLabel: true, }, + '0a9bd0fa-9966-489b-8c95-70997a7aad4cX0': { + label: 'Part of Memory Total (avg)', + dataType: 'number', + operationType: 'average', + sourceField: 'system.memory.total', + isBucketed: false, + scale: 'ratio', + params: { + emptyAsNull: false, + }, + customLabel: true, + }, + 'fe5a4d7d-6f48-45ab-974c-96bc864ac36fX0': { + label: 'Part of Memory Usage (avg)', + dataType: 'number', + operationType: 'average', + sourceField: 'system.memory.used.pct', + isBucketed: false, + scale: 'ratio', + params: { + emptyAsNull: false, + }, + customLabel: true, + }, '3eca2307-228e-4842-a023-57e15c8c364dX0': { label: 'Part of Disk Latency (avg ms)', dataType: 'number', @@ -188,24 +208,208 @@ const getLensHostsTable = ( references: ['3eca2307-228e-4842-a023-57e15c8c364dX0'], customLabel: true, }, - '3eca2307-228e-4842-a023-57e15c8c364d': { - label: 'Disk latency (avg.)', + '02e9d54c-bbe0-42dc-839c-55080a29838dX0': { + label: 'Part of RX (avg)', + dataType: 'number', + operationType: 'average', + sourceField: 'host.network.ingress.bytes', + isBucketed: false, + scale: 'ratio', + filter: { + query: 'host.network.ingress.bytes: *', + language: 'kuery', + }, + params: { + emptyAsNull: false, + }, + customLabel: true, + }, + '02e9d54c-bbe0-42dc-839c-55080a29838dX1': { + label: 'Part of RX (avg)', + dataType: 'number', + operationType: 'max', + sourceField: 'metricset.period', + isBucketed: false, + scale: 'ratio', + filter: { + query: 'host.network.ingress.bytes: *', + language: 'kuery', + }, + params: { + emptyAsNull: false, + }, + customLabel: true, + }, + '02e9d54c-bbe0-42dc-839c-55080a29838dX2': { + label: 'Part of RX (avg)', + dataType: 'number', + operationType: 'math', + isBucketed: false, + scale: 'ratio', + params: { + tinymathAst: { + type: 'function', + name: 'divide', + args: [ + { + type: 'function', + name: 'multiply', + args: ['02e9d54c-bbe0-42dc-839c-55080a29838dX0', 8], + location: { + min: 1, + max: 40, + }, + text: 'average(host.network.ingress.bytes) * 8', + }, + { + type: 'function', + name: 'divide', + args: ['02e9d54c-bbe0-42dc-839c-55080a29838dX1', 1000], + location: { + min: 45, + max: 73, + }, + text: 'max(metricset.period) / 1000', + }, + ], + location: { + min: 0, + max: 75, + }, + text: '(average(host.network.ingress.bytes) * 8) / (max(metricset.period) / 1000)\n', + }, + }, + references: [ + '02e9d54c-bbe0-42dc-839c-55080a29838dX0', + '02e9d54c-bbe0-42dc-839c-55080a29838dX1', + ], + customLabel: true, + }, + '02e9d54c-bbe0-42dc-839c-55080a29838d': { + label: 'RX (avg.)', dataType: 'number', operationType: 'formula', isBucketed: false, scale: 'ratio', params: { - formula: 'average(system.diskio.io.time) / 1000', + formula: + '(average(host.network.ingress.bytes) * 8) / (max(metricset.period) / 1000)\n', isFormulaBroken: false, format: { - id: 'number', + id: 'bits', params: { decimals: 0, - suffix: 'ms', + suffix: '/s', }, }, }, - references: ['3eca2307-228e-4842-a023-57e15c8c364dX1'], + references: ['02e9d54c-bbe0-42dc-839c-55080a29838dX2'], + filter: { + query: 'host.network.ingress.bytes: *', + language: 'kuery', + }, + customLabel: true, + }, + '7802ef93-622c-44df-94fa-03eec01bb7b6X0': { + label: 'Part of TX', + dataType: 'number', + operationType: 'average', + sourceField: 'host.network.egress.bytes', + isBucketed: false, + scale: 'ratio', + filter: { + query: 'host.network.egress.bytes: *', + language: 'kuery', + }, + params: { + emptyAsNull: false, + }, + customLabel: true, + }, + '7802ef93-622c-44df-94fa-03eec01bb7b6X1': { + label: 'Part of TX', + dataType: 'number', + operationType: 'max', + sourceField: 'metricset.period', + isBucketed: false, + scale: 'ratio', + filter: { + query: 'host.network.egress.bytes: *', + language: 'kuery', + }, + params: { + emptyAsNull: false, + }, + customLabel: true, + }, + '7802ef93-622c-44df-94fa-03eec01bb7b6X2': { + label: 'Part of TX', + dataType: 'number', + operationType: 'math', + isBucketed: false, + scale: 'ratio', + params: { + tinymathAst: { + type: 'function', + name: 'divide', + args: [ + { + type: 'function', + name: 'multiply', + args: ['7802ef93-622c-44df-94fa-03eec01bb7b6X0', 8], + location: { + min: 1, + max: 39, + }, + text: 'average(host.network.egress.bytes) * 8', + }, + { + type: 'function', + name: 'divide', + args: ['7802ef93-622c-44df-94fa-03eec01bb7b6X1', 1000], + location: { + min: 44, + max: 72, + }, + text: 'max(metricset.period) / 1000', + }, + ], + location: { + min: 0, + max: 74, + }, + text: '(average(host.network.egress.bytes) * 8) / (max(metricset.period) / 1000)\n', + }, + }, + references: [ + '7802ef93-622c-44df-94fa-03eec01bb7b6X0', + '7802ef93-622c-44df-94fa-03eec01bb7b6X1', + ], + customLabel: true, + }, + '7802ef93-622c-44df-94fa-03eec01bb7b6': { + label: 'TX (avg.)', + dataType: 'number', + operationType: 'formula', + isBucketed: false, + scale: 'ratio', + params: { + formula: + '(average(host.network.egress.bytes) * 8) / (max(metricset.period) / 1000)\n', + isFormulaBroken: false, + format: { + id: 'bits', + params: { + decimals: 0, + suffix: '/s', + }, + }, + }, + references: ['7802ef93-622c-44df-94fa-03eec01bb7b6X2'], + filter: { + query: 'host.network.egress.bytes: *', + language: 'kuery', + }, customLabel: true, }, }, @@ -214,12 +418,20 @@ const getLensHostsTable = ( '155fc728-d010-498e-8126-0bc46cad2be2', '467de550-9186-4e18-8cfa-bce07087801a', '3eca2307-228e-4842-a023-57e15c8c364d', + '02e9d54c-bbe0-42dc-839c-55080a29838d', + '7802ef93-622c-44df-94fa-03eec01bb7b6', '0a9bd0fa-9966-489b-8c95-70997a7aad4c', 'fe5a4d7d-6f48-45ab-974c-96bc864ac36f', '0a9bd0fa-9966-489b-8c95-70997a7aad4cX0', 'fe5a4d7d-6f48-45ab-974c-96bc864ac36fX0', '3eca2307-228e-4842-a023-57e15c8c364dX0', '3eca2307-228e-4842-a023-57e15c8c364dX1', + '02e9d54c-bbe0-42dc-839c-55080a29838dX0', + '02e9d54c-bbe0-42dc-839c-55080a29838dX1', + '02e9d54c-bbe0-42dc-839c-55080a29838dX2', + '7802ef93-622c-44df-94fa-03eec01bb7b6X0', + '7802ef93-622c-44df-94fa-03eec01bb7b6X1', + '7802ef93-622c-44df-94fa-03eec01bb7b6X2', ], incompleteColumns: {}, indexPatternId: '305688db-9e02-4046-acc1-5d0d8dd73ef6', @@ -234,6 +446,7 @@ const getLensHostsTable = ( { columnId: '8d17458d-31af-41d1-a23c-5180fd960bee', width: 296.16666666666663, + isTransposed: false, }, { columnId: '155fc728-d010-498e-8126-0bc46cad2be2', @@ -245,6 +458,10 @@ const getLensHostsTable = ( isTransposed: false, width: 121.11666666666667, }, + { + columnId: '3eca2307-228e-4842-a023-57e15c8c364d', + isTransposed: false, + }, { columnId: '0a9bd0fa-9966-489b-8c95-70997a7aad4c', isTransposed: false, @@ -254,8 +471,12 @@ const getLensHostsTable = ( isTransposed: false, }, { - columnId: '3eca2307-228e-4842-a023-57e15c8c364d', isTransposed: false, + columnId: '02e9d54c-bbe0-42dc-839c-55080a29838d', + }, + { + isTransposed: false, + columnId: '7802ef93-622c-44df-94fa-03eec01bb7b6', }, ], paging: { @@ -288,7 +509,6 @@ export const HostsTable: React.FunctionComponent = ({ services: { lens }, } = useKibana(); const LensComponent = lens?.EmbeddableComponent; - return ( { ]); return ( - - i18n.translate('xpack.infra.infrastructureHostsPage.documentTitle', { - defaultMessage: '{previousTitle} | Hosts', - values: { - previousTitle, - }, - }) - } - /> {isLoading && !source ? ( ) : metricIndicesExist && source ? ( diff --git a/x-pack/plugins/infra/public/pages/metrics/index.tsx b/x-pack/plugins/infra/public/pages/metrics/index.tsx index 9c02424aac949..691069a978e83 100644 --- a/x-pack/plugins/infra/public/pages/metrics/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/index.tsx @@ -15,7 +15,6 @@ import { useKibana } from '@kbn/kibana-react-plugin/public'; import { HeaderMenuPortal } from '@kbn/observability-plugin/public'; import { useLinkProps } from '@kbn/observability-plugin/public'; import { MetricsSourceConfigurationProperties } from '../../../common/metrics_sources'; -import { DocumentTitle } from '../../components/document_title'; import { HelpCenterContent } from '../../components/help_center_content'; import { useReadOnlyBadge } from '../../hooks/use_readonly_badge'; import { @@ -73,12 +72,6 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => { - - Legend Options - + - + ); }; + +const StyledEuiForm = euiStyled(EuiForm)` + min-width: 400px; + @media (max-width: 480px) { + min-width: 100%; + max-width: 100%; + width: 100vw; + } +`; diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/map.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/map.tsx index e0d03284d63fc..a4558d6a7e9b0 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/map.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/map.tsx @@ -105,6 +105,7 @@ const WaffleMapOuterContainer = euiStyled.div<{ bottomMargin: number; staticHeig overflow-x: hidden; overflow-y: auto; margin-bottom: ${(props) => props.bottomMargin}px; + max-width: calc(100vw - 90px); ${(props) => props.staticHeight && 'min-height: 300px;'} `; diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/palette_preview.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/palette_preview.tsx index 132982eae69b9..9dc5f3acd6e57 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/palette_preview.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/components/waffle/palette_preview.tsx @@ -28,9 +28,9 @@ export const PalettePreview = ({ steps, palette, reverse }: Props) => { }; const Swatch = euiStyled.div` - width: 15px; + max-width: 15px; height: 12px; - flex: 0 0 auto; + flex: 1 1 auto; &:first-child { border-radius: ${(props) => props.theme.eui.euiBorderRadius} 0 0 ${(props) => props.theme.eui.euiBorderRadius}; diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/index.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/index.tsx index 8031af55828c4..77b8e9a35a64e 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/index.tsx @@ -6,14 +6,10 @@ */ import { EuiErrorBoundary } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; import React from 'react'; import { useTrackPageview } from '@kbn/observability-plugin/public'; import { APP_WRAPPER_CLASS } from '@kbn/core/public'; import { FilterBar } from './components/filter_bar'; - -import { DocumentTitle } from '../../../components/document_title'; - import { SourceErrorPage } from '../../../components/source_error_page'; import { SourceLoadingPage } from '../../../components/source_loading_page'; import { useSourceContext } from '../../../containers/metrics_source'; @@ -49,16 +45,6 @@ export const SnapshotPage = () => { return ( - - i18n.translate('xpack.infra.infrastructureSnapshotPage.documentTitle', { - defaultMessage: '{previousTitle} | Inventory', - values: { - previousTitle, - }, - }) - } - /> {isLoading && !source ? ( ) : metricIndicesExist ? ( diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/page_error.test.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/page_error.test.tsx new file mode 100644 index 0000000000000..25ae3b3717bd6 --- /dev/null +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/page_error.test.tsx @@ -0,0 +1,47 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 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 { PageError } from './page_error'; +import { errorTitle } from '../../../../translations'; +import { InfraHttpError } from '../../../../types'; +import { useDocumentTitle } from '../../../../hooks/use_document_title'; +import { I18nProvider } from '@kbn/i18n-react'; + +jest.mock('../../../../hooks/use_document_title', () => ({ + useDocumentTitle: jest.fn(), +})); + +const renderErrorPage = () => + render( + + + + ); + +describe('PageError component', () => { + it('renders correctly and set title', () => { + const { getByText } = renderErrorPage(); + expect(useDocumentTitle).toHaveBeenCalledWith([{ text: `${errorTitle}` }]); + + expect(getByText('Error Message')).toBeInTheDocument(); + expect(getByText('Please click the back button and try again.')).toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/page_error.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/page_error.tsx index a6665e0d244f2..b4cdb47399e98 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/page_error.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/page_error.tsx @@ -6,11 +6,11 @@ */ import React from 'react'; -import { i18n } from '@kbn/i18n'; +import { useDocumentTitle } from '../../../../hooks/use_document_title'; import { InvalidNodeError } from './invalid_node'; -import { DocumentTitle } from '../../../../components/document_title'; import { ErrorPageBody } from '../../../error'; import { InfraHttpError } from '../../../../types'; +import { errorTitle } from '../../../../translations'; interface Props { name: string; @@ -18,18 +18,10 @@ interface Props { } export const PageError = ({ error, name }: Props) => { + useDocumentTitle([{ text: errorTitle }]); + return ( <> - - i18n.translate('xpack.infra.metricDetailPage.documentTitleError', { - defaultMessage: '{previousTitle} | Uh oh', - values: { - previousTitle, - }, - }) - } - /> {error.body?.statusCode === 404 ? ( ) : ( diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/index.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/index.tsx index 823b9d703f502..9b92901976bff 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/index.tsx @@ -9,7 +9,6 @@ import { i18n } from '@kbn/i18n'; import React, { useState } from 'react'; import { EuiTheme, withTheme } from '@kbn/kibana-react-plugin/common'; import { useLinkProps } from '@kbn/observability-plugin/public'; -import { DocumentTitle } from '../../../components/document_title'; import { withMetricPageProviders } from './page_providers'; import { useMetadata } from './hooks/use_metadata'; import { useMetricsBreadcrumbs } from '../../../hooks/use_metrics_breadcrumbs'; @@ -100,14 +99,6 @@ export const MetricDetail = withMetricPageProviders( return ( <> - {metadata ? ( - - i18n.translate('xpack.infra.infrastructureMetricsExplorerPage.documentTitle', { - defaultMessage: '{previousTitle} | Metrics Explorer', - values: { - previousTitle, - }, - }) - } - /> { - 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/app_plugin/mounter.tsx b/x-pack/plugins/lens/public/app_plugin/mounter.tsx index 7cf1331282d4e..ef1933dbd5ca1 100644 --- a/x-pack/plugins/lens/public/app_plugin/mounter.tsx +++ b/x-pack/plugins/lens/public/app_plugin/mounter.tsx @@ -386,5 +386,6 @@ export async function mountApp( lensServices.inspector.close(); unlistenParentHistory(); lensStore.dispatch(navigateAway()); + stateTransfer.clearEditorState?.(APP_ID); }; } 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 a118183c49061..6e3978a414ec7 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 17907ac19c4bc..0000000000000 --- 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 5f3fd2d4a73b5..3094a07cf3290 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 b6d7e58b0f7e7..8b1fe4082b31c 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 26d4c1f04f41a..97d0cf73b80dd 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 b9ca695882ef2..bc1c41caa650b 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 32a18d1535697..58a4248b51857 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 4614874777cc2..0000000000000 --- 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.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx index baece355d1d54..74394e89f0d63 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx @@ -243,7 +243,7 @@ describe('LayerPanel', () => { filterOperations: () => true, supportsMoreColumns: true, dataTestSubj: 'lnsGroup', - required: true, + requiredMinDimensionCount: 1, }, ], }); @@ -303,37 +303,83 @@ describe('LayerPanel', () => { expect(groups.findWhere((e) => e.prop('error') === '')).toHaveLength(1); }); - it('should render the required warning when only one group is configured (with requiredMinDimensionCount)', async () => { - mockVisualization.getConfiguration.mockReturnValue({ - groups: [ - { - groupLabel: 'A', - groupId: 'a', - accessors: [{ columnId: 'x' }], - filterOperations: () => true, - supportsMoreColumns: false, - dataTestSubj: 'lnsGroup', - }, - { - groupLabel: 'B', - groupId: 'b', - accessors: [{ columnId: 'y' }], - filterOperations: () => true, - supportsMoreColumns: true, - dataTestSubj: 'lnsGroup', - requiredMinDimensionCount: 2, - }, - ], - }); - - const { instance } = await mountWithProvider(); + it.each` + minDimensions | accessors | errors + ${1} | ${0} | ${1} + ${2} | ${0} | ${2} + ${2} | ${1} | ${2} + `( + 'should render the required warning for $errors fields when only one group is configured with requiredMinDimensionCount: $minDimensions and $accessors accessors', + async ({ minDimensions, accessors, errors }) => { + mockVisualization.getConfiguration.mockReturnValue({ + groups: [ + { + groupLabel: 'A', + groupId: 'a', + accessors: [{ columnId: 'x' }], + filterOperations: () => true, + supportsMoreColumns: false, + dataTestSubj: 'lnsGroup', + }, + { + groupLabel: 'B', + groupId: 'b', + accessors: [{ columnId: 'y' }].slice(0, accessors), + filterOperations: () => true, + supportsMoreColumns: true, + dataTestSubj: 'lnsGroup', + requiredMinDimensionCount: minDimensions, + }, + ], + }); + const { instance } = await mountWithProvider(); + + const errorMessage = errors === 1 ? 'Requires field' : 'Requires 2 fields'; + + const group = instance.find(EuiFormRow).findWhere((e) => e.prop('error') === errorMessage); + + expect(group).toHaveLength(1); + } + ); + + it.each` + minDimensions | accessors + ${0} | ${0} + ${0} | ${1} + ${1} | ${1} + ${1} | ${2} + ${2} | ${2} + `( + 'should not render the required warning when only one group is configured with requiredMinDimensionCount: $minDimensions and $accessors accessors', + async ({ minDimensions, accessors }) => { + mockVisualization.getConfiguration.mockReturnValue({ + groups: [ + { + groupLabel: 'A', + groupId: 'a', + accessors: [{ columnId: 'x' }], + filterOperations: () => true, + supportsMoreColumns: false, + dataTestSubj: 'lnsGroup', + }, + { + groupLabel: 'B', + groupId: 'b', + accessors: [{ columnId: 'y' }, { columnId: 'z' }].slice(0, accessors), + filterOperations: () => true, + supportsMoreColumns: true, + dataTestSubj: 'lnsGroup', + requiredMinDimensionCount: minDimensions, + }, + ], + }); + const { instance } = await mountWithProvider(); - const group = instance - .find(EuiFormRow) - .findWhere((e) => e.prop('error') === 'Requires 2 fields'); + const group = instance.find(EuiFormRow).findWhere((e) => e.prop('error')); - expect(group).toHaveLength(1); - }); + expect(group).toHaveLength(0); + } + ); it('should render the datasource and visualization panels inside the dimension container', async () => { mockVisualization.getConfiguration.mockReturnValueOnce({ 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 ed6d6b8c0553d..3d1068ebd521f 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) && } @@ -381,20 +406,25 @@ export function LayerPanel( let errorText: string = ''; if (!isEmptyLayer) { - if (group.requiredMinDimensionCount) { - errorText = i18n.translate( - 'xpack.lens.editorFrame.requiresTwoOrMoreFieldsWarningLabel', - { - defaultMessage: 'Requires {requiredMinDimensionCount} fields', - values: { - requiredMinDimensionCount: group.requiredMinDimensionCount, - }, - } - ); - } else if (group.required && group.accessors.length === 0) { - errorText = i18n.translate('xpack.lens.editorFrame.requiresFieldWarningLabel', { - defaultMessage: 'Requires field', - }); + if ( + group.requiredMinDimensionCount && + group.requiredMinDimensionCount > group.accessors.length + ) { + if (group.requiredMinDimensionCount > 1) { + errorText = i18n.translate( + 'xpack.lens.editorFrame.requiresTwoOrMoreFieldsWarningLabel', + { + defaultMessage: 'Requires {requiredMinDimensionCount} fields', + values: { + requiredMinDimensionCount: group.requiredMinDimensionCount, + }, + } + ); + } else { + errorText = i18n.translate('xpack.lens.editorFrame.requiresFieldWarningLabel', { + defaultMessage: 'Requires field', + }); + } } else if (group.dimensionsTooMany && group.dimensionsTooMany > 0) { errorText = i18n.translate( 'xpack.lens.editorFrame.tooManyDimensionsSingularWarningLabel', @@ -408,7 +438,7 @@ export function LayerPanel( ); } } - const isOptional = !group.required && !group.suggestedValue; + const isOptional = !group.requiredMinDimensionCount && !group.suggestedValue; return ( setHideTooltip(true)} onDragEnd={() => setHideTooltip(false)} onDrop={onDrop} @@ -562,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/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx index 2e81f9443ff15..dc09baf01fb2a 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/chart_switch.tsx @@ -534,12 +534,8 @@ function getTopSuggestion( ); }); - // We prefer unchanged or reduced suggestions when switching - // charts since that allows you to switch from A to B and back - // to A with the greatest chance of preserving your original state. return ( - suggestions.find((s) => s.changeType === 'unchanged') || - suggestions.find((s) => s.changeType === 'reduced') || + suggestions.find((s) => s.changeType === 'unchanged' || s.changeType === 'reduced') || suggestions[0] ); } diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.tsx index f7a0d8304296c..01370d7919c29 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { EuiPageContentBody_Deprecated as EuiPageContentBody, EuiText } from '@elastic/eui'; +import { EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import { UiActionsStart, VISUALIZE_GEO_FIELD_TRIGGER } from '@kbn/ui-actions-plugin/public'; @@ -45,7 +45,7 @@ export function GeoFieldWorkspacePanel(props: Props) { } return ( - +

@@ -72,6 +72,6 @@ export function GeoFieldWorkspacePanel(props: Props) {

- +
); } diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx index 0a6d0391c15a1..38f62b6e928b6 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.tsx @@ -18,7 +18,6 @@ import { EuiText, EuiButtonEmpty, EuiLink, - EuiPageContentBody_Deprecated as EuiPageContentBody, EuiButton, EuiSpacer, EuiTextColor, @@ -618,9 +617,7 @@ export const InnerWorkspacePanel = React.memo(function InnerWorkspacePanel({ value={dropProps.value} order={dropProps.order} > - - {renderWorkspaceContents()} - +
{renderWorkspaceContents()}
); }; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.tsx index cdc293dc78bc5..865dbb4e859e4 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.tsx @@ -9,7 +9,8 @@ import './workspace_panel_wrapper.scss'; import React, { useCallback } from 'react'; import { - EuiPageContent_Deprecated as EuiPageContent, + EuiPageSection, + EuiPageTemplate, EuiFlexGroup, EuiFlexItem, EuiButton, @@ -117,92 +118,93 @@ export function WorkspacePanelWrapper({ warningMessages.push(...requestWarnings); } return ( - <> + {!(isFullscreen && (autoApplyEnabled || warningMessages?.length)) && ( - - {!isFullscreen && ( - - - - - - - {activeVisualization && activeVisualization.renderToolbar && ( + + + {!isFullscreen && ( + + - + + {activeVisualization && activeVisualization.renderToolbar && ( + + + + )} + + + )} + + + + {warningMessages?.length ? ( + + {warningMessages} + + ) : null} + + {!autoApplyEnabled && ( + + dispatchLens(applyChanges())} + size="m" + data-test-subj="lnsApplyChanges__toolbar" + minWidth="auto" + > + + + )} - )} - - - - {warningMessages?.length ? ( - - {warningMessages} - - ) : null} - - {!autoApplyEnabled && ( - - dispatchLens(applyChanges())} - size="m" - data-test-subj="lnsApplyChanges__toolbar" - minWidth="auto" - > - - - - )} - - - + + )} - - {children} - - + + ); } diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx index fbd9a5650013d..5a975482e6250 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_editor.tsx @@ -20,6 +20,11 @@ import { useEuiTheme, EuiFlexGroup, EuiFlexItem, + EuiPopover, + EuiPopoverTitle, + EuiPanel, + EuiBasicTable, + EuiButtonIcon, } from '@elastic/eui'; import ReactDOM from 'react-dom'; import type { IndexPatternDimensionEditorProps } from './dimension_panel'; @@ -116,6 +121,10 @@ export function DimensionEditor(props: DimensionEditorProps) { selectedColumn && operationDefinitionMap[selectedColumn.operationType]; const [temporaryState, setTemporaryState] = useState('none'); + const [isHelpOpen, setIsHelpOpen] = useState(false); + + const onHelpClick = () => setIsHelpOpen((prevIsHelpOpen) => !prevIsHelpOpen); + const closeHelp = () => setIsHelpOpen(false); const temporaryQuickFunction = Boolean(temporaryState === quickFunctionsName); const temporaryStaticValue = Boolean(temporaryState === staticValueOperationName); @@ -596,12 +605,88 @@ export function DimensionEditor(props: DimensionEditorProps) { ...services, }; + const helpButton = ; + + const columnsSidebar = [ + { + field: 'function', + name: i18n.translate('xpack.lens.indexPattern.functionTable.functionHeader', { + defaultMessage: 'Function', + }), + width: '150px', + }, + { + field: 'description', + name: i18n.translate('xpack.lens.indexPattern.functionTable.descriptionHeader', { + defaultMessage: 'Description', + }), + }, + ]; + + const items = sideNavItems + .filter((item) => operationDefinitionMap[item.id!].quickFunctionDocumentation) + .map((item) => { + const operationDefinition = operationDefinitionMap[item.id!]!; + return { + id: item.id!, + function: operationDefinition.displayName, + description: operationDefinition.quickFunctionDocumentation!, + }; + }); + const quickFunctions = ( <> + + + + {i18n.translate('xpack.lens.indexPattern.quickFunctions.popoverTitle', { + defaultMessage: 'Quick functions', + })} + + + + + + + + {i18n.translate('xpack.lens.indexPattern.functionsLabel', { + defaultMessage: 'Functions', + })} + + + } fullWidth > !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 6156be3570031..3b468181db6df 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 8ea027a3da98f..232c96610f04c 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 2404d53b8f02a..64de29b0691c3 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 29f666a4ff6eb..6434af979028d 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 4bf33013b3280..6b1b052c90b14 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 20d0df1358be7..fb31c3c1a9a71 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/indexpattern_suggestions.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx index 860c272d9ee19..382c11bda545a 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.test.tsx @@ -1774,7 +1774,7 @@ describe('IndexPattern Data Source suggestions', () => { state: expect.objectContaining({ layers: { test: expect.objectContaining({ - columnOrder: ['column-id-3', 'column-id-2', 'column-id-1'], + columnOrder: ['column-id-2', 'column-id-3', 'column-id-1'], columns: { 'column-id-1': expect.objectContaining({ operationType: 'count', @@ -1804,10 +1804,10 @@ describe('IndexPattern Data Source suggestions', () => { isMultiRow: true, columns: [ expect.objectContaining({ - columnId: 'column-id-3', + columnId: 'column-id-2', }), expect.objectContaining({ - columnId: 'column-id-2', + columnId: 'column-id-3', }), expect.objectContaining({ columnId: 'column-id-1', diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts index fed70d2970b1e..8503c369f4ec2 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/indexpattern_suggestions.ts @@ -341,6 +341,7 @@ function createNewLayerWithMetricAggregationFromVizEditor( newLayer = insertNewColumn({ ...column, layer: newLayer, + respectOrder: true, }); } }); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/counter_rate.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/counter_rate.tsx index 674eac8194e41..f2c421946bafb 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/counter_rate.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/counter_rate.tsx @@ -151,5 +151,13 @@ Example: Visualize the rate of bytes received over time by a memcached server: `, }), }, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.counterRate.documentation.quick', + { + defaultMessage: ` + The rate of change over time for an ever growing time series metric. + `, + } + ), shiftable: true, }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/cumulative_sum.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/cumulative_sum.tsx index 11e1da98b0ca0..67260672fa66d 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/cumulative_sum.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/cumulative_sum.tsx @@ -147,5 +147,13 @@ Example: Visualize the received bytes accumulated over time: `, }), }, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.cumulativeSum.documentation.quick', + { + defaultMessage: ` + The sum of all values as they grow over time. + `, + } + ), shiftable: true, }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/differences.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/differences.tsx index 6873377bd437e..1d76667654cb3 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/differences.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/differences.tsx @@ -135,5 +135,13 @@ Example: Visualize the change in bytes received over time: `, }), }, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.differences.documentation.quick', + { + defaultMessage: ` + The change between the values in subsequent intervals. + `, + } + ), shiftable: true, }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx index 3876623b53611..0fbdd96153a0f 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/calculations/moving_average.tsx @@ -166,6 +166,14 @@ Example: Smooth a line of measurements: }, }), }, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.movingAverage.documentation.quick', + { + defaultMessage: ` + The average of a moving window of values over time. + `, + } + ), shiftable: true, }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx index b08fbf8f6c89a..04b11885c016e 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/cardinality.tsx @@ -218,4 +218,12 @@ Example: Calculate the number of different products from the "clothes" group: `, }), }, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.cardinality.documentation.quick', + { + defaultMessage: ` +The number of unique values for a specified number, string, date, or boolean field. + `, + } + ), }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx index 4c325e604f64c..b911ac5394a23 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/count.tsx @@ -248,5 +248,10 @@ To calculate the number of documents that match a specific filter, use \`count(k `, }), }, + quickFunctionDocumentation: i18n.translate('xpack.lens.indexPattern.count.documentation.quick', { + defaultMessage: ` +The total number of documents. When you provide a field, the total number of field values is counted. Use the count function for fields that have multiple values in a single document. + `, + }), shiftable: true, }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx index 52d7dff8d6ec7..8d6b201b2cc19 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/date_histogram.tsx @@ -515,6 +515,14 @@ export const dateHistogramOperation: OperationDefinition< ); }, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.dateHistogram.documentation.quick', + { + defaultMessage: ` +The date or date range values distributed into intervals. + `, + } + ), }; function parseInterval(currentInterval: string) { 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 299896e5ffe65..2b227674c26e9 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 da06ea8ae1bf4..434dbb092bdb0 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 @@ -158,6 +158,14 @@ export const filtersOperation: OperationDefinition< }, getMaxPossibleNumValues: (column) => column.params.filters.length, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.filters.documentation.quick', + { + defaultMessage: ` + Divides values into predefined subsets. + `, + } + ), }; export const FilterList = ({ @@ -227,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={ >({ hideZeroOption, aggConfigParams, documentationDescription, + quickFunctionDocumentation, }: { type: T['operationType']; displayName: string; @@ -71,6 +72,7 @@ function buildMetricOperation>({ hideZeroOption?: boolean; aggConfigParams?: Record; documentationDescription?: string; + quickFunctionDocumentation?: string; }) { const labelLookup = (name: string, column?: BaseIndexPatternColumn) => { const label = ofName(name); @@ -240,6 +242,7 @@ Example: Get the {metric} of price for orders from the UK: }, }), }, + quickFunctionDocumentation, shiftable: true, } as OperationDefinition; } @@ -265,6 +268,12 @@ export const minOperation = buildMetricOperation({ defaultMessage: 'A single-value metrics aggregation that returns the minimum value among the numeric values extracted from the aggregated documents.', }), + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.min.quickFunctionDescription', + { + defaultMessage: 'The minimum value of a number field.', + } + ), supportsDate: true, }); @@ -282,6 +291,12 @@ export const maxOperation = buildMetricOperation({ defaultMessage: 'A single-value metrics aggregation that returns the maximum value among the numeric values extracted from the aggregated documents.', }), + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.max.quickFunctionDescription', + { + defaultMessage: 'The maximum value of a number field.', + } + ), supportsDate: true, }); @@ -300,6 +315,12 @@ export const averageOperation = buildMetricOperation({ defaultMessage: 'A single-value metric aggregation that computes the average of numeric values that are extracted from the aggregated documents', }), + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.avg.quickFunctionDescription', + { + defaultMessage: 'The average value of a number field.', + } + ), }); export const standardDeviationOperation = buildMetricOperation( @@ -334,6 +355,13 @@ To get the variance of price for orders from the UK, use \`square(standard_devia `, } ), + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.standardDeviation.quickFunctionDescription', + { + defaultMessage: + 'The standard deviation of the values of a number field which is the amount of variation of the fields values.', + } + ), } ); @@ -354,6 +382,12 @@ export const sumOperation = buildMetricOperation({ 'A single-value metrics aggregation that sums up numeric values that are extracted from the aggregated documents.', }), hideZeroOption: true, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.sum.quickFunctionDescription', + { + defaultMessage: 'The total amount of the values of a number field.', + } + ), }); export const medianOperation = buildMetricOperation({ @@ -371,4 +405,10 @@ export const medianOperation = buildMetricOperation({ defaultMessage: 'A single-value metrics aggregation that computes the median value that are extracted from the aggregated documents.', }), + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.median.quickFunctionDescription', + { + defaultMessage: 'The median value of a number field.', + } + ), }); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.tsx index 3bc91b91ed3d6..ec4a3d569e7da 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile.tsx @@ -417,4 +417,12 @@ Example: Get the number of bytes larger than 95 % of values: `, }), }, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.percentile.documentation.quick', + { + defaultMessage: ` + The largest value that is smaller than n percent of the values that occur in all documents. + `, + } + ), }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.tsx index 7cb8d7ea64aea..45bd05f37372f 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/percentile_ranks.tsx @@ -266,4 +266,12 @@ Example: Get the percentage of values which are below of 100: `, }), }, + quickFunctionDocumentation: i18n.translate( + 'xpack.lens.indexPattern.percentileRanks.documentation.quick', + { + defaultMessage: ` +The percentage of values that are below a specific value. For example, when a value is greater than or equal to 95% of the calculated values, the value is the 95th percentile rank. + `, + } + ), }; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx index 9afd9311f026c..d3f5000646bc9 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/advanced_editor.tsx @@ -7,7 +7,7 @@ import './advanced_editor.scss'; -import React, { useState } from 'react'; +import React, { useState, useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, @@ -220,7 +220,7 @@ export const AdvancedRangeEditor = ({ [localRanges] ); - const addNewRange = () => { + 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 907a9f685215a..874559ae66c19 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/ranges/ranges.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.tsx index aa84c727ae507..52c9471aefe0e 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/ranges/ranges.tsx @@ -267,4 +267,9 @@ export const rangeOperation: OperationDefinition< /> ); }, + quickFunctionDocumentation: i18n.translate('xpack.lens.indexPattern.ranges.documentation.quick', { + defaultMessage: ` + Buckets values along defined numeric ranges. + `, + }), }; 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 f140fdb9807ac..d22fc5392f2cc 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/definitions/terms/index.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx index 9017e91bff089..1f4b4846906d4 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/terms/index.tsx @@ -557,6 +557,11 @@ export const termsOperation: OperationDefinition<
); }, + quickFunctionDocumentation: i18n.translate('xpack.lens.indexPattern.terms.documentation.quick', { + defaultMessage: ` +The top values of a specified field ranked by the chosen metric. + `, + }), paramEditor: function ParamEditor({ layer, paramEditorUpdater, 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 2df8300eb6481..1a77cd253424f 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/operations/layer_helpers.ts b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts index 2d8b41ce866b4..b3f1b3bc7d5f3 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts +++ b/x-pack/plugins/lens/public/indexpattern_datasource/operations/layer_helpers.ts @@ -68,6 +68,7 @@ interface ColumnChange { columnParams?: Record; initialParams?: { params: Record }; // TODO: bind this to the op parameter references?: Array>; + respectOrder?: boolean; } interface ColumnCopy { @@ -362,6 +363,7 @@ export function insertNewColumn({ columnParams, initialParams, references, + respectOrder, }: ColumnChange): IndexPatternLayer { const operationDefinition = operationDefinitionMap[op]; @@ -394,7 +396,14 @@ export function insertNewColumn({ : operationDefinition.buildColumn({ ...baseOptions, layer }); return updateDefaultLabels( - addOperationFn(layer, buildColumnFn, columnId, visualizationGroups, targetGroup), + addOperationFn( + layer, + buildColumnFn, + columnId, + visualizationGroups, + targetGroup, + respectOrder + ), indexPattern ); } @@ -445,7 +454,14 @@ export function insertNewColumn({ ) : operationDefinition.buildColumn({ ...baseOptions, layer: tempLayer, referenceIds }); return updateDefaultLabels( - addOperationFn(tempLayer, buildColumnFn, columnId, visualizationGroups, targetGroup), + addOperationFn( + tempLayer, + buildColumnFn, + columnId, + visualizationGroups, + targetGroup, + respectOrder + ), indexPattern ); } @@ -468,7 +484,8 @@ export function insertNewColumn({ operationDefinition.buildColumn({ ...baseOptions, layer, field: invalidField }), columnId, visualizationGroups, - targetGroup + targetGroup, + respectOrder ), indexPattern ); @@ -508,7 +525,7 @@ export function insertNewColumn({ const isBucketed = Boolean(possibleOperation.isBucketed); const addOperationFn = isBucketed ? addBucket : addMetric; return updateDefaultLabels( - addOperationFn(layer, newColumn, columnId, visualizationGroups, targetGroup), + addOperationFn(layer, newColumn, columnId, visualizationGroups, targetGroup, respectOrder), indexPattern ); } @@ -1154,7 +1171,8 @@ function addBucket( column: BaseIndexPatternColumn, addedColumnId: string, visualizationGroups: VisualizationDimensionGroupConfig[], - targetGroup?: string + targetGroup?: string, + respectOrder?: boolean ): IndexPatternLayer { const [buckets, metrics] = partition( layer.columnOrder, @@ -1166,7 +1184,7 @@ function addBucket( ); let updatedColumnOrder: string[] = []; - if (oldDateHistogramIndex > -1 && column.operationType === 'terms') { + if (oldDateHistogramIndex > -1 && column.operationType === 'terms' && !respectOrder) { // Insert the new terms bucket above the first date histogram updatedColumnOrder = [ ...buckets.slice(0, oldDateHistogramIndex), 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 e1fd78e0b1713..39b4bcdf49229 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/indexpattern_datasource/utils.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/utils.tsx index 2cb1ba164d572..77a359729a5e0 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/utils.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/utils.tsx @@ -194,7 +194,7 @@ export function getTSDBRollupWarningMessages( ).map((label) => i18n.translate('xpack.lens.indexPattern.tsdbRollupWarning', { defaultMessage: - '"{label}" does not work for all indices in the selected data view because it\'s using a function which is not supported on rolled up data. Please edit the visualization to use another function or change the time range.', + '{label} uses a function that is unsupported by rolled up data. Select a different function or change the time range.', values: { label, }, diff --git a/x-pack/plugins/lens/public/mocks/datasource_mock.ts b/x-pack/plugins/lens/public/mocks/datasource_mock.ts index 3d169b643c2ce..65d001a726b8c 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 aba0cbfc40a6e..2336495c9a316 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 720d8c85ca486..7d0893cdd54ee 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 0000000000000..bfae243dc1ac5 --- /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 0000000000000..eedcba3fee5ec --- /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 0000000000000..127471dc2cca5 --- /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 0000000000000..38b74ca7c83fb --- /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 0000000000000..fe08048e875c2 --- /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 3f30eb64ff2c9..a2fcc9c54882d 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 dc2425917bad8..5b942eff4a683 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 fc536b30ddac6..f83786238f628 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 725c60bfc22cb..38aee718a536f 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 c2238bfd9fef1..92a3ef01fdb7d 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 5a03500c76fbf..e9ab24b8392c6 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 2ea1692cf37c0..11b9612624efd 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 1cbd830a92fc2..bc511bb2b86ce 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 6c17d5206efb0..c4e41103f0fd1 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/trigger_actions/visualize_agg_based_vis_actions.ts b/x-pack/plugins/lens/public/trigger_actions/visualize_agg_based_vis_actions.ts index 2d2b329a7ea67..a5300d550f2c7 100644 --- a/x-pack/plugins/lens/public/trigger_actions/visualize_agg_based_vis_actions.ts +++ b/x-pack/plugins/lens/public/trigger_actions/visualize_agg_based_vis_actions.ts @@ -35,7 +35,7 @@ export const visualizeAggBasedVisAction = (application: ApplicationStart) => type: ACTION_CONVERT_TO_LENS, payload, originatingApp: i18n.translate('xpack.lens.AggBasedLabel', { - defaultMessage: 'Aggregation based visualization', + defaultMessage: 'aggregation based visualization', }), }, }); diff --git a/x-pack/plugins/lens/public/types.ts b/x-pack/plugins/lens/public/types.ts index af2dcc601c996..29aff3d428690 100644 --- a/x-pack/plugins/lens/public/types.ts +++ b/x-pack/plugins/lens/public/types.ts @@ -17,7 +17,7 @@ import type { IInterpreterRenderHandlers, Datatable, } from '@kbn/expressions-plugin/public'; -import type { NavigateToLensContext } from '@kbn/visualizations-plugin/common'; +import type { Configuration, NavigateToLensContext } from '@kbn/visualizations-plugin/common'; import { Adapters } from '@kbn/inspector-plugin/public'; import type { Query } from '@kbn/es-query'; import type { @@ -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 { @@ -217,25 +218,18 @@ export interface InitializationOptions { isFullEditor?: boolean; } -export type VisualizeEditorContext = { +export type VisualizeEditorContext = { savedObjectId?: string; embeddableId?: string; vizEditorOriginatingAppUrl?: string; originatingApp?: string; isVisualizeAction: boolean; -} & NavigateToLensContext; +} & NavigateToLensContext; 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' && @@ -704,7 +719,6 @@ export type VisualizationDimensionGroupConfig = SharedDimensionProps & { supportsMoreColumns: boolean; dimensionsTooMany?: number; /** If required, a warning will appear if accessors are empty */ - required?: boolean; requiredMinDimensionCount?: number; dataTestSubj?: string; prioritizedOperation?: string; @@ -893,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 */ @@ -962,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'; @@ -1023,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 @@ -1129,7 +1158,7 @@ export interface Visualization { getSuggestionFromConvertToLensContext?: ( props: VisualizationStateFromContextChangeProps - ) => Suggestion; + ) => Suggestion | undefined; } // Use same technique as TriggerContext diff --git a/x-pack/plugins/lens/public/utils.ts b/x-pack/plugins/lens/public/utils.ts index 8f25379c0e21e..c40403cfd0928 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/datatable/visualization.tsx b/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx index 72bf5812b7157..ca6f6775f8934 100644 --- a/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/visualization.tsx @@ -161,11 +161,19 @@ export const getDatatableVisualization = ({ }, }); + const changeType = table.changeType; + const changeFactor = + changeType === 'reduced' || changeType === 'layers' + ? 0.3 + : changeType === 'unchanged' + ? 0.5 + : 1; + return [ { title, // table with >= 10 columns will have a score of 0.4, fewer columns reduce score - score: (Math.min(table.columns.length, 10) / 10) * 0.4, + score: (Math.min(table.columns.length, 10) / 10) * 0.4 * changeFactor, state: { ...(state || {}), layerId: table.layerId, @@ -292,7 +300,7 @@ export const getDatatableVisualization = ({ }), supportsMoreColumns: true, filterOperations: (op) => !op.isBucketed, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsDatatable_metrics', enableDimensionEditor: true, }, diff --git a/x-pack/plugins/lens/public/visualizations/gauge/visualization.test.ts b/x-pack/plugins/lens/public/visualizations/gauge/visualization.test.ts index 94c9ce28987bf..e999cac9dd0e6 100644 --- a/x-pack/plugins/lens/public/visualizations/gauge/visualization.test.ts +++ b/x-pack/plugins/lens/public/visualizations/gauge/visualization.test.ts @@ -105,7 +105,7 @@ describe('gauge', () => { accessors: [{ columnId: 'metric-accessor', triggerIcon: 'none' }], filterOperations: isNumericDynamicMetric, supportsMoreColumns: false, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsGauge_metricDimensionPanel', enableDimensionEditor: true, enableFormatSelector: true, @@ -155,7 +155,7 @@ describe('gauge', () => { accessors: [{ columnId: 'goal-accessor' }], filterOperations: isNumericMetric, supportsMoreColumns: false, - required: false, + requiredMinDimensionCount: 0, dataTestSubj: 'lnsGauge_goalDimensionPanel', enableFormatSelector: false, supportStaticValue: true, @@ -187,7 +187,7 @@ describe('gauge', () => { accessors: [], filterOperations: isNumericDynamicMetric, supportsMoreColumns: true, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsGauge_metricDimensionPanel', enableDimensionEditor: true, enableFormatSelector: true, @@ -237,7 +237,7 @@ describe('gauge', () => { accessors: [], filterOperations: isNumericMetric, supportsMoreColumns: true, - required: false, + requiredMinDimensionCount: 0, dataTestSubj: 'lnsGauge_goalDimensionPanel', enableFormatSelector: false, supportStaticValue: true, @@ -275,7 +275,7 @@ describe('gauge', () => { accessors: [{ columnId: 'metric-accessor', triggerIcon: 'none' }], filterOperations: isNumericDynamicMetric, supportsMoreColumns: false, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsGauge_metricDimensionPanel', enableDimensionEditor: true, enableFormatSelector: true, @@ -325,7 +325,7 @@ describe('gauge', () => { accessors: [{ columnId: 'goal-accessor' }], filterOperations: isNumericMetric, supportsMoreColumns: false, - required: false, + requiredMinDimensionCount: 0, dataTestSubj: 'lnsGauge_goalDimensionPanel', enableFormatSelector: false, supportStaticValue: true, @@ -368,7 +368,7 @@ describe('gauge', () => { accessors: [{ columnId: 'metric-accessor', triggerIcon: 'none' }], filterOperations: isNumericDynamicMetric, supportsMoreColumns: false, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsGauge_metricDimensionPanel', enableDimensionEditor: true, enableFormatSelector: true, @@ -422,7 +422,7 @@ describe('gauge', () => { accessors: [{ columnId: 'goal-accessor' }], filterOperations: isNumericMetric, supportsMoreColumns: false, - required: false, + requiredMinDimensionCount: 0, dataTestSubj: 'lnsGauge_goalDimensionPanel', enableFormatSelector: false, supportStaticValue: true, diff --git a/x-pack/plugins/lens/public/visualizations/gauge/visualization.tsx b/x-pack/plugins/lens/public/visualizations/gauge/visualization.tsx index 37d10918d4129..19fd46459b2b7 100644 --- a/x-pack/plugins/lens/public/visualizations/gauge/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/gauge/visualization.tsx @@ -275,7 +275,7 @@ export const getGaugeVisualization = ({ : [], filterOperations: isNumericDynamicMetric, supportsMoreColumns: !metricAccessor, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsGauge_metricDimensionPanel', enableDimensionEditor: true, }, @@ -352,7 +352,7 @@ export const getGaugeVisualization = ({ accessors: state.goalAccessor ? [{ columnId: state.goalAccessor }] : [], filterOperations: isNumericMetric, supportsMoreColumns: !state.goalAccessor, - required: false, + requiredMinDimensionCount: 0, dataTestSubj: 'lnsGauge_goalDimensionPanel', }, ], diff --git a/x-pack/plugins/lens/public/visualizations/heatmap/visualization.test.ts b/x-pack/plugins/lens/public/visualizations/heatmap/visualization.test.ts index ee6a7030a0c9d..38cfa9bf10b54 100644 --- a/x-pack/plugins/lens/public/visualizations/heatmap/visualization.test.ts +++ b/x-pack/plugins/lens/public/visualizations/heatmap/visualization.test.ts @@ -136,7 +136,7 @@ describe('heatmap', () => { accessors: [{ columnId: 'x-accessor' }], filterOperations: filterOperationsAxis, supportsMoreColumns: false, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsHeatmap_xDimensionPanel', }, { @@ -146,7 +146,7 @@ describe('heatmap', () => { accessors: [{ columnId: 'y-accessor' }], filterOperations: filterOperationsAxis, supportsMoreColumns: false, - required: false, + requiredMinDimensionCount: 0, dataTestSubj: 'lnsHeatmap_yDimensionPanel', }, { @@ -165,7 +165,7 @@ describe('heatmap', () => { ], filterOperations: isCellValueSupported, supportsMoreColumns: false, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsHeatmap_cellPanel', enableDimensionEditor: true, }, @@ -194,7 +194,7 @@ describe('heatmap', () => { accessors: [{ columnId: 'x-accessor' }], filterOperations: filterOperationsAxis, supportsMoreColumns: false, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsHeatmap_xDimensionPanel', }, { @@ -204,7 +204,7 @@ describe('heatmap', () => { accessors: [], filterOperations: filterOperationsAxis, supportsMoreColumns: true, - required: false, + requiredMinDimensionCount: 0, dataTestSubj: 'lnsHeatmap_yDimensionPanel', }, { @@ -217,7 +217,7 @@ describe('heatmap', () => { accessors: [], filterOperations: isCellValueSupported, supportsMoreColumns: true, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsHeatmap_cellPanel', enableDimensionEditor: true, }, @@ -250,7 +250,7 @@ describe('heatmap', () => { accessors: [{ columnId: 'x-accessor' }], filterOperations: filterOperationsAxis, supportsMoreColumns: false, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsHeatmap_xDimensionPanel', }, { @@ -260,7 +260,7 @@ describe('heatmap', () => { accessors: [{ columnId: 'y-accessor' }], filterOperations: filterOperationsAxis, supportsMoreColumns: false, - required: false, + requiredMinDimensionCount: 0, dataTestSubj: 'lnsHeatmap_yDimensionPanel', }, { @@ -278,7 +278,7 @@ describe('heatmap', () => { ], filterOperations: isCellValueSupported, supportsMoreColumns: false, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsHeatmap_cellPanel', enableDimensionEditor: true, }, diff --git a/x-pack/plugins/lens/public/visualizations/heatmap/visualization.tsx b/x-pack/plugins/lens/public/visualizations/heatmap/visualization.tsx index 09548df0a67e4..1fc48b4d71c3e 100644 --- a/x-pack/plugins/lens/public/visualizations/heatmap/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/heatmap/visualization.tsx @@ -181,7 +181,7 @@ export const getHeatmapVisualization = ({ accessors: state.xAccessor ? [{ columnId: state.xAccessor }] : [], filterOperations: filterOperationsAxis, supportsMoreColumns: !state.xAccessor, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsHeatmap_xDimensionPanel', }, { @@ -191,7 +191,7 @@ export const getHeatmapVisualization = ({ accessors: state.yAccessor ? [{ columnId: state.yAccessor }] : [], filterOperations: filterOperationsAxis, supportsMoreColumns: !state.yAccessor, - required: false, + requiredMinDimensionCount: 0, dataTestSubj: 'lnsHeatmap_yDimensionPanel', }, { @@ -224,7 +224,7 @@ export const getHeatmapVisualization = ({ filterOperations: isCellValueSupported, supportsMoreColumns: !state.valueAccessor, enableDimensionEditor: true, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsHeatmap_cellPanel', }, ], diff --git a/x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.tsx index f1b1ffd1f00b4..02a4cd23ad4f8 100644 --- a/x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/visualization.tsx @@ -258,7 +258,7 @@ export const getLegacyMetricVisualization = ({ filterOperations: (op: OperationMetadata) => !op.isBucketed && legacyMetricSupportedTypes.has(op.dataType), enableDimensionEditor: true, - required: true, + requiredMinDimensionCount: 1, }, ], }; diff --git a/x-pack/plugins/lens/public/visualizations/metric/__snapshots__/visualization.test.ts.snap b/x-pack/plugins/lens/public/visualizations/metric/__snapshots__/visualization.test.ts.snap index 8c565cbed53be..7d1df68158266 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/__snapshots__/visualization.test.ts.snap +++ b/x-pack/plugins/lens/public/visualizations/metric/__snapshots__/visualization.test.ts.snap @@ -24,7 +24,7 @@ Object { "paramEditorCustomProps": Object { "headingLabel": "Value", }, - "required": true, + "requiredMinDimensionCount": 1, "supportsMoreColumns": false, }, Object { @@ -46,7 +46,7 @@ Object { "paramEditorCustomProps": Object { "headingLabel": "Value", }, - "required": false, + "requiredMinDimensionCount": 0, "supportsMoreColumns": false, }, Object { @@ -70,7 +70,7 @@ Object { "headingLabel": "Value", }, "prioritizedOperation": "max", - "required": false, + "requiredMinDimensionCount": 0, "supportStaticValue": true, "supportsMoreColumns": false, }, @@ -91,7 +91,7 @@ Object { "groupId": "breakdownBy", "groupLabel": "Break down by", "layerId": "first", - "required": false, + "requiredMinDimensionCount": 0, "supportsMoreColumns": false, }, ], diff --git a/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx b/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx index b58068b3ec202..81f7f08fe3223 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx @@ -315,7 +315,7 @@ export const getMetricVisualization = ({ enableDimensionEditor: true, enableFormatSelector: true, formatSelectorOptions: formatterOptions, - required: true, + requiredMinDimensionCount: 1, }, { groupId: GROUP_ID.SECONDARY_METRIC, @@ -341,7 +341,7 @@ export const getMetricVisualization = ({ enableDimensionEditor: true, enableFormatSelector: true, formatSelectorOptions: formatterOptions, - required: false, + requiredMinDimensionCount: 0, }, { groupId: GROUP_ID.MAX, @@ -367,7 +367,7 @@ export const getMetricVisualization = ({ formatSelectorOptions: formatterOptions, supportStaticValue: true, prioritizedOperation: 'max', - required: false, + requiredMinDimensionCount: 0, groupTooltip: i18n.translate('xpack.lens.metric.maxTooltip', { defaultMessage: 'If the maximum value is specified, the minimum value is fixed at zero.', @@ -393,7 +393,7 @@ export const getMetricVisualization = ({ enableDimensionEditor: true, enableFormatSelector: true, formatSelectorOptions: formatterOptions, - required: false, + requiredMinDimensionCount: 0, }, ], }; diff --git a/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts b/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts index eea673dc531d3..dc0ce54b5bc09 100644 --- a/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts @@ -93,7 +93,7 @@ describe('suggestions', () => { ).toHaveLength(0); }); - it('should reject date operations', () => { + it('should hide date operations', () => { expect( suggestions({ table: { @@ -118,11 +118,17 @@ describe('suggestions', () => { }, state: undefined, keptLayerIds: ['first'], - }) - ).toHaveLength(0); + }).map((s) => [s.hide, s.score]) + ).toEqual([ + [true, 0], + [true, 0], + [true, 0], + [true, 0], + [true, 0], + ]); }); - it('should reject histogram operations', () => { + it('should hide histogram operations', () => { expect( suggestions({ table: { @@ -147,8 +153,14 @@ describe('suggestions', () => { }, state: undefined, keptLayerIds: ['first'], - }) - ).toHaveLength(0); + }).map((s) => [s.hide, s.score]) + ).toEqual([ + [true, 0], + [true, 0], + [true, 0], + [true, 0], + [true, 0], + ]); }); it('should not reject histogram operations in case of switching between partition charts', () => { diff --git a/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts b/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts index 36e367ca3ad6f..9f2d0920983ad 100644 --- a/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts @@ -29,15 +29,10 @@ function hasIntervalScale(columns: TableSuggestionColumn[]) { } function shouldReject({ table, keptLayerIds, state }: SuggestionRequest) { - // Histograms are not good for pi. But we should not reject them on switching between partition charts. - const shouldRejectIntervals = - state?.shape && isPartitionShape(state.shape) ? false : hasIntervalScale(table.columns); - return ( keptLayerIds.length > 1 || (keptLayerIds.length && table.layerId !== keptLayerIds[0]) || table.changeType === 'reorder' || - shouldRejectIntervals || table.columns.some((col) => col.operation.isStaticValue) ); } @@ -111,6 +106,10 @@ export function suggestions({ const results: Array> = []; + // Histograms are not good for pi. But we should not hide suggestion on switching between partition charts. + const shouldHideSuggestion = + state?.shape && isPartitionShape(state.shape) ? false : hasIntervalScale(table.columns); + if ( groups.length <= PartitionChartsMeta.pie.maxBuckets && !hasCustomSuggestionsExists(subVisualizationId) @@ -309,11 +308,11 @@ export function suggestions({ return [...results] .map((suggestion) => ({ ...suggestion, - score: suggestion.score + 0.05 * groups.length, + score: shouldHideSuggestion ? 0 : suggestion.score + 0.05 * groups.length, })) .sort((a, b) => b.score - a.score) .map((suggestion) => ({ ...suggestion, - hide: incompleteConfiguration || suggestion.hide, + hide: shouldHideSuggestion || incompleteConfiguration || suggestion.hide, })); } diff --git a/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx b/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx index 6a58d46b34caa..2a8bdc2dd4ab0 100644 --- a/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx @@ -14,11 +14,14 @@ import { ThemeServiceStart } from '@kbn/core/public'; import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public'; import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public'; import { EuiSpacer } from '@elastic/eui'; +import { PartitionVisConfiguration } from '@kbn/visualizations-plugin/common/convert_to_lens'; import type { Visualization, OperationMetadata, AccessorConfig, VisualizationDimensionGroupConfig, + Suggestion, + VisualizeEditorContext, } from '../../types'; import { getSortedGroups, toExpression, toPreviewExpression } from './to_expression'; import { CategoryDisplay, layerTypes, LegendDisplay, NumberDisplay } from '../../../common'; @@ -27,6 +30,17 @@ import { PartitionChartsMeta } from './partition_charts_meta'; import { DimensionEditor, PieToolbar } from './toolbar'; import { checkTableForContainsSmallValues } from './render_helpers'; import { PieChartTypes, PieLayerState, PieVisualizationState } from '../../../common'; +import { IndexPatternLayer } from '../..'; + +interface DatatableDatasourceState { + [prop: string]: unknown; + layers: IndexPatternLayer[]; +} + +export interface PartitionSuggestion extends Suggestion { + datasourceState: DatatableDatasourceState; + visualizationState: PieVisualizationState; +} function newLayerState(layerId: string): PieLayerState { return { @@ -42,6 +56,12 @@ function newLayerState(layerId: string): PieLayerState { }; } +function isPartitionVisConfiguration( + context: VisualizeEditorContext +): context is VisualizeEditorContext { + return context.type === 'lnsPie'; +} + const bucketedOperations = (op: OperationMetadata) => op.isBucketed; const numberMetricOperations = (op: OperationMetadata) => !op.isBucketed && op.dataType === 'number' && !op.isStaticValue; @@ -148,7 +168,7 @@ export const getPieVisualization = ({ } const primaryGroupConfigBaseProps = { - required: true, + requiredMinDimensionCount: 1, groupId: 'primaryGroups', accessors, enableDimensionEditor: true, @@ -264,7 +284,7 @@ export const getPieVisualization = ({ accessors: layer.metric ? [{ columnId: layer.metric }] : [], supportsMoreColumns: !layer.metric, filterOperations: numberMetricOperations, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsPie_sizeByDimensionPanel', }); @@ -422,6 +442,29 @@ export const getPieVisualization = ({ return warningMessages; }, + getSuggestionFromConvertToLensContext(props) { + const context = props.context; + if (!isPartitionVisConfiguration(context)) { + return; + } + if (!props.suggestions.length) { + return; + } + const suggestionByShape = (props.suggestions as PartitionSuggestion[]).find( + (suggestion) => suggestion.visualizationState.shape === context.configuration.shape + ); + if (!suggestionByShape) { + return; + } + return { + ...suggestionByShape, + visualizationState: { + ...suggestionByShape.visualizationState, + ...context.configuration, + }, + }; + }, + getErrorMessages(state) { const hasTooManyBucketDimensions = state.layers .map( 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 0000000000000..d7d3c9ca8a56a --- /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 34aff26582771..990d0dd8f94d0 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) { @@ -414,7 +496,7 @@ export const getAnnotationsConfiguration = ({ invalidMessage: i18n.translate('xpack.lens.xyChart.addAnnotationsLayerLabelDisabledHelp', { defaultMessage: 'Annotations require a time based chart to work. Add a date histogram.', }), - required: false, + requiredMinDimensionCount: 0, supportsMoreColumns: true, supportFieldFormat: false, enableDimensionEditor: true, diff --git a/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx b/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx index 362b63c46eb2d..84f0a35d3b95e 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx @@ -461,7 +461,7 @@ export const getReferenceConfiguration = ({ accessors: config.map(({ forAccessor, color }) => getSingleColorConfig(forAccessor, color)), filterOperations: isNumericMetric, supportsMoreColumns: true, - required: false, + requiredMinDimensionCount: 0, enableDimensionEditor: true, supportStaticValue: true, paramEditorCustomProps: { 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 345e8ffcb5b19..bf75018f111ee 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 818df64fba94f..e76633b349924 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, - }, - ]); + ]); + }); }); }); }); @@ -1047,7 +1392,7 @@ describe('xy_visualization', () => { frame, layerId: 'first', }).groups; - expect(splitGroup.required).toBe(true); + expect(splitGroup.requiredMinDimensionCount).toBe(1); }); test.each([ @@ -1087,7 +1432,7 @@ describe('xy_visualization', () => { frame, layerId: 'first', }).groups; - expect(splitGroup.required).toBe(false); + expect(splitGroup.requiredMinDimensionCount).toBe(0); } ); @@ -1236,7 +1581,7 @@ describe('xy_visualization', () => { frame, layerId: 'first', }).groups; - expect(splitGroup.required).toBe(true); + expect(splitGroup.requiredMinDimensionCount).toBe(1); } ); }); @@ -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 61bdd4151219c..c013f0cd1d079 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]; @@ -276,10 +292,6 @@ export const getXyVisualization = ({ accessors: sortedAccessors, }); - if (isReferenceLayer(layer)) { - return getReferenceConfiguration({ state, frame, layer, sortedAccessors }); - } - const dataLayer: XYDataLayerConfig = layer; const dataLayers = getDataLayers(state.layers); @@ -332,7 +344,7 @@ export const getXyVisualization = ({ accessors: mappedAccessors, filterOperations: isNumericDynamicMetric, supportsMoreColumns: true, - required: true, + requiredMinDimensionCount: 1, dataTestSubj: 'lnsXY_yDimensionPanel', enableDimensionEditor: true, }, @@ -357,7 +369,8 @@ export const getXyVisualization = ({ filterOperations: isBucketed, supportsMoreColumns: !dataLayer.splitAccessor, dataTestSubj: 'lnsXY_splitDimensionPanel', - required: dataLayer.seriesType.includes('percentage') && hasOnlyOneAccessor, + requiredMinDimensionCount: + dataLayer.seriesType.includes('percentage') && hasOnlyOneAccessor ? 1 : 0, enableDimensionEditor: true, }, ], @@ -369,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 @@ -727,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 a6e1cd6b2ac34..480c0773f4520 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 2ca0f9530bbe1..89fbdfd38fcf1 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 2b59be0b044f9..93bf0e2c72662 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 c44f76427e0a7..20a99e8458fc0 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/lens/public/visualizations/xy/xy_suggestions.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_suggestions.ts index 1184712ae033a..b63bfeb5fbd9b 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_suggestions.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_suggestions.ts @@ -615,7 +615,12 @@ function getScore( changeType: TableChangeType ) { // Unchanged table suggestions half the score because the underlying data doesn't change - const changeFactor = changeType === 'unchanged' ? 0.5 : 1; + const changeFactor = + changeType === 'reduced' || changeType === 'layers' + ? 0.3 + : changeType === 'unchanged' + ? 0.5 + : 1; // chart with multiple y values and split series will have a score of 1, single y value and no split series reduce score return (((yValues.length > 1 ? 2 : 1) + (splitBy ? 1 : 0)) / 3) * changeFactor; } 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 963a12e9f7374..c42b338032f05 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 fc471375e1d30..cc13b70d01060 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 db0b5359ca56e..19a7ec2941102 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 0000000000000..53f1b75003ea3 --- /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 05207acf7329a..d18a00df34f07 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 b884785d348aa..a1c1c60d75561 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 01f77e4a45c38..c2c5e6404c8f0 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 8adb3f8f927ab..6ee55bd72e49d 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 2a8ce6e04144c..9cfa17fe71941 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 899006b5918dd..3f70e0c58324d 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 8d5958c2f5574..1014b4e3a08b3 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 0000000000000..20b52a773d032 --- /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 0000000000000..08ff962449d2d --- /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 aa6c80ee5b92d..6ad828bc39661 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/full_time_range_selector/full_time_range_selector.test.tsx b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx index 0d20267f33ecb..7566d3664af61 100644 --- a/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx +++ b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.test.tsx @@ -20,7 +20,7 @@ jest.mock('./full_time_range_selector_service', () => ({ mockSetFullTimeRange(indexPattern, query), })); -jest.mock('../../contexts/ml/use_storage', () => { +jest.mock('../../contexts/storage', () => { return { useStorage: jest.fn(() => 'exclude-frozen'), }; diff --git a/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx index 06bb873971ba0..9b9154eb33660 100644 --- a/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx +++ b/x-pack/plugins/ml/public/application/components/full_time_range_selector/full_time_range_selector.tsx @@ -23,7 +23,7 @@ import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/type import { i18n } from '@kbn/i18n'; import type { DataView } from '@kbn/data-views-plugin/public'; import { setFullTimeRange } from './full_time_range_selector_service'; -import { useStorage } from '../../contexts/ml/use_storage'; +import { useStorage } from '../../contexts/storage'; import { ML_FROZEN_TIER_PREFERENCE } from '../../../../common/types/storage'; import { GetTimeFieldRangeResponse } from '../../services/ml_api_service'; diff --git a/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx b/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx index 79d33ef9cd2ab..16fbc81b23f12 100644 --- a/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx +++ b/x-pack/plugins/ml/public/application/components/job_selector/job_selector.tsx @@ -28,7 +28,7 @@ import { JobSelectorFlyoutProps, } from './job_selector_flyout'; import { MlJobWithTimeRange } from '../../../../common/types/anomaly_detection_jobs'; -import { useStorage } from '../../contexts/ml/use_storage'; +import { useStorage } from '../../contexts/storage'; import { ML_APPLY_TIME_RANGE_CONFIG } from '../../../../common/types/storage'; interface GroupObj { 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 20d771f5654d4..2d95f0c971696 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,51 +15,13 @@ import { EuiNotificationBadge, EuiToolTip, } from '@elastic/eui'; -import { combineLatest, of, timer } from 'rxjs'; -import { catchError, filter, switchMap } from 'rxjs/operators'; -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 { FIELD_FORMAT_IDS } from '@kbn/field-formats-plugin/common'; +import { useFieldFormatter } from '../../contexts/kibana/use_field_formatter'; +import { useMlNotifications } from '../../contexts/ml/ml_notifications_context'; export const NotificationsIndicator: FC = () => { - const { - services: { - mlServices: { mlApiServices }, - }, - } = useMlKibana(); - const [lastCheckedAt] = useStorage(ML_NOTIFICATIONS_LAST_CHECKED_AT); - - const lastCheckedAt$ = useAsObservable(lastCheckedAt); - - const [notificationsCounts, setNotificationsCounts] = useState(); - - useEffect(function startPollingNotifications() { - const subscription = combineLatest([ - lastCheckedAt$.pipe(filter((v): v is number => !!v)), - timer(0, NOTIFICATIONS_CHECK_INTERVAL), - ]) - .pipe( - switchMap(([lastChecked]) => - mlApiServices.notifications.countMessages$({ lastCheckedAt: lastChecked }) - ), - 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 { notificationsCounts, latestRequestedAt } = useMlNotifications(); + const dateFormatter = useFieldFormatter(FIELD_FORMAT_IDS.DATE); const errorsAndWarningCount = (notificationsCounts?.error ?? 0) + (notificationsCounts?.warning ?? 0); @@ -80,12 +42,22 @@ export const NotificationsIndicator: FC = () => { content={ } > - {errorsAndWarningCount} + + {errorsAndWarningCount} + ) : null} @@ -96,7 +68,8 @@ export const NotificationsIndicator: FC = () => { content={ } > @@ -106,6 +79,7 @@ export const NotificationsIndicator: FC = () => { aria-label={i18n.translate('xpack.ml.notificationsIndicator.unreadIcon', { defaultMessage: 'Unread notifications indicator.', })} + data-test-subj={'mlNotificationsIndicator'} /> 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 5f263b51364e0..536cc26888a98 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 75cb787abadc4..75c503a139499 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 0000000000000..4076966942cd8 --- /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 0000000000000..fef04e9366671 --- /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/ml/use_storage.ts b/x-pack/plugins/ml/public/application/contexts/ml/use_storage.ts deleted file mode 100644 index 761434a7bb3b4..0000000000000 --- a/x-pack/plugins/ml/public/application/contexts/ml/use_storage.ts +++ /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 { useCallback, useState } from 'react'; -import { isDefined } from '../../../../common/types/guards'; -import { useMlKibana } from '../kibana'; -import type { MlStorageKey } from '../../../../common/types/storage'; -import { TMlStorageMapped } from '../../../../common/types/storage'; - -/** - * Hook for accessing and changing a value in the storage. - * @param key - Storage key - * @param initValue - */ -export function useStorage>( - key: K, - initValue?: T -): [ - typeof initValue extends undefined - ? TMlStorageMapped - : Exclude, undefined>, - (value: TMlStorageMapped) => void -] { - const { - services: { storage }, - } = useMlKibana(); - - const [val, setVal] = useState(storage.get(key) ?? initValue); - - const setStorage = useCallback((value: TMlStorageMapped): void => { - try { - if (isDefined(value)) { - storage.set(key, value); - setVal(value); - } else { - storage.remove(key); - setVal(initValue); - } - } catch (e) { - throw new Error('Unable to update storage with provided value'); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - return [val, setStorage]; -} diff --git a/x-pack/plugins/ml/public/application/contexts/storage/storage_context.test.tsx b/x-pack/plugins/ml/public/application/contexts/storage/storage_context.test.tsx new file mode 100644 index 0000000000000..6aeeb396f38c3 --- /dev/null +++ b/x-pack/plugins/ml/public/application/contexts/storage/storage_context.test.tsx @@ -0,0 +1,144 @@ +/* + * 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 { MlStorageContextProvider, useStorage } from './storage_context'; +import { MlStorageKey } from '../../../../common/types/storage'; + +const mockSet = jest.fn(); +const mockRemove = jest.fn(); + +jest.mock('../kibana', () => ({ + useMlKibana: () => { + return { + services: { + storage: { + set: mockSet, + get: jest.fn((key: MlStorageKey) => { + switch (key) { + case 'ml.gettingStarted.isDismissed': + return true; + default: + return; + } + }), + remove: mockRemove, + }, + }, + }; + }, +})); + +describe('useStorage', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + + test('returns the default value', () => { + const { result } = renderHook(() => useStorage('ml.jobSelectorFlyout.applyTimeRange', true), { + wrapper: MlStorageContextProvider, + }); + + expect(result.current[0]).toBe(true); + }); + + test('returns the value from storage', () => { + const { result } = renderHook(() => useStorage('ml.gettingStarted.isDismissed', false), { + wrapper: MlStorageContextProvider, + }); + + expect(result.current[0]).toBe(true); + }); + + test('updates the storage value', async () => { + const { result, waitForNextUpdate } = renderHook( + () => useStorage('ml.gettingStarted.isDismissed'), + { + wrapper: MlStorageContextProvider, + } + ); + + const [value, setValue] = result.current; + + expect(value).toBe(true); + + await act(async () => { + setValue(false); + await waitForNextUpdate(); + }); + + expect(result.current[0]).toBe(false); + expect(mockSet).toHaveBeenCalledWith('ml.gettingStarted.isDismissed', false); + }); + + test('removes the storage value', async () => { + const { result, waitForNextUpdate } = renderHook( + () => useStorage('ml.gettingStarted.isDismissed'), + { + wrapper: MlStorageContextProvider, + } + ); + + const [value, setValue] = result.current; + + expect(value).toBe(true); + + await act(async () => { + setValue(undefined); + await waitForNextUpdate(); + }); + + expect(result.current[0]).toBe(undefined); + expect(mockRemove).toHaveBeenCalledWith('ml.gettingStarted.isDismissed'); + }); + + test('updates the value on storage event', async () => { + const { result, waitForNextUpdate } = renderHook( + () => useStorage('ml.gettingStarted.isDismissed'), + { + wrapper: MlStorageContextProvider, + } + ); + + expect(result.current[0]).toBe(true); + + await act(async () => { + window.dispatchEvent( + new StorageEvent('storage', { + key: 'test_key', + newValue: 'test_value', + }) + ); + }); + + expect(result.current[0]).toBe(true); + + await act(async () => { + window.dispatchEvent( + new StorageEvent('storage', { + key: 'ml.gettingStarted.isDismissed', + newValue: null, + }) + ); + await waitForNextUpdate(); + }); + + expect(result.current[0]).toBe(undefined); + + await act(async () => { + window.dispatchEvent( + new StorageEvent('storage', { + key: 'ml.gettingStarted.isDismissed', + newValue: 'false', + }) + ); + await waitForNextUpdate(); + }); + + expect(result.current[0]).toBe(false); + }); +}); 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 ccd46c446ed2c..65e2a64ee3181 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() { @@ -69,7 +70,8 @@ export const MlStorageContextProvider: FC = ({ children }) => { setState((prev) => { return { ...prev, - [event.key as MlStorageKey]: event.newValue, + [event.key as MlStorageKey]: + typeof event.newValue === 'string' ? JSON.parse(event.newValue) : event.newValue, }; }); } else { @@ -106,21 +108,32 @@ export const MlStorageContextProvider: FC = ({ children }) => { * @param key * @param initValue */ -export function useStorage( +export function useStorage>( key: K, - initValue?: TMlStorageMapped -): [TMlStorageMapped | undefined, (value: TMlStorageMapped) => void] { - const { value, setValue } = useContext(MlStorageContext); + initValue?: T +): [ + typeof initValue extends undefined + ? TMlStorageMapped | undefined + : Exclude, undefined>, + (value: TMlStorageMapped) => void +] { + const { value, setValue, removeValue } = useContext(MlStorageContext); const resultValue = useMemo(() => { - return (value?.[key] ?? initValue) as TMlStorageMapped; + return (value?.[key] ?? initValue) as typeof initValue extends undefined + ? TMlStorageMapped | undefined + : Exclude, undefined>; }, [value, key, initValue]); const setVal = useCallback( (v: TMlStorageMapped) => { - setValue(key, v); + if (isDefined(v)) { + setValue(key, v); + } else { + removeValue(key); + } }, - [setValue, key] + [setValue, removeValue, key] ); return [resultValue, setVal]; diff --git a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/add_swimlane_to_dashboard_controls.tsx b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/add_swimlane_to_dashboard_controls.tsx index 7f109defdff79..93fa7e908f35a 100644 --- a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/add_swimlane_to_dashboard_controls.tsx +++ b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/add_swimlane_to_dashboard_controls.tsx @@ -15,7 +15,7 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; -import { DashboardSavedObject } from '@kbn/dashboard-plugin/public'; +import { DashboardAttributes } from '@kbn/dashboard-plugin/common'; import type { Query } from '@kbn/es-query'; import { SEARCH_QUERY_LANGUAGE } from '../../../../common/constants/search'; import { getDefaultSwimlanePanelTitle } from '../../../embeddables/anomaly_swimlane/anomaly_swimlane_embeddable'; @@ -30,7 +30,7 @@ export interface DashboardItem { id: string; title: string; description: string | undefined; - attributes: DashboardSavedObject; + attributes: DashboardAttributes; } export type EuiTableProps = EuiInMemoryTableProps; diff --git a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_dashboards_table.tsx b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_dashboards_table.tsx index ac023017d43f5..8bb7705938d84 100644 --- a/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_dashboards_table.tsx +++ b/x-pack/plugins/ml/public/application/explorer/dashboard_controls/use_dashboards_table.tsx @@ -8,7 +8,7 @@ import type { EuiInMemoryTableProps } from '@elastic/eui'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { debounce } from 'lodash'; -import type { DashboardSavedObject } from '@kbn/dashboard-plugin/public'; +import type { DashboardAttributes } from '@kbn/dashboard-plugin/common'; import { useDashboardService } from '../../services/dashboard_service'; import { useMlKibana } from '../../contexts/kibana'; @@ -16,7 +16,7 @@ export interface DashboardItem { id: string; title: string; description: string | undefined; - attributes: DashboardSavedObject; + attributes: DashboardAttributes; } export type EuiTableProps = EuiInMemoryTableProps; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer.tsx b/x-pack/plugins/ml/public/application/explorer/explorer.tsx index b9feffb1ec116..5fcab05f068b8 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer.tsx +++ b/x-pack/plugins/ml/public/application/explorer/explorer.tsx @@ -78,7 +78,7 @@ import { useMlKibana, useMlLocator } from '../contexts/kibana'; import { useMlContext } from '../contexts/ml'; import { useAnomalyExplorerContext } from './anomaly_explorer_context'; import { ML_ANOMALY_EXPLORER_PANELS } from '../../../common/types/storage'; -import { useStorage } from '../contexts/ml/use_storage'; +import { useStorage } from '../contexts/storage'; interface ExplorerPageProps { jobSelectorProps: JobSelectorProps; 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 1824d8e91e740..9c2fa8383b7a5 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 811b1c43bce37..cd68f366b57a6 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(); @@ -162,6 +162,7 @@ export const NotificationsList: FC = () => { const columns: Array> = [ { + id: 'timestamp', field: 'timestamp', name: , sortable: true, @@ -175,7 +176,7 @@ export const NotificationsList: FC = () => { name: , sortable: true, truncateText: false, - 'data-test-subj': 'mlNotificationLabel', + 'data-test-subj': 'mlNotificationLevel', render: (value: MlNotificationMessageLevel) => { return {value}; }, @@ -194,7 +195,7 @@ export const NotificationsList: FC = () => { }, { field: 'job_id', - name: , + name: , sortable: true, truncateText: false, 'data-test-subj': 'mlNotificationEntity', @@ -279,10 +280,29 @@ export const NotificationsList: FC = () => { ]; }, []); + const newNotificationsCount = Object.values(notificationsCounts).reduce((a, b) => a + b); + return ( <> + {newNotificationsCount ? ( + <> + + } + iconType="bell" + /> + + + ) : null} + { }, }, }, + 'data-test-subj': 'mlNotificationsSearchBarInput', }} filters={filters} onChange={(e) => { diff --git a/x-pack/plugins/ml/public/application/overview/components/getting_started_callout.tsx b/x-pack/plugins/ml/public/application/overview/components/getting_started_callout.tsx index 457bca80ee2c0..7b1f380c90658 100644 --- a/x-pack/plugins/ml/public/application/overview/components/getting_started_callout.tsx +++ b/x-pack/plugins/ml/public/application/overview/components/getting_started_callout.tsx @@ -9,7 +9,7 @@ import React, { FC } from 'react'; import { EuiButton, EuiCallOut, EuiLink, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { useMlKibana } from '../../contexts/kibana'; -import { useStorage } from '../../contexts/ml/use_storage'; +import { useStorage } from '../../contexts/storage'; import { ML_GETTING_STARTED_CALLOUT_DISMISSED } from '../../../../common/types/storage'; const feedbackLink = 'https://www.elastic.co/community/'; diff --git a/x-pack/plugins/ml/public/application/routing/router.tsx b/x-pack/plugins/ml/public/application/routing/router.tsx index c1036b8d007fa..8807de5b0f173 100644 --- a/x-pack/plugins/ml/public/application/routing/router.tsx +++ b/x-pack/plugins/ml/public/application/routing/router.tsx @@ -18,7 +18,7 @@ import type { import type { DataViewsContract } from '@kbn/data-views-plugin/public'; import { EuiLoadingContent } from '@elastic/eui'; -import { MlStorageContextProvider } from '../contexts/storage'; +import { MlNotificationsContextProvider } from '../contexts/ml/ml_notifications_context'; import { MlContext, MlContextValue } from '../contexts/ml'; import { UrlStateProvider } from '../util/url_state'; @@ -105,11 +105,11 @@ export const MlRouter: FC<{ }> = ({ pageDeps }) => ( - - + + - - + + ); diff --git a/x-pack/plugins/ml/public/application/services/dashboard_service.ts b/x-pack/plugins/ml/public/application/services/dashboard_service.ts index ff7b696551f41..abd97722f86bc 100644 --- a/x-pack/plugins/ml/public/application/services/dashboard_service.ts +++ b/x-pack/plugins/ml/public/application/services/dashboard_service.ts @@ -7,7 +7,8 @@ import { SavedObjectsClientContract } from '@kbn/core/public'; import { useMemo } from 'react'; -import { DashboardSavedObject, DashboardAppLocator } from '@kbn/dashboard-plugin/public'; +import { DashboardAppLocator } from '@kbn/dashboard-plugin/public'; +import type { DashboardAttributes } from '@kbn/dashboard-plugin/common'; import { ViewMode } from '@kbn/embeddable-plugin/public'; import { useMlKibana } from '../contexts/kibana'; @@ -22,7 +23,7 @@ export function dashboardServiceProvider( * Fetches dashboards */ async fetchDashboards(query?: string) { - return await savedObjectClient.find({ + return await savedObjectClient.find({ type: 'dashboard', perPage: 1000, search: query ? `${query}*` : '', diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/series_controls/series_controls.tsx b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/series_controls/series_controls.tsx index 0df10505e73cc..23084c8d8886d 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/series_controls/series_controls.tsx +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/series_controls/series_controls.tsx @@ -26,7 +26,7 @@ import { PartitionFieldConfig, PartitionFieldsConfig, } from '../../../../../common/types/storage'; -import { useStorage } from '../../../contexts/ml/use_storage'; +import { useStorage } from '../../../contexts/storage'; import { EntityFieldType } from '../../../../../common/types/anomalies'; import { FieldDefinition } from '../../../services/results_service/result_service_rx'; import { getViewableDetectors } from '../../timeseriesexplorer_utils/get_viewable_detectors'; diff --git a/x-pack/plugins/ml/public/application/trained_models/nodes_overview/allocated_models.tsx b/x-pack/plugins/ml/public/application/trained_models/nodes_overview/allocated_models.tsx index d1808c2c82135..198c01806e06b 100644 --- a/x-pack/plugins/ml/public/application/trained_models/nodes_overview/allocated_models.tsx +++ b/x-pack/plugins/ml/public/application/trained_models/nodes_overview/allocated_models.tsx @@ -5,8 +5,17 @@ * 2.0. */ import React, { FC } from 'react'; -import { EuiBadge, EuiIcon, EuiInMemoryTable, EuiToolTip } from '@elastic/eui'; +import { + EuiBadge, + EuiFlexGroup, + EuiFlexItem, + EuiIcon, + EuiInMemoryTable, + EuiToolTip, + useEuiTheme, +} from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n-react'; import { EuiBasicTableColumn } from '@elastic/eui/src/components/basic_table/basic_table'; import { FIELD_FORMAT_IDS } from '@kbn/field-formats-plugin/common'; import type { @@ -27,6 +36,7 @@ export const AllocatedModels: FC = ({ const bytesFormatter = useFieldFormatter(FIELD_FORMAT_IDS.BYTES); const dateFormatter = useFieldFormatter(FIELD_FORMAT_IDS.DATE); const durationFormatter = useFieldFormatter(FIELD_FORMAT_IDS.DURATION); + const euiTheme = useEuiTheme(); const columns: Array> = [ { @@ -97,11 +107,36 @@ export const AllocatedModels: FC = ({ 'data-test-subj': 'mlAllocatedModelsTableThroughput', }, { - name: i18n.translate( - 'xpack.ml.trainedModels.nodesList.modelsList.modelAvgInferenceTimeHeader', - { - defaultMessage: 'Avg inference time', - } + name: ( + + } + content={ + + } + > + + + + + + + + + + + ), width: '100px', truncateText: false, diff --git a/x-pack/plugins/ml/server/routes/schemas/notifications_schema.ts b/x-pack/plugins/ml/server/routes/schemas/notifications_schema.ts index a82691ee52813..153ffd0aeea87 100644 --- a/x-pack/plugins/ml/server/routes/schemas/notifications_schema.ts +++ b/x-pack/plugins/ml/server/routes/schemas/notifications_schema.ts @@ -8,26 +8,10 @@ import { schema, TypeOf } from '@kbn/config-schema'; export const getNotificationsQuerySchema = schema.object({ - /** - * Message level, e.g. info, error - */ - level: schema.maybe(schema.string()), - /** - * Message type, e.g. anomaly_detector - */ - type: schema.maybe(schema.string()), /** * Search string for the message content */ queryString: schema.maybe(schema.string()), - /** - * Page numer, zero-indexed - */ - from: schema.number({ defaultValue: 0 }), - /** - * Number of messages to return - */ - size: schema.number({ defaultValue: 10 }), /** * Sort field */ diff --git a/x-pack/plugins/observability/e2e/synthetics_runner.ts b/x-pack/plugins/observability/e2e/synthetics_runner.ts index 25c236c6da585..a24771c091c09 100644 --- a/x-pack/plugins/observability/e2e/synthetics_runner.ts +++ b/x-pack/plugins/observability/e2e/synthetics_runner.ts @@ -10,7 +10,7 @@ import Url from 'url'; import { run as syntheticsRun } from '@elastic/synthetics'; import { PromiseType } from 'utility-types'; -import { createApmUsers } from '@kbn/apm-plugin/scripts/create_apm_users/create_apm_users'; +import { createApmUsers } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/create_apm_users'; import { esArchiverUnload } from './tasks/es_archiver'; @@ -23,6 +23,7 @@ export interface ArgParams { export class SyntheticsRunner { public getService: any; public kibanaUrl: string; + private elasticsearchUrl: string; public testFilesLoaded: boolean = false; @@ -31,6 +32,7 @@ export class SyntheticsRunner { constructor(getService: any, params: ArgParams) { this.getService = getService; this.kibanaUrl = this.getKibanaUrl(); + this.elasticsearchUrl = this.getElasticsearchUrl(); this.params = params; } @@ -40,7 +42,7 @@ export class SyntheticsRunner { async createTestUsers() { await createApmUsers({ - elasticsearch: { username: 'elastic', password: 'changeme' }, + elasticsearch: { node: this.elasticsearchUrl, username: 'elastic', password: 'changeme' }, kibana: { hostname: this.kibanaUrl }, }); } @@ -79,6 +81,16 @@ export class SyntheticsRunner { }); } + getElasticsearchUrl() { + const config = this.getService('config'); + + return Url.format({ + protocol: config.get('servers.elasticsearch.protocol'), + hostname: config.get('servers.elasticsearch.hostname'), + port: config.get('servers.elasticsearch.port'), + }); + } + async run() { if (!this.testFilesLoaded) { throw new Error('Test files not loaded'); diff --git a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/series_actions.tsx b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/series_actions.tsx index 129fdf1cf25e3..aab83cc511d9c 100644 --- a/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/series_actions.tsx +++ b/x-pack/plugins/observability/public/components/shared/exploratory_view/series_editor/columns/series_actions.tsx @@ -89,6 +89,7 @@ export function SeriesActions({ seriesId, series, seriesConfig, onEditClick }: P aria-label={EDIT_SERIES_LABEL} size="s" onClick={onEditClick} + data-test-subj={`editSeries${seriesId}`} /> 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 b9600088af3bf..bc41b8d803285 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/hooks/use_fetch_alert_detail.ts b/x-pack/plugins/observability/public/hooks/use_fetch_alert_detail.ts index aa604659f8c08..a86b97741f24c 100644 --- a/x-pack/plugins/observability/public/hooks/use_fetch_alert_detail.ts +++ b/x-pack/plugins/observability/public/hooks/use_fetch_alert_detail.ts @@ -21,7 +21,6 @@ interface AlertDetailParams { export const useFetchAlertDetail = (id: string): [boolean, TopAlert | null] => { const { observabilityRuleTypeRegistry } = usePluginContext(); - const params = useMemo( () => ({ id, ruleType: observabilityRuleTypeRegistry }), [id, observabilityRuleTypeRegistry] diff --git a/x-pack/plugins/observability/public/pages/alert_details/components/alert_details.test.tsx b/x-pack/plugins/observability/public/pages/alert_details/components/alert_details.test.tsx index d2c67c85c021e..eaa253efbc51f 100644 --- a/x-pack/plugins/observability/public/pages/alert_details/components/alert_details.test.tsx +++ b/x-pack/plugins/observability/public/pages/alert_details/components/alert_details.test.tsx @@ -7,23 +7,58 @@ import React from 'react'; import * as useUiSettingHook from '@kbn/kibana-react-plugin/public/ui_settings/use_ui_setting'; +import { useParams } from 'react-router-dom'; +import { Chance } from 'chance'; +import { waitFor } from '@testing-library/react'; +import { casesPluginMock } from '@kbn/cases-plugin/public/mocks'; +import { triggersActionsUiMock } from '@kbn/triggers-actions-ui-plugin/public/mocks'; + import { render } from '../../../utils/test_helper'; +import { useKibana } from '../../../utils/kibana_react'; +import { kibanaStartMock } from '../../../utils/kibana_react.mock'; import { useFetchAlertDetail } from '../../../hooks/use_fetch_alert_detail'; -import { AlertDetails } from './alert_details'; -import { Chance } from 'chance'; -import { useParams } from 'react-router-dom'; import { useBreadcrumbs } from '../../../hooks/use_breadcrumbs'; +import { AlertDetails } from './alert_details'; import { ConfigSchema } from '../../../plugin'; import { alert, alertWithNoData } from '../mock/alert'; -import { waitFor } from '@testing-library/react'; -jest.mock('../../../hooks/use_fetch_alert_detail'); -jest.mock('../../../hooks/use_breadcrumbs'); jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), useParams: jest.fn(), })); +jest.mock('../../../utils/kibana_react'); + +const useKibanaMock = useKibana as jest.Mock; + +const mockKibana = () => { + useKibanaMock.mockReturnValue({ + services: { + ...kibanaStartMock.startContract(), + cases: casesPluginMock.createStartContract(), + http: { + basePath: { + prepend: jest.fn(), + }, + }, + triggersActionsUi: triggersActionsUiMock.createStart(), + }, + }); +}; + +jest.mock('../../../hooks/use_fetch_alert_detail'); +jest.mock('../../../hooks/use_breadcrumbs'); +jest.mock('../../../hooks/use_get_user_cases_permissions', () => ({ + useGetUserCasesPermissions: () => ({ + all: true, + create: true, + delete: true, + push: true, + read: true, + update: true, + }), +})); + const useFetchAlertDetailMock = useFetchAlertDetail as jest.Mock; const useParamsMock = useParams as jest.Mock; const useBreadcrumbsMock = useBreadcrumbs as jest.Mock; @@ -49,16 +84,20 @@ describe('Alert details', () => { jest.clearAllMocks(); useParamsMock.mockReturnValue(params); useBreadcrumbsMock.mockReturnValue([]); + mockKibana(); }); - it('should show alert summary', async () => { + it('should show the alert detail page with all necessary components', async () => { useFetchAlertDetailMock.mockReturnValue([false, alert]); const alertDetails = render(, config); - expect(alertDetails.queryByTestId('alertDetails')).toBeTruthy(); await waitFor(() => expect(alertDetails.queryByTestId('centerJustifiedSpinner')).toBeFalsy()); + + expect(alertDetails.queryByTestId('alertDetails')).toBeTruthy(); expect(alertDetails.queryByTestId('alertDetailsError')).toBeFalsy(); + expect(alertDetails.queryByTestId('page-title-container')).toBeTruthy(); + expect(alertDetails.queryByTestId('alert-summary-container')).toBeTruthy(); }); it('should show error loading the alert details', async () => { diff --git a/x-pack/plugins/observability/public/pages/alert_details/components/alert_details.tsx b/x-pack/plugins/observability/public/pages/alert_details/components/alert_details.tsx index a2cd7fd68a2ce..1b501e62a7dde 100644 --- a/x-pack/plugins/observability/public/pages/alert_details/components/alert_details.tsx +++ b/x-pack/plugins/observability/public/pages/alert_details/components/alert_details.tsx @@ -9,23 +9,36 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { useParams } from 'react-router-dom'; import { EuiEmptyPrompt, EuiPanel } from '@elastic/eui'; + import { useKibana } from '../../../utils/kibana_react'; -import { ObservabilityAppServices } from '../../../application/types'; import { usePluginContext } from '../../../hooks/use_plugin_context'; import { useBreadcrumbs } from '../../../hooks/use_breadcrumbs'; -import { paths } from '../../../config/paths'; -import { AlertDetailsPathParams } from '../types'; +import { useFetchAlertDetail } from '../../../hooks/use_fetch_alert_detail'; + +import { AlertSummary, HeaderActions, PageTitle } from '.'; import { CenterJustifiedSpinner } from '../../rule_details/components/center_justified_spinner'; -import { AlertSummary } from '.'; import PageNotFound from '../../404'; -import { useFetchAlertDetail } from '../../../hooks/use_fetch_alert_detail'; + +import { ObservabilityAppServices } from '../../../application/types'; +import { AlertDetailsPathParams } from '../types'; +import { observabilityFeatureId } from '../../../../common'; +import { paths } from '../../../config/paths'; export function AlertDetails() { - const { http } = useKibana().services; + const { + http, + cases: { + helpers: { canUseCases }, + ui: { getCasesContext }, + }, + } = useKibana().services; const { ObservabilityPageTemplate, config } = usePluginContext(); const { alertId } = useParams(); const [isLoading, alert] = useFetchAlertDetail(alertId); + const CasesContext = getCasesContext(); + const userCasesPermissions = canUseCases(); + useBreadcrumbs([ { href: http.basePath.prepend(paths.observability.alerts), @@ -69,7 +82,22 @@ export function AlertDetails() { ); return ( - + , + rightSideItems: [ + + + , + ], + bottomBorder: false, + }} + data-test-subj="alertDetails" + > ); diff --git a/x-pack/plugins/observability/public/pages/alert_details/components/alert_summary.tsx b/x-pack/plugins/observability/public/pages/alert_details/components/alert_summary.tsx index 4a1d88e928fb2..eada6a3925521 100644 --- a/x-pack/plugins/observability/public/pages/alert_details/components/alert_summary.tsx +++ b/x-pack/plugins/observability/public/pages/alert_details/components/alert_summary.tsx @@ -30,7 +30,7 @@ export function AlertSummary({ alert }: AlertSummaryProps) { const tags = alert?.fields[ALERT_RULE_TAGS]; return ( - <> +
@@ -161,6 +161,6 @@ export function AlertSummary({ alert }: AlertSummaryProps) {
- +
); } diff --git a/x-pack/plugins/observability/public/pages/alert_details/components/header_actions.test.tsx b/x-pack/plugins/observability/public/pages/alert_details/components/header_actions.test.tsx new file mode 100644 index 0000000000000..8bbec59c52b95 --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alert_details/components/header_actions.test.tsx @@ -0,0 +1,83 @@ +/* + * 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 { fireEvent } from '@testing-library/react'; +import { triggersActionsUiMock } from '@kbn/triggers-actions-ui-plugin/public/mocks'; +import { casesPluginMock, openAddToExistingCaseModalMock } from '@kbn/cases-plugin/public/mocks'; + +import { render } from '../../../utils/test_helper'; +import { useKibana } from '../../../utils/kibana_react'; +import { kibanaStartMock } from '../../../utils/kibana_react.mock'; +import { alertWithTags, mockAlertUuid } from '../mock/alert'; + +import { HeaderActions } from './header_actions'; + +jest.mock('../../../utils/kibana_react'); + +const useKibanaMock = useKibana as jest.Mock; + +const mockKibana = () => { + useKibanaMock.mockReturnValue({ + services: { + ...kibanaStartMock.startContract(), + triggersActionsUi: triggersActionsUiMock.createStart(), + cases: casesPluginMock.createStartContract(), + }, + }); +}; + +const ruleId = '123'; +const ruleName = '456'; + +jest.mock('../../../hooks/use_fetch_rule', () => { + return { + useFetchRule: () => ({ + reloadRule: jest.fn(), + rule: { + id: ruleId, + name: ruleName, + }, + }), + }; +}); + +describe('Header Actions', () => { + beforeEach(() => { + jest.clearAllMocks(); + mockKibana(); + }); + + it('should display an actions button', () => { + const { queryByTestId } = render(); + expect(queryByTestId('alert-details-header-actions-menu-button')).toBeTruthy(); + }); + + describe('when clicking the actions button', () => { + it('should offer an "add to case" button which opens the add to case modal', async () => { + const { getByTestId, findByRole } = render(); + + fireEvent.click(await findByRole('button', { name: 'Actions' })); + + fireEvent.click(getByTestId('add-to-case-button')); + + expect(openAddToExistingCaseModalMock).toBeCalledWith({ + attachments: [ + { + alertId: mockAlertUuid, + index: '.internal.alerts-observability.metrics.alerts-*', + rule: { + id: ruleId, + name: ruleName, + }, + type: 'alert', + }, + ], + }); + }); + }); +}); diff --git a/x-pack/plugins/observability/public/pages/alert_details/components/header_actions.tsx b/x-pack/plugins/observability/public/pages/alert_details/components/header_actions.tsx new file mode 100644 index 0000000000000..e7a2c773dc68f --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alert_details/components/header_actions.tsx @@ -0,0 +1,160 @@ +/* + * 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, { useState } from 'react'; +import { i18n } from '@kbn/i18n'; +import { noop } from 'lodash'; +import { CaseAttachmentsWithoutOwner } from '@kbn/cases-plugin/public/types'; +import { CommentType } from '@kbn/cases-plugin/common'; +import { EuiButton, EuiButtonEmpty, EuiFlexGroup, EuiPopover, EuiText } from '@elastic/eui'; +import { ALERT_RULE_UUID, ALERT_UUID } from '@kbn/rule-data-utils'; + +import { useKibana } from '../../../utils/kibana_react'; +import { useFetchRule } from '../../../hooks/use_fetch_rule'; +import { ObservabilityAppServices } from '../../../application/types'; +import { TopAlert } from '../../alerts'; + +export interface HeaderActionsProps { + alert: TopAlert | null; +} + +export function HeaderActions({ alert }: HeaderActionsProps) { + const { + http, + cases: { + hooks: { getUseCasesAddToExistingCaseModal }, + }, + triggersActionsUi: { getEditAlertFlyout, getRuleSnoozeModal }, + } = useKibana().services; + + const { rule, reloadRule } = useFetchRule({ + http, + ruleId: alert?.fields[ALERT_RULE_UUID] || '', + }); + + const [isPopoverOpen, setIsPopoverOpen] = useState(false); + const [ruleConditionsFlyoutOpen, setRuleConditionsFlyoutOpen] = useState(false); + const [snoozeModalOpen, setSnoozeModalOpen] = useState(false); + + const selectCaseModal = getUseCasesAddToExistingCaseModal(); + + const handleTogglePopover = () => setIsPopoverOpen(!isPopoverOpen); + const handleClosePopover = () => setIsPopoverOpen(false); + + const attachments: CaseAttachmentsWithoutOwner = + alert && rule + ? [ + { + alertId: alert?.fields[ALERT_UUID] || '', + index: '.internal.alerts-observability.metrics.alerts-*', + rule: { + id: rule.id, + name: rule.name, + }, + type: CommentType.alert, + }, + ] + : []; + + const handleAddToCase = () => { + setIsPopoverOpen(false); + selectCaseModal.open({ attachments }); + }; + + const handleViewRuleDetails = () => { + setIsPopoverOpen(false); + setRuleConditionsFlyoutOpen(true); + }; + + const handleOpenSnoozeModal = () => { + setIsPopoverOpen(false); + setSnoozeModalOpen(true); + }; + + return ( + <> + + {i18n.translate('xpack.observability.alertDetails.actionsButtonLabel', { + defaultMessage: 'Actions', + })} + + } + > + + + + {i18n.translate('xpack.observability.alertDetails.viewRuleDetails', { + defaultMessage: 'View rule details', + })} + + + + + + {i18n.translate('xpack.observability.alertDetails.editSnoozeRule', { + defaultMessage: 'Snooze the rule', + })} + + + + + + {i18n.translate('xpack.observability.alertDetails.addToCase', { + defaultMessage: 'Add to case', + })} + + + + + + {rule && ruleConditionsFlyoutOpen + ? getEditAlertFlyout({ + initialRule: rule, + onClose: () => { + setRuleConditionsFlyoutOpen(false); + }, + onSave: reloadRule, + }) + : null} + + {rule && snoozeModalOpen + ? getRuleSnoozeModal({ + rule, + onClose: () => setSnoozeModalOpen(false), + onRuleChanged: reloadRule, + onLoading: noop, + }) + : null} + + ); +} diff --git a/x-pack/plugins/observability/public/pages/alert_details/components/index.ts b/x-pack/plugins/observability/public/pages/alert_details/components/index.ts index f49d7bd3c721a..9e2ae5d34dc18 100644 --- a/x-pack/plugins/observability/public/pages/alert_details/components/index.ts +++ b/x-pack/plugins/observability/public/pages/alert_details/components/index.ts @@ -5,5 +5,7 @@ * 2.0. */ +export { HeaderActions } from './header_actions'; export { AlertSummary } from './alert_summary'; export { AlertDetails } from './alert_details'; +export { PageTitle } from './page_title'; diff --git a/x-pack/plugins/observability/public/pages/alert_details/components/page_title.stories.tsx b/x-pack/plugins/observability/public/pages/alert_details/components/page_title.stories.tsx new file mode 100644 index 0000000000000..ab0109ef1c214 --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alert_details/components/page_title.stories.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 { ComponentStory } from '@storybook/react'; +import { EuiPageTemplate } from '@elastic/eui'; + +import { PageTitle as Component, PageTitleProps } from './page_title'; + +export default { + component: Component, + title: 'app/AlertDetails/PageTitle', + argTypes: { + title: { control: 'text' }, + active: { control: 'boolean' }, + }, +}; + +const Template: ComponentStory = (props: PageTitleProps) => ( + +); + +const TemplateWithPageTemplate: ComponentStory = (props: PageTitleProps) => ( + + } bottomBorder={false} /> + +); + +const defaultProps = { + title: 'host.cpu.usage is 0.2024 in the last 1 min for all hosts. Alert when > 0.02.', + active: true, +}; + +export const PageTitle = Template.bind({}); +PageTitle.args = defaultProps; + +export const PageTitleUsedWithinPageTemplate = TemplateWithPageTemplate.bind({}); +PageTitleUsedWithinPageTemplate.args = defaultProps; diff --git a/x-pack/plugins/observability/public/pages/alert_details/components/page_title.test.tsx b/x-pack/plugins/observability/public/pages/alert_details/components/page_title.test.tsx new file mode 100644 index 0000000000000..bd0b15e8ffc2a --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alert_details/components/page_title.test.tsx @@ -0,0 +1,44 @@ +/* + * 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 { PageTitle, PageTitleProps } from './page_title'; + +describe('Page Title', () => { + const defaultProps = { + title: 'Great success', + active: true, + }; + + const renderComp = (props: PageTitleProps) => { + return render(); + }; + + it('should display a title when it is passed', () => { + const { getByText } = renderComp(defaultProps); + expect(getByText(defaultProps.title)).toBeTruthy(); + }); + + it('should display an active badge when active is true', async () => { + const { getByText } = renderComp(defaultProps); + expect(getByText('Active')).toBeTruthy(); + }); + + it('should display an inactive badge when active is false', async () => { + const { getByText } = renderComp({ ...defaultProps, active: false }); + + expect(getByText('Recovered')).toBeTruthy(); + }); + + it('should display no badge when active is not passed', async () => { + const { queryByTestId } = renderComp({ title: '123' }); + + expect(queryByTestId('page-title-active-badge')).not.toBeInTheDocument(); + }); +}); diff --git a/x-pack/plugins/observability/public/pages/alert_details/components/page_title.tsx b/x-pack/plugins/observability/public/pages/alert_details/components/page_title.tsx new file mode 100644 index 0000000000000..61301f16e37a9 --- /dev/null +++ b/x-pack/plugins/observability/public/pages/alert_details/components/page_title.tsx @@ -0,0 +1,43 @@ +/* + * 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 { EuiBadge, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +export interface PageTitleProps { + title: string | undefined; + active?: boolean; +} + +export function PageTitle({ title, active }: PageTitleProps) { + const label = active + ? i18n.translate('xpack.observability.alertDetails.alertActiveState', { + defaultMessage: 'Active', + }) + : i18n.translate('xpack.observability.alertDetails.alertRecoveredState', { + defaultMessage: 'Recovered', + }); + + return ( +
+ {title} + + + +
+ {typeof active === 'boolean' ? ( + + {label} + + ) : null} +
+
+
+
+ ); +} diff --git a/x-pack/plugins/observability/public/pages/alert_details/mock/alert.ts b/x-pack/plugins/observability/public/pages/alert_details/mock/alert.ts index ed129fc3d24ec..a3031fb0aa18d 100644 --- a/x-pack/plugins/observability/public/pages/alert_details/mock/alert.ts +++ b/x-pack/plugins/observability/public/pages/alert_details/mock/alert.ts @@ -32,6 +32,8 @@ import { TopAlert } from '../../alerts'; export const tags: string[] = ['tag1', 'tag2', 'tag3']; +export const mockAlertUuid = '756240e5-92fb-452f-b08e-cd3e0dc51738'; + export const alert: TopAlert = { reason: '1957 log entries (more than 100.25) match the conditions.', fields: { @@ -50,7 +52,7 @@ export const alert: TopAlert = { [ALERT_EVALUATION_VALUE]: 1957, [ALERT_INSTANCE_ID]: '*', [ALERT_RULE_NAME]: 'Log threshold (from logs)', - [ALERT_UUID]: '756240e5-92fb-452f-b08e-cd3e0dc51738', + [ALERT_UUID]: mockAlertUuid, [SPACE_IDS]: ['default'], [VERSION]: '8.0.0', [EVENT_KIND]: 'signal', 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 3a6bcb8d28f26..eecadba66b614 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 eddead1fa90de..2ebb4629ba7bd 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 26af884840570..0cf6c092dc70a 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 6c84eb2588a0d..161fe2851ae3a 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/observability/public/utils/build_es_query/__snapshots__/build_es_query.test.ts.snap b/x-pack/plugins/observability/public/utils/build_es_query/__snapshots__/build_es_query.test.ts.snap index fcadce3f18b19..8e6559830cd90 100644 --- a/x-pack/plugins/observability/public/utils/build_es_query/__snapshots__/build_es_query.test.ts.snap +++ b/x-pack/plugins/observability/public/utils/build_es_query/__snapshots__/build_es_query.test.ts.snap @@ -166,3 +166,36 @@ Object { }, } `; + +exports[`buildEsQuery should generate correct es query for {"timeRange":{"from":"now-15min","to":"now"},"kuery":"kibana.alert.status: \\"recovered\\""} 1`] = ` +Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "kibana.alert.status": "recovered", + }, + }, + ], + }, + }, + Object { + "range": Object { + "@timestamp": Object { + "format": "strict_date_optional_time", + "gte": "now-15min", + "lte": "now", + }, + }, + }, + ], + "must": Array [], + "must_not": Array [], + "should": Array [], + }, +} +`; diff --git a/x-pack/plugins/observability/public/utils/build_es_query/build_es_query.test.ts b/x-pack/plugins/observability/public/utils/build_es_query/build_es_query.test.ts index 4bbacaa7bb1ad..39029a03bb267 100644 --- a/x-pack/plugins/observability/public/utils/build_es_query/build_es_query.test.ts +++ b/x-pack/plugins/observability/public/utils/build_es_query/build_es_query.test.ts @@ -34,6 +34,13 @@ describe('buildEsQuery', () => { timeRange: defaultTimeRange, kuery: 'kibana.alert.status: "recovered" and kibana.alert.duration.us >= 120', }, + { + timeRange: { + from: 'now-15min', + to: 'now', + }, + kuery: 'kibana.alert.status: "recovered"', + }, ]; test.each(testData)('should generate correct es query for %j', ({ kuery, timeRange }) => { diff --git a/x-pack/plugins/observability/public/utils/build_es_query/build_es_query.ts b/x-pack/plugins/observability/public/utils/build_es_query/build_es_query.ts index 28e2942c1f606..12711c54f9784 100644 --- a/x-pack/plugins/observability/public/utils/build_es_query/build_es_query.ts +++ b/x-pack/plugins/observability/public/utils/build_es_query/build_es_query.ts @@ -7,15 +7,15 @@ import { buildEsQuery as kbnBuildEsQuery, TimeRange } from '@kbn/es-query'; import { TIMESTAMP } from '@kbn/rule-data-utils'; -import { getTime } from '@kbn/data-plugin/common'; +import { getRelativeTime } from '@kbn/data-plugin/common'; export function buildEsQuery(timeRange: TimeRange, kuery?: string) { const timeFilter = timeRange && - getTime(undefined, timeRange, { + getRelativeTime(undefined, timeRange, { fieldName: TIMESTAMP, }); - const filtersToUse = [...(timeFilter ? [timeFilter] : [])]; + const filtersToUse = timeFilter ? [timeFilter] : []; const queryToUse = kuery ? { query: kuery, language: 'kuery' } : []; return kbnBuildEsQuery(undefined, queryToUse, filtersToUse); diff --git a/x-pack/plugins/observability/server/assets/constants.ts b/x-pack/plugins/observability/server/assets/constants.ts index 4c0cc0e2e6f83..182ca89712dcc 100644 --- a/x-pack/plugins/observability/server/assets/constants.ts +++ b/x-pack/plugins/observability/server/assets/constants.ts @@ -9,11 +9,7 @@ export const SLO_COMPONENT_TEMPLATE_MAPPINGS_NAME = 'slo-observability.sli-mappi export const SLO_COMPONENT_TEMPLATE_SETTINGS_NAME = 'slo-observability.sli-settings'; export const SLO_INDEX_TEMPLATE_NAME = 'slo-observability.sli'; export const SLO_RESOURCES_VERSION = 1; - -export const getSLOIngestPipelineName = (spaceId: string) => - `${SLO_INDEX_TEMPLATE_NAME}.monthly-${spaceId}`; - -export const getSLODestinationIndexName = (spaceId: string) => - `${SLO_INDEX_TEMPLATE_NAME}-v${SLO_RESOURCES_VERSION}-${spaceId}`; +export const SLO_INGEST_PIPELINE_NAME = `${SLO_INDEX_TEMPLATE_NAME}.monthly`; +export const SLO_DESTINATION_INDEX_NAME = `${SLO_INDEX_TEMPLATE_NAME}-v${SLO_RESOURCES_VERSION}`; export const getSLOTransformId = (sloId: string) => `slo-${sloId}`; diff --git a/x-pack/plugins/observability/server/plugin.ts b/x-pack/plugins/observability/server/plugin.ts index 1d9d3cbf455f1..ff5fd246bea1b 100644 --- a/x-pack/plugins/observability/server/plugin.ts +++ b/x-pack/plugins/observability/server/plugin.ts @@ -144,7 +144,6 @@ export class ObservabilityPlugin implements Plugin { const start = () => core.getStartServices().then(([coreStart]) => coreStart); - const { spacesService } = plugins.spaces; const { ruleDataService } = plugins.ruleRegistry; registerRoutes({ @@ -155,7 +154,6 @@ export class ObservabilityPlugin implements Plugin { logger: this.initContext.logger.get(), repository: getGlobalObservabilityServerRouteRepository(config), ruleDataService, - spacesService, }); return { diff --git a/x-pack/plugins/observability/server/routes/register_routes.ts b/x-pack/plugins/observability/server/routes/register_routes.ts index e0e9e94f5cb21..1c45eb6001479 100644 --- a/x-pack/plugins/observability/server/routes/register_routes.ts +++ b/x-pack/plugins/observability/server/routes/register_routes.ts @@ -14,7 +14,6 @@ import { CoreSetup, CoreStart, Logger, RouteRegistrar } from '@kbn/core/server'; import Boom from '@hapi/boom'; import { errors } from '@elastic/elasticsearch'; import { RuleDataPluginService } from '@kbn/rule-registry-plugin/server'; -import { SpacesServiceStart } from '@kbn/spaces-plugin/server'; import { ObservabilityRequestHandlerContext } from '../types'; import { AbstractObservabilityServerRouteRepository } from './types'; import { getHTTPResponseCode, ObservabilityError } from '../errors'; @@ -24,7 +23,6 @@ export function registerRoutes({ core, logger, ruleDataService, - spacesService, }: { core: { setup: CoreSetup; @@ -33,7 +31,6 @@ export function registerRoutes({ repository: AbstractObservabilityServerRouteRepository; logger: Logger; ruleDataService: RuleDataPluginService; - spacesService: SpacesServiceStart; }) { const routes = Object.values(repository); @@ -67,7 +64,6 @@ export function registerRoutes({ logger, params: decodedParams, ruleDataService, - spacesService, })) as any; if (data === undefined) { diff --git a/x-pack/plugins/observability/server/routes/slo/route.ts b/x-pack/plugins/observability/server/routes/slo/route.ts index 3f04d5e0b13c6..63ef4e1e07e64 100644 --- a/x-pack/plugins/observability/server/routes/slo/route.ts +++ b/x-pack/plugins/observability/server/routes/slo/route.ts @@ -38,19 +38,13 @@ const createSLORoute = createObservabilityServerRoute({ tags: [], }, params: createSLOParamsSchema, - handler: async ({ context, request, params, logger, spacesService }) => { + handler: async ({ context, params, logger }) => { const esClient = (await context.core).elasticsearch.client.asCurrentUser; const soClient = (await context.core).savedObjects.client; - const spaceId = spacesService.getSpaceId(request); - const resourceInstaller = new DefaultResourceInstaller(esClient, logger, spaceId); + const resourceInstaller = new DefaultResourceInstaller(esClient, logger); const repository = new KibanaSavedObjectsSLORepository(soClient); - const transformManager = new DefaultTransformManager( - transformGenerators, - esClient, - logger, - spaceId - ); + const transformManager = new DefaultTransformManager(transformGenerators, esClient, logger); const createSLO = new CreateSLO(resourceInstaller, repository, transformManager); const response = await createSLO.execute(params.body); @@ -65,18 +59,12 @@ const deleteSLORoute = createObservabilityServerRoute({ tags: [], }, params: deleteSLOParamsSchema, - handler: async ({ context, request, params, logger, spacesService }) => { + handler: async ({ context, params, logger }) => { const esClient = (await context.core).elasticsearch.client.asCurrentUser; const soClient = (await context.core).savedObjects.client; - const spaceId = spacesService.getSpaceId(request); const repository = new KibanaSavedObjectsSLORepository(soClient); - const transformManager = new DefaultTransformManager( - transformGenerators, - esClient, - logger, - spaceId - ); + const transformManager = new DefaultTransformManager(transformGenerators, esClient, logger); const deleteSLO = new DeleteSLO(repository, transformManager, esClient); diff --git a/x-pack/plugins/observability/server/services/slo/delete_slo.test.ts b/x-pack/plugins/observability/server/services/slo/delete_slo.test.ts index b1a68b9c04aee..2e43c81f6d382 100644 --- a/x-pack/plugins/observability/server/services/slo/delete_slo.test.ts +++ b/x-pack/plugins/observability/server/services/slo/delete_slo.test.ts @@ -33,6 +33,7 @@ describe('DeleteSLO', () => { await deleteSLO.execute(slo.id); + expect(mockRepository.findById).toHaveBeenCalledWith(slo.id); expect(mockTransformManager.stop).toHaveBeenCalledWith(getSLOTransformId(slo.id)); expect(mockTransformManager.uninstall).toHaveBeenCalledWith(getSLOTransformId(slo.id)); expect(mockEsClient.deleteByQuery).toHaveBeenCalledWith( diff --git a/x-pack/plugins/observability/server/services/slo/delete_slo.ts b/x-pack/plugins/observability/server/services/slo/delete_slo.ts index 59e5df8a5975a..a7d931174a59a 100644 --- a/x-pack/plugins/observability/server/services/slo/delete_slo.ts +++ b/x-pack/plugins/observability/server/services/slo/delete_slo.ts @@ -19,6 +19,9 @@ export class DeleteSLO { ) {} public async execute(sloId: string): Promise { + // ensure the slo exists on the request's space. + await this.repository.findById(sloId); + const sloTransformId = getSLOTransformId(sloId); await this.transformManager.stop(sloTransformId); await this.transformManager.uninstall(sloTransformId); diff --git a/x-pack/plugins/observability/server/services/slo/resource_installer.test.ts b/x-pack/plugins/observability/server/services/slo/resource_installer.test.ts index f8746f38cd246..90749176513da 100644 --- a/x-pack/plugins/observability/server/services/slo/resource_installer.test.ts +++ b/x-pack/plugins/observability/server/services/slo/resource_installer.test.ts @@ -9,7 +9,7 @@ import { IngestGetPipelineResponse } from '@elastic/elasticsearch/lib/api/typesW import { elasticsearchServiceMock } from '@kbn/core/server/mocks'; import { loggerMock } from '@kbn/logging-mocks'; import { - getSLOIngestPipelineName, + SLO_INGEST_PIPELINE_NAME, SLO_COMPONENT_TEMPLATE_MAPPINGS_NAME, SLO_COMPONENT_TEMPLATE_SETTINGS_NAME, SLO_INDEX_TEMPLATE_NAME, @@ -17,17 +17,12 @@ import { } from '../../assets/constants'; import { DefaultResourceInstaller } from './resource_installer'; -const SPACE_ID = 'space-id'; describe('resourceInstaller', () => { describe("when the common resources don't exist", () => { it('installs the common resources', async () => { const mockClusterClient = elasticsearchServiceMock.createElasticsearchClient(); mockClusterClient.indices.existsIndexTemplate.mockResponseOnce(false); - const installer = new DefaultResourceInstaller( - mockClusterClient, - loggerMock.create(), - SPACE_ID - ); + const installer = new DefaultResourceInstaller(mockClusterClient, loggerMock.create()); await installer.ensureCommonResourcesInstalled(); @@ -44,7 +39,7 @@ describe('resourceInstaller', () => { expect.objectContaining({ name: SLO_INDEX_TEMPLATE_NAME }) ); expect(mockClusterClient.ingest.putPipeline).toHaveBeenCalledWith( - expect.objectContaining({ id: getSLOIngestPipelineName(SPACE_ID) }) + expect.objectContaining({ id: SLO_INGEST_PIPELINE_NAME }) ); }); }); @@ -55,13 +50,9 @@ describe('resourceInstaller', () => { mockClusterClient.indices.existsIndexTemplate.mockResponseOnce(true); mockClusterClient.ingest.getPipeline.mockResponseOnce({ // @ts-ignore _meta not typed properly - [getSLOIngestPipelineName(SPACE_ID)]: { _meta: { version: SLO_RESOURCES_VERSION } }, + [SLO_INGEST_PIPELINE_NAME]: { _meta: { version: SLO_RESOURCES_VERSION } }, } as IngestGetPipelineResponse); - const installer = new DefaultResourceInstaller( - mockClusterClient, - loggerMock.create(), - SPACE_ID - ); + const installer = new DefaultResourceInstaller(mockClusterClient, loggerMock.create()); await installer.ensureCommonResourcesInstalled(); diff --git a/x-pack/plugins/observability/server/services/slo/resource_installer.ts b/x-pack/plugins/observability/server/services/slo/resource_installer.ts index 8ed8108b3c4b7..abc02052097b5 100644 --- a/x-pack/plugins/observability/server/services/slo/resource_installer.ts +++ b/x-pack/plugins/observability/server/services/slo/resource_installer.ts @@ -13,7 +13,7 @@ import type { import type { ElasticsearchClient, Logger } from '@kbn/core/server'; import { - getSLOIngestPipelineName, + SLO_INGEST_PIPELINE_NAME, SLO_COMPONENT_TEMPLATE_MAPPINGS_NAME, SLO_COMPONENT_TEMPLATE_SETTINGS_NAME, SLO_INDEX_TEMPLATE_NAME, @@ -29,11 +29,7 @@ export interface ResourceInstaller { } export class DefaultResourceInstaller implements ResourceInstaller { - constructor( - private esClient: ElasticsearchClient, - private logger: Logger, - private spaceId: string - ) {} + constructor(private esClient: ElasticsearchClient, private logger: Logger) {} public async ensureCommonResourcesInstalled(): Promise { const alreadyInstalled = await this.areResourcesAlreadyInstalled(); @@ -64,8 +60,8 @@ export class DefaultResourceInstaller implements ResourceInstaller { await this.createOrUpdateIngestPipelineTemplate( getSLOPipelineTemplate( - getSLOIngestPipelineName(this.spaceId), - this.getPipelinePrefix(SLO_RESOURCES_VERSION, this.spaceId) + SLO_INGEST_PIPELINE_NAME, + this.getPipelinePrefix(SLO_RESOURCES_VERSION) ) ); } catch (err) { @@ -74,10 +70,10 @@ export class DefaultResourceInstaller implements ResourceInstaller { } } - private getPipelinePrefix(version: number, spaceId: string): string { + private getPipelinePrefix(version: number): string { // Following https://www.elastic.co/blog/an-introduction-to-the-elastic-data-stream-naming-scheme - // slo-observability.sli--. - return `${SLO_INDEX_TEMPLATE_NAME}-v${version}-${spaceId}.`; + // slo-observability.sli-. + return `${SLO_INDEX_TEMPLATE_NAME}-v${version}.`; } private async areResourcesAlreadyInstalled(): Promise { @@ -87,12 +83,11 @@ export class DefaultResourceInstaller implements ResourceInstaller { let ingestPipelineExists = false; try { - const pipelineName = getSLOIngestPipelineName(this.spaceId); - const pipeline = await this.esClient.ingest.getPipeline({ id: pipelineName }); + const pipeline = await this.esClient.ingest.getPipeline({ id: SLO_INGEST_PIPELINE_NAME }); ingestPipelineExists = // @ts-ignore _meta is not defined on the type - pipeline && pipeline[pipelineName]._meta.version === SLO_RESOURCES_VERSION; + pipeline && pipeline[SLO_INGEST_PIPELINE_NAME]._meta.version === SLO_RESOURCES_VERSION; } catch (err) { return false; } diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap index 239c3c93503b9..7b7f49061fd57 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_duration.test.ts.snap @@ -20,8 +20,8 @@ Object { "version": 1, }, "dest": Object { - "index": "slo-observability.sli-v1-my-namespace", - "pipeline": "slo-observability.sli.monthly-my-namespace", + "index": "slo-observability.sli-v1", + "pipeline": "slo-observability.sli.monthly", }, "frequency": "1m", "pivot": Object { diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap index 1fdaec28f8977..8b73f76a8082d 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/__snapshots__/apm_transaction_error_rate.test.ts.snap @@ -20,8 +20,8 @@ Object { "version": 1, }, "dest": Object { - "index": "slo-observability.sli-v1-my-namespace", - "pipeline": "slo-observability.sli.monthly-my-namespace", + "index": "slo-observability.sli-v1", + "pipeline": "slo-observability.sli.monthly", }, "frequency": "1m", "pivot": Object { diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_duration.test.ts b/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_duration.test.ts index 1e8fadf365d72..ba984e542619b 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_duration.test.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_duration.test.ts @@ -13,7 +13,7 @@ const generator = new ApmTransactionDurationTransformGenerator(); describe('APM Transaction Duration Transform Generator', () => { it('returns the correct transform params with every specified indicator params', async () => { const anSLO = createSLO(createAPMTransactionDurationIndicator()); - const transform = generator.getTransformParams(anSLO, 'my-namespace'); + const transform = generator.getTransformParams(anSLO); expect(transform).toMatchSnapshot({ transform_id: expect.any(String), @@ -34,7 +34,7 @@ describe('APM Transaction Duration Transform Generator', () => { transaction_type: '*', }) ); - const transform = generator.getTransformParams(anSLO, 'my-namespace'); + const transform = generator.getTransformParams(anSLO); expect(transform.source.query).toMatchSnapshot(); }); diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_duration.ts b/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_duration.ts index 4c46421737630..bc45e12abbb30 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_duration.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_duration.ts @@ -12,8 +12,8 @@ import { } from '@elastic/elasticsearch/lib/api/types'; import { ALL_VALUE } from '../../../types/schema'; import { - getSLODestinationIndexName, - getSLOIngestPipelineName, + SLO_DESTINATION_INDEX_NAME, + SLO_INGEST_PIPELINE_NAME, getSLOTransformId, } from '../../../assets/constants'; import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; @@ -27,7 +27,7 @@ import { TransformGenerator } from '.'; const APM_SOURCE_INDEX = 'metrics-apm*'; export class ApmTransactionDurationTransformGenerator implements TransformGenerator { - public getTransformParams(slo: SLO, spaceId: string): TransformPutTransformRequest { + public getTransformParams(slo: SLO): TransformPutTransformRequest { if (!apmTransactionDurationSLOSchema.is(slo)) { throw new Error(`Cannot handle SLO of indicator type: ${slo.indicator.type}`); } @@ -35,7 +35,7 @@ export class ApmTransactionDurationTransformGenerator implements TransformGenera return getSLOTransformTemplate( this.buildTransformId(slo), this.buildSource(slo), - this.buildDestination(slo, spaceId), + this.buildDestination(), this.buildGroupBy(), this.buildAggregations(slo) ); @@ -104,10 +104,10 @@ export class ApmTransactionDurationTransformGenerator implements TransformGenera }; } - private buildDestination(slo: APMTransactionDurationSLO, spaceId: string) { + private buildDestination() { return { - pipeline: getSLOIngestPipelineName(spaceId), - index: getSLODestinationIndexName(spaceId), + pipeline: SLO_INGEST_PIPELINE_NAME, + index: SLO_DESTINATION_INDEX_NAME, }; } diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_error_rate.test.ts b/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_error_rate.test.ts index afa904fa1f8cb..2bc88c576f8c4 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_error_rate.test.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_error_rate.test.ts @@ -13,7 +13,7 @@ const generator = new ApmTransactionErrorRateTransformGenerator(); describe('APM Transaction Error Rate Transform Generator', () => { it('returns the correct transform params with every specified indicator params', async () => { const anSLO = createSLO(createAPMTransactionErrorRateIndicator()); - const transform = generator.getTransformParams(anSLO, 'my-namespace'); + const transform = generator.getTransformParams(anSLO); expect(transform).toMatchSnapshot({ transform_id: expect.any(String), @@ -27,7 +27,7 @@ describe('APM Transaction Error Rate Transform Generator', () => { it("uses default values when 'good_status_codes' is not specified", async () => { const anSLO = createSLO(createAPMTransactionErrorRateIndicator({ good_status_codes: [] })); - const transform = generator.getTransformParams(anSLO, 'my-namespace'); + const transform = generator.getTransformParams(anSLO); expect(transform.pivot?.aggregations).toMatchSnapshot(); }); @@ -41,7 +41,7 @@ describe('APM Transaction Error Rate Transform Generator', () => { transaction_type: '*', }) ); - const transform = generator.getTransformParams(anSLO, 'my-namespace'); + const transform = generator.getTransformParams(anSLO); expect(transform.source.query).toMatchSnapshot(); }); diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_error_rate.ts b/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_error_rate.ts index 6740bee2b707f..23a9a03f6e14c 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_error_rate.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/apm_transaction_error_rate.ts @@ -14,8 +14,8 @@ import { ALL_VALUE } from '../../../types/schema'; import { getSLOTransformTemplate } from '../../../assets/transform_templates/slo_transform_template'; import { TransformGenerator } from '.'; import { - getSLODestinationIndexName, - getSLOIngestPipelineName, + SLO_DESTINATION_INDEX_NAME, + SLO_INGEST_PIPELINE_NAME, getSLOTransformId, } from '../../../assets/constants'; import { @@ -29,7 +29,7 @@ const ALLOWED_STATUS_CODES = ['2xx', '3xx', '4xx', '5xx']; const DEFAULT_GOOD_STATUS_CODES = ['2xx', '3xx', '4xx']; export class ApmTransactionErrorRateTransformGenerator implements TransformGenerator { - public getTransformParams(slo: SLO, spaceId: string): TransformPutTransformRequest { + public getTransformParams(slo: SLO): TransformPutTransformRequest { if (!apmTransactionErrorRateSLOSchema.is(slo)) { throw new Error(`Cannot handle SLO of indicator type: ${slo.indicator.type}`); } @@ -37,7 +37,7 @@ export class ApmTransactionErrorRateTransformGenerator implements TransformGener return getSLOTransformTemplate( this.buildTransformId(slo), this.buildSource(slo), - this.buildDestination(slo, spaceId), + this.buildDestination(), this.buildGroupBy(), this.buildAggregations(slo) ); @@ -106,10 +106,10 @@ export class ApmTransactionErrorRateTransformGenerator implements TransformGener }; } - private buildDestination(slo: APMTransactionErrorRateSLO, spaceId: string) { + private buildDestination() { return { - pipeline: getSLOIngestPipelineName(spaceId), - index: getSLODestinationIndexName(spaceId), + pipeline: SLO_INGEST_PIPELINE_NAME, + index: SLO_DESTINATION_INDEX_NAME, }; } diff --git a/x-pack/plugins/observability/server/services/slo/transform_generators/transform_generator.ts b/x-pack/plugins/observability/server/services/slo/transform_generators/transform_generator.ts index 21a917ea1af6d..3965e809373c8 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_generators/transform_generator.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_generators/transform_generator.ts @@ -9,5 +9,5 @@ import { TransformPutTransformRequest } from '@elastic/elasticsearch/lib/api/typ import { SLO } from '../../../types/models'; export interface TransformGenerator { - getTransformParams(slo: SLO, spaceId: string): TransformPutTransformRequest; + getTransformParams(slo: SLO): TransformPutTransformRequest; } diff --git a/x-pack/plugins/observability/server/services/slo/transform_manager.test.ts b/x-pack/plugins/observability/server/services/slo/transform_manager.test.ts index 1badb6b08e49f..434e6841ff0e9 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_manager.test.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_manager.test.ts @@ -23,8 +23,6 @@ import { import { SLO, SLITypes } from '../../types/models'; import { createAPMTransactionErrorRateIndicator, createSLO } from './fixtures/slo'; -const SPACE_ID = 'space-id'; - describe('TransformManager', () => { let esClientMock: ElasticsearchClientMock; let loggerMock: jest.Mocked; @@ -41,7 +39,7 @@ describe('TransformManager', () => { const generators: Record = { 'slo.apm.transaction_duration': new DummyTransformGenerator(), }; - const service = new DefaultTransformManager(generators, esClientMock, loggerMock, SPACE_ID); + const service = new DefaultTransformManager(generators, esClientMock, loggerMock); await expect( service.install( @@ -63,12 +61,7 @@ describe('TransformManager', () => { const generators: Record = { 'slo.apm.transaction_duration': new FailTransformGenerator(), }; - const transformManager = new DefaultTransformManager( - generators, - esClientMock, - loggerMock, - SPACE_ID - ); + const transformManager = new DefaultTransformManager(generators, esClientMock, loggerMock); await expect( transformManager.install( @@ -92,12 +85,7 @@ describe('TransformManager', () => { const generators: Record = { 'slo.apm.transaction_error_rate': new ApmTransactionErrorRateTransformGenerator(), }; - const transformManager = new DefaultTransformManager( - generators, - esClientMock, - loggerMock, - SPACE_ID - ); + const transformManager = new DefaultTransformManager(generators, esClientMock, loggerMock); const slo = createSLO(createAPMTransactionErrorRateIndicator()); const transformId = await transformManager.install(slo); @@ -113,12 +101,7 @@ describe('TransformManager', () => { const generators: Record = { 'slo.apm.transaction_error_rate': new ApmTransactionErrorRateTransformGenerator(), }; - const transformManager = new DefaultTransformManager( - generators, - esClientMock, - loggerMock, - SPACE_ID - ); + const transformManager = new DefaultTransformManager(generators, esClientMock, loggerMock); await transformManager.start('slo-transform-id'); @@ -132,12 +115,7 @@ describe('TransformManager', () => { const generators: Record = { 'slo.apm.transaction_error_rate': new ApmTransactionErrorRateTransformGenerator(), }; - const transformManager = new DefaultTransformManager( - generators, - esClientMock, - loggerMock, - SPACE_ID - ); + const transformManager = new DefaultTransformManager(generators, esClientMock, loggerMock); await transformManager.stop('slo-transform-id'); @@ -151,12 +129,7 @@ describe('TransformManager', () => { const generators: Record = { 'slo.apm.transaction_error_rate': new ApmTransactionErrorRateTransformGenerator(), }; - const transformManager = new DefaultTransformManager( - generators, - esClientMock, - loggerMock, - SPACE_ID - ); + const transformManager = new DefaultTransformManager(generators, esClientMock, loggerMock); await transformManager.uninstall('slo-transform-id'); @@ -171,12 +144,7 @@ describe('TransformManager', () => { const generators: Record = { 'slo.apm.transaction_error_rate': new ApmTransactionErrorRateTransformGenerator(), }; - const transformManager = new DefaultTransformManager( - generators, - esClientMock, - loggerMock, - SPACE_ID - ); + const transformManager = new DefaultTransformManager(generators, esClientMock, loggerMock); await transformManager.uninstall('slo-transform-id'); diff --git a/x-pack/plugins/observability/server/services/slo/transform_manager.ts b/x-pack/plugins/observability/server/services/slo/transform_manager.ts index ab7799a4a00c6..154660fccaf9f 100644 --- a/x-pack/plugins/observability/server/services/slo/transform_manager.ts +++ b/x-pack/plugins/observability/server/services/slo/transform_manager.ts @@ -24,8 +24,7 @@ export class DefaultTransformManager implements TransformManager { constructor( private generators: Record, private esClient: ElasticsearchClient, - private logger: Logger, - private spaceId: string + private logger: Logger ) {} async install(slo: SLO): Promise { @@ -35,7 +34,7 @@ export class DefaultTransformManager implements TransformManager { throw new Error(`Unsupported SLO type: ${slo.indicator.type}`); } - const transformParams = generator.getTransformParams(slo, this.spaceId); + const transformParams = generator.getTransformParams(slo); try { await retryTransientEsErrors(() => this.esClient.transform.putTransform(transformParams), { logger: this.logger, diff --git a/x-pack/plugins/osquery/cypress/e2e/all/alerts.cy.ts b/x-pack/plugins/osquery/cypress/e2e/all/alerts.cy.ts index e5c6b5013b138..34d04289ad676 100644 --- a/x-pack/plugins/osquery/cypress/e2e/all/alerts.cy.ts +++ b/x-pack/plugins/osquery/cypress/e2e/all/alerts.cy.ts @@ -8,7 +8,6 @@ import { ArchiverMethod, runKbnArchiverScript } from '../../tasks/archiver'; import { login } from '../../tasks/login'; import { - checkResults, findAndClickButton, findFormFieldByRowsLabelAndType, inputQuery, @@ -59,6 +58,28 @@ describe('Alert Event Details', () => { cy.getBySel('ruleSwitch').should('have.attr', 'aria-checked', 'true'); }); + it('enables to add detection action with osquery', () => { + cy.visit('/app/security/rules'); + cy.contains(RULE_NAME).click(); + cy.contains('Edit rule settings').click(); + cy.getBySel('edit-rule-actions-tab').wait(500).click(); + cy.contains('Perform no actions').get('select').select('On each rule execution'); + cy.contains('Response actions are run on each rule execution'); + cy.getBySel('.osquery-ResponseActionTypeSelectOption').click(); + cy.get(LIVE_QUERY_EDITOR); + cy.contains('Save changes').click(); + cy.contains('Query is a required field'); + inputQuery('select * from uptime'); + cy.wait(1000); // wait for the validation to trigger - cypress is way faster than users ;) + + // getSavedQueriesDropdown().type(`users{downArrow}{enter}`); + cy.contains('Save changes').click(); + cy.contains(`${RULE_NAME} was saved`).should('exist'); + cy.contains('Edit rule settings').click(); + cy.getBySel('edit-rule-actions-tab').wait(500).click(); + cy.contains('select * from uptime'); + }); + it('should be able to run live query and add to timeline (-depending on the previous test)', () => { const TIMELINE_NAME = 'Untitled timeline'; cy.visit('/app/security/alerts'); @@ -94,38 +115,20 @@ describe('Alert Event Details', () => { cy.contains('Cancel').click(); cy.contains(TIMELINE_NAME).click(); cy.getBySel('draggableWrapperKeyboardHandler').contains('action_id: "'); - }); - it('enables to add detection action with osquery', () => { - cy.visit('/app/security/rules'); - cy.contains(RULE_NAME).click(); - cy.contains('Edit rule settings').click(); - cy.getBySel('edit-rule-actions-tab').wait(500).click(); - cy.contains('Perform no actions').get('select').select('On each rule execution'); - cy.contains('Response actions are run on each rule execution'); - cy.getBySel('.osquery-ResponseActionTypeSelectOption').click(); - cy.get(LIVE_QUERY_EDITOR); - cy.contains('Save changes').click(); - cy.contains('Query is a required field'); - inputQuery('select * from uptime'); - cy.wait(1000); // wait for the validation to trigger - cypress is way faster than users ;) - - // getSavedQueriesDropdown().type(`users{downArrow}{enter}`); - cy.contains('Save changes').click(); - cy.contains(`${RULE_NAME} was saved`).should('exist'); - cy.contains('Edit rule settings').click(); - cy.getBySel('edit-rule-actions-tab').wait(500).click(); - cy.contains('select * from uptime'); + // timeline unsaved changes modal + cy.visit('/app/osquery'); + closeModalIfVisible(); }); // TODO think on how to get these actions triggered faster (because now they are not triggered during the test). - it.skip('sees osquery results from last action', () => { - cy.visit('/app/security/alerts'); - cy.getBySel('header-page-title').contains('Alerts').should('exist'); - cy.getBySel('expand-event').first().click({ force: true }); - cy.contains('Osquery Results').click(); - cy.getBySel('osquery-results').should('exist'); - cy.contains('select * from uptime'); - cy.getBySel('osqueryResultsTable').within(() => { - checkResults(); - }); - }); + // it.skip('sees osquery results from last action', () => { + // cy.visit('/app/security/alerts'); + // cy.getBySel('header-page-title').contains('Alerts').should('exist'); + // cy.getBySel('expand-event').first().click({ force: true }); + // cy.contains('Osquery Results').click(); + // cy.getBySel('osquery-results').should('exist'); + // cy.contains('select * from uptime'); + // cy.getBySel('osqueryResultsTable').within(() => { + // checkResults(); + // }); + // }); }); diff --git a/x-pack/plugins/osquery/cypress/integration/all/cases.spec.ts b/x-pack/plugins/osquery/cypress/e2e/all/cases.cy.ts similarity index 96% rename from x-pack/plugins/osquery/cypress/integration/all/cases.spec.ts rename to x-pack/plugins/osquery/cypress/e2e/all/cases.cy.ts index cb16dd1dfb8fe..ce586e4d49943 100644 --- a/x-pack/plugins/osquery/cypress/integration/all/cases.spec.ts +++ b/x-pack/plugins/osquery/cypress/e2e/all/cases.cy.ts @@ -35,7 +35,7 @@ describe('Add to Cases', () => { cy.contains('Test Obs case').click(); checkResults(); cy.contains('attached Osquery results'); - cy.contains('SELECT * FROM users;'); + cy.contains('select * from uptime;'); cy.contains('View in Discover').should('exist'); cy.contains('View in Lens').should('exist'); cy.contains('Add to Case').should('not.exist'); @@ -66,7 +66,7 @@ describe('Add to Cases', () => { cy.contains('Test Security Case').click(); checkResults(); cy.contains('attached Osquery results'); - cy.contains('SELECT * FROM users;'); + cy.contains('select * from uptime;'); cy.contains('View in Discover').should('exist'); cy.contains('View in Lens').should('exist'); cy.contains('Add to Case').should('not.exist'); diff --git a/x-pack/plugins/osquery/cypress/e2e/roles/alert_test.cy.ts b/x-pack/plugins/osquery/cypress/e2e/roles/alert_test.cy.ts index 5d25b6599b13c..3adffecd77848 100644 --- a/x-pack/plugins/osquery/cypress/e2e/roles/alert_test.cy.ts +++ b/x-pack/plugins/osquery/cypress/e2e/roles/alert_test.cy.ts @@ -8,7 +8,12 @@ import { ROLES } from '../../test'; import { ArchiverMethod, runKbnArchiverScript } from '../../tasks/archiver'; import { login } from '../../tasks/login'; -import { findAndClickButton, findFormFieldByRowsLabelAndType } from '../../tasks/live_query'; +import { + checkResults, + findAndClickButton, + findFormFieldByRowsLabelAndType, + submitQuery, +} from '../../tasks/live_query'; import { preparePack } from '../../tasks/packs'; import { closeModalIfVisible } from '../../tasks/integrations'; import { navigateTo } from '../../tasks/navigation'; @@ -18,43 +23,76 @@ describe('Alert_Test', () => { runKbnArchiverScript(ArchiverMethod.LOAD, 'pack'); runKbnArchiverScript(ArchiverMethod.LOAD, 'rule'); }); - beforeEach(() => { - login(ROLES.alert_test); - }); after(() => { runKbnArchiverScript(ArchiverMethod.UNLOAD, 'pack'); runKbnArchiverScript(ArchiverMethod.UNLOAD, 'rule'); }); - it('should be able to run live query', () => { - const PACK_NAME = 'testpack'; - const RULE_NAME = 'Test-rule'; - navigateTo('/app/osquery'); - preparePack(PACK_NAME); - findAndClickButton('Edit'); - cy.contains(`Edit ${PACK_NAME}`); - findFormFieldByRowsLabelAndType( - 'Scheduled agent policies (optional)', - 'fleet server {downArrow}{enter}' - ); - findAndClickButton('Update pack'); - closeModalIfVisible(); - cy.contains(PACK_NAME); - cy.visit('/app/security/rules'); - cy.contains(RULE_NAME).click(); - cy.wait(2000); - cy.getBySel('ruleSwitch').should('have.attr', 'aria-checked', 'true'); - cy.getBySel('ruleSwitch').click(); - cy.getBySel('ruleSwitch').should('have.attr', 'aria-checked', 'false'); - cy.getBySel('ruleSwitch').click(); - cy.getBySel('ruleSwitch').should('have.attr', 'aria-checked', 'true'); - cy.visit('/app/security/alerts'); - cy.getBySel('expand-event').first().click(); - cy.getBySel('take-action-dropdown-btn').click(); - cy.getBySel('osquery-action-item').click(); - - cy.contains('Run Osquery'); - cy.contains('Permission denied'); + describe('alert_test role', () => { + it('should not be able to run live query', () => { + login(ROLES.alert_test); + + const PACK_NAME = 'testpack'; + const RULE_NAME = 'Test-rule'; + navigateTo('/app/osquery'); + preparePack(PACK_NAME); + findAndClickButton('Edit'); + cy.contains(`Edit ${PACK_NAME}`); + findFormFieldByRowsLabelAndType( + 'Scheduled agent policies (optional)', + 'fleet server {downArrow}{enter}' + ); + findAndClickButton('Update pack'); + closeModalIfVisible(); + cy.contains(PACK_NAME); + cy.visit('/app/security/rules'); + cy.contains(RULE_NAME).click(); + cy.wait(2000); + cy.getBySel('ruleSwitch').should('have.attr', 'aria-checked', 'true'); + cy.getBySel('ruleSwitch').click(); + cy.getBySel('ruleSwitch').should('have.attr', 'aria-checked', 'false'); + cy.getBySel('ruleSwitch').click(); + cy.getBySel('ruleSwitch').should('have.attr', 'aria-checked', 'true'); + cy.visit('/app/security/alerts'); + cy.getBySel('expand-event').first().click(); + cy.getBySel('take-action-dropdown-btn').click(); + cy.getBySel('osquery-action-item').click(); + + cy.contains('Run Osquery'); + cy.contains('Permission denied'); + }); + }); + + describe('t1_analyst role', () => { + it('should be able to run rule investigation guide query', () => { + login(ROLES.t1_analyst); + + navigateTo('/app/osquery'); + + cy.visit('/app/security/alerts'); + cy.getBySel('expand-event').first().click(); + + cy.contains('Get processes').click(); + submitQuery(); + checkResults(); + }); + + it('should not be able to run custom query', () => { + login(ROLES.t1_analyst); + + navigateTo('/app/osquery'); + + cy.visit('/app/security/alerts'); + cy.getBySel('expand-event').first().click(); + + cy.contains('Get processes').click(); + + cy.intercept('POST', '/api/osquery/live_queries', (req) => { + req.body.query = 'select * from processes limit 10'; + }); + submitQuery(); + cy.contains('Forbidden'); + }); }); }); diff --git a/x-pack/plugins/osquery/cypress/e2e/roles/t1_analyst.cy.ts b/x-pack/plugins/osquery/cypress/e2e/roles/t1_analyst.cy.ts index 8cd90d200bca7..2df197f5f63ce 100644 --- a/x-pack/plugins/osquery/cypress/e2e/roles/t1_analyst.cy.ts +++ b/x-pack/plugins/osquery/cypress/e2e/roles/t1_analyst.cy.ts @@ -50,7 +50,7 @@ describe('T1 Analyst - READ + runSavedQueries ', () => { cy.contains('New live query').should('not.be.disabled'); cy.contains('select * from uptime'); cy.wait(1000); - cy.react('EuiTableBody').first().react('DefaultItemAction').first().click(); + cy.react('EuiTableBody').first().react('CustomItemAction').first().click(); cy.contains(SAVED_QUERY_ID); submitQuery(); checkResults(); diff --git a/x-pack/plugins/osquery/cypress/fixtures/saved_objects/rule.ndjson b/x-pack/plugins/osquery/cypress/fixtures/saved_objects/rule.ndjson index f688dc0731c7f..d1804c3aafec6 100644 --- a/x-pack/plugins/osquery/cypress/fixtures/saved_objects/rule.ndjson +++ b/x-pack/plugins/osquery/cypress/fixtures/saved_objects/rule.ndjson @@ -47,7 +47,8 @@ "winlogbeat-*" ], "query": "_id:*", - "filters": [] + "filters": [], + "note": "!{osquery{\"query\":\"SELECT * FROM processes;\",\"label\":\"Get processes\",\"ecs_mapping\":{\"process.pid\":{\"field\":\"pid\"},\"process.name\":{\"field\":\"name\"},\"process.executable\":{\"field\":\"path\"},\"process.args\":{\"field\":\"cmdline\"},\"process.working_directory\":{\"field\":\"cwd\"},\"user.id\":{\"field\":\"uid\"},\"group.id\":{\"field\":\"gid\"},\"process.parent.pid\":{\"field\":\"parent\"},\"process.pgid\":{\"field\":\"pgroup\"}}}}\n\n!{osquery{\"query\":\"select * from users;\",\"label\":\"Get users\"}}" }, "schedule": { "interval": "5m" diff --git a/x-pack/plugins/osquery/kibana.json b/x-pack/plugins/osquery/kibana.json index 6d956fdce9fe9..ec5443abd6fb1 100644 --- a/x-pack/plugins/osquery/kibana.json +++ b/x-pack/plugins/osquery/kibana.json @@ -12,12 +12,14 @@ "requiredPlugins": [ "actions", "data", + "licensing", "dataViews", "discover", "features", "navigation", "taskManager", "triggersActionsUi", + "ruleRegistry", "security" ], "server": true, diff --git a/x-pack/plugins/osquery/public/actions/actions_table.tsx b/x-pack/plugins/osquery/public/actions/actions_table.tsx index f34a775edf8f1..51eadd954cc4d 100644 --- a/x-pack/plugins/osquery/public/actions/actions_table.tsx +++ b/x-pack/plugins/osquery/public/actions/actions_table.tsx @@ -15,6 +15,7 @@ import { EuiIcon, EuiFlexItem, EuiFlexGroup, + EuiToolTip, } from '@elastic/eui'; import React, { useState, useCallback, useMemo } from 'react'; import { useHistory } from 'react-router-dom'; @@ -34,7 +35,18 @@ interface ActionTableResultsButtonProps { const ActionTableResultsButton: React.FC = ({ actionId }) => { const navProps = useRouterNavigate(`live_queries/${actionId}`); - return ; + const detailsText = i18n.translate( + 'xpack.osquery.liveQueryActions.table.viewDetailsActionButton', + { + defaultMessage: 'Details', + } + ); + + return ( + + + + ); }; ActionTableResultsButton.displayName = 'ActionTableResultsButton'; @@ -100,7 +112,7 @@ const ActionsTableComponent = () => { ); const handlePlayClick = useCallback( - (item) => { + (item) => () => { const packId = item._source.pack_id; if (packId) { @@ -139,6 +151,25 @@ const ActionsTableComponent = () => { }, [push] ); + const renderPlayButton = useCallback( + (item, enabled) => { + const playText = i18n.translate('xpack.osquery.liveQueryActions.table.runActionAriaLabel', { + defaultMessage: 'Run query', + }); + + return ( + + + + ); + }, + [handlePlayClick] + ); const existingPackIds = useMemo(() => map(packsData?.data ?? [], 'id'), [packsData]); @@ -197,10 +228,8 @@ const ActionsTableComponent = () => { }), actions: [ { - type: 'icon', - icon: 'play', - onClick: handlePlayClick, available: isPlayButtonAvailable, + render: renderPlayButton, }, { render: renderActionsColumn, @@ -209,11 +238,11 @@ const ActionsTableComponent = () => { }, ], [ - handlePlayClick, isPlayButtonAvailable, renderActionsColumn, renderAgentsColumn, renderCreatedByColumn, + renderPlayButton, renderQueryColumn, renderTimestampColumn, ] diff --git a/x-pack/plugins/osquery/public/cases/add_to_cases.tsx b/x-pack/plugins/osquery/public/cases/add_to_cases.tsx new file mode 100644 index 0000000000000..bc46a76edf361 --- /dev/null +++ b/x-pack/plugins/osquery/public/cases/add_to_cases.tsx @@ -0,0 +1,27 @@ +/* + * 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 { useKibana } from '../common/lib/kibana'; +import type { AddToCaseButtonProps } from './add_to_cases_button'; +import { AddToCaseButton } from './add_to_cases_button'; + +const CASES_OWNER: string[] = []; + +export const AddToCaseWrapper: React.FC = React.memo((props) => { + const { cases } = useKibana().services; + const casePermissions = cases.helpers.canUseCases(); + const CasesContext = cases.ui.getCasesContext(); + + return ( + + {' '} + + ); +}); + +AddToCaseWrapper.displayName = 'AddToCaseWrapper'; diff --git a/x-pack/plugins/osquery/public/cases/add_to_cases_button.tsx b/x-pack/plugins/osquery/public/cases/add_to_cases_button.tsx index 9f2df87f35615..7124ebd955490 100644 --- a/x-pack/plugins/osquery/public/cases/add_to_cases_button.tsx +++ b/x-pack/plugins/osquery/public/cases/add_to_cases_button.tsx @@ -19,7 +19,7 @@ const ADD_TO_CASE = i18n.translate( } ); -interface IProps { +export interface AddToCaseButtonProps { queryId: string; agentIds?: string[]; actionId: string; @@ -28,7 +28,7 @@ interface IProps { iconProps?: Record; } -export const AddToCaseButton: React.FC = ({ +export const AddToCaseButton: React.FC = ({ actionId, agentIds = [], queryId = '', diff --git a/x-pack/plugins/osquery/public/common/schemas/ecs/v8.4.0.json b/x-pack/plugins/osquery/public/common/schemas/ecs/v8.4.0.json deleted file mode 100644 index 212a0f6b44b23..0000000000000 --- a/x-pack/plugins/osquery/public/common/schemas/ecs/v8.4.0.json +++ /dev/null @@ -1 +0,0 @@ -[{"field":"labels","type":"object","normalization":"","example":{"application":"foo-bar","env":"production"},"description":"Custom key/value pairs."},{"field":"message","type":"match_only_text","normalization":"","example":"Hello World","description":"Log message optimized for viewing in a log viewer."},{"field":"tags","type":"keyword","normalization":"array","example":["production","env2"],"description":"List of keywords used to tag each event."},{"field":"agent.build.original","type":"keyword","normalization":"","example":"metricbeat version 7.6.0 (amd64), libbeat 7.6.0 [6a23e8f8f30f5001ba344e4e54d8d9cb82cb107c built 2020-02-05 23:10:10 +0000 UTC]","description":"Extended build information for the agent."},{"field":"client.address","type":"keyword","normalization":"","example":"","description":"Client network address."},{"field":"client.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"client.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"client.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"client.bytes","type":"long","normalization":"","example":184,"description":"Bytes sent from the client to the server."},{"field":"client.domain","type":"keyword","normalization":"","example":"foo.example.com","description":"The domain name of the client."},{"field":"client.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"client.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"client.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"client.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"client.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"client.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"client.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"client.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"client.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"client.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"client.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"client.ip","type":"ip","normalization":"","example":"","description":"IP address of the client."},{"field":"client.mac","type":"keyword","normalization":"","example":"00-00-5E-00-53-23","description":"MAC address of the client."},{"field":"client.nat.ip","type":"ip","normalization":"","example":"","description":"Client NAT ip address"},{"field":"client.nat.port","type":"long","normalization":"","example":"","description":"Client NAT port"},{"field":"client.packets","type":"long","normalization":"","example":12,"description":"Packets sent from the client to the server."},{"field":"client.port","type":"long","normalization":"","example":"","description":"Port of the client."},{"field":"client.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered client domain, stripped of the subdomain."},{"field":"client.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"client.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"client.user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"client.user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"client.user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"client.user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"client.user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"client.user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"client.user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"client.user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"client.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"client.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"client.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"client.user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"cloud.account.id","type":"keyword","normalization":"","example":666777888999,"description":"The cloud account or organization id."},{"field":"cloud.account.name","type":"keyword","normalization":"","example":"elastic-dev","description":"The cloud account name."},{"field":"cloud.availability_zone","type":"keyword","normalization":"","example":"us-east-1c","description":"Availability zone in which this host, resource, or service is located."},{"field":"cloud.instance.id","type":"keyword","normalization":"","example":"i-1234567890abcdef0","description":"Instance ID of the host machine."},{"field":"cloud.instance.name","type":"keyword","normalization":"","example":"","description":"Instance name of the host machine."},{"field":"cloud.machine.type","type":"keyword","normalization":"","example":"t2.medium","description":"Machine type of the host machine."},{"field":"cloud.origin.account.id","type":"keyword","normalization":"","example":666777888999,"description":"The cloud account or organization id."},{"field":"cloud.origin.account.name","type":"keyword","normalization":"","example":"elastic-dev","description":"The cloud account name."},{"field":"cloud.origin.availability_zone","type":"keyword","normalization":"","example":"us-east-1c","description":"Availability zone in which this host, resource, or service is located."},{"field":"cloud.origin.instance.id","type":"keyword","normalization":"","example":"i-1234567890abcdef0","description":"Instance ID of the host machine."},{"field":"cloud.origin.instance.name","type":"keyword","normalization":"","example":"","description":"Instance name of the host machine."},{"field":"cloud.origin.machine.type","type":"keyword","normalization":"","example":"t2.medium","description":"Machine type of the host machine."},{"field":"cloud.origin.project.id","type":"keyword","normalization":"","example":"my-project","description":"The cloud project id."},{"field":"cloud.origin.project.name","type":"keyword","normalization":"","example":"my project","description":"The cloud project name."},{"field":"cloud.origin.provider","type":"keyword","normalization":"","example":"aws","description":"Name of the cloud provider."},{"field":"cloud.origin.region","type":"keyword","normalization":"","example":"us-east-1","description":"Region in which this host, resource, or service is located."},{"field":"cloud.origin.service.name","type":"keyword","normalization":"","example":"lambda","description":"The cloud service name."},{"field":"cloud.project.id","type":"keyword","normalization":"","example":"my-project","description":"The cloud project id."},{"field":"cloud.project.name","type":"keyword","normalization":"","example":"my project","description":"The cloud project name."},{"field":"cloud.provider","type":"keyword","normalization":"","example":"aws","description":"Name of the cloud provider."},{"field":"cloud.region","type":"keyword","normalization":"","example":"us-east-1","description":"Region in which this host, resource, or service is located."},{"field":"cloud.service.name","type":"keyword","normalization":"","example":"lambda","description":"The cloud service name."},{"field":"cloud.target.account.id","type":"keyword","normalization":"","example":666777888999,"description":"The cloud account or organization id."},{"field":"cloud.target.account.name","type":"keyword","normalization":"","example":"elastic-dev","description":"The cloud account name."},{"field":"cloud.target.availability_zone","type":"keyword","normalization":"","example":"us-east-1c","description":"Availability zone in which this host, resource, or service is located."},{"field":"cloud.target.instance.id","type":"keyword","normalization":"","example":"i-1234567890abcdef0","description":"Instance ID of the host machine."},{"field":"cloud.target.instance.name","type":"keyword","normalization":"","example":"","description":"Instance name of the host machine."},{"field":"cloud.target.machine.type","type":"keyword","normalization":"","example":"t2.medium","description":"Machine type of the host machine."},{"field":"cloud.target.project.id","type":"keyword","normalization":"","example":"my-project","description":"The cloud project id."},{"field":"cloud.target.project.name","type":"keyword","normalization":"","example":"my project","description":"The cloud project name."},{"field":"cloud.target.provider","type":"keyword","normalization":"","example":"aws","description":"Name of the cloud provider."},{"field":"cloud.target.region","type":"keyword","normalization":"","example":"us-east-1","description":"Region in which this host, resource, or service is located."},{"field":"cloud.target.service.name","type":"keyword","normalization":"","example":"lambda","description":"The cloud service name."},{"field":"container.cpu.usage","type":"scaled_float","normalization":"","example":"","description":"Percent CPU used, between 0 and 1."},{"field":"container.disk.read.bytes","type":"long","normalization":"","example":"","description":"The number of bytes read by all disks."},{"field":"container.disk.write.bytes","type":"long","normalization":"","example":"","description":"The number of bytes written on all disks."},{"field":"container.id","type":"keyword","normalization":"","example":"","description":"Unique container id."},{"field":"container.image.hash.all","type":"keyword","normalization":"array","example":"[sha256:f8fefc80e3273dc756f288a63945820d6476ad64883892c771b5e2ece6bf1b26]","description":"An array of digests of the image the container was built on."},{"field":"container.image.name","type":"keyword","normalization":"","example":"","description":"Name of the image the container was built on."},{"field":"container.image.tag","type":"keyword","normalization":"array","example":"","description":"Container image tags."},{"field":"container.labels","type":"object","normalization":"","example":"","description":"Image labels."},{"field":"container.memory.usage","type":"scaled_float","normalization":"","example":"","description":"Percent memory used, between 0 and 1."},{"field":"container.name","type":"keyword","normalization":"","example":"","description":"Container name."},{"field":"container.network.egress.bytes","type":"long","normalization":"","example":"","description":"The number of bytes sent on all network interfaces."},{"field":"container.network.ingress.bytes","type":"long","normalization":"","example":"","description":"The number of bytes received on all network interfaces."},{"field":"container.runtime","type":"keyword","normalization":"","example":"docker","description":"Runtime managing this container."},{"field":"data_stream.dataset","type":"constant_keyword","normalization":"","example":"nginx.access","description":"The field can contain anything that makes sense to signify the source of the data."},{"field":"data_stream.namespace","type":"constant_keyword","normalization":"","example":"production","description":"A user defined namespace. Namespaces are useful to allow grouping of data."},{"field":"data_stream.type","type":"constant_keyword","normalization":"","example":"logs","description":"An overarching type for the data stream."},{"field":"destination.address","type":"keyword","normalization":"","example":"","description":"Destination network address."},{"field":"destination.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"destination.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"destination.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"destination.bytes","type":"long","normalization":"","example":184,"description":"Bytes sent from the destination to the source."},{"field":"destination.domain","type":"keyword","normalization":"","example":"foo.example.com","description":"The domain name of the destination."},{"field":"destination.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"destination.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"destination.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"destination.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"destination.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"destination.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"destination.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"destination.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"destination.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"destination.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"destination.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"destination.ip","type":"ip","normalization":"","example":"","description":"IP address of the destination."},{"field":"destination.mac","type":"keyword","normalization":"","example":"00-00-5E-00-53-23","description":"MAC address of the destination."},{"field":"destination.nat.ip","type":"ip","normalization":"","example":"","description":"Destination NAT ip"},{"field":"destination.nat.port","type":"long","normalization":"","example":"","description":"Destination NAT Port"},{"field":"destination.packets","type":"long","normalization":"","example":12,"description":"Packets sent from the destination to the source."},{"field":"destination.port","type":"long","normalization":"","example":"","description":"Port of the destination."},{"field":"destination.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered destination domain, stripped of the subdomain."},{"field":"destination.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"destination.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"destination.user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"destination.user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"destination.user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"destination.user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"destination.user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"destination.user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"destination.user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"destination.user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"destination.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"destination.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"destination.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"destination.user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"dll.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"dll.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"dll.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"dll.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"dll.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"dll.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"dll.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"dll.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"dll.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"dll.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"dll.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"dll.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"dll.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"dll.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"dll.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"dll.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"dll.name","type":"keyword","normalization":"","example":"kernel32.dll","description":"Name of the library."},{"field":"dll.path","type":"keyword","normalization":"","example":"C:\\Windows\\System32\\kernel32.dll","description":"Full file path of the library."},{"field":"dll.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"dll.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"dll.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"dll.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"dll.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"dll.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"dll.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"dll.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"dns.answers","type":"object","normalization":"array","example":"","description":"Array of DNS answers."},{"field":"dns.answers.class","type":"keyword","normalization":"","example":"IN","description":"The class of DNS data contained in this resource record."},{"field":"dns.answers.data","type":"keyword","normalization":"","example":"10.10.10.10","description":"The data describing the resource."},{"field":"dns.answers.name","type":"keyword","normalization":"","example":"www.example.com","description":"The domain name to which this resource record pertains."},{"field":"dns.answers.ttl","type":"long","normalization":"","example":180,"description":"The time interval in seconds that this resource record may be cached before it should be discarded."},{"field":"dns.answers.type","type":"keyword","normalization":"","example":"CNAME","description":"The type of data contained in this resource record."},{"field":"dns.header_flags","type":"keyword","normalization":"array","example":["RD","RA"],"description":"Array of DNS header flags."},{"field":"dns.id","type":"keyword","normalization":"","example":62111,"description":"The DNS packet identifier assigned by the program that generated the query. The identifier is copied to the response."},{"field":"dns.op_code","type":"keyword","normalization":"","example":"QUERY","description":"The DNS operation code that specifies the kind of query in the message."},{"field":"dns.question.class","type":"keyword","normalization":"","example":"IN","description":"The class of records being queried."},{"field":"dns.question.name","type":"keyword","normalization":"","example":"www.example.com","description":"The name being queried."},{"field":"dns.question.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered domain, stripped of the subdomain."},{"field":"dns.question.subdomain","type":"keyword","normalization":"","example":"www","description":"The subdomain of the domain."},{"field":"dns.question.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"dns.question.type","type":"keyword","normalization":"","example":"AAAA","description":"The type of record being queried."},{"field":"dns.resolved_ip","type":"ip","normalization":"array","example":["10.10.10.10","10.10.10.11"],"description":"Array containing all IPs seen in answers.data"},{"field":"dns.response_code","type":"keyword","normalization":"","example":"NOERROR","description":"The DNS response code."},{"field":"dns.type","type":"keyword","normalization":"","example":"answer","description":"The type of DNS event captured, query or answer."},{"field":"email.attachments","type":"nested","normalization":"array","example":"","description":"List of objects describing the attachments."},{"field":"email.attachments.file.extension","type":"keyword","normalization":"","example":"txt","description":"Attachment file extension."},{"field":"email.attachments.file.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"email.attachments.file.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"email.attachments.file.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"email.attachments.file.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"email.attachments.file.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"email.attachments.file.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"email.attachments.file.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"email.attachments.file.mime_type","type":"keyword","normalization":"","example":"text/plain","description":"MIME type of the attachment file."},{"field":"email.attachments.file.name","type":"keyword","normalization":"","example":"attachment.txt","description":"Name of the attachment file."},{"field":"email.attachments.file.size","type":"long","normalization":"","example":64329,"description":"Attachment file size."},{"field":"email.bcc.address","type":"keyword","normalization":"array","example":"bcc.user1@example.com","description":"Email address of BCC recipient"},{"field":"email.cc.address","type":"keyword","normalization":"array","example":"cc.user1@example.com","description":"Email address of CC recipient"},{"field":"email.content_type","type":"keyword","normalization":"","example":"text/plain","description":"MIME type of the email message."},{"field":"email.delivery_timestamp","type":"date","normalization":"","example":"2020-11-10T22:12:34.8196921Z","description":"Date and time when message was delivered."},{"field":"email.direction","type":"keyword","normalization":"","example":"inbound","description":"Direction of the message."},{"field":"email.from.address","type":"keyword","normalization":"array","example":"sender@example.com","description":"The sender's email address."},{"field":"email.local_id","type":"keyword","normalization":"","example":"c26dbea0-80d5-463b-b93c-4e8b708219ce","description":"Unique identifier given by the source."},{"field":"email.message_id","type":"wildcard","normalization":"","example":"81ce15$8r2j59@mail01.example.com","description":"Value from the Message-ID header."},{"field":"email.origination_timestamp","type":"date","normalization":"","example":"2020-11-10T22:12:34.8196921Z","description":"Date and time the email was composed."},{"field":"email.reply_to.address","type":"keyword","normalization":"array","example":"reply.here@example.com","description":"Address replies should be delivered to."},{"field":"email.sender.address","type":"keyword","normalization":"","example":"","description":"Address of the message sender."},{"field":"email.subject","type":"keyword","normalization":"","example":"Please see this important message.","description":"The subject of the email message."},{"field":"email.subject.text","type":"match_only_text","normalization":"","example":"Please see this important message.","description":"The subject of the email message."},{"field":"email.to.address","type":"keyword","normalization":"array","example":"user1@example.com","description":"Email address of recipient"},{"field":"email.x_mailer","type":"keyword","normalization":"","example":"Spambot v2.5","description":"Application that drafted email."},{"field":"error.code","type":"keyword","normalization":"","example":"","description":"Error code describing the error."},{"field":"error.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the error."},{"field":"error.message","type":"match_only_text","normalization":"","example":"","description":"Error message."},{"field":"error.stack_trace","type":"wildcard","normalization":"","example":"","description":"The stack trace of this error in plain text."},{"field":"error.stack_trace.text","type":"match_only_text","normalization":"","example":"","description":"The stack trace of this error in plain text."},{"field":"error.type","type":"keyword","normalization":"","example":"java.lang.NullPointerException","description":"The type of the error, for example the class name of the exception."},{"field":"event.action","type":"keyword","normalization":"","example":"user-password-change","description":"The action captured by the event."},{"field":"event.category","type":"keyword","normalization":"array","example":"authentication","description":"Event category. The second categorization field in the hierarchy."},{"field":"event.code","type":"keyword","normalization":"","example":4648,"description":"Identification code for this event."},{"field":"event.created","type":"date","normalization":"","example":"2016-05-23T08:05:34.857Z","description":"Time when the event was first read by an agent or by your pipeline."},{"field":"event.dataset","type":"keyword","normalization":"","example":"apache.access","description":"Name of the dataset."},{"field":"event.duration","type":"long","normalization":"","example":"","description":"Duration of the event in nanoseconds."},{"field":"event.end","type":"date","normalization":"","example":"","description":"event.end contains the date when the event ended or when the activity was last observed."},{"field":"event.hash","type":"keyword","normalization":"","example":"123456789012345678901234567890ABCD","description":"Hash (perhaps logstash fingerprint) of raw field to be able to demonstrate log integrity."},{"field":"event.id","type":"keyword","normalization":"","example":"8a4f500d","description":"Unique ID to describe the event."},{"field":"event.kind","type":"keyword","normalization":"","example":"alert","description":"The kind of the event. The highest categorization field in the hierarchy."},{"field":"event.original","type":"keyword","normalization":"","example":"Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100| worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232","description":"Raw text message of entire event."},{"field":"event.outcome","type":"keyword","normalization":"","example":"success","description":"The outcome of the event. The lowest level categorization field in the hierarchy."},{"field":"event.provider","type":"keyword","normalization":"","example":"kernel","description":"Source of the event."},{"field":"event.reason","type":"keyword","normalization":"","example":"Terminated an unexpected process","description":"Reason why this event happened, according to the source"},{"field":"event.reference","type":"keyword","normalization":"","example":"https://system.example.com/event/#0001234","description":"Event reference URL"},{"field":"event.risk_score","type":"float","normalization":"","example":"","description":"Risk score or priority of the event (e.g. security solutions). Use your system's original value here."},{"field":"event.risk_score_norm","type":"float","normalization":"","example":"","description":"Normalized risk score or priority of the event (0-100)."},{"field":"event.sequence","type":"long","normalization":"","example":"","description":"Sequence number of the event."},{"field":"event.severity","type":"long","normalization":"","example":7,"description":"Numeric severity of the event."},{"field":"event.start","type":"date","normalization":"","example":"","description":"event.start contains the date when the event started or when the activity was first observed."},{"field":"event.timezone","type":"keyword","normalization":"","example":"","description":"Event time zone."},{"field":"event.type","type":"keyword","normalization":"array","example":"","description":"Event type. The third categorization field in the hierarchy."},{"field":"event.url","type":"keyword","normalization":"","example":"https://mysystem.example.com/alert/5271dedb-f5b0-4218-87f0-4ac4870a38fe","description":"Event investigation URL"},{"field":"faas.coldstart","type":"boolean","normalization":"","example":"","description":"Boolean value indicating a cold start of a function."},{"field":"faas.execution","type":"keyword","normalization":"","example":"af9d5aa4-a685-4c5f-a22b-444f80b3cc28","description":"The execution ID of the current function execution."},{"field":"faas.id","type":"keyword","normalization":"","example":"arn:aws:lambda:us-west-2:123456789012:function:my-function","description":"The unique identifier of a serverless function."},{"field":"faas.name","type":"keyword","normalization":"","example":"my-function","description":"The name of a serverless function."},{"field":"faas.trigger","type":"nested","normalization":"","example":"","description":"Details about the function trigger."},{"field":"faas.trigger.request_id","type":"keyword","normalization":"","example":123456789,"description":"The ID of the trigger request , message, event, etc."},{"field":"faas.trigger.type","type":"keyword","normalization":"","example":"http","description":"The trigger for the function execution."},{"field":"faas.version","type":"keyword","normalization":"","example":123,"description":"The version of a serverless function."},{"field":"file.accessed","type":"date","normalization":"","example":"","description":"Last time the file was accessed."},{"field":"file.attributes","type":"keyword","normalization":"array","example":["readonly","system"],"description":"Array of file attributes."},{"field":"file.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"file.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"file.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"file.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"file.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"file.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"file.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"file.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"file.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"file.created","type":"date","normalization":"","example":"","description":"File creation time."},{"field":"file.ctime","type":"date","normalization":"","example":"","description":"Last time the file attributes or metadata changed."},{"field":"file.device","type":"keyword","normalization":"","example":"sda","description":"Device that is the source of the file."},{"field":"file.directory","type":"keyword","normalization":"","example":"/home/alice","description":"Directory where the file is located."},{"field":"file.drive_letter","type":"keyword","normalization":"","example":"C","description":"Drive letter where the file is located."},{"field":"file.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"file.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"file.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"file.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"file.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"file.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"file.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"file.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"file.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"file.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"file.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"file.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"file.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"file.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"file.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"file.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"file.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"file.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"file.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"file.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"file.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"file.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"file.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"file.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"file.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"file.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"file.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"file.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"file.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"file.extension","type":"keyword","normalization":"","example":"png","description":"File extension, excluding the leading dot."},{"field":"file.fork_name","type":"keyword","normalization":"","example":"Zone.Identifer","description":"A fork is additional data associated with a filesystem object."},{"field":"file.gid","type":"keyword","normalization":"","example":1001,"description":"Primary group ID (GID) of the file."},{"field":"file.group","type":"keyword","normalization":"","example":"alice","description":"Primary group name of the file."},{"field":"file.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"file.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"file.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"file.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"file.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"file.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"file.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"file.inode","type":"keyword","normalization":"","example":256383,"description":"Inode representing the file in the filesystem."},{"field":"file.mime_type","type":"keyword","normalization":"","example":"","description":"Media type of file, document, or arrangement of bytes."},{"field":"file.mode","type":"keyword","normalization":"","example":"0640","description":"Mode of the file in octal representation."},{"field":"file.mtime","type":"date","normalization":"","example":"","description":"Last time the file content was modified."},{"field":"file.name","type":"keyword","normalization":"","example":"example.png","description":"Name of the file including the extension, without the directory."},{"field":"file.owner","type":"keyword","normalization":"","example":"alice","description":"File owner's username."},{"field":"file.path","type":"keyword","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"file.path.text","type":"match_only_text","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"file.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"file.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"file.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"file.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"file.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"file.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"file.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"file.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"file.size","type":"long","normalization":"","example":16384,"description":"File size in bytes."},{"field":"file.target_path","type":"keyword","normalization":"","example":"","description":"Target path for symlinks."},{"field":"file.target_path.text","type":"match_only_text","normalization":"","example":"","description":"Target path for symlinks."},{"field":"file.type","type":"keyword","normalization":"","example":"file","description":"File type (file, dir, or symlink)."},{"field":"file.uid","type":"keyword","normalization":"","example":1001,"description":"The user ID (UID) or security identifier (SID) of the file owner."},{"field":"file.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"file.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"file.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"file.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"file.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"file.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"file.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"file.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"file.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"file.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"file.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"file.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"file.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"file.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"file.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"file.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"file.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"file.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"file.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"file.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"file.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"file.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"file.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"file.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"host.boot.id","type":"keyword","normalization":"","example":"88a1f0ed-5ae5-41ee-af6b-41921c311872","description":"Linux boot uuid taken from /proc/sys/kernel/random/boot_id"},{"field":"host.cpu.usage","type":"scaled_float","normalization":"","example":"","description":"Percent CPU used, between 0 and 1."},{"field":"host.disk.read.bytes","type":"long","normalization":"","example":"","description":"The number of bytes read by all disks."},{"field":"host.disk.write.bytes","type":"long","normalization":"","example":"","description":"The number of bytes written on all disks."},{"field":"host.domain","type":"keyword","normalization":"","example":"CONTOSO","description":"Name of the directory the group is a member of."},{"field":"host.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"host.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"host.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"host.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"host.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"host.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"host.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"host.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"host.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"host.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"host.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"host.name","type":"keyword","normalization":"","example":"","description":"Name of the host."},{"field":"host.network.egress.bytes","type":"long","normalization":"","example":"","description":"The number of bytes sent on all network interfaces."},{"field":"host.network.egress.packets","type":"long","normalization":"","example":"","description":"The number of packets sent on all network interfaces."},{"field":"host.network.ingress.bytes","type":"long","normalization":"","example":"","description":"The number of bytes received on all network interfaces."},{"field":"host.network.ingress.packets","type":"long","normalization":"","example":"","description":"The number of packets received on all network interfaces."},{"field":"host.os.full","type":"keyword","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"host.os.full.text","type":"match_only_text","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"host.os.name.text","type":"match_only_text","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"host.os.platform","type":"keyword","normalization":"","example":"darwin","description":"Operating system platform (such centos, ubuntu, windows)."},{"field":"host.pid_ns_ino","type":"keyword","normalization":"","example":256383,"description":"Pid namespace inode"},{"field":"host.type","type":"keyword","normalization":"","example":"","description":"Type of host."},{"field":"host.uptime","type":"long","normalization":"","example":1325,"description":"Seconds the host has been up."},{"field":"http.request.body.bytes","type":"long","normalization":"","example":887,"description":"Size in bytes of the request body."},{"field":"http.request.body.content","type":"wildcard","normalization":"","example":"Hello world","description":"The full HTTP request body."},{"field":"http.request.body.content.text","type":"match_only_text","normalization":"","example":"Hello world","description":"The full HTTP request body."},{"field":"http.request.bytes","type":"long","normalization":"","example":1437,"description":"Total size in bytes of the request (body and headers)."},{"field":"http.request.id","type":"keyword","normalization":"","example":"123e4567-e89b-12d3-a456-426614174000","description":"HTTP request ID."},{"field":"http.request.method","type":"keyword","normalization":"","example":"POST","description":"HTTP request method."},{"field":"http.request.mime_type","type":"keyword","normalization":"","example":"image/gif","description":"Mime type of the body of the request."},{"field":"http.request.referrer","type":"keyword","normalization":"","example":"https://blog.example.com/","description":"Referrer for this HTTP request."},{"field":"http.response.body.bytes","type":"long","normalization":"","example":887,"description":"Size in bytes of the response body."},{"field":"http.response.body.content","type":"wildcard","normalization":"","example":"Hello world","description":"The full HTTP response body."},{"field":"http.response.body.content.text","type":"match_only_text","normalization":"","example":"Hello world","description":"The full HTTP response body."},{"field":"http.response.bytes","type":"long","normalization":"","example":1437,"description":"Total size in bytes of the response (body and headers)."},{"field":"http.response.mime_type","type":"keyword","normalization":"","example":"image/gif","description":"Mime type of the body of the response."},{"field":"http.response.status_code","type":"long","normalization":"","example":404,"description":"HTTP response status code."},{"field":"http.version","type":"keyword","normalization":"","example":1.1,"description":"HTTP version."},{"field":"log.file.path","type":"keyword","normalization":"","example":"/var/log/fun-times.log","description":"Full path to the log file this event came from."},{"field":"log.level","type":"keyword","normalization":"","example":"error","description":"Log level of the log event."},{"field":"log.logger","type":"keyword","normalization":"","example":"org.elasticsearch.bootstrap.Bootstrap","description":"Name of the logger."},{"field":"log.origin.file.line","type":"long","normalization":"","example":42,"description":"The line number of the file which originated the log event."},{"field":"log.origin.file.name","type":"keyword","normalization":"","example":"Bootstrap.java","description":"The code file which originated the log event."},{"field":"log.origin.function","type":"keyword","normalization":"","example":"init","description":"The function which originated the log event."},{"field":"log.syslog","type":"object","normalization":"","example":"","description":"Syslog metadata"},{"field":"log.syslog.appname","type":"keyword","normalization":"","example":"sshd","description":"The device or application that originated the Syslog message."},{"field":"log.syslog.facility.code","type":"long","normalization":"","example":23,"description":"Syslog numeric facility of the event."},{"field":"log.syslog.facility.name","type":"keyword","normalization":"","example":"local7","description":"Syslog text-based facility of the event."},{"field":"log.syslog.hostname","type":"keyword","normalization":"","example":"example-host","description":"The host that originated the Syslog message."},{"field":"log.syslog.msgid","type":"keyword","normalization":"","example":"ID47","description":"An identifier for the type of Syslog message."},{"field":"log.syslog.priority","type":"long","normalization":"","example":135,"description":"Syslog priority of the event."},{"field":"log.syslog.procid","type":"keyword","normalization":"","example":12345,"description":"The process name or ID that originated the Syslog message."},{"field":"log.syslog.severity.code","type":"long","normalization":"","example":3,"description":"Syslog numeric severity of the event."},{"field":"log.syslog.severity.name","type":"keyword","normalization":"","example":"Error","description":"Syslog text-based severity of the event."},{"field":"log.syslog.structured_data","type":"flattened","normalization":"","example":"","description":"Structured data expressed in RFC 5424 messages."},{"field":"log.syslog.version","type":"keyword","normalization":"","example":1,"description":"Syslog protocol version."},{"field":"network.application","type":"keyword","normalization":"","example":"aim","description":"Application level protocol name."},{"field":"network.bytes","type":"long","normalization":"","example":368,"description":"Total bytes transferred in both directions."},{"field":"network.community_id","type":"keyword","normalization":"","example":"1:hO+sN4H+MG5MY/8hIrXPqc4ZQz0=","description":"A hash of source and destination IPs and ports."},{"field":"network.direction","type":"keyword","normalization":"","example":"inbound","description":"Direction of the network traffic."},{"field":"network.forwarded_ip","type":"ip","normalization":"","example":"192.1.1.2","description":"Host IP address when the source IP address is the proxy."},{"field":"network.iana_number","type":"keyword","normalization":"","example":6,"description":"IANA Protocol Number."},{"field":"network.inner","type":"object","normalization":"","example":"","description":"Inner VLAN tag information"},{"field":"network.inner.vlan.id","type":"keyword","normalization":"","example":10,"description":"VLAN ID as reported by the observer."},{"field":"network.inner.vlan.name","type":"keyword","normalization":"","example":"outside","description":"Optional VLAN name as reported by the observer."},{"field":"network.name","type":"keyword","normalization":"","example":"Guest Wifi","description":"Name given by operators to sections of their network."},{"field":"network.packets","type":"long","normalization":"","example":24,"description":"Total packets transferred in both directions."},{"field":"network.protocol","type":"keyword","normalization":"","example":"http","description":"Application protocol name."},{"field":"network.transport","type":"keyword","normalization":"","example":"tcp","description":"Protocol Name corresponding to the field `iana_number`."},{"field":"network.type","type":"keyword","normalization":"","example":"ipv4","description":"In the OSI Model this would be the Network Layer. ipv4, ipv6, ipsec, pim, etc"},{"field":"network.vlan.id","type":"keyword","normalization":"","example":10,"description":"VLAN ID as reported by the observer."},{"field":"network.vlan.name","type":"keyword","normalization":"","example":"outside","description":"Optional VLAN name as reported by the observer."},{"field":"observer.egress","type":"object","normalization":"","example":"","description":"Object field for egress information"},{"field":"observer.egress.interface.alias","type":"keyword","normalization":"","example":"outside","description":"Interface alias"},{"field":"observer.egress.interface.id","type":"keyword","normalization":"","example":10,"description":"Interface ID"},{"field":"observer.egress.interface.name","type":"keyword","normalization":"","example":"eth0","description":"Interface name"},{"field":"observer.egress.vlan.id","type":"keyword","normalization":"","example":10,"description":"VLAN ID as reported by the observer."},{"field":"observer.egress.vlan.name","type":"keyword","normalization":"","example":"outside","description":"Optional VLAN name as reported by the observer."},{"field":"observer.egress.zone","type":"keyword","normalization":"","example":"Public_Internet","description":"Observer Egress zone"},{"field":"observer.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"observer.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"observer.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"observer.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"observer.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"observer.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"observer.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"observer.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"observer.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"observer.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"observer.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"observer.hostname","type":"keyword","normalization":"","example":"","description":"Hostname of the observer."},{"field":"observer.ingress","type":"object","normalization":"","example":"","description":"Object field for ingress information"},{"field":"observer.ingress.interface.alias","type":"keyword","normalization":"","example":"outside","description":"Interface alias"},{"field":"observer.ingress.interface.id","type":"keyword","normalization":"","example":10,"description":"Interface ID"},{"field":"observer.ingress.interface.name","type":"keyword","normalization":"","example":"eth0","description":"Interface name"},{"field":"observer.ingress.vlan.id","type":"keyword","normalization":"","example":10,"description":"VLAN ID as reported by the observer."},{"field":"observer.ingress.vlan.name","type":"keyword","normalization":"","example":"outside","description":"Optional VLAN name as reported by the observer."},{"field":"observer.ingress.zone","type":"keyword","normalization":"","example":"DMZ","description":"Observer ingress zone"},{"field":"observer.ip","type":"ip","normalization":"array","example":"","description":"IP addresses of the observer."},{"field":"observer.mac","type":"keyword","normalization":"array","example":["00-00-5E-00-53-23","00-00-5E-00-53-24"],"description":"MAC addresses of the observer."},{"field":"observer.name","type":"keyword","normalization":"","example":"1_proxySG","description":"Custom name of the observer."},{"field":"observer.os.family","type":"keyword","normalization":"","example":"debian","description":"OS family (such as redhat, debian, freebsd, windows)."},{"field":"observer.os.full","type":"keyword","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"observer.os.full.text","type":"match_only_text","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"observer.os.kernel","type":"keyword","normalization":"","example":"4.4.0-112-generic","description":"Operating system kernel version as a raw string."},{"field":"observer.os.name","type":"keyword","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"observer.os.name.text","type":"match_only_text","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"observer.os.platform","type":"keyword","normalization":"","example":"darwin","description":"Operating system platform (such centos, ubuntu, windows)."},{"field":"observer.os.type","type":"keyword","normalization":"","example":"macos","description":"Which commercial OS family (one of: linux, macos, unix or windows)."},{"field":"observer.os.version","type":"keyword","normalization":"","example":"10.14.1","description":"Operating system version as a raw string."},{"field":"observer.product","type":"keyword","normalization":"","example":"s200","description":"The product name of the observer."},{"field":"observer.serial_number","type":"keyword","normalization":"","example":"","description":"Observer serial number."},{"field":"observer.type","type":"keyword","normalization":"","example":"firewall","description":"The type of the observer the data is coming from."},{"field":"observer.vendor","type":"keyword","normalization":"","example":"Symantec","description":"Vendor name of the observer."},{"field":"observer.version","type":"keyword","normalization":"","example":"","description":"Observer version."},{"field":"orchestrator.api_version","type":"keyword","normalization":"","example":"v1beta1","description":"API version being used to carry out the action"},{"field":"orchestrator.cluster.id","type":"keyword","normalization":"","example":"","description":"Unique ID of the cluster."},{"field":"orchestrator.cluster.name","type":"keyword","normalization":"","example":"","description":"Name of the cluster."},{"field":"orchestrator.cluster.url","type":"keyword","normalization":"","example":"","description":"URL of the API used to manage the cluster."},{"field":"orchestrator.cluster.version","type":"keyword","normalization":"","example":"","description":"The version of the cluster."},{"field":"orchestrator.namespace","type":"keyword","normalization":"","example":"kube-system","description":"Namespace in which the action is taking place."},{"field":"orchestrator.organization","type":"keyword","normalization":"","example":"elastic","description":"Organization affected by the event (for multi-tenant orchestrator setups)."},{"field":"orchestrator.resource.id","type":"keyword","normalization":"","example":"","description":"Unique ID of the resource being acted upon."},{"field":"orchestrator.resource.ip","type":"ip","normalization":"array","example":"","description":"IP address assigned to the resource associated with the event being observed."},{"field":"orchestrator.resource.name","type":"keyword","normalization":"","example":"test-pod-cdcws","description":"Name of the resource being acted upon."},{"field":"orchestrator.resource.parent.type","type":"keyword","normalization":"","example":"DaemonSet","description":"Type or kind of the parent resource associated with the event being observed."},{"field":"orchestrator.resource.type","type":"keyword","normalization":"","example":"service","description":"Type of resource being acted upon."},{"field":"orchestrator.type","type":"keyword","normalization":"","example":"kubernetes","description":"Orchestrator cluster type (e.g. kubernetes, nomad or cloudfoundry)."},{"field":"organization.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the organization."},{"field":"organization.name","type":"keyword","normalization":"","example":"","description":"Organization name."},{"field":"organization.name.text","type":"match_only_text","normalization":"","example":"","description":"Organization name."},{"field":"package.architecture","type":"keyword","normalization":"","example":"x86_64","description":"Package architecture."},{"field":"package.build_version","type":"keyword","normalization":"","example":"36f4f7e89dd61b0988b12ee000b98966867710cd","description":"Build version information"},{"field":"package.checksum","type":"keyword","normalization":"","example":"68b329da9893e34099c7d8ad5cb9c940","description":"Checksum of the installed package for verification."},{"field":"package.description","type":"keyword","normalization":"","example":"Open source programming language to build simple/reliable/efficient software.","description":"Description of the package."},{"field":"package.install_scope","type":"keyword","normalization":"","example":"global","description":"Indicating how the package was installed, e.g. user-local, global."},{"field":"package.installed","type":"date","normalization":"","example":"","description":"Time when package was installed."},{"field":"package.license","type":"keyword","normalization":"","example":"Apache License 2.0","description":"Package license"},{"field":"package.name","type":"keyword","normalization":"","example":"go","description":"Package name"},{"field":"package.path","type":"keyword","normalization":"","example":"/usr/local/Cellar/go/1.12.9/","description":"Path where the package is installed."},{"field":"package.reference","type":"keyword","normalization":"","example":"https://golang.org","description":"Package home page or reference URL"},{"field":"package.size","type":"long","normalization":"","example":62231,"description":"Package size in bytes."},{"field":"package.type","type":"keyword","normalization":"","example":"rpm","description":"Package type"},{"field":"package.version","type":"keyword","normalization":"","example":"1.12.9","description":"Package version"},{"field":"process.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"process.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"process.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"process.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"process.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"process.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"process.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"process.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"process.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"process.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"process.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"process.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"process.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"process.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"process.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"process.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"process.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"process.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"process.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"process.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"process.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"process.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"process.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"process.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"process.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"process.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"process.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"process.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"process.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"process.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"process.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"process.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"process.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"process.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"process.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"process.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"process.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"process.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"process.end","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process ended."},{"field":"process.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.entry_leader.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.entry_leader.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.entry_leader.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.entry_leader.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.entry_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.entry_leader.entry_meta.source.ip","type":"ip","normalization":"","example":"","description":"IP address of the source."},{"field":"process.entry_leader.entry_meta.type","type":"keyword","normalization":"","example":"","description":"The entry type for the entry session leader."},{"field":"process.entry_leader.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.entry_leader.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.entry_leader.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.entry_leader.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.entry_leader.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.entry_leader.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.entry_leader.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.entry_leader.parent.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.entry_leader.parent.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.entry_leader.parent.session_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.entry_leader.parent.session_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.entry_leader.parent.session_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.entry_leader.parent.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.entry_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.entry_leader.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.entry_leader.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.entry_leader.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.entry_leader.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.same_as_process","type":"boolean","normalization":"","example":"True","description":"This boolean is used to identify if a leader process is the same as the top level process."},{"field":"process.entry_leader.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.entry_leader.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.entry_leader.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.entry_leader.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.entry_leader.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.entry_leader.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.entry_leader.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.entry_leader.tty.char_device.major","type":"long","normalization":"","example":1,"description":"The TTY character device's major number."},{"field":"process.entry_leader.tty.char_device.minor","type":"long","normalization":"","example":128,"description":"The TTY character device's minor number."},{"field":"process.entry_leader.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.entry_leader.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.entry_leader.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.env_vars","type":"object","normalization":"","example":{"USER":"elastic","LANG":"en_US.UTF-8","HOME":"/home/elastic"},"description":"Environment variables set at the time of the event."},{"field":"process.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.exit_code","type":"long","normalization":"","example":137,"description":"The exit code of the process."},{"field":"process.group_leader.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.group_leader.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.group_leader.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.group_leader.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.group_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.group_leader.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.group_leader.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.group_leader.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.group_leader.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.group_leader.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.group_leader.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.group_leader.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.group_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.group_leader.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.group_leader.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.group_leader.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.group_leader.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.same_as_process","type":"boolean","normalization":"","example":"True","description":"This boolean is used to identify if a leader process is the same as the top level process."},{"field":"process.group_leader.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.group_leader.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.group_leader.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.group_leader.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.group_leader.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.group_leader.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.group_leader.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.group_leader.tty.char_device.major","type":"long","normalization":"","example":1,"description":"The TTY character device's major number."},{"field":"process.group_leader.tty.char_device.minor","type":"long","normalization":"","example":128,"description":"The TTY character device's minor number."},{"field":"process.group_leader.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.group_leader.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.group_leader.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"process.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"process.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"process.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"process.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"process.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"process.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"process.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.parent.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.parent.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.parent.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"process.parent.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"process.parent.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"process.parent.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"process.parent.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"process.parent.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"process.parent.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"process.parent.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"process.parent.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"process.parent.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.parent.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.parent.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"process.parent.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"process.parent.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"process.parent.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"process.parent.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"process.parent.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"process.parent.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"process.parent.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"process.parent.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"process.parent.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"process.parent.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"process.parent.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"process.parent.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"process.parent.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"process.parent.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"process.parent.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"process.parent.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"process.parent.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"process.parent.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"process.parent.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"process.parent.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"process.parent.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"process.parent.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"process.parent.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"process.parent.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"process.parent.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"process.parent.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"process.parent.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"process.parent.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"process.parent.end","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process ended."},{"field":"process.parent.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.parent.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.parent.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.parent.exit_code","type":"long","normalization":"","example":137,"description":"The exit code of the process."},{"field":"process.parent.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.parent.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.parent.group_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.parent.group_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.parent.group_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.parent.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"process.parent.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"process.parent.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"process.parent.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"process.parent.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"process.parent.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"process.parent.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"process.parent.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.parent.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.parent.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.parent.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"process.parent.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"process.parent.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"process.parent.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"process.parent.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"process.parent.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"process.parent.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"process.parent.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"process.parent.pgid","type":"long","normalization":"","example":"","description":"Deprecated identifier of the group of processes the process belongs to."},{"field":"process.parent.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.parent.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.parent.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.parent.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.parent.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.parent.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.parent.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.parent.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.parent.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.parent.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.parent.thread.id","type":"long","normalization":"","example":4242,"description":"Thread ID."},{"field":"process.parent.thread.name","type":"keyword","normalization":"","example":"thread-0","description":"Thread name."},{"field":"process.parent.title","type":"keyword","normalization":"","example":"","description":"Process title."},{"field":"process.parent.title.text","type":"match_only_text","normalization":"","example":"","description":"Process title."},{"field":"process.parent.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.parent.tty.char_device.major","type":"long","normalization":"","example":1,"description":"The TTY character device's major number."},{"field":"process.parent.tty.char_device.minor","type":"long","normalization":"","example":128,"description":"The TTY character device's minor number."},{"field":"process.parent.uptime","type":"long","normalization":"","example":1325,"description":"Seconds the process has been up."},{"field":"process.parent.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.parent.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.parent.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"process.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"process.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"process.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"process.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"process.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"process.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"process.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"process.pgid","type":"long","normalization":"","example":"","description":"Deprecated identifier of the group of processes the process belongs to."},{"field":"process.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.previous.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.previous.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.previous.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.previous.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.session_leader.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.session_leader.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.session_leader.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.session_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.session_leader.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.session_leader.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.session_leader.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.session_leader.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.session_leader.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.session_leader.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.session_leader.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.session_leader.parent.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.session_leader.parent.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.session_leader.parent.session_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.session_leader.parent.session_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.session_leader.parent.session_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.session_leader.parent.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.session_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.session_leader.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.session_leader.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.session_leader.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.session_leader.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.same_as_process","type":"boolean","normalization":"","example":"True","description":"This boolean is used to identify if a leader process is the same as the top level process."},{"field":"process.session_leader.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.session_leader.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.session_leader.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.session_leader.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.session_leader.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.session_leader.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.session_leader.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.session_leader.tty.char_device.major","type":"long","normalization":"","example":1,"description":"The TTY character device's major number."},{"field":"process.session_leader.tty.char_device.minor","type":"long","normalization":"","example":128,"description":"The TTY character device's minor number."},{"field":"process.session_leader.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.session_leader.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.session_leader.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.thread.id","type":"long","normalization":"","example":4242,"description":"Thread ID."},{"field":"process.thread.name","type":"keyword","normalization":"","example":"thread-0","description":"Thread name."},{"field":"process.title","type":"keyword","normalization":"","example":"","description":"Process title."},{"field":"process.title.text","type":"match_only_text","normalization":"","example":"","description":"Process title."},{"field":"process.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.tty.char_device.major","type":"long","normalization":"","example":1,"description":"The TTY character device's major number."},{"field":"process.tty.char_device.minor","type":"long","normalization":"","example":128,"description":"The TTY character device's minor number."},{"field":"process.uptime","type":"long","normalization":"","example":1325,"description":"Seconds the process has been up."},{"field":"process.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"registry.data.bytes","type":"keyword","normalization":"","example":"ZQBuAC0AVQBTAAAAZQBuAAAAAAA=","description":"Original bytes written with base64 encoding."},{"field":"registry.data.strings","type":"wildcard","normalization":"array","example":"[\"C:\\rta\\red_ttp\\bin\\myapp.exe\"]","description":"List of strings representing what was written to the registry."},{"field":"registry.data.type","type":"keyword","normalization":"","example":"REG_SZ","description":"Standard registry type for encoding contents"},{"field":"registry.hive","type":"keyword","normalization":"","example":"HKLM","description":"Abbreviated name for the hive."},{"field":"registry.key","type":"keyword","normalization":"","example":"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe","description":"Hive-relative path of keys."},{"field":"registry.path","type":"keyword","normalization":"","example":"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe\\Debugger","description":"Full path, including hive, key and value"},{"field":"registry.value","type":"keyword","normalization":"","example":"Debugger","description":"Name of the value written."},{"field":"related.hash","type":"keyword","normalization":"array","example":"","description":"All the hashes seen on your event."},{"field":"related.hosts","type":"keyword","normalization":"array","example":"","description":"All the host identifiers seen on your event."},{"field":"related.ip","type":"ip","normalization":"array","example":"","description":"All of the IPs seen on your event."},{"field":"related.user","type":"keyword","normalization":"array","example":"","description":"All the user names or other user identifiers seen on the event."},{"field":"rule.author","type":"keyword","normalization":"array","example":["Star-Lord"],"description":"Rule author"},{"field":"rule.category","type":"keyword","normalization":"","example":"Attempted Information Leak","description":"Rule category"},{"field":"rule.description","type":"keyword","normalization":"","example":"Block requests to public DNS over HTTPS / TLS protocols","description":"Rule description"},{"field":"rule.id","type":"keyword","normalization":"","example":101,"description":"Rule ID"},{"field":"rule.license","type":"keyword","normalization":"","example":"Apache 2.0","description":"Rule license"},{"field":"rule.name","type":"keyword","normalization":"","example":"BLOCK_DNS_over_TLS","description":"Rule name"},{"field":"rule.reference","type":"keyword","normalization":"","example":"https://en.wikipedia.org/wiki/DNS_over_TLS","description":"Rule reference URL"},{"field":"rule.ruleset","type":"keyword","normalization":"","example":"Standard_Protocol_Filters","description":"Rule ruleset"},{"field":"rule.uuid","type":"keyword","normalization":"","example":1100110011,"description":"Rule UUID"},{"field":"rule.version","type":"keyword","normalization":"","example":1.1,"description":"Rule version"},{"field":"server.address","type":"keyword","normalization":"","example":"","description":"Server network address."},{"field":"server.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"server.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"server.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"server.bytes","type":"long","normalization":"","example":184,"description":"Bytes sent from the server to the client."},{"field":"server.domain","type":"keyword","normalization":"","example":"foo.example.com","description":"The domain name of the server."},{"field":"server.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"server.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"server.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"server.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"server.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"server.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"server.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"server.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"server.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"server.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"server.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"server.ip","type":"ip","normalization":"","example":"","description":"IP address of the server."},{"field":"server.mac","type":"keyword","normalization":"","example":"00-00-5E-00-53-23","description":"MAC address of the server."},{"field":"server.nat.ip","type":"ip","normalization":"","example":"","description":"Server NAT ip"},{"field":"server.nat.port","type":"long","normalization":"","example":"","description":"Server NAT port"},{"field":"server.packets","type":"long","normalization":"","example":12,"description":"Packets sent from the server to the client."},{"field":"server.port","type":"long","normalization":"","example":"","description":"Port of the server."},{"field":"server.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered server domain, stripped of the subdomain."},{"field":"server.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"server.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"server.user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"server.user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"server.user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"server.user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"server.user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"server.user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"server.user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"server.user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"server.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"server.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"server.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"server.user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"service.address","type":"keyword","normalization":"","example":"172.26.0.2:5432","description":"Address of this service."},{"field":"service.environment","type":"keyword","normalization":"","example":"production","description":"Environment of the service."},{"field":"service.ephemeral_id","type":"keyword","normalization":"","example":"8a4f500f","description":"Ephemeral identifier of this service."},{"field":"service.id","type":"keyword","normalization":"","example":"d37e5ebfe0ae6c4972dbe9f0174a1637bb8247f6","description":"Unique identifier of the running service."},{"field":"service.name","type":"keyword","normalization":"","example":"elasticsearch-metrics","description":"Name of the service."},{"field":"service.node.name","type":"keyword","normalization":"","example":"instance-0000000016","description":"Name of the service node."},{"field":"service.node.role","type":"keyword","normalization":"","example":"background_tasks","description":"Deprecated role (singular) of the service node."},{"field":"service.node.roles","type":"keyword","normalization":"array","example":["ui","background_tasks"],"description":"Roles of the service node."},{"field":"service.origin.address","type":"keyword","normalization":"","example":"172.26.0.2:5432","description":"Address of this service."},{"field":"service.origin.environment","type":"keyword","normalization":"","example":"production","description":"Environment of the service."},{"field":"service.origin.ephemeral_id","type":"keyword","normalization":"","example":"8a4f500f","description":"Ephemeral identifier of this service."},{"field":"service.origin.id","type":"keyword","normalization":"","example":"d37e5ebfe0ae6c4972dbe9f0174a1637bb8247f6","description":"Unique identifier of the running service."},{"field":"service.origin.name","type":"keyword","normalization":"","example":"elasticsearch-metrics","description":"Name of the service."},{"field":"service.origin.node.name","type":"keyword","normalization":"","example":"instance-0000000016","description":"Name of the service node."},{"field":"service.origin.node.role","type":"keyword","normalization":"","example":"background_tasks","description":"Deprecated role (singular) of the service node."},{"field":"service.origin.node.roles","type":"keyword","normalization":"array","example":["ui","background_tasks"],"description":"Roles of the service node."},{"field":"service.origin.state","type":"keyword","normalization":"","example":"","description":"Current state of the service."},{"field":"service.origin.type","type":"keyword","normalization":"","example":"elasticsearch","description":"The type of the service."},{"field":"service.origin.version","type":"keyword","normalization":"","example":"3.2.4","description":"Version of the service."},{"field":"service.state","type":"keyword","normalization":"","example":"","description":"Current state of the service."},{"field":"service.target.address","type":"keyword","normalization":"","example":"172.26.0.2:5432","description":"Address of this service."},{"field":"service.target.environment","type":"keyword","normalization":"","example":"production","description":"Environment of the service."},{"field":"service.target.ephemeral_id","type":"keyword","normalization":"","example":"8a4f500f","description":"Ephemeral identifier of this service."},{"field":"service.target.id","type":"keyword","normalization":"","example":"d37e5ebfe0ae6c4972dbe9f0174a1637bb8247f6","description":"Unique identifier of the running service."},{"field":"service.target.name","type":"keyword","normalization":"","example":"elasticsearch-metrics","description":"Name of the service."},{"field":"service.target.node.name","type":"keyword","normalization":"","example":"instance-0000000016","description":"Name of the service node."},{"field":"service.target.node.role","type":"keyword","normalization":"","example":"background_tasks","description":"Deprecated role (singular) of the service node."},{"field":"service.target.node.roles","type":"keyword","normalization":"array","example":["ui","background_tasks"],"description":"Roles of the service node."},{"field":"service.target.state","type":"keyword","normalization":"","example":"","description":"Current state of the service."},{"field":"service.target.type","type":"keyword","normalization":"","example":"elasticsearch","description":"The type of the service."},{"field":"service.target.version","type":"keyword","normalization":"","example":"3.2.4","description":"Version of the service."},{"field":"service.type","type":"keyword","normalization":"","example":"elasticsearch","description":"The type of the service."},{"field":"service.version","type":"keyword","normalization":"","example":"3.2.4","description":"Version of the service."},{"field":"source.address","type":"keyword","normalization":"","example":"","description":"Source network address."},{"field":"source.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"source.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"source.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"source.bytes","type":"long","normalization":"","example":184,"description":"Bytes sent from the source to the destination."},{"field":"source.domain","type":"keyword","normalization":"","example":"foo.example.com","description":"The domain name of the source."},{"field":"source.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"source.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"source.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"source.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"source.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"source.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"source.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"source.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"source.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"source.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"source.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"source.ip","type":"ip","normalization":"","example":"","description":"IP address of the source."},{"field":"source.mac","type":"keyword","normalization":"","example":"00-00-5E-00-53-23","description":"MAC address of the source."},{"field":"source.nat.ip","type":"ip","normalization":"","example":"","description":"Source NAT ip"},{"field":"source.nat.port","type":"long","normalization":"","example":"","description":"Source NAT port"},{"field":"source.packets","type":"long","normalization":"","example":12,"description":"Packets sent from the source to the destination."},{"field":"source.port","type":"long","normalization":"","example":"","description":"Port of the source."},{"field":"source.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered source domain, stripped of the subdomain."},{"field":"source.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"source.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"source.user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"source.user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"source.user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"source.user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"source.user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"source.user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"source.user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"source.user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"source.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"source.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"source.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"source.user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"span.id","type":"keyword","normalization":"","example":"3ff9a8981b7ccd5a","description":"Unique identifier of the span within the scope of its trace."},{"field":"threat.enrichments","type":"nested","normalization":"array","example":"","description":"List of objects containing indicators enriching the event."},{"field":"threat.enrichments.indicator","type":"object","normalization":"","example":"","description":"Object containing indicators enriching the event."},{"field":"threat.enrichments.indicator.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"threat.enrichments.indicator.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"threat.enrichments.indicator.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"threat.enrichments.indicator.confidence","type":"keyword","normalization":"","example":"Medium","description":"Indicator confidence rating"},{"field":"threat.enrichments.indicator.description","type":"keyword","normalization":"","example":"IP x.x.x.x was observed delivering the Angler EK.","description":"Indicator description"},{"field":"threat.enrichments.indicator.email.address","type":"keyword","normalization":"","example":"phish@example.com","description":"Indicator email address"},{"field":"threat.enrichments.indicator.file.accessed","type":"date","normalization":"","example":"","description":"Last time the file was accessed."},{"field":"threat.enrichments.indicator.file.attributes","type":"keyword","normalization":"array","example":["readonly","system"],"description":"Array of file attributes."},{"field":"threat.enrichments.indicator.file.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"threat.enrichments.indicator.file.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"threat.enrichments.indicator.file.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"threat.enrichments.indicator.file.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"threat.enrichments.indicator.file.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"threat.enrichments.indicator.file.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"threat.enrichments.indicator.file.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"threat.enrichments.indicator.file.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"threat.enrichments.indicator.file.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"threat.enrichments.indicator.file.created","type":"date","normalization":"","example":"","description":"File creation time."},{"field":"threat.enrichments.indicator.file.ctime","type":"date","normalization":"","example":"","description":"Last time the file attributes or metadata changed."},{"field":"threat.enrichments.indicator.file.device","type":"keyword","normalization":"","example":"sda","description":"Device that is the source of the file."},{"field":"threat.enrichments.indicator.file.directory","type":"keyword","normalization":"","example":"/home/alice","description":"Directory where the file is located."},{"field":"threat.enrichments.indicator.file.drive_letter","type":"keyword","normalization":"","example":"C","description":"Drive letter where the file is located."},{"field":"threat.enrichments.indicator.file.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"threat.enrichments.indicator.file.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"threat.enrichments.indicator.file.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"threat.enrichments.indicator.file.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"threat.enrichments.indicator.file.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"threat.enrichments.indicator.file.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"threat.enrichments.indicator.file.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"threat.enrichments.indicator.file.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"threat.enrichments.indicator.file.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"threat.enrichments.indicator.file.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"threat.enrichments.indicator.file.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"threat.enrichments.indicator.file.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"threat.enrichments.indicator.file.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"threat.enrichments.indicator.file.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"threat.enrichments.indicator.file.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"threat.enrichments.indicator.file.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"threat.enrichments.indicator.file.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"threat.enrichments.indicator.file.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"threat.enrichments.indicator.file.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"threat.enrichments.indicator.file.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"threat.enrichments.indicator.file.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"threat.enrichments.indicator.file.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"threat.enrichments.indicator.file.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"threat.enrichments.indicator.file.extension","type":"keyword","normalization":"","example":"png","description":"File extension, excluding the leading dot."},{"field":"threat.enrichments.indicator.file.fork_name","type":"keyword","normalization":"","example":"Zone.Identifer","description":"A fork is additional data associated with a filesystem object."},{"field":"threat.enrichments.indicator.file.gid","type":"keyword","normalization":"","example":1001,"description":"Primary group ID (GID) of the file."},{"field":"threat.enrichments.indicator.file.group","type":"keyword","normalization":"","example":"alice","description":"Primary group name of the file."},{"field":"threat.enrichments.indicator.file.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"threat.enrichments.indicator.file.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"threat.enrichments.indicator.file.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"threat.enrichments.indicator.file.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"threat.enrichments.indicator.file.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"threat.enrichments.indicator.file.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"threat.enrichments.indicator.file.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"threat.enrichments.indicator.file.inode","type":"keyword","normalization":"","example":256383,"description":"Inode representing the file in the filesystem."},{"field":"threat.enrichments.indicator.file.mime_type","type":"keyword","normalization":"","example":"","description":"Media type of file, document, or arrangement of bytes."},{"field":"threat.enrichments.indicator.file.mode","type":"keyword","normalization":"","example":"0640","description":"Mode of the file in octal representation."},{"field":"threat.enrichments.indicator.file.mtime","type":"date","normalization":"","example":"","description":"Last time the file content was modified."},{"field":"threat.enrichments.indicator.file.name","type":"keyword","normalization":"","example":"example.png","description":"Name of the file including the extension, without the directory."},{"field":"threat.enrichments.indicator.file.owner","type":"keyword","normalization":"","example":"alice","description":"File owner's username."},{"field":"threat.enrichments.indicator.file.path","type":"keyword","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"threat.enrichments.indicator.file.path.text","type":"match_only_text","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"threat.enrichments.indicator.file.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"threat.enrichments.indicator.file.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"threat.enrichments.indicator.file.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"threat.enrichments.indicator.file.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"threat.enrichments.indicator.file.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"threat.enrichments.indicator.file.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"threat.enrichments.indicator.file.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"threat.enrichments.indicator.file.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"threat.enrichments.indicator.file.size","type":"long","normalization":"","example":16384,"description":"File size in bytes."},{"field":"threat.enrichments.indicator.file.target_path","type":"keyword","normalization":"","example":"","description":"Target path for symlinks."},{"field":"threat.enrichments.indicator.file.target_path.text","type":"match_only_text","normalization":"","example":"","description":"Target path for symlinks."},{"field":"threat.enrichments.indicator.file.type","type":"keyword","normalization":"","example":"file","description":"File type (file, dir, or symlink)."},{"field":"threat.enrichments.indicator.file.uid","type":"keyword","normalization":"","example":1001,"description":"The user ID (UID) or security identifier (SID) of the file owner."},{"field":"threat.enrichments.indicator.file.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"threat.enrichments.indicator.file.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"threat.enrichments.indicator.file.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"threat.enrichments.indicator.file.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"threat.enrichments.indicator.file.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"threat.enrichments.indicator.file.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"threat.enrichments.indicator.file.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"threat.enrichments.indicator.file.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.enrichments.indicator.file.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"threat.enrichments.indicator.file.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"threat.enrichments.indicator.file.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"threat.enrichments.indicator.file.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"threat.enrichments.indicator.file.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"threat.enrichments.indicator.file.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"threat.enrichments.indicator.file.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"threat.enrichments.indicator.file.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"threat.enrichments.indicator.file.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"threat.enrichments.indicator.file.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"threat.enrichments.indicator.file.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"threat.enrichments.indicator.file.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"threat.enrichments.indicator.file.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"threat.enrichments.indicator.file.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"threat.enrichments.indicator.file.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.enrichments.indicator.file.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"threat.enrichments.indicator.first_seen","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was first reported."},{"field":"threat.enrichments.indicator.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"threat.enrichments.indicator.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"threat.enrichments.indicator.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"threat.enrichments.indicator.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"threat.enrichments.indicator.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"threat.enrichments.indicator.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"threat.enrichments.indicator.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"threat.enrichments.indicator.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"threat.enrichments.indicator.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"threat.enrichments.indicator.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"threat.enrichments.indicator.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"threat.enrichments.indicator.ip","type":"ip","normalization":"","example":"1.2.3.4","description":"Indicator IP address"},{"field":"threat.enrichments.indicator.last_seen","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was last reported."},{"field":"threat.enrichments.indicator.marking.tlp","type":"keyword","normalization":"","example":"WHITE","description":"Indicator TLP marking"},{"field":"threat.enrichments.indicator.modified_at","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was last updated."},{"field":"threat.enrichments.indicator.port","type":"long","normalization":"","example":443,"description":"Indicator port"},{"field":"threat.enrichments.indicator.provider","type":"keyword","normalization":"","example":"lrz_urlhaus","description":"Indicator provider"},{"field":"threat.enrichments.indicator.reference","type":"keyword","normalization":"","example":"https://system.example.com/indicator/0001234","description":"Indicator reference URL"},{"field":"threat.enrichments.indicator.registry.data.bytes","type":"keyword","normalization":"","example":"ZQBuAC0AVQBTAAAAZQBuAAAAAAA=","description":"Original bytes written with base64 encoding."},{"field":"threat.enrichments.indicator.registry.data.strings","type":"wildcard","normalization":"array","example":"[\"C:\\rta\\red_ttp\\bin\\myapp.exe\"]","description":"List of strings representing what was written to the registry."},{"field":"threat.enrichments.indicator.registry.data.type","type":"keyword","normalization":"","example":"REG_SZ","description":"Standard registry type for encoding contents"},{"field":"threat.enrichments.indicator.registry.hive","type":"keyword","normalization":"","example":"HKLM","description":"Abbreviated name for the hive."},{"field":"threat.enrichments.indicator.registry.key","type":"keyword","normalization":"","example":"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe","description":"Hive-relative path of keys."},{"field":"threat.enrichments.indicator.registry.path","type":"keyword","normalization":"","example":"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe\\Debugger","description":"Full path, including hive, key and value"},{"field":"threat.enrichments.indicator.registry.value","type":"keyword","normalization":"","example":"Debugger","description":"Name of the value written."},{"field":"threat.enrichments.indicator.scanner_stats","type":"long","normalization":"","example":4,"description":"Scanner statistics"},{"field":"threat.enrichments.indicator.sightings","type":"long","normalization":"","example":20,"description":"Number of times indicator observed"},{"field":"threat.enrichments.indicator.type","type":"keyword","normalization":"","example":"ipv4-addr","description":"Type of indicator"},{"field":"threat.enrichments.indicator.url.domain","type":"keyword","normalization":"","example":"www.elastic.co","description":"Domain of the url."},{"field":"threat.enrichments.indicator.url.extension","type":"keyword","normalization":"","example":"png","description":"File extension from the request url, excluding the leading dot."},{"field":"threat.enrichments.indicator.url.fragment","type":"keyword","normalization":"","example":"","description":"Portion of the url after the `#`."},{"field":"threat.enrichments.indicator.url.full","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"threat.enrichments.indicator.url.full.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"threat.enrichments.indicator.url.original","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"threat.enrichments.indicator.url.original.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"threat.enrichments.indicator.url.password","type":"keyword","normalization":"","example":"","description":"Password of the request."},{"field":"threat.enrichments.indicator.url.path","type":"wildcard","normalization":"","example":"","description":"Path of the request, such as \"/search\"."},{"field":"threat.enrichments.indicator.url.port","type":"long","normalization":"","example":443,"description":"Port of the request, such as 443."},{"field":"threat.enrichments.indicator.url.query","type":"keyword","normalization":"","example":"","description":"Query string of the request."},{"field":"threat.enrichments.indicator.url.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered url domain, stripped of the subdomain."},{"field":"threat.enrichments.indicator.url.scheme","type":"keyword","normalization":"","example":"https","description":"Scheme of the url."},{"field":"threat.enrichments.indicator.url.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"threat.enrichments.indicator.url.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"threat.enrichments.indicator.url.username","type":"keyword","normalization":"","example":"","description":"Username of the request."},{"field":"threat.enrichments.indicator.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"threat.enrichments.indicator.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"threat.enrichments.indicator.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"threat.enrichments.indicator.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"threat.enrichments.indicator.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"threat.enrichments.indicator.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"threat.enrichments.indicator.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"threat.enrichments.indicator.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.enrichments.indicator.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"threat.enrichments.indicator.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"threat.enrichments.indicator.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"threat.enrichments.indicator.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"threat.enrichments.indicator.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"threat.enrichments.indicator.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"threat.enrichments.indicator.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"threat.enrichments.indicator.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"threat.enrichments.indicator.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"threat.enrichments.indicator.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"threat.enrichments.indicator.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"threat.enrichments.indicator.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"threat.enrichments.indicator.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"threat.enrichments.indicator.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"threat.enrichments.indicator.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.enrichments.indicator.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"threat.enrichments.matched.atomic","type":"keyword","normalization":"","example":"bad-domain.com","description":"Matched indicator value"},{"field":"threat.enrichments.matched.field","type":"keyword","normalization":"","example":"file.hash.sha256","description":"Matched indicator field"},{"field":"threat.enrichments.matched.id","type":"keyword","normalization":"","example":"ff93aee5-86a1-4a61-b0e6-0cdc313d01b5","description":"Matched indicator identifier"},{"field":"threat.enrichments.matched.index","type":"keyword","normalization":"","example":"filebeat-8.0.0-2021.05.23-000011","description":"Matched indicator index"},{"field":"threat.enrichments.matched.occurred","type":"date","normalization":"","example":"2021-10-05T17:00:58.326Z","description":"Date of match"},{"field":"threat.enrichments.matched.type","type":"keyword","normalization":"","example":"indicator_match_rule","description":"Type of indicator match"},{"field":"threat.feed.dashboard_id","type":"keyword","normalization":"","example":"5ba16340-72e6-11eb-a3e3-b3cc7c78a70f","description":"Feed dashboard ID."},{"field":"threat.feed.description","type":"keyword","normalization":"","example":"Threat feed from the AlienVault Open Threat eXchange network.","description":"Description of the threat feed."},{"field":"threat.feed.name","type":"keyword","normalization":"","example":"AlienVault OTX","description":"Name of the threat feed."},{"field":"threat.feed.reference","type":"keyword","normalization":"","example":"https://otx.alienvault.com","description":"Reference for the threat feed."},{"field":"threat.framework","type":"keyword","normalization":"","example":"MITRE ATT&CK","description":"Threat classification framework."},{"field":"threat.group.alias","type":"keyword","normalization":"array","example":["Magecart Group 6"],"description":"Alias of the group."},{"field":"threat.group.id","type":"keyword","normalization":"","example":"G0037","description":"ID of the group."},{"field":"threat.group.name","type":"keyword","normalization":"","example":"FIN6","description":"Name of the group."},{"field":"threat.group.reference","type":"keyword","normalization":"","example":"https://attack.mitre.org/groups/G0037/","description":"Reference URL of the group."},{"field":"threat.indicator.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"threat.indicator.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"threat.indicator.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"threat.indicator.confidence","type":"keyword","normalization":"","example":"Medium","description":"Indicator confidence rating"},{"field":"threat.indicator.description","type":"keyword","normalization":"","example":"IP x.x.x.x was observed delivering the Angler EK.","description":"Indicator description"},{"field":"threat.indicator.email.address","type":"keyword","normalization":"","example":"phish@example.com","description":"Indicator email address"},{"field":"threat.indicator.file.accessed","type":"date","normalization":"","example":"","description":"Last time the file was accessed."},{"field":"threat.indicator.file.attributes","type":"keyword","normalization":"array","example":["readonly","system"],"description":"Array of file attributes."},{"field":"threat.indicator.file.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"threat.indicator.file.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"threat.indicator.file.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"threat.indicator.file.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"threat.indicator.file.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"threat.indicator.file.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"threat.indicator.file.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"threat.indicator.file.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"threat.indicator.file.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"threat.indicator.file.created","type":"date","normalization":"","example":"","description":"File creation time."},{"field":"threat.indicator.file.ctime","type":"date","normalization":"","example":"","description":"Last time the file attributes or metadata changed."},{"field":"threat.indicator.file.device","type":"keyword","normalization":"","example":"sda","description":"Device that is the source of the file."},{"field":"threat.indicator.file.directory","type":"keyword","normalization":"","example":"/home/alice","description":"Directory where the file is located."},{"field":"threat.indicator.file.drive_letter","type":"keyword","normalization":"","example":"C","description":"Drive letter where the file is located."},{"field":"threat.indicator.file.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"threat.indicator.file.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"threat.indicator.file.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"threat.indicator.file.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"threat.indicator.file.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"threat.indicator.file.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"threat.indicator.file.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"threat.indicator.file.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"threat.indicator.file.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"threat.indicator.file.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"threat.indicator.file.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"threat.indicator.file.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"threat.indicator.file.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"threat.indicator.file.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"threat.indicator.file.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"threat.indicator.file.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"threat.indicator.file.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"threat.indicator.file.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"threat.indicator.file.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"threat.indicator.file.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"threat.indicator.file.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"threat.indicator.file.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"threat.indicator.file.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"threat.indicator.file.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"threat.indicator.file.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"threat.indicator.file.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"threat.indicator.file.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"threat.indicator.file.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"threat.indicator.file.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"threat.indicator.file.extension","type":"keyword","normalization":"","example":"png","description":"File extension, excluding the leading dot."},{"field":"threat.indicator.file.fork_name","type":"keyword","normalization":"","example":"Zone.Identifer","description":"A fork is additional data associated with a filesystem object."},{"field":"threat.indicator.file.gid","type":"keyword","normalization":"","example":1001,"description":"Primary group ID (GID) of the file."},{"field":"threat.indicator.file.group","type":"keyword","normalization":"","example":"alice","description":"Primary group name of the file."},{"field":"threat.indicator.file.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"threat.indicator.file.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"threat.indicator.file.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"threat.indicator.file.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"threat.indicator.file.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"threat.indicator.file.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"threat.indicator.file.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"threat.indicator.file.inode","type":"keyword","normalization":"","example":256383,"description":"Inode representing the file in the filesystem."},{"field":"threat.indicator.file.mime_type","type":"keyword","normalization":"","example":"","description":"Media type of file, document, or arrangement of bytes."},{"field":"threat.indicator.file.mode","type":"keyword","normalization":"","example":"0640","description":"Mode of the file in octal representation."},{"field":"threat.indicator.file.mtime","type":"date","normalization":"","example":"","description":"Last time the file content was modified."},{"field":"threat.indicator.file.name","type":"keyword","normalization":"","example":"example.png","description":"Name of the file including the extension, without the directory."},{"field":"threat.indicator.file.owner","type":"keyword","normalization":"","example":"alice","description":"File owner's username."},{"field":"threat.indicator.file.path","type":"keyword","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"threat.indicator.file.path.text","type":"match_only_text","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"threat.indicator.file.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"threat.indicator.file.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"threat.indicator.file.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"threat.indicator.file.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"threat.indicator.file.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"threat.indicator.file.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"threat.indicator.file.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"threat.indicator.file.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"threat.indicator.file.size","type":"long","normalization":"","example":16384,"description":"File size in bytes."},{"field":"threat.indicator.file.target_path","type":"keyword","normalization":"","example":"","description":"Target path for symlinks."},{"field":"threat.indicator.file.target_path.text","type":"match_only_text","normalization":"","example":"","description":"Target path for symlinks."},{"field":"threat.indicator.file.type","type":"keyword","normalization":"","example":"file","description":"File type (file, dir, or symlink)."},{"field":"threat.indicator.file.uid","type":"keyword","normalization":"","example":1001,"description":"The user ID (UID) or security identifier (SID) of the file owner."},{"field":"threat.indicator.file.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"threat.indicator.file.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"threat.indicator.file.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"threat.indicator.file.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"threat.indicator.file.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"threat.indicator.file.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"threat.indicator.file.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"threat.indicator.file.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.indicator.file.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"threat.indicator.file.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"threat.indicator.file.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"threat.indicator.file.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"threat.indicator.file.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"threat.indicator.file.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"threat.indicator.file.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"threat.indicator.file.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"threat.indicator.file.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"threat.indicator.file.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"threat.indicator.file.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"threat.indicator.file.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"threat.indicator.file.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"threat.indicator.file.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"threat.indicator.file.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.indicator.file.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"threat.indicator.first_seen","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was first reported."},{"field":"threat.indicator.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"threat.indicator.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"threat.indicator.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"threat.indicator.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"threat.indicator.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"threat.indicator.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"threat.indicator.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"threat.indicator.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"threat.indicator.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"threat.indicator.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"threat.indicator.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"threat.indicator.ip","type":"ip","normalization":"","example":"1.2.3.4","description":"Indicator IP address"},{"field":"threat.indicator.last_seen","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was last reported."},{"field":"threat.indicator.marking.tlp","type":"keyword","normalization":"","example":"WHITE","description":"Indicator TLP marking"},{"field":"threat.indicator.modified_at","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was last updated."},{"field":"threat.indicator.port","type":"long","normalization":"","example":443,"description":"Indicator port"},{"field":"threat.indicator.provider","type":"keyword","normalization":"","example":"lrz_urlhaus","description":"Indicator provider"},{"field":"threat.indicator.reference","type":"keyword","normalization":"","example":"https://system.example.com/indicator/0001234","description":"Indicator reference URL"},{"field":"threat.indicator.registry.data.bytes","type":"keyword","normalization":"","example":"ZQBuAC0AVQBTAAAAZQBuAAAAAAA=","description":"Original bytes written with base64 encoding."},{"field":"threat.indicator.registry.data.strings","type":"wildcard","normalization":"array","example":"[\"C:\\rta\\red_ttp\\bin\\myapp.exe\"]","description":"List of strings representing what was written to the registry."},{"field":"threat.indicator.registry.data.type","type":"keyword","normalization":"","example":"REG_SZ","description":"Standard registry type for encoding contents"},{"field":"threat.indicator.registry.hive","type":"keyword","normalization":"","example":"HKLM","description":"Abbreviated name for the hive."},{"field":"threat.indicator.registry.key","type":"keyword","normalization":"","example":"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe","description":"Hive-relative path of keys."},{"field":"threat.indicator.registry.path","type":"keyword","normalization":"","example":"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe\\Debugger","description":"Full path, including hive, key and value"},{"field":"threat.indicator.registry.value","type":"keyword","normalization":"","example":"Debugger","description":"Name of the value written."},{"field":"threat.indicator.scanner_stats","type":"long","normalization":"","example":4,"description":"Scanner statistics"},{"field":"threat.indicator.sightings","type":"long","normalization":"","example":20,"description":"Number of times indicator observed"},{"field":"threat.indicator.type","type":"keyword","normalization":"","example":"ipv4-addr","description":"Type of indicator"},{"field":"threat.indicator.url.domain","type":"keyword","normalization":"","example":"www.elastic.co","description":"Domain of the url."},{"field":"threat.indicator.url.extension","type":"keyword","normalization":"","example":"png","description":"File extension from the request url, excluding the leading dot."},{"field":"threat.indicator.url.fragment","type":"keyword","normalization":"","example":"","description":"Portion of the url after the `#`."},{"field":"threat.indicator.url.full","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"threat.indicator.url.full.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"threat.indicator.url.original","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"threat.indicator.url.original.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"threat.indicator.url.password","type":"keyword","normalization":"","example":"","description":"Password of the request."},{"field":"threat.indicator.url.path","type":"wildcard","normalization":"","example":"","description":"Path of the request, such as \"/search\"."},{"field":"threat.indicator.url.port","type":"long","normalization":"","example":443,"description":"Port of the request, such as 443."},{"field":"threat.indicator.url.query","type":"keyword","normalization":"","example":"","description":"Query string of the request."},{"field":"threat.indicator.url.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered url domain, stripped of the subdomain."},{"field":"threat.indicator.url.scheme","type":"keyword","normalization":"","example":"https","description":"Scheme of the url."},{"field":"threat.indicator.url.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"threat.indicator.url.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"threat.indicator.url.username","type":"keyword","normalization":"","example":"","description":"Username of the request."},{"field":"threat.indicator.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"threat.indicator.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"threat.indicator.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"threat.indicator.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"threat.indicator.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"threat.indicator.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"threat.indicator.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"threat.indicator.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.indicator.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"threat.indicator.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"threat.indicator.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"threat.indicator.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"threat.indicator.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"threat.indicator.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"threat.indicator.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"threat.indicator.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"threat.indicator.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"threat.indicator.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"threat.indicator.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"threat.indicator.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"threat.indicator.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"threat.indicator.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"threat.indicator.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.indicator.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"threat.software.alias","type":"keyword","normalization":"array","example":["X-Agent"],"description":"Alias of the software"},{"field":"threat.software.id","type":"keyword","normalization":"","example":"S0552","description":"ID of the software"},{"field":"threat.software.name","type":"keyword","normalization":"","example":"AdFind","description":"Name of the software."},{"field":"threat.software.platforms","type":"keyword","normalization":"array","example":["Windows"],"description":"Platforms of the software."},{"field":"threat.software.reference","type":"keyword","normalization":"","example":"https://attack.mitre.org/software/S0552/","description":"Software reference URL."},{"field":"threat.software.type","type":"keyword","normalization":"","example":"Tool","description":"Software type."},{"field":"threat.tactic.id","type":"keyword","normalization":"array","example":"TA0002","description":"Threat tactic id."},{"field":"threat.tactic.name","type":"keyword","normalization":"array","example":"Execution","description":"Threat tactic."},{"field":"threat.tactic.reference","type":"keyword","normalization":"array","example":"https://attack.mitre.org/tactics/TA0002/","description":"Threat tactic URL reference."},{"field":"threat.technique.id","type":"keyword","normalization":"array","example":"T1059","description":"Threat technique id."},{"field":"threat.technique.name","type":"keyword","normalization":"array","example":"Command and Scripting Interpreter","description":"Threat technique name."},{"field":"threat.technique.name.text","type":"match_only_text","normalization":"","example":"Command and Scripting Interpreter","description":"Threat technique name."},{"field":"threat.technique.reference","type":"keyword","normalization":"array","example":"https://attack.mitre.org/techniques/T1059/","description":"Threat technique URL reference."},{"field":"threat.technique.subtechnique.id","type":"keyword","normalization":"array","example":"T1059.001","description":"Threat subtechnique id."},{"field":"threat.technique.subtechnique.name","type":"keyword","normalization":"array","example":"PowerShell","description":"Threat subtechnique name."},{"field":"threat.technique.subtechnique.name.text","type":"match_only_text","normalization":"","example":"PowerShell","description":"Threat subtechnique name."},{"field":"threat.technique.subtechnique.reference","type":"keyword","normalization":"array","example":"https://attack.mitre.org/techniques/T1059/001/","description":"Threat subtechnique URL reference."},{"field":"tls.cipher","type":"keyword","normalization":"","example":"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256","description":"String indicating the cipher used during the current connection."},{"field":"tls.client.certificate","type":"keyword","normalization":"","example":"MII...","description":"PEM-encoded stand-alone certificate offered by the client."},{"field":"tls.client.certificate_chain","type":"keyword","normalization":"array","example":["MII...","MII..."],"description":"Array of PEM-encoded certificates that make up the certificate chain offered by the client."},{"field":"tls.client.hash.md5","type":"keyword","normalization":"","example":"0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC","description":"Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the client."},{"field":"tls.client.hash.sha1","type":"keyword","normalization":"","example":"9E393D93138888D288266C2D915214D1D1CCEB2A","description":"Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the client."},{"field":"tls.client.hash.sha256","type":"keyword","normalization":"","example":"0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0","description":"Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the client."},{"field":"tls.client.issuer","type":"keyword","normalization":"","example":"CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com","description":"Distinguished name of subject of the issuer of the x.509 certificate presented by the client."},{"field":"tls.client.ja3","type":"keyword","normalization":"","example":"d4e5b18d6b55c71272893221c96ba240","description":"A hash that identifies clients based on how they perform an SSL/TLS handshake."},{"field":"tls.client.not_after","type":"date","normalization":"","example":"2021-01-01T00:00:00.000Z","description":"Date/Time indicating when client certificate is no longer considered valid."},{"field":"tls.client.not_before","type":"date","normalization":"","example":"1970-01-01T00:00:00.000Z","description":"Date/Time indicating when client certificate is first considered valid."},{"field":"tls.client.server_name","type":"keyword","normalization":"","example":"www.elastic.co","description":"Hostname the client is trying to connect to. Also called the SNI."},{"field":"tls.client.subject","type":"keyword","normalization":"","example":"CN=myclient, OU=Documentation Team, DC=example, DC=com","description":"Distinguished name of subject of the x.509 certificate presented by the client."},{"field":"tls.client.supported_ciphers","type":"keyword","normalization":"array","example":["TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","..."],"description":"Array of ciphers offered by the client during the client hello."},{"field":"tls.client.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"tls.client.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"tls.client.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"tls.client.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"tls.client.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"tls.client.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"tls.client.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"tls.client.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"tls.client.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"tls.client.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"tls.client.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"tls.client.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"tls.client.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"tls.client.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"tls.client.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"tls.client.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"tls.client.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"tls.client.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"tls.client.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"tls.client.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"tls.client.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"tls.client.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"tls.client.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"tls.client.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"tls.curve","type":"keyword","normalization":"","example":"secp256r1","description":"String indicating the curve used for the given cipher, when applicable."},{"field":"tls.established","type":"boolean","normalization":"","example":"","description":"Boolean flag indicating if the TLS negotiation was successful and transitioned to an encrypted tunnel."},{"field":"tls.next_protocol","type":"keyword","normalization":"","example":"http/1.1","description":"String indicating the protocol being tunneled."},{"field":"tls.resumed","type":"boolean","normalization":"","example":"","description":"Boolean flag indicating if this TLS connection was resumed from an existing TLS negotiation."},{"field":"tls.server.certificate","type":"keyword","normalization":"","example":"MII...","description":"PEM-encoded stand-alone certificate offered by the server."},{"field":"tls.server.certificate_chain","type":"keyword","normalization":"array","example":["MII...","MII..."],"description":"Array of PEM-encoded certificates that make up the certificate chain offered by the server."},{"field":"tls.server.hash.md5","type":"keyword","normalization":"","example":"0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC","description":"Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the server."},{"field":"tls.server.hash.sha1","type":"keyword","normalization":"","example":"9E393D93138888D288266C2D915214D1D1CCEB2A","description":"Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the server."},{"field":"tls.server.hash.sha256","type":"keyword","normalization":"","example":"0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0","description":"Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the server."},{"field":"tls.server.issuer","type":"keyword","normalization":"","example":"CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com","description":"Subject of the issuer of the x.509 certificate presented by the server."},{"field":"tls.server.ja3s","type":"keyword","normalization":"","example":"394441ab65754e2207b1e1b457b3641d","description":"A hash that identifies servers based on how they perform an SSL/TLS handshake."},{"field":"tls.server.not_after","type":"date","normalization":"","example":"2021-01-01T00:00:00.000Z","description":"Timestamp indicating when server certificate is no longer considered valid."},{"field":"tls.server.not_before","type":"date","normalization":"","example":"1970-01-01T00:00:00.000Z","description":"Timestamp indicating when server certificate is first considered valid."},{"field":"tls.server.subject","type":"keyword","normalization":"","example":"CN=www.example.com, OU=Infrastructure Team, DC=example, DC=com","description":"Subject of the x.509 certificate presented by the server."},{"field":"tls.server.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"tls.server.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"tls.server.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"tls.server.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"tls.server.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"tls.server.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"tls.server.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"tls.server.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"tls.server.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"tls.server.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"tls.server.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"tls.server.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"tls.server.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"tls.server.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"tls.server.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"tls.server.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"tls.server.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"tls.server.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"tls.server.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"tls.server.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"tls.server.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"tls.server.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"tls.server.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"tls.server.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"tls.version","type":"keyword","normalization":"","example":1.2,"description":"Numeric part of the version parsed from the original string."},{"field":"tls.version_protocol","type":"keyword","normalization":"","example":"tls","description":"Normalized lowercase protocol name parsed from original string."},{"field":"trace.id","type":"keyword","normalization":"","example":"4bf92f3577b34da6a3ce929d0e0e4736","description":"Unique identifier of the trace."},{"field":"transaction.id","type":"keyword","normalization":"","example":"00f067aa0ba902b7","description":"Unique identifier of the transaction within the scope of its trace."},{"field":"url.domain","type":"keyword","normalization":"","example":"www.elastic.co","description":"Domain of the url."},{"field":"url.extension","type":"keyword","normalization":"","example":"png","description":"File extension from the request url, excluding the leading dot."},{"field":"url.fragment","type":"keyword","normalization":"","example":"","description":"Portion of the url after the `#`."},{"field":"url.full","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"url.full.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"url.original","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"url.original.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"url.password","type":"keyword","normalization":"","example":"","description":"Password of the request."},{"field":"url.path","type":"wildcard","normalization":"","example":"","description":"Path of the request, such as \"/search\"."},{"field":"url.port","type":"long","normalization":"","example":443,"description":"Port of the request, such as 443."},{"field":"url.query","type":"keyword","normalization":"","example":"","description":"Query string of the request."},{"field":"url.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered url domain, stripped of the subdomain."},{"field":"url.scheme","type":"keyword","normalization":"","example":"https","description":"Scheme of the url."},{"field":"url.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"url.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"url.username","type":"keyword","normalization":"","example":"","description":"Username of the request."},{"field":"user.changes.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"user.changes.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"user.changes.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.changes.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.changes.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"user.changes.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"user.changes.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"user.changes.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"user.changes.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"user.changes.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.changes.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.changes.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"user.effective.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"user.effective.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"user.effective.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.effective.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.effective.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"user.effective.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"user.effective.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"user.effective.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"user.effective.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"user.effective.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.effective.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.effective.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"user.target.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"user.target.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"user.target.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.target.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.target.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"user.target.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"user.target.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"user.target.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"user.target.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"user.target.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.target.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.target.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"user_agent.device.name","type":"keyword","normalization":"","example":"iPhone","description":"Name of the device."},{"field":"user_agent.name","type":"keyword","normalization":"","example":"Safari","description":"Name of the user agent."},{"field":"user_agent.original","type":"keyword","normalization":"","example":"Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1","description":"Unparsed user_agent string."},{"field":"user_agent.original.text","type":"match_only_text","normalization":"","example":"Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1","description":"Unparsed user_agent string."},{"field":"user_agent.os.family","type":"keyword","normalization":"","example":"debian","description":"OS family (such as redhat, debian, freebsd, windows)."},{"field":"user_agent.os.full","type":"keyword","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"user_agent.os.full.text","type":"match_only_text","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"user_agent.os.kernel","type":"keyword","normalization":"","example":"4.4.0-112-generic","description":"Operating system kernel version as a raw string."},{"field":"user_agent.os.name","type":"keyword","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"user_agent.os.name.text","type":"match_only_text","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"user_agent.os.platform","type":"keyword","normalization":"","example":"darwin","description":"Operating system platform (such centos, ubuntu, windows)."},{"field":"user_agent.os.type","type":"keyword","normalization":"","example":"macos","description":"Which commercial OS family (one of: linux, macos, unix or windows)."},{"field":"user_agent.os.version","type":"keyword","normalization":"","example":"10.14.1","description":"Operating system version as a raw string."},{"field":"user_agent.version","type":"keyword","normalization":"","example":12,"description":"Version of the user agent."},{"field":"vulnerability.category","type":"keyword","normalization":"array","example":["Firewall"],"description":"Category of a vulnerability."},{"field":"vulnerability.classification","type":"keyword","normalization":"","example":"CVSS","description":"Classification of the vulnerability."},{"field":"vulnerability.description","type":"keyword","normalization":"","example":"In macOS before 2.12.6, there is a vulnerability in the RPC...","description":"Description of the vulnerability."},{"field":"vulnerability.description.text","type":"match_only_text","normalization":"","example":"In macOS before 2.12.6, there is a vulnerability in the RPC...","description":"Description of the vulnerability."},{"field":"vulnerability.enumeration","type":"keyword","normalization":"","example":"CVE","description":"Identifier of the vulnerability."},{"field":"vulnerability.id","type":"keyword","normalization":"","example":"CVE-2019-00001","description":"ID of the vulnerability."},{"field":"vulnerability.reference","type":"keyword","normalization":"","example":"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-6111","description":"Reference of the vulnerability."},{"field":"vulnerability.report_id","type":"keyword","normalization":"","example":20191018.0001,"description":"Scan identification number."},{"field":"vulnerability.scanner.vendor","type":"keyword","normalization":"","example":"Tenable","description":"Name of the scanner vendor."},{"field":"vulnerability.score.base","type":"float","normalization":"","example":5.5,"description":"Vulnerability Base score."},{"field":"vulnerability.score.environmental","type":"float","normalization":"","example":5.5,"description":"Vulnerability Environmental score."},{"field":"vulnerability.score.temporal","type":"float","normalization":"","example":"","description":"Vulnerability Temporal score."},{"field":"vulnerability.score.version","type":"keyword","normalization":"","example":2,"description":"CVSS version."},{"field":"vulnerability.severity","type":"keyword","normalization":"","example":"Critical","description":"Severity of the vulnerability."}] \ No newline at end of file diff --git a/x-pack/plugins/osquery/public/common/schemas/ecs/v8.5.0.json b/x-pack/plugins/osquery/public/common/schemas/ecs/v8.5.0.json new file mode 100644 index 0000000000000..5fe03a8130fd0 --- /dev/null +++ b/x-pack/plugins/osquery/public/common/schemas/ecs/v8.5.0.json @@ -0,0 +1 @@ +[{"field":"labels","type":"object","normalization":"","example":{"application":"foo-bar","env":"production"},"description":"Custom key/value pairs."},{"field":"message","type":"match_only_text","normalization":"","example":"Hello World","description":"Log message optimized for viewing in a log viewer."},{"field":"tags","type":"keyword","normalization":"array","example":["production","env2"],"description":"List of keywords used to tag each event."},{"field":"agent.build.original","type":"keyword","normalization":"","example":"metricbeat version 7.6.0 (amd64), libbeat 7.6.0 [6a23e8f8f30f5001ba344e4e54d8d9cb82cb107c built 2020-02-05 23:10:10 +0000 UTC]","description":"Extended build information for the agent."},{"field":"client.address","type":"keyword","normalization":"","example":"","description":"Client network address."},{"field":"client.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"client.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"client.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"client.bytes","type":"long","normalization":"","example":184,"description":"Bytes sent from the client to the server."},{"field":"client.domain","type":"keyword","normalization":"","example":"foo.example.com","description":"The domain name of the client."},{"field":"client.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"client.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"client.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"client.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"client.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"client.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"client.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"client.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"client.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"client.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"client.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"client.ip","type":"ip","normalization":"","example":"","description":"IP address of the client."},{"field":"client.mac","type":"keyword","normalization":"","example":"00-00-5E-00-53-23","description":"MAC address of the client."},{"field":"client.nat.ip","type":"ip","normalization":"","example":"","description":"Client NAT ip address"},{"field":"client.nat.port","type":"long","normalization":"","example":"","description":"Client NAT port"},{"field":"client.packets","type":"long","normalization":"","example":12,"description":"Packets sent from the client to the server."},{"field":"client.port","type":"long","normalization":"","example":"","description":"Port of the client."},{"field":"client.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered client domain, stripped of the subdomain."},{"field":"client.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"client.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"client.user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"client.user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"client.user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"client.user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"client.user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"client.user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"client.user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"client.user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"client.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"client.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"client.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"client.user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"cloud.account.id","type":"keyword","normalization":"","example":666777888999,"description":"The cloud account or organization id."},{"field":"cloud.account.name","type":"keyword","normalization":"","example":"elastic-dev","description":"The cloud account name."},{"field":"cloud.availability_zone","type":"keyword","normalization":"","example":"us-east-1c","description":"Availability zone in which this host, resource, or service is located."},{"field":"cloud.instance.id","type":"keyword","normalization":"","example":"i-1234567890abcdef0","description":"Instance ID of the host machine."},{"field":"cloud.instance.name","type":"keyword","normalization":"","example":"","description":"Instance name of the host machine."},{"field":"cloud.machine.type","type":"keyword","normalization":"","example":"t2.medium","description":"Machine type of the host machine."},{"field":"cloud.origin.account.id","type":"keyword","normalization":"","example":666777888999,"description":"The cloud account or organization id."},{"field":"cloud.origin.account.name","type":"keyword","normalization":"","example":"elastic-dev","description":"The cloud account name."},{"field":"cloud.origin.availability_zone","type":"keyword","normalization":"","example":"us-east-1c","description":"Availability zone in which this host, resource, or service is located."},{"field":"cloud.origin.instance.id","type":"keyword","normalization":"","example":"i-1234567890abcdef0","description":"Instance ID of the host machine."},{"field":"cloud.origin.instance.name","type":"keyword","normalization":"","example":"","description":"Instance name of the host machine."},{"field":"cloud.origin.machine.type","type":"keyword","normalization":"","example":"t2.medium","description":"Machine type of the host machine."},{"field":"cloud.origin.project.id","type":"keyword","normalization":"","example":"my-project","description":"The cloud project id."},{"field":"cloud.origin.project.name","type":"keyword","normalization":"","example":"my project","description":"The cloud project name."},{"field":"cloud.origin.provider","type":"keyword","normalization":"","example":"aws","description":"Name of the cloud provider."},{"field":"cloud.origin.region","type":"keyword","normalization":"","example":"us-east-1","description":"Region in which this host, resource, or service is located."},{"field":"cloud.origin.service.name","type":"keyword","normalization":"","example":"lambda","description":"The cloud service name."},{"field":"cloud.project.id","type":"keyword","normalization":"","example":"my-project","description":"The cloud project id."},{"field":"cloud.project.name","type":"keyword","normalization":"","example":"my project","description":"The cloud project name."},{"field":"cloud.provider","type":"keyword","normalization":"","example":"aws","description":"Name of the cloud provider."},{"field":"cloud.region","type":"keyword","normalization":"","example":"us-east-1","description":"Region in which this host, resource, or service is located."},{"field":"cloud.service.name","type":"keyword","normalization":"","example":"lambda","description":"The cloud service name."},{"field":"cloud.target.account.id","type":"keyword","normalization":"","example":666777888999,"description":"The cloud account or organization id."},{"field":"cloud.target.account.name","type":"keyword","normalization":"","example":"elastic-dev","description":"The cloud account name."},{"field":"cloud.target.availability_zone","type":"keyword","normalization":"","example":"us-east-1c","description":"Availability zone in which this host, resource, or service is located."},{"field":"cloud.target.instance.id","type":"keyword","normalization":"","example":"i-1234567890abcdef0","description":"Instance ID of the host machine."},{"field":"cloud.target.instance.name","type":"keyword","normalization":"","example":"","description":"Instance name of the host machine."},{"field":"cloud.target.machine.type","type":"keyword","normalization":"","example":"t2.medium","description":"Machine type of the host machine."},{"field":"cloud.target.project.id","type":"keyword","normalization":"","example":"my-project","description":"The cloud project id."},{"field":"cloud.target.project.name","type":"keyword","normalization":"","example":"my project","description":"The cloud project name."},{"field":"cloud.target.provider","type":"keyword","normalization":"","example":"aws","description":"Name of the cloud provider."},{"field":"cloud.target.region","type":"keyword","normalization":"","example":"us-east-1","description":"Region in which this host, resource, or service is located."},{"field":"cloud.target.service.name","type":"keyword","normalization":"","example":"lambda","description":"The cloud service name."},{"field":"container.cpu.usage","type":"scaled_float","normalization":"","example":"","description":"Percent CPU used, between 0 and 1."},{"field":"container.disk.read.bytes","type":"long","normalization":"","example":"","description":"The number of bytes read by all disks."},{"field":"container.disk.write.bytes","type":"long","normalization":"","example":"","description":"The number of bytes written on all disks."},{"field":"container.id","type":"keyword","normalization":"","example":"","description":"Unique container id."},{"field":"container.image.hash.all","type":"keyword","normalization":"array","example":"[sha256:f8fefc80e3273dc756f288a63945820d6476ad64883892c771b5e2ece6bf1b26]","description":"An array of digests of the image the container was built on."},{"field":"container.image.name","type":"keyword","normalization":"","example":"","description":"Name of the image the container was built on."},{"field":"container.image.tag","type":"keyword","normalization":"array","example":"","description":"Container image tags."},{"field":"container.labels","type":"object","normalization":"","example":"","description":"Image labels."},{"field":"container.memory.usage","type":"scaled_float","normalization":"","example":"","description":"Percent memory used, between 0 and 1."},{"field":"container.name","type":"keyword","normalization":"","example":"","description":"Container name."},{"field":"container.network.egress.bytes","type":"long","normalization":"","example":"","description":"The number of bytes sent on all network interfaces."},{"field":"container.network.ingress.bytes","type":"long","normalization":"","example":"","description":"The number of bytes received on all network interfaces."},{"field":"container.runtime","type":"keyword","normalization":"","example":"docker","description":"Runtime managing this container."},{"field":"data_stream.dataset","type":"constant_keyword","normalization":"","example":"nginx.access","description":"The field can contain anything that makes sense to signify the source of the data."},{"field":"data_stream.namespace","type":"constant_keyword","normalization":"","example":"production","description":"A user defined namespace. Namespaces are useful to allow grouping of data."},{"field":"data_stream.type","type":"constant_keyword","normalization":"","example":"logs","description":"An overarching type for the data stream."},{"field":"destination.address","type":"keyword","normalization":"","example":"","description":"Destination network address."},{"field":"destination.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"destination.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"destination.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"destination.bytes","type":"long","normalization":"","example":184,"description":"Bytes sent from the destination to the source."},{"field":"destination.domain","type":"keyword","normalization":"","example":"foo.example.com","description":"The domain name of the destination."},{"field":"destination.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"destination.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"destination.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"destination.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"destination.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"destination.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"destination.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"destination.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"destination.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"destination.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"destination.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"destination.ip","type":"ip","normalization":"","example":"","description":"IP address of the destination."},{"field":"destination.mac","type":"keyword","normalization":"","example":"00-00-5E-00-53-23","description":"MAC address of the destination."},{"field":"destination.nat.ip","type":"ip","normalization":"","example":"","description":"Destination NAT ip"},{"field":"destination.nat.port","type":"long","normalization":"","example":"","description":"Destination NAT Port"},{"field":"destination.packets","type":"long","normalization":"","example":12,"description":"Packets sent from the destination to the source."},{"field":"destination.port","type":"long","normalization":"","example":"","description":"Port of the destination."},{"field":"destination.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered destination domain, stripped of the subdomain."},{"field":"destination.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"destination.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"destination.user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"destination.user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"destination.user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"destination.user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"destination.user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"destination.user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"destination.user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"destination.user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"destination.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"destination.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"destination.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"destination.user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"dll.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"dll.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"dll.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"dll.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"dll.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"dll.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"dll.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"dll.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"dll.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"dll.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"dll.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"dll.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"dll.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"dll.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"dll.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"dll.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"dll.name","type":"keyword","normalization":"","example":"kernel32.dll","description":"Name of the library."},{"field":"dll.path","type":"keyword","normalization":"","example":"C:\\Windows\\System32\\kernel32.dll","description":"Full file path of the library."},{"field":"dll.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"dll.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"dll.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"dll.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"dll.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"dll.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"dll.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"dll.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"dns.answers","type":"object","normalization":"array","example":"","description":"Array of DNS answers."},{"field":"dns.answers.class","type":"keyword","normalization":"","example":"IN","description":"The class of DNS data contained in this resource record."},{"field":"dns.answers.data","type":"keyword","normalization":"","example":"10.10.10.10","description":"The data describing the resource."},{"field":"dns.answers.name","type":"keyword","normalization":"","example":"www.example.com","description":"The domain name to which this resource record pertains."},{"field":"dns.answers.ttl","type":"long","normalization":"","example":180,"description":"The time interval in seconds that this resource record may be cached before it should be discarded."},{"field":"dns.answers.type","type":"keyword","normalization":"","example":"CNAME","description":"The type of data contained in this resource record."},{"field":"dns.header_flags","type":"keyword","normalization":"array","example":["RD","RA"],"description":"Array of DNS header flags."},{"field":"dns.id","type":"keyword","normalization":"","example":62111,"description":"The DNS packet identifier assigned by the program that generated the query. The identifier is copied to the response."},{"field":"dns.op_code","type":"keyword","normalization":"","example":"QUERY","description":"The DNS operation code that specifies the kind of query in the message."},{"field":"dns.question.class","type":"keyword","normalization":"","example":"IN","description":"The class of records being queried."},{"field":"dns.question.name","type":"keyword","normalization":"","example":"www.example.com","description":"The name being queried."},{"field":"dns.question.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered domain, stripped of the subdomain."},{"field":"dns.question.subdomain","type":"keyword","normalization":"","example":"www","description":"The subdomain of the domain."},{"field":"dns.question.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"dns.question.type","type":"keyword","normalization":"","example":"AAAA","description":"The type of record being queried."},{"field":"dns.resolved_ip","type":"ip","normalization":"array","example":["10.10.10.10","10.10.10.11"],"description":"Array containing all IPs seen in answers.data"},{"field":"dns.response_code","type":"keyword","normalization":"","example":"NOERROR","description":"The DNS response code."},{"field":"dns.type","type":"keyword","normalization":"","example":"answer","description":"The type of DNS event captured, query or answer."},{"field":"email.attachments","type":"nested","normalization":"array","example":"","description":"List of objects describing the attachments."},{"field":"email.attachments.file.extension","type":"keyword","normalization":"","example":"txt","description":"Attachment file extension."},{"field":"email.attachments.file.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"email.attachments.file.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"email.attachments.file.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"email.attachments.file.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"email.attachments.file.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"email.attachments.file.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"email.attachments.file.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"email.attachments.file.mime_type","type":"keyword","normalization":"","example":"text/plain","description":"MIME type of the attachment file."},{"field":"email.attachments.file.name","type":"keyword","normalization":"","example":"attachment.txt","description":"Name of the attachment file."},{"field":"email.attachments.file.size","type":"long","normalization":"","example":64329,"description":"Attachment file size."},{"field":"email.bcc.address","type":"keyword","normalization":"array","example":"bcc.user1@example.com","description":"Email address of BCC recipient"},{"field":"email.cc.address","type":"keyword","normalization":"array","example":"cc.user1@example.com","description":"Email address of CC recipient"},{"field":"email.content_type","type":"keyword","normalization":"","example":"text/plain","description":"MIME type of the email message."},{"field":"email.delivery_timestamp","type":"date","normalization":"","example":"2020-11-10T22:12:34.8196921Z","description":"Date and time when message was delivered."},{"field":"email.direction","type":"keyword","normalization":"","example":"inbound","description":"Direction of the message."},{"field":"email.from.address","type":"keyword","normalization":"array","example":"sender@example.com","description":"The sender's email address."},{"field":"email.local_id","type":"keyword","normalization":"","example":"c26dbea0-80d5-463b-b93c-4e8b708219ce","description":"Unique identifier given by the source."},{"field":"email.message_id","type":"wildcard","normalization":"","example":"81ce15$8r2j59@mail01.example.com","description":"Value from the Message-ID header."},{"field":"email.origination_timestamp","type":"date","normalization":"","example":"2020-11-10T22:12:34.8196921Z","description":"Date and time the email was composed."},{"field":"email.reply_to.address","type":"keyword","normalization":"array","example":"reply.here@example.com","description":"Address replies should be delivered to."},{"field":"email.sender.address","type":"keyword","normalization":"","example":"","description":"Address of the message sender."},{"field":"email.subject","type":"keyword","normalization":"","example":"Please see this important message.","description":"The subject of the email message."},{"field":"email.subject.text","type":"match_only_text","normalization":"","example":"Please see this important message.","description":"The subject of the email message."},{"field":"email.to.address","type":"keyword","normalization":"array","example":"user1@example.com","description":"Email address of recipient"},{"field":"email.x_mailer","type":"keyword","normalization":"","example":"Spambot v2.5","description":"Application that drafted email."},{"field":"error.code","type":"keyword","normalization":"","example":"","description":"Error code describing the error."},{"field":"error.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the error."},{"field":"error.message","type":"match_only_text","normalization":"","example":"","description":"Error message."},{"field":"error.stack_trace","type":"wildcard","normalization":"","example":"","description":"The stack trace of this error in plain text."},{"field":"error.stack_trace.text","type":"match_only_text","normalization":"","example":"","description":"The stack trace of this error in plain text."},{"field":"error.type","type":"keyword","normalization":"","example":"java.lang.NullPointerException","description":"The type of the error, for example the class name of the exception."},{"field":"event.action","type":"keyword","normalization":"","example":"user-password-change","description":"The action captured by the event."},{"field":"event.category","type":"keyword","normalization":"array","example":"authentication","description":"Event category. The second categorization field in the hierarchy."},{"field":"event.code","type":"keyword","normalization":"","example":4648,"description":"Identification code for this event."},{"field":"event.created","type":"date","normalization":"","example":"2016-05-23T08:05:34.857Z","description":"Time when the event was first read by an agent or by your pipeline."},{"field":"event.dataset","type":"keyword","normalization":"","example":"apache.access","description":"Name of the dataset."},{"field":"event.duration","type":"long","normalization":"","example":"","description":"Duration of the event in nanoseconds."},{"field":"event.end","type":"date","normalization":"","example":"","description":"event.end contains the date when the event ended or when the activity was last observed."},{"field":"event.hash","type":"keyword","normalization":"","example":"123456789012345678901234567890ABCD","description":"Hash (perhaps logstash fingerprint) of raw field to be able to demonstrate log integrity."},{"field":"event.id","type":"keyword","normalization":"","example":"8a4f500d","description":"Unique ID to describe the event."},{"field":"event.kind","type":"keyword","normalization":"","example":"alert","description":"The kind of the event. The highest categorization field in the hierarchy."},{"field":"event.original","type":"keyword","normalization":"","example":"Sep 19 08:26:10 host CEF:0|Security| threatmanager|1.0|100| worm successfully stopped|10|src=10.0.0.1 dst=2.1.2.2spt=1232","description":"Raw text message of entire event."},{"field":"event.outcome","type":"keyword","normalization":"","example":"success","description":"The outcome of the event. The lowest level categorization field in the hierarchy."},{"field":"event.provider","type":"keyword","normalization":"","example":"kernel","description":"Source of the event."},{"field":"event.reason","type":"keyword","normalization":"","example":"Terminated an unexpected process","description":"Reason why this event happened, according to the source"},{"field":"event.reference","type":"keyword","normalization":"","example":"https://system.example.com/event/#0001234","description":"Event reference URL"},{"field":"event.risk_score","type":"float","normalization":"","example":"","description":"Risk score or priority of the event (e.g. security solutions). Use your system's original value here."},{"field":"event.risk_score_norm","type":"float","normalization":"","example":"","description":"Normalized risk score or priority of the event (0-100)."},{"field":"event.sequence","type":"long","normalization":"","example":"","description":"Sequence number of the event."},{"field":"event.severity","type":"long","normalization":"","example":7,"description":"Numeric severity of the event."},{"field":"event.start","type":"date","normalization":"","example":"","description":"event.start contains the date when the event started or when the activity was first observed."},{"field":"event.timezone","type":"keyword","normalization":"","example":"","description":"Event time zone."},{"field":"event.type","type":"keyword","normalization":"array","example":"","description":"Event type. The third categorization field in the hierarchy."},{"field":"event.url","type":"keyword","normalization":"","example":"https://mysystem.example.com/alert/5271dedb-f5b0-4218-87f0-4ac4870a38fe","description":"Event investigation URL"},{"field":"faas.coldstart","type":"boolean","normalization":"","example":"","description":"Boolean value indicating a cold start of a function."},{"field":"faas.execution","type":"keyword","normalization":"","example":"af9d5aa4-a685-4c5f-a22b-444f80b3cc28","description":"The execution ID of the current function execution."},{"field":"faas.id","type":"keyword","normalization":"","example":"arn:aws:lambda:us-west-2:123456789012:function:my-function","description":"The unique identifier of a serverless function."},{"field":"faas.name","type":"keyword","normalization":"","example":"my-function","description":"The name of a serverless function."},{"field":"faas.trigger","type":"nested","normalization":"","example":"","description":"Details about the function trigger."},{"field":"faas.trigger.request_id","type":"keyword","normalization":"","example":123456789,"description":"The ID of the trigger request , message, event, etc."},{"field":"faas.trigger.type","type":"keyword","normalization":"","example":"http","description":"The trigger for the function execution."},{"field":"faas.version","type":"keyword","normalization":"","example":123,"description":"The version of a serverless function."},{"field":"file.accessed","type":"date","normalization":"","example":"","description":"Last time the file was accessed."},{"field":"file.attributes","type":"keyword","normalization":"array","example":["readonly","system"],"description":"Array of file attributes."},{"field":"file.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"file.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"file.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"file.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"file.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"file.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"file.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"file.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"file.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"file.created","type":"date","normalization":"","example":"","description":"File creation time."},{"field":"file.ctime","type":"date","normalization":"","example":"","description":"Last time the file attributes or metadata changed."},{"field":"file.device","type":"keyword","normalization":"","example":"sda","description":"Device that is the source of the file."},{"field":"file.directory","type":"keyword","normalization":"","example":"/home/alice","description":"Directory where the file is located."},{"field":"file.drive_letter","type":"keyword","normalization":"","example":"C","description":"Drive letter where the file is located."},{"field":"file.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"file.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"file.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"file.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"file.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"file.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"file.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"file.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"file.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"file.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"file.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"file.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"file.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"file.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"file.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"file.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"file.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"file.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"file.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"file.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"file.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"file.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"file.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"file.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"file.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"file.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"file.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"file.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"file.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"file.extension","type":"keyword","normalization":"","example":"png","description":"File extension, excluding the leading dot."},{"field":"file.fork_name","type":"keyword","normalization":"","example":"Zone.Identifer","description":"A fork is additional data associated with a filesystem object."},{"field":"file.gid","type":"keyword","normalization":"","example":1001,"description":"Primary group ID (GID) of the file."},{"field":"file.group","type":"keyword","normalization":"","example":"alice","description":"Primary group name of the file."},{"field":"file.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"file.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"file.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"file.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"file.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"file.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"file.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"file.inode","type":"keyword","normalization":"","example":256383,"description":"Inode representing the file in the filesystem."},{"field":"file.mime_type","type":"keyword","normalization":"","example":"","description":"Media type of file, document, or arrangement of bytes."},{"field":"file.mode","type":"keyword","normalization":"","example":"0640","description":"Mode of the file in octal representation."},{"field":"file.mtime","type":"date","normalization":"","example":"","description":"Last time the file content was modified."},{"field":"file.name","type":"keyword","normalization":"","example":"example.png","description":"Name of the file including the extension, without the directory."},{"field":"file.owner","type":"keyword","normalization":"","example":"alice","description":"File owner's username."},{"field":"file.path","type":"keyword","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"file.path.text","type":"match_only_text","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"file.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"file.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"file.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"file.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"file.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"file.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"file.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"file.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"file.size","type":"long","normalization":"","example":16384,"description":"File size in bytes."},{"field":"file.target_path","type":"keyword","normalization":"","example":"","description":"Target path for symlinks."},{"field":"file.target_path.text","type":"match_only_text","normalization":"","example":"","description":"Target path for symlinks."},{"field":"file.type","type":"keyword","normalization":"","example":"file","description":"File type (file, dir, or symlink)."},{"field":"file.uid","type":"keyword","normalization":"","example":1001,"description":"The user ID (UID) or security identifier (SID) of the file owner."},{"field":"file.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"file.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"file.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"file.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"file.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"file.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"file.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"file.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"file.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"file.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"file.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"file.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"file.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"file.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"file.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"file.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"file.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"file.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"file.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"file.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"file.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"file.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"file.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"file.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"host.boot.id","type":"keyword","normalization":"","example":"88a1f0ed-5ae5-41ee-af6b-41921c311872","description":"Linux boot uuid taken from /proc/sys/kernel/random/boot_id"},{"field":"host.cpu.usage","type":"scaled_float","normalization":"","example":"","description":"Percent CPU used, between 0 and 1."},{"field":"host.disk.read.bytes","type":"long","normalization":"","example":"","description":"The number of bytes read by all disks."},{"field":"host.disk.write.bytes","type":"long","normalization":"","example":"","description":"The number of bytes written on all disks."},{"field":"host.domain","type":"keyword","normalization":"","example":"CONTOSO","description":"Name of the directory the group is a member of."},{"field":"host.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"host.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"host.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"host.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"host.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"host.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"host.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"host.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"host.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"host.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"host.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"host.name","type":"keyword","normalization":"","example":"","description":"Name of the host."},{"field":"host.network.egress.bytes","type":"long","normalization":"","example":"","description":"The number of bytes sent on all network interfaces."},{"field":"host.network.egress.packets","type":"long","normalization":"","example":"","description":"The number of packets sent on all network interfaces."},{"field":"host.network.ingress.bytes","type":"long","normalization":"","example":"","description":"The number of bytes received on all network interfaces."},{"field":"host.network.ingress.packets","type":"long","normalization":"","example":"","description":"The number of packets received on all network interfaces."},{"field":"host.os.full","type":"keyword","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"host.os.full.text","type":"match_only_text","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"host.os.name.text","type":"match_only_text","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"host.os.platform","type":"keyword","normalization":"","example":"darwin","description":"Operating system platform (such centos, ubuntu, windows)."},{"field":"host.pid_ns_ino","type":"keyword","normalization":"","example":256383,"description":"Pid namespace inode"},{"field":"host.risk.calculated_level","type":"keyword","normalization":"","example":"High","description":"A risk classification level calculated by an internal system as part of entity analytics and entity risk scoring."},{"field":"host.risk.calculated_score","type":"float","normalization":"","example":880.73,"description":"A risk classification score calculated by an internal system as part of entity analytics and entity risk scoring."},{"field":"host.risk.calculated_score_norm","type":"float","normalization":"","example":88.73,"description":"A normalized risk score calculated by an internal system."},{"field":"host.risk.static_level","type":"keyword","normalization":"","example":"High","description":"A risk classification level obtained from outside the system, such as from some external Threat Intelligence Platform."},{"field":"host.risk.static_score","type":"float","normalization":"","example":830,"description":"A risk classification score obtained from outside the system, such as from some external Threat Intelligence Platform."},{"field":"host.risk.static_score_norm","type":"float","normalization":"","example":83,"description":"A normalized risk score calculated by an external system."},{"field":"host.type","type":"keyword","normalization":"","example":"","description":"Type of host."},{"field":"host.uptime","type":"long","normalization":"","example":1325,"description":"Seconds the host has been up."},{"field":"http.request.body.bytes","type":"long","normalization":"","example":887,"description":"Size in bytes of the request body."},{"field":"http.request.body.content","type":"wildcard","normalization":"","example":"Hello world","description":"The full HTTP request body."},{"field":"http.request.body.content.text","type":"match_only_text","normalization":"","example":"Hello world","description":"The full HTTP request body."},{"field":"http.request.bytes","type":"long","normalization":"","example":1437,"description":"Total size in bytes of the request (body and headers)."},{"field":"http.request.id","type":"keyword","normalization":"","example":"123e4567-e89b-12d3-a456-426614174000","description":"HTTP request ID."},{"field":"http.request.method","type":"keyword","normalization":"","example":"POST","description":"HTTP request method."},{"field":"http.request.mime_type","type":"keyword","normalization":"","example":"image/gif","description":"Mime type of the body of the request."},{"field":"http.request.referrer","type":"keyword","normalization":"","example":"https://blog.example.com/","description":"Referrer for this HTTP request."},{"field":"http.response.body.bytes","type":"long","normalization":"","example":887,"description":"Size in bytes of the response body."},{"field":"http.response.body.content","type":"wildcard","normalization":"","example":"Hello world","description":"The full HTTP response body."},{"field":"http.response.body.content.text","type":"match_only_text","normalization":"","example":"Hello world","description":"The full HTTP response body."},{"field":"http.response.bytes","type":"long","normalization":"","example":1437,"description":"Total size in bytes of the response (body and headers)."},{"field":"http.response.mime_type","type":"keyword","normalization":"","example":"image/gif","description":"Mime type of the body of the response."},{"field":"http.response.status_code","type":"long","normalization":"","example":404,"description":"HTTP response status code."},{"field":"http.version","type":"keyword","normalization":"","example":1.1,"description":"HTTP version."},{"field":"log.file.path","type":"keyword","normalization":"","example":"/var/log/fun-times.log","description":"Full path to the log file this event came from."},{"field":"log.level","type":"keyword","normalization":"","example":"error","description":"Log level of the log event."},{"field":"log.logger","type":"keyword","normalization":"","example":"org.elasticsearch.bootstrap.Bootstrap","description":"Name of the logger."},{"field":"log.origin.file.line","type":"long","normalization":"","example":42,"description":"The line number of the file which originated the log event."},{"field":"log.origin.file.name","type":"keyword","normalization":"","example":"Bootstrap.java","description":"The code file which originated the log event."},{"field":"log.origin.function","type":"keyword","normalization":"","example":"init","description":"The function which originated the log event."},{"field":"log.syslog","type":"object","normalization":"","example":"","description":"Syslog metadata"},{"field":"log.syslog.appname","type":"keyword","normalization":"","example":"sshd","description":"The device or application that originated the Syslog message."},{"field":"log.syslog.facility.code","type":"long","normalization":"","example":23,"description":"Syslog numeric facility of the event."},{"field":"log.syslog.facility.name","type":"keyword","normalization":"","example":"local7","description":"Syslog text-based facility of the event."},{"field":"log.syslog.hostname","type":"keyword","normalization":"","example":"example-host","description":"The host that originated the Syslog message."},{"field":"log.syslog.msgid","type":"keyword","normalization":"","example":"ID47","description":"An identifier for the type of Syslog message."},{"field":"log.syslog.priority","type":"long","normalization":"","example":135,"description":"Syslog priority of the event."},{"field":"log.syslog.procid","type":"keyword","normalization":"","example":12345,"description":"The process name or ID that originated the Syslog message."},{"field":"log.syslog.severity.code","type":"long","normalization":"","example":3,"description":"Syslog numeric severity of the event."},{"field":"log.syslog.severity.name","type":"keyword","normalization":"","example":"Error","description":"Syslog text-based severity of the event."},{"field":"log.syslog.structured_data","type":"flattened","normalization":"","example":"","description":"Structured data expressed in RFC 5424 messages."},{"field":"log.syslog.version","type":"keyword","normalization":"","example":1,"description":"Syslog protocol version."},{"field":"network.application","type":"keyword","normalization":"","example":"aim","description":"Application level protocol name."},{"field":"network.bytes","type":"long","normalization":"","example":368,"description":"Total bytes transferred in both directions."},{"field":"network.community_id","type":"keyword","normalization":"","example":"1:hO+sN4H+MG5MY/8hIrXPqc4ZQz0=","description":"A hash of source and destination IPs and ports."},{"field":"network.direction","type":"keyword","normalization":"","example":"inbound","description":"Direction of the network traffic."},{"field":"network.forwarded_ip","type":"ip","normalization":"","example":"192.1.1.2","description":"Host IP address when the source IP address is the proxy."},{"field":"network.iana_number","type":"keyword","normalization":"","example":6,"description":"IANA Protocol Number."},{"field":"network.inner","type":"object","normalization":"","example":"","description":"Inner VLAN tag information"},{"field":"network.inner.vlan.id","type":"keyword","normalization":"","example":10,"description":"VLAN ID as reported by the observer."},{"field":"network.inner.vlan.name","type":"keyword","normalization":"","example":"outside","description":"Optional VLAN name as reported by the observer."},{"field":"network.name","type":"keyword","normalization":"","example":"Guest Wifi","description":"Name given by operators to sections of their network."},{"field":"network.packets","type":"long","normalization":"","example":24,"description":"Total packets transferred in both directions."},{"field":"network.protocol","type":"keyword","normalization":"","example":"http","description":"Application protocol name."},{"field":"network.transport","type":"keyword","normalization":"","example":"tcp","description":"Protocol Name corresponding to the field `iana_number`."},{"field":"network.type","type":"keyword","normalization":"","example":"ipv4","description":"In the OSI Model this would be the Network Layer. ipv4, ipv6, ipsec, pim, etc"},{"field":"network.vlan.id","type":"keyword","normalization":"","example":10,"description":"VLAN ID as reported by the observer."},{"field":"network.vlan.name","type":"keyword","normalization":"","example":"outside","description":"Optional VLAN name as reported by the observer."},{"field":"observer.egress","type":"object","normalization":"","example":"","description":"Object field for egress information"},{"field":"observer.egress.interface.alias","type":"keyword","normalization":"","example":"outside","description":"Interface alias"},{"field":"observer.egress.interface.id","type":"keyword","normalization":"","example":10,"description":"Interface ID"},{"field":"observer.egress.interface.name","type":"keyword","normalization":"","example":"eth0","description":"Interface name"},{"field":"observer.egress.vlan.id","type":"keyword","normalization":"","example":10,"description":"VLAN ID as reported by the observer."},{"field":"observer.egress.vlan.name","type":"keyword","normalization":"","example":"outside","description":"Optional VLAN name as reported by the observer."},{"field":"observer.egress.zone","type":"keyword","normalization":"","example":"Public_Internet","description":"Observer Egress zone"},{"field":"observer.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"observer.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"observer.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"observer.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"observer.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"observer.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"observer.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"observer.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"observer.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"observer.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"observer.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"observer.hostname","type":"keyword","normalization":"","example":"","description":"Hostname of the observer."},{"field":"observer.ingress","type":"object","normalization":"","example":"","description":"Object field for ingress information"},{"field":"observer.ingress.interface.alias","type":"keyword","normalization":"","example":"outside","description":"Interface alias"},{"field":"observer.ingress.interface.id","type":"keyword","normalization":"","example":10,"description":"Interface ID"},{"field":"observer.ingress.interface.name","type":"keyword","normalization":"","example":"eth0","description":"Interface name"},{"field":"observer.ingress.vlan.id","type":"keyword","normalization":"","example":10,"description":"VLAN ID as reported by the observer."},{"field":"observer.ingress.vlan.name","type":"keyword","normalization":"","example":"outside","description":"Optional VLAN name as reported by the observer."},{"field":"observer.ingress.zone","type":"keyword","normalization":"","example":"DMZ","description":"Observer ingress zone"},{"field":"observer.ip","type":"ip","normalization":"array","example":"","description":"IP addresses of the observer."},{"field":"observer.mac","type":"keyword","normalization":"array","example":["00-00-5E-00-53-23","00-00-5E-00-53-24"],"description":"MAC addresses of the observer."},{"field":"observer.name","type":"keyword","normalization":"","example":"1_proxySG","description":"Custom name of the observer."},{"field":"observer.os.family","type":"keyword","normalization":"","example":"debian","description":"OS family (such as redhat, debian, freebsd, windows)."},{"field":"observer.os.full","type":"keyword","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"observer.os.full.text","type":"match_only_text","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"observer.os.kernel","type":"keyword","normalization":"","example":"4.4.0-112-generic","description":"Operating system kernel version as a raw string."},{"field":"observer.os.name","type":"keyword","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"observer.os.name.text","type":"match_only_text","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"observer.os.platform","type":"keyword","normalization":"","example":"darwin","description":"Operating system platform (such centos, ubuntu, windows)."},{"field":"observer.os.type","type":"keyword","normalization":"","example":"macos","description":"Which commercial OS family (one of: linux, macos, unix, windows, ios or android)."},{"field":"observer.os.version","type":"keyword","normalization":"","example":"10.14.1","description":"Operating system version as a raw string."},{"field":"observer.product","type":"keyword","normalization":"","example":"s200","description":"The product name of the observer."},{"field":"observer.serial_number","type":"keyword","normalization":"","example":"","description":"Observer serial number."},{"field":"observer.type","type":"keyword","normalization":"","example":"firewall","description":"The type of the observer the data is coming from."},{"field":"observer.vendor","type":"keyword","normalization":"","example":"Symantec","description":"Vendor name of the observer."},{"field":"observer.version","type":"keyword","normalization":"","example":"","description":"Observer version."},{"field":"orchestrator.api_version","type":"keyword","normalization":"","example":"v1beta1","description":"API version being used to carry out the action"},{"field":"orchestrator.cluster.id","type":"keyword","normalization":"","example":"","description":"Unique ID of the cluster."},{"field":"orchestrator.cluster.name","type":"keyword","normalization":"","example":"","description":"Name of the cluster."},{"field":"orchestrator.cluster.url","type":"keyword","normalization":"","example":"","description":"URL of the API used to manage the cluster."},{"field":"orchestrator.cluster.version","type":"keyword","normalization":"","example":"","description":"The version of the cluster."},{"field":"orchestrator.namespace","type":"keyword","normalization":"","example":"kube-system","description":"Namespace in which the action is taking place."},{"field":"orchestrator.organization","type":"keyword","normalization":"","example":"elastic","description":"Organization affected by the event (for multi-tenant orchestrator setups)."},{"field":"orchestrator.resource.id","type":"keyword","normalization":"","example":"","description":"Unique ID of the resource being acted upon."},{"field":"orchestrator.resource.ip","type":"ip","normalization":"array","example":"","description":"IP address assigned to the resource associated with the event being observed."},{"field":"orchestrator.resource.name","type":"keyword","normalization":"","example":"test-pod-cdcws","description":"Name of the resource being acted upon."},{"field":"orchestrator.resource.parent.type","type":"keyword","normalization":"","example":"DaemonSet","description":"Type or kind of the parent resource associated with the event being observed."},{"field":"orchestrator.resource.type","type":"keyword","normalization":"","example":"service","description":"Type of resource being acted upon."},{"field":"orchestrator.type","type":"keyword","normalization":"","example":"kubernetes","description":"Orchestrator cluster type (e.g. kubernetes, nomad or cloudfoundry)."},{"field":"organization.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the organization."},{"field":"organization.name","type":"keyword","normalization":"","example":"","description":"Organization name."},{"field":"organization.name.text","type":"match_only_text","normalization":"","example":"","description":"Organization name."},{"field":"package.architecture","type":"keyword","normalization":"","example":"x86_64","description":"Package architecture."},{"field":"package.build_version","type":"keyword","normalization":"","example":"36f4f7e89dd61b0988b12ee000b98966867710cd","description":"Build version information"},{"field":"package.checksum","type":"keyword","normalization":"","example":"68b329da9893e34099c7d8ad5cb9c940","description":"Checksum of the installed package for verification."},{"field":"package.description","type":"keyword","normalization":"","example":"Open source programming language to build simple/reliable/efficient software.","description":"Description of the package."},{"field":"package.install_scope","type":"keyword","normalization":"","example":"global","description":"Indicating how the package was installed, e.g. user-local, global."},{"field":"package.installed","type":"date","normalization":"","example":"","description":"Time when package was installed."},{"field":"package.license","type":"keyword","normalization":"","example":"Apache License 2.0","description":"Package license"},{"field":"package.name","type":"keyword","normalization":"","example":"go","description":"Package name"},{"field":"package.path","type":"keyword","normalization":"","example":"/usr/local/Cellar/go/1.12.9/","description":"Path where the package is installed."},{"field":"package.reference","type":"keyword","normalization":"","example":"https://golang.org","description":"Package home page or reference URL"},{"field":"package.size","type":"long","normalization":"","example":62231,"description":"Package size in bytes."},{"field":"package.type","type":"keyword","normalization":"","example":"rpm","description":"Package type"},{"field":"package.version","type":"keyword","normalization":"","example":"1.12.9","description":"Package version"},{"field":"process.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"process.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"process.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"process.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"process.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"process.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"process.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"process.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"process.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"process.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"process.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"process.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"process.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"process.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"process.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"process.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"process.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"process.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"process.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"process.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"process.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"process.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"process.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"process.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"process.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"process.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"process.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"process.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"process.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"process.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"process.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"process.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"process.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"process.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"process.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"process.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"process.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"process.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"process.end","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process ended."},{"field":"process.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.entry_leader.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.entry_leader.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.entry_leader.attested_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.entry_leader.attested_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.entry_leader.attested_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.attested_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.entry_leader.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.entry_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.entry_leader.entry_meta.source.ip","type":"ip","normalization":"","example":"","description":"IP address of the source."},{"field":"process.entry_leader.entry_meta.type","type":"keyword","normalization":"","example":"","description":"The entry type for the entry session leader."},{"field":"process.entry_leader.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.entry_leader.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.entry_leader.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.entry_leader.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.entry_leader.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.entry_leader.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.entry_leader.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.entry_leader.parent.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.entry_leader.parent.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.entry_leader.parent.session_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.entry_leader.parent.session_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.entry_leader.parent.session_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.entry_leader.parent.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.entry_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.entry_leader.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.entry_leader.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.entry_leader.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.entry_leader.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.same_as_process","type":"boolean","normalization":"","example":"True","description":"This boolean is used to identify if a leader process is the same as the top level process."},{"field":"process.entry_leader.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.entry_leader.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.entry_leader.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.entry_leader.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.entry_leader.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.entry_leader.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.entry_leader.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.entry_leader.tty.char_device.major","type":"long","normalization":"","example":4,"description":"The TTY character device's major number."},{"field":"process.entry_leader.tty.char_device.minor","type":"long","normalization":"","example":1,"description":"The TTY character device's minor number."},{"field":"process.entry_leader.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.entry_leader.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.entry_leader.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.entry_leader.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.env_vars","type":"keyword","normalization":"array","example":["PATH=/usr/local/bin:/usr/bin","USER=ubuntu"],"description":"Array of environment variable bindings."},{"field":"process.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.exit_code","type":"long","normalization":"","example":137,"description":"The exit code of the process."},{"field":"process.group_leader.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.group_leader.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.group_leader.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.group_leader.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.group_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.group_leader.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.group_leader.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.group_leader.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.group_leader.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.group_leader.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.group_leader.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.group_leader.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.group_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.group_leader.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.group_leader.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.group_leader.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.group_leader.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.same_as_process","type":"boolean","normalization":"","example":"True","description":"This boolean is used to identify if a leader process is the same as the top level process."},{"field":"process.group_leader.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.group_leader.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.group_leader.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.group_leader.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.group_leader.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.group_leader.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.group_leader.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.group_leader.tty.char_device.major","type":"long","normalization":"","example":4,"description":"The TTY character device's major number."},{"field":"process.group_leader.tty.char_device.minor","type":"long","normalization":"","example":1,"description":"The TTY character device's minor number."},{"field":"process.group_leader.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.group_leader.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.group_leader.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.group_leader.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"process.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"process.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"process.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"process.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"process.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"process.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"process.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.parent.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.parent.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.parent.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"process.parent.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"process.parent.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"process.parent.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"process.parent.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"process.parent.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"process.parent.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"process.parent.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"process.parent.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"process.parent.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.parent.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.parent.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"process.parent.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"process.parent.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"process.parent.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"process.parent.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"process.parent.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"process.parent.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"process.parent.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"process.parent.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"process.parent.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"process.parent.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"process.parent.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"process.parent.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"process.parent.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"process.parent.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"process.parent.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"process.parent.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"process.parent.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"process.parent.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"process.parent.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"process.parent.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"process.parent.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"process.parent.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"process.parent.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"process.parent.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"process.parent.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"process.parent.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"process.parent.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"process.parent.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"process.parent.end","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process ended."},{"field":"process.parent.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.parent.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.parent.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.parent.exit_code","type":"long","normalization":"","example":137,"description":"The exit code of the process."},{"field":"process.parent.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.parent.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.parent.group_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.parent.group_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.parent.group_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.parent.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"process.parent.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"process.parent.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"process.parent.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"process.parent.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"process.parent.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"process.parent.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"process.parent.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.parent.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.parent.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.parent.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"process.parent.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"process.parent.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"process.parent.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"process.parent.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"process.parent.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"process.parent.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"process.parent.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"process.parent.pgid","type":"long","normalization":"","example":"","description":"Deprecated identifier of the group of processes the process belongs to."},{"field":"process.parent.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.parent.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.parent.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.parent.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.parent.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.parent.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.parent.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.parent.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.parent.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.parent.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.parent.thread.id","type":"long","normalization":"","example":4242,"description":"Thread ID."},{"field":"process.parent.thread.name","type":"keyword","normalization":"","example":"thread-0","description":"Thread name."},{"field":"process.parent.title","type":"keyword","normalization":"","example":"","description":"Process title."},{"field":"process.parent.title.text","type":"match_only_text","normalization":"","example":"","description":"Process title."},{"field":"process.parent.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.parent.tty.char_device.major","type":"long","normalization":"","example":4,"description":"The TTY character device's major number."},{"field":"process.parent.tty.char_device.minor","type":"long","normalization":"","example":1,"description":"The TTY character device's minor number."},{"field":"process.parent.uptime","type":"long","normalization":"","example":1325,"description":"Seconds the process has been up."},{"field":"process.parent.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.parent.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.parent.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.parent.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"process.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"process.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"process.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"process.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"process.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"process.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"process.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"process.pgid","type":"long","normalization":"","example":"","description":"Deprecated identifier of the group of processes the process belongs to."},{"field":"process.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.previous.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.previous.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.previous.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.previous.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.args","type":"keyword","normalization":"array","example":["/usr/bin/ssh","-l","user","10.0.0.16"],"description":"Array of process arguments."},{"field":"process.session_leader.args_count","type":"long","normalization":"","example":4,"description":"Length of the process.args array."},{"field":"process.session_leader.command_line","type":"wildcard","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.session_leader.command_line.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh -l user 10.0.0.16","description":"Full command line that started the process."},{"field":"process.session_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.session_leader.executable","type":"keyword","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.session_leader.executable.text","type":"match_only_text","normalization":"","example":"/usr/bin/ssh","description":"Absolute path to the process executable."},{"field":"process.session_leader.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.session_leader.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.session_leader.interactive","type":"boolean","normalization":"","example":"True","description":"Whether the process is connected to an interactive shell."},{"field":"process.session_leader.name","type":"keyword","normalization":"","example":"ssh","description":"Process name."},{"field":"process.session_leader.name.text","type":"match_only_text","normalization":"","example":"ssh","description":"Process name."},{"field":"process.session_leader.parent.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.session_leader.parent.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.session_leader.parent.session_leader.entity_id","type":"keyword","normalization":"","example":"c2c455d9f99375d","description":"Unique identifier for the process."},{"field":"process.session_leader.parent.session_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.session_leader.parent.session_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.session_leader.parent.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.session_leader.pid","type":"long","normalization":"","example":4242,"description":"Process id."},{"field":"process.session_leader.real_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.session_leader.real_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.session_leader.real_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.session_leader.real_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.real_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.same_as_process","type":"boolean","normalization":"","example":"True","description":"This boolean is used to identify if a leader process is the same as the top level process."},{"field":"process.session_leader.saved_group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.session_leader.saved_group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.session_leader.saved_user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.session_leader.saved_user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.saved_user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.session_leader.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.session_leader.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.session_leader.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.session_leader.tty.char_device.major","type":"long","normalization":"","example":4,"description":"The TTY character device's major number."},{"field":"process.session_leader.tty.char_device.minor","type":"long","normalization":"","example":1,"description":"The TTY character device's minor number."},{"field":"process.session_leader.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.session_leader.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.session_leader.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.session_leader.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.start","type":"date","normalization":"","example":"2016-05-23T08:05:34.853Z","description":"The time the process started."},{"field":"process.supplemental_groups.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"process.supplemental_groups.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"process.thread.id","type":"long","normalization":"","example":4242,"description":"Thread ID."},{"field":"process.thread.name","type":"keyword","normalization":"","example":"thread-0","description":"Thread name."},{"field":"process.title","type":"keyword","normalization":"","example":"","description":"Process title."},{"field":"process.title.text","type":"match_only_text","normalization":"","example":"","description":"Process title."},{"field":"process.tty","type":"object","normalization":"","example":"","description":"Information about the controlling TTY device."},{"field":"process.tty.char_device.major","type":"long","normalization":"","example":4,"description":"The TTY character device's major number."},{"field":"process.tty.char_device.minor","type":"long","normalization":"","example":1,"description":"The TTY character device's minor number."},{"field":"process.tty.columns","type":"long","normalization":"","example":80,"description":"The number of character columns per line. e.g terminal width"},{"field":"process.tty.rows","type":"long","normalization":"","example":24,"description":"The number of character rows in the terminal. e.g terminal height"},{"field":"process.uptime","type":"long","normalization":"","example":1325,"description":"Seconds the process has been up."},{"field":"process.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"process.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"process.working_directory","type":"keyword","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"process.working_directory.text","type":"match_only_text","normalization":"","example":"/home/alice","description":"The working directory of the process."},{"field":"registry.data.bytes","type":"keyword","normalization":"","example":"ZQBuAC0AVQBTAAAAZQBuAAAAAAA=","description":"Original bytes written with base64 encoding."},{"field":"registry.data.strings","type":"wildcard","normalization":"array","example":"[\"C:\\rta\\red_ttp\\bin\\myapp.exe\"]","description":"List of strings representing what was written to the registry."},{"field":"registry.data.type","type":"keyword","normalization":"","example":"REG_SZ","description":"Standard registry type for encoding contents"},{"field":"registry.hive","type":"keyword","normalization":"","example":"HKLM","description":"Abbreviated name for the hive."},{"field":"registry.key","type":"keyword","normalization":"","example":"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe","description":"Hive-relative path of keys."},{"field":"registry.path","type":"keyword","normalization":"","example":"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe\\Debugger","description":"Full path, including hive, key and value"},{"field":"registry.value","type":"keyword","normalization":"","example":"Debugger","description":"Name of the value written."},{"field":"related.hash","type":"keyword","normalization":"array","example":"","description":"All the hashes seen on your event."},{"field":"related.hosts","type":"keyword","normalization":"array","example":"","description":"All the host identifiers seen on your event."},{"field":"related.ip","type":"ip","normalization":"array","example":"","description":"All of the IPs seen on your event."},{"field":"related.user","type":"keyword","normalization":"array","example":"","description":"All the user names or other user identifiers seen on the event."},{"field":"rule.author","type":"keyword","normalization":"array","example":["Star-Lord"],"description":"Rule author"},{"field":"rule.category","type":"keyword","normalization":"","example":"Attempted Information Leak","description":"Rule category"},{"field":"rule.description","type":"keyword","normalization":"","example":"Block requests to public DNS over HTTPS / TLS protocols","description":"Rule description"},{"field":"rule.id","type":"keyword","normalization":"","example":101,"description":"Rule ID"},{"field":"rule.license","type":"keyword","normalization":"","example":"Apache 2.0","description":"Rule license"},{"field":"rule.name","type":"keyword","normalization":"","example":"BLOCK_DNS_over_TLS","description":"Rule name"},{"field":"rule.reference","type":"keyword","normalization":"","example":"https://en.wikipedia.org/wiki/DNS_over_TLS","description":"Rule reference URL"},{"field":"rule.ruleset","type":"keyword","normalization":"","example":"Standard_Protocol_Filters","description":"Rule ruleset"},{"field":"rule.uuid","type":"keyword","normalization":"","example":1100110011,"description":"Rule UUID"},{"field":"rule.version","type":"keyword","normalization":"","example":1.1,"description":"Rule version"},{"field":"server.address","type":"keyword","normalization":"","example":"","description":"Server network address."},{"field":"server.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"server.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"server.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"server.bytes","type":"long","normalization":"","example":184,"description":"Bytes sent from the server to the client."},{"field":"server.domain","type":"keyword","normalization":"","example":"foo.example.com","description":"The domain name of the server."},{"field":"server.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"server.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"server.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"server.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"server.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"server.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"server.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"server.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"server.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"server.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"server.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"server.ip","type":"ip","normalization":"","example":"","description":"IP address of the server."},{"field":"server.mac","type":"keyword","normalization":"","example":"00-00-5E-00-53-23","description":"MAC address of the server."},{"field":"server.nat.ip","type":"ip","normalization":"","example":"","description":"Server NAT ip"},{"field":"server.nat.port","type":"long","normalization":"","example":"","description":"Server NAT port"},{"field":"server.packets","type":"long","normalization":"","example":12,"description":"Packets sent from the server to the client."},{"field":"server.port","type":"long","normalization":"","example":"","description":"Port of the server."},{"field":"server.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered server domain, stripped of the subdomain."},{"field":"server.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"server.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"server.user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"server.user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"server.user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"server.user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"server.user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"server.user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"server.user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"server.user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"server.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"server.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"server.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"server.user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"service.address","type":"keyword","normalization":"","example":"172.26.0.2:5432","description":"Address of this service."},{"field":"service.environment","type":"keyword","normalization":"","example":"production","description":"Environment of the service."},{"field":"service.ephemeral_id","type":"keyword","normalization":"","example":"8a4f500f","description":"Ephemeral identifier of this service."},{"field":"service.id","type":"keyword","normalization":"","example":"d37e5ebfe0ae6c4972dbe9f0174a1637bb8247f6","description":"Unique identifier of the running service."},{"field":"service.name","type":"keyword","normalization":"","example":"elasticsearch-metrics","description":"Name of the service."},{"field":"service.node.name","type":"keyword","normalization":"","example":"instance-0000000016","description":"Name of the service node."},{"field":"service.node.role","type":"keyword","normalization":"","example":"background_tasks","description":"Deprecated role (singular) of the service node."},{"field":"service.node.roles","type":"keyword","normalization":"array","example":["ui","background_tasks"],"description":"Roles of the service node."},{"field":"service.origin.address","type":"keyword","normalization":"","example":"172.26.0.2:5432","description":"Address of this service."},{"field":"service.origin.environment","type":"keyword","normalization":"","example":"production","description":"Environment of the service."},{"field":"service.origin.ephemeral_id","type":"keyword","normalization":"","example":"8a4f500f","description":"Ephemeral identifier of this service."},{"field":"service.origin.id","type":"keyword","normalization":"","example":"d37e5ebfe0ae6c4972dbe9f0174a1637bb8247f6","description":"Unique identifier of the running service."},{"field":"service.origin.name","type":"keyword","normalization":"","example":"elasticsearch-metrics","description":"Name of the service."},{"field":"service.origin.node.name","type":"keyword","normalization":"","example":"instance-0000000016","description":"Name of the service node."},{"field":"service.origin.node.role","type":"keyword","normalization":"","example":"background_tasks","description":"Deprecated role (singular) of the service node."},{"field":"service.origin.node.roles","type":"keyword","normalization":"array","example":["ui","background_tasks"],"description":"Roles of the service node."},{"field":"service.origin.state","type":"keyword","normalization":"","example":"","description":"Current state of the service."},{"field":"service.origin.type","type":"keyword","normalization":"","example":"elasticsearch","description":"The type of the service."},{"field":"service.origin.version","type":"keyword","normalization":"","example":"3.2.4","description":"Version of the service."},{"field":"service.state","type":"keyword","normalization":"","example":"","description":"Current state of the service."},{"field":"service.target.address","type":"keyword","normalization":"","example":"172.26.0.2:5432","description":"Address of this service."},{"field":"service.target.environment","type":"keyword","normalization":"","example":"production","description":"Environment of the service."},{"field":"service.target.ephemeral_id","type":"keyword","normalization":"","example":"8a4f500f","description":"Ephemeral identifier of this service."},{"field":"service.target.id","type":"keyword","normalization":"","example":"d37e5ebfe0ae6c4972dbe9f0174a1637bb8247f6","description":"Unique identifier of the running service."},{"field":"service.target.name","type":"keyword","normalization":"","example":"elasticsearch-metrics","description":"Name of the service."},{"field":"service.target.node.name","type":"keyword","normalization":"","example":"instance-0000000016","description":"Name of the service node."},{"field":"service.target.node.role","type":"keyword","normalization":"","example":"background_tasks","description":"Deprecated role (singular) of the service node."},{"field":"service.target.node.roles","type":"keyword","normalization":"array","example":["ui","background_tasks"],"description":"Roles of the service node."},{"field":"service.target.state","type":"keyword","normalization":"","example":"","description":"Current state of the service."},{"field":"service.target.type","type":"keyword","normalization":"","example":"elasticsearch","description":"The type of the service."},{"field":"service.target.version","type":"keyword","normalization":"","example":"3.2.4","description":"Version of the service."},{"field":"service.type","type":"keyword","normalization":"","example":"elasticsearch","description":"The type of the service."},{"field":"service.version","type":"keyword","normalization":"","example":"3.2.4","description":"Version of the service."},{"field":"source.address","type":"keyword","normalization":"","example":"","description":"Source network address."},{"field":"source.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"source.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"source.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"source.bytes","type":"long","normalization":"","example":184,"description":"Bytes sent from the source to the destination."},{"field":"source.domain","type":"keyword","normalization":"","example":"foo.example.com","description":"The domain name of the source."},{"field":"source.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"source.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"source.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"source.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"source.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"source.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"source.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"source.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"source.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"source.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"source.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"source.ip","type":"ip","normalization":"","example":"","description":"IP address of the source."},{"field":"source.mac","type":"keyword","normalization":"","example":"00-00-5E-00-53-23","description":"MAC address of the source."},{"field":"source.nat.ip","type":"ip","normalization":"","example":"","description":"Source NAT ip"},{"field":"source.nat.port","type":"long","normalization":"","example":"","description":"Source NAT port"},{"field":"source.packets","type":"long","normalization":"","example":12,"description":"Packets sent from the source to the destination."},{"field":"source.port","type":"long","normalization":"","example":"","description":"Port of the source."},{"field":"source.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered source domain, stripped of the subdomain."},{"field":"source.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"source.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"source.user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"source.user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"source.user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"source.user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"source.user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"source.user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"source.user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"source.user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"source.user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"source.user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"source.user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"source.user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"span.id","type":"keyword","normalization":"","example":"3ff9a8981b7ccd5a","description":"Unique identifier of the span within the scope of its trace."},{"field":"threat.enrichments","type":"nested","normalization":"array","example":"","description":"List of objects containing indicators enriching the event."},{"field":"threat.enrichments.indicator","type":"object","normalization":"","example":"","description":"Object containing indicators enriching the event."},{"field":"threat.enrichments.indicator.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"threat.enrichments.indicator.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"threat.enrichments.indicator.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"threat.enrichments.indicator.confidence","type":"keyword","normalization":"","example":"Medium","description":"Indicator confidence rating"},{"field":"threat.enrichments.indicator.description","type":"keyword","normalization":"","example":"IP x.x.x.x was observed delivering the Angler EK.","description":"Indicator description"},{"field":"threat.enrichments.indicator.email.address","type":"keyword","normalization":"","example":"phish@example.com","description":"Indicator email address"},{"field":"threat.enrichments.indicator.file.accessed","type":"date","normalization":"","example":"","description":"Last time the file was accessed."},{"field":"threat.enrichments.indicator.file.attributes","type":"keyword","normalization":"array","example":["readonly","system"],"description":"Array of file attributes."},{"field":"threat.enrichments.indicator.file.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"threat.enrichments.indicator.file.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"threat.enrichments.indicator.file.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"threat.enrichments.indicator.file.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"threat.enrichments.indicator.file.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"threat.enrichments.indicator.file.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"threat.enrichments.indicator.file.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"threat.enrichments.indicator.file.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"threat.enrichments.indicator.file.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"threat.enrichments.indicator.file.created","type":"date","normalization":"","example":"","description":"File creation time."},{"field":"threat.enrichments.indicator.file.ctime","type":"date","normalization":"","example":"","description":"Last time the file attributes or metadata changed."},{"field":"threat.enrichments.indicator.file.device","type":"keyword","normalization":"","example":"sda","description":"Device that is the source of the file."},{"field":"threat.enrichments.indicator.file.directory","type":"keyword","normalization":"","example":"/home/alice","description":"Directory where the file is located."},{"field":"threat.enrichments.indicator.file.drive_letter","type":"keyword","normalization":"","example":"C","description":"Drive letter where the file is located."},{"field":"threat.enrichments.indicator.file.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"threat.enrichments.indicator.file.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"threat.enrichments.indicator.file.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"threat.enrichments.indicator.file.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"threat.enrichments.indicator.file.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"threat.enrichments.indicator.file.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"threat.enrichments.indicator.file.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"threat.enrichments.indicator.file.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"threat.enrichments.indicator.file.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"threat.enrichments.indicator.file.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"threat.enrichments.indicator.file.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"threat.enrichments.indicator.file.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"threat.enrichments.indicator.file.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"threat.enrichments.indicator.file.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"threat.enrichments.indicator.file.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"threat.enrichments.indicator.file.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"threat.enrichments.indicator.file.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"threat.enrichments.indicator.file.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"threat.enrichments.indicator.file.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"threat.enrichments.indicator.file.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"threat.enrichments.indicator.file.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"threat.enrichments.indicator.file.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"threat.enrichments.indicator.file.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"threat.enrichments.indicator.file.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"threat.enrichments.indicator.file.extension","type":"keyword","normalization":"","example":"png","description":"File extension, excluding the leading dot."},{"field":"threat.enrichments.indicator.file.fork_name","type":"keyword","normalization":"","example":"Zone.Identifer","description":"A fork is additional data associated with a filesystem object."},{"field":"threat.enrichments.indicator.file.gid","type":"keyword","normalization":"","example":1001,"description":"Primary group ID (GID) of the file."},{"field":"threat.enrichments.indicator.file.group","type":"keyword","normalization":"","example":"alice","description":"Primary group name of the file."},{"field":"threat.enrichments.indicator.file.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"threat.enrichments.indicator.file.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"threat.enrichments.indicator.file.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"threat.enrichments.indicator.file.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"threat.enrichments.indicator.file.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"threat.enrichments.indicator.file.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"threat.enrichments.indicator.file.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"threat.enrichments.indicator.file.inode","type":"keyword","normalization":"","example":256383,"description":"Inode representing the file in the filesystem."},{"field":"threat.enrichments.indicator.file.mime_type","type":"keyword","normalization":"","example":"","description":"Media type of file, document, or arrangement of bytes."},{"field":"threat.enrichments.indicator.file.mode","type":"keyword","normalization":"","example":"0640","description":"Mode of the file in octal representation."},{"field":"threat.enrichments.indicator.file.mtime","type":"date","normalization":"","example":"","description":"Last time the file content was modified."},{"field":"threat.enrichments.indicator.file.name","type":"keyword","normalization":"","example":"example.png","description":"Name of the file including the extension, without the directory."},{"field":"threat.enrichments.indicator.file.owner","type":"keyword","normalization":"","example":"alice","description":"File owner's username."},{"field":"threat.enrichments.indicator.file.path","type":"keyword","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"threat.enrichments.indicator.file.path.text","type":"match_only_text","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"threat.enrichments.indicator.file.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"threat.enrichments.indicator.file.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"threat.enrichments.indicator.file.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"threat.enrichments.indicator.file.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"threat.enrichments.indicator.file.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"threat.enrichments.indicator.file.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"threat.enrichments.indicator.file.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"threat.enrichments.indicator.file.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"threat.enrichments.indicator.file.size","type":"long","normalization":"","example":16384,"description":"File size in bytes."},{"field":"threat.enrichments.indicator.file.target_path","type":"keyword","normalization":"","example":"","description":"Target path for symlinks."},{"field":"threat.enrichments.indicator.file.target_path.text","type":"match_only_text","normalization":"","example":"","description":"Target path for symlinks."},{"field":"threat.enrichments.indicator.file.type","type":"keyword","normalization":"","example":"file","description":"File type (file, dir, or symlink)."},{"field":"threat.enrichments.indicator.file.uid","type":"keyword","normalization":"","example":1001,"description":"The user ID (UID) or security identifier (SID) of the file owner."},{"field":"threat.enrichments.indicator.file.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"threat.enrichments.indicator.file.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"threat.enrichments.indicator.file.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"threat.enrichments.indicator.file.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"threat.enrichments.indicator.file.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"threat.enrichments.indicator.file.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"threat.enrichments.indicator.file.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"threat.enrichments.indicator.file.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.enrichments.indicator.file.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"threat.enrichments.indicator.file.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"threat.enrichments.indicator.file.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"threat.enrichments.indicator.file.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"threat.enrichments.indicator.file.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"threat.enrichments.indicator.file.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"threat.enrichments.indicator.file.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"threat.enrichments.indicator.file.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"threat.enrichments.indicator.file.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"threat.enrichments.indicator.file.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"threat.enrichments.indicator.file.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"threat.enrichments.indicator.file.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"threat.enrichments.indicator.file.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"threat.enrichments.indicator.file.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"threat.enrichments.indicator.file.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.enrichments.indicator.file.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"threat.enrichments.indicator.first_seen","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was first reported."},{"field":"threat.enrichments.indicator.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"threat.enrichments.indicator.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"threat.enrichments.indicator.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"threat.enrichments.indicator.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"threat.enrichments.indicator.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"threat.enrichments.indicator.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"threat.enrichments.indicator.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"threat.enrichments.indicator.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"threat.enrichments.indicator.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"threat.enrichments.indicator.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"threat.enrichments.indicator.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"threat.enrichments.indicator.ip","type":"ip","normalization":"","example":"1.2.3.4","description":"Indicator IP address"},{"field":"threat.enrichments.indicator.last_seen","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was last reported."},{"field":"threat.enrichments.indicator.marking.tlp","type":"keyword","normalization":"","example":"WHITE","description":"Indicator TLP marking"},{"field":"threat.enrichments.indicator.modified_at","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was last updated."},{"field":"threat.enrichments.indicator.port","type":"long","normalization":"","example":443,"description":"Indicator port"},{"field":"threat.enrichments.indicator.provider","type":"keyword","normalization":"","example":"lrz_urlhaus","description":"Indicator provider"},{"field":"threat.enrichments.indicator.reference","type":"keyword","normalization":"","example":"https://system.example.com/indicator/0001234","description":"Indicator reference URL"},{"field":"threat.enrichments.indicator.registry.data.bytes","type":"keyword","normalization":"","example":"ZQBuAC0AVQBTAAAAZQBuAAAAAAA=","description":"Original bytes written with base64 encoding."},{"field":"threat.enrichments.indicator.registry.data.strings","type":"wildcard","normalization":"array","example":"[\"C:\\rta\\red_ttp\\bin\\myapp.exe\"]","description":"List of strings representing what was written to the registry."},{"field":"threat.enrichments.indicator.registry.data.type","type":"keyword","normalization":"","example":"REG_SZ","description":"Standard registry type for encoding contents"},{"field":"threat.enrichments.indicator.registry.hive","type":"keyword","normalization":"","example":"HKLM","description":"Abbreviated name for the hive."},{"field":"threat.enrichments.indicator.registry.key","type":"keyword","normalization":"","example":"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe","description":"Hive-relative path of keys."},{"field":"threat.enrichments.indicator.registry.path","type":"keyword","normalization":"","example":"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe\\Debugger","description":"Full path, including hive, key and value"},{"field":"threat.enrichments.indicator.registry.value","type":"keyword","normalization":"","example":"Debugger","description":"Name of the value written."},{"field":"threat.enrichments.indicator.scanner_stats","type":"long","normalization":"","example":4,"description":"Scanner statistics"},{"field":"threat.enrichments.indicator.sightings","type":"long","normalization":"","example":20,"description":"Number of times indicator observed"},{"field":"threat.enrichments.indicator.type","type":"keyword","normalization":"","example":"ipv4-addr","description":"Type of indicator"},{"field":"threat.enrichments.indicator.url.domain","type":"keyword","normalization":"","example":"www.elastic.co","description":"Domain of the url."},{"field":"threat.enrichments.indicator.url.extension","type":"keyword","normalization":"","example":"png","description":"File extension from the request url, excluding the leading dot."},{"field":"threat.enrichments.indicator.url.fragment","type":"keyword","normalization":"","example":"","description":"Portion of the url after the `#`."},{"field":"threat.enrichments.indicator.url.full","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"threat.enrichments.indicator.url.full.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"threat.enrichments.indicator.url.original","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"threat.enrichments.indicator.url.original.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"threat.enrichments.indicator.url.password","type":"keyword","normalization":"","example":"","description":"Password of the request."},{"field":"threat.enrichments.indicator.url.path","type":"wildcard","normalization":"","example":"","description":"Path of the request, such as \"/search\"."},{"field":"threat.enrichments.indicator.url.port","type":"long","normalization":"","example":443,"description":"Port of the request, such as 443."},{"field":"threat.enrichments.indicator.url.query","type":"keyword","normalization":"","example":"","description":"Query string of the request."},{"field":"threat.enrichments.indicator.url.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered url domain, stripped of the subdomain."},{"field":"threat.enrichments.indicator.url.scheme","type":"keyword","normalization":"","example":"https","description":"Scheme of the url."},{"field":"threat.enrichments.indicator.url.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"threat.enrichments.indicator.url.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"threat.enrichments.indicator.url.username","type":"keyword","normalization":"","example":"","description":"Username of the request."},{"field":"threat.enrichments.indicator.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"threat.enrichments.indicator.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"threat.enrichments.indicator.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"threat.enrichments.indicator.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"threat.enrichments.indicator.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"threat.enrichments.indicator.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"threat.enrichments.indicator.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"threat.enrichments.indicator.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.enrichments.indicator.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"threat.enrichments.indicator.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"threat.enrichments.indicator.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"threat.enrichments.indicator.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"threat.enrichments.indicator.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"threat.enrichments.indicator.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"threat.enrichments.indicator.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"threat.enrichments.indicator.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"threat.enrichments.indicator.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"threat.enrichments.indicator.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"threat.enrichments.indicator.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"threat.enrichments.indicator.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"threat.enrichments.indicator.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"threat.enrichments.indicator.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"threat.enrichments.indicator.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.enrichments.indicator.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"threat.enrichments.matched.atomic","type":"keyword","normalization":"","example":"bad-domain.com","description":"Matched indicator value"},{"field":"threat.enrichments.matched.field","type":"keyword","normalization":"","example":"file.hash.sha256","description":"Matched indicator field"},{"field":"threat.enrichments.matched.id","type":"keyword","normalization":"","example":"ff93aee5-86a1-4a61-b0e6-0cdc313d01b5","description":"Matched indicator identifier"},{"field":"threat.enrichments.matched.index","type":"keyword","normalization":"","example":"filebeat-8.0.0-2021.05.23-000011","description":"Matched indicator index"},{"field":"threat.enrichments.matched.occurred","type":"date","normalization":"","example":"2021-10-05T17:00:58.326Z","description":"Date of match"},{"field":"threat.enrichments.matched.type","type":"keyword","normalization":"","example":"indicator_match_rule","description":"Type of indicator match"},{"field":"threat.feed.dashboard_id","type":"keyword","normalization":"","example":"5ba16340-72e6-11eb-a3e3-b3cc7c78a70f","description":"Feed dashboard ID."},{"field":"threat.feed.description","type":"keyword","normalization":"","example":"Threat feed from the AlienVault Open Threat eXchange network.","description":"Description of the threat feed."},{"field":"threat.feed.name","type":"keyword","normalization":"","example":"AlienVault OTX","description":"Name of the threat feed."},{"field":"threat.feed.reference","type":"keyword","normalization":"","example":"https://otx.alienvault.com","description":"Reference for the threat feed."},{"field":"threat.framework","type":"keyword","normalization":"","example":"MITRE ATT&CK","description":"Threat classification framework."},{"field":"threat.group.alias","type":"keyword","normalization":"array","example":["Magecart Group 6"],"description":"Alias of the group."},{"field":"threat.group.id","type":"keyword","normalization":"","example":"G0037","description":"ID of the group."},{"field":"threat.group.name","type":"keyword","normalization":"","example":"FIN6","description":"Name of the group."},{"field":"threat.group.reference","type":"keyword","normalization":"","example":"https://attack.mitre.org/groups/G0037/","description":"Reference URL of the group."},{"field":"threat.indicator.as.number","type":"long","normalization":"","example":15169,"description":"Unique number allocated to the autonomous system."},{"field":"threat.indicator.as.organization.name","type":"keyword","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"threat.indicator.as.organization.name.text","type":"match_only_text","normalization":"","example":"Google LLC","description":"Organization name."},{"field":"threat.indicator.confidence","type":"keyword","normalization":"","example":"Medium","description":"Indicator confidence rating"},{"field":"threat.indicator.description","type":"keyword","normalization":"","example":"IP x.x.x.x was observed delivering the Angler EK.","description":"Indicator description"},{"field":"threat.indicator.email.address","type":"keyword","normalization":"","example":"phish@example.com","description":"Indicator email address"},{"field":"threat.indicator.file.accessed","type":"date","normalization":"","example":"","description":"Last time the file was accessed."},{"field":"threat.indicator.file.attributes","type":"keyword","normalization":"array","example":["readonly","system"],"description":"Array of file attributes."},{"field":"threat.indicator.file.code_signature.digest_algorithm","type":"keyword","normalization":"","example":"sha256","description":"Hashing algorithm used to sign the process."},{"field":"threat.indicator.file.code_signature.exists","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if a signature is present."},{"field":"threat.indicator.file.code_signature.signing_id","type":"keyword","normalization":"","example":"com.apple.xpc.proxy","description":"The identifier used to sign the process."},{"field":"threat.indicator.file.code_signature.status","type":"keyword","normalization":"","example":"ERROR_UNTRUSTED_ROOT","description":"Additional information about the certificate status."},{"field":"threat.indicator.file.code_signature.subject_name","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Subject name of the code signer"},{"field":"threat.indicator.file.code_signature.team_id","type":"keyword","normalization":"","example":"EQHXZ8M8AV","description":"The team identifier used to sign the process."},{"field":"threat.indicator.file.code_signature.timestamp","type":"date","normalization":"","example":"2021-01-01T12:10:30Z","description":"When the signature was generated and signed."},{"field":"threat.indicator.file.code_signature.trusted","type":"boolean","normalization":"","example":true,"description":"Stores the trust status of the certificate chain."},{"field":"threat.indicator.file.code_signature.valid","type":"boolean","normalization":"","example":true,"description":"Boolean to capture if the digital signature is verified against the binary content."},{"field":"threat.indicator.file.created","type":"date","normalization":"","example":"","description":"File creation time."},{"field":"threat.indicator.file.ctime","type":"date","normalization":"","example":"","description":"Last time the file attributes or metadata changed."},{"field":"threat.indicator.file.device","type":"keyword","normalization":"","example":"sda","description":"Device that is the source of the file."},{"field":"threat.indicator.file.directory","type":"keyword","normalization":"","example":"/home/alice","description":"Directory where the file is located."},{"field":"threat.indicator.file.drive_letter","type":"keyword","normalization":"","example":"C","description":"Drive letter where the file is located."},{"field":"threat.indicator.file.elf.architecture","type":"keyword","normalization":"","example":"x86-64","description":"Machine architecture of the ELF file."},{"field":"threat.indicator.file.elf.byte_order","type":"keyword","normalization":"","example":"Little Endian","description":"Byte sequence of ELF file."},{"field":"threat.indicator.file.elf.cpu_type","type":"keyword","normalization":"","example":"Intel","description":"CPU type of the ELF file."},{"field":"threat.indicator.file.elf.creation_date","type":"date","normalization":"","example":"","description":"Build or compile date."},{"field":"threat.indicator.file.elf.exports","type":"flattened","normalization":"array","example":"","description":"List of exported element names and types."},{"field":"threat.indicator.file.elf.header.abi_version","type":"keyword","normalization":"","example":"","description":"Version of the ELF Application Binary Interface (ABI)."},{"field":"threat.indicator.file.elf.header.class","type":"keyword","normalization":"","example":"","description":"Header class of the ELF file."},{"field":"threat.indicator.file.elf.header.data","type":"keyword","normalization":"","example":"","description":"Data table of the ELF header."},{"field":"threat.indicator.file.elf.header.entrypoint","type":"long","normalization":"","example":"","description":"Header entrypoint of the ELF file."},{"field":"threat.indicator.file.elf.header.object_version","type":"keyword","normalization":"","example":"","description":"0x1\" for original ELF files."},{"field":"threat.indicator.file.elf.header.os_abi","type":"keyword","normalization":"","example":"","description":"Application Binary Interface (ABI) of the Linux OS."},{"field":"threat.indicator.file.elf.header.type","type":"keyword","normalization":"","example":"","description":"Header type of the ELF file."},{"field":"threat.indicator.file.elf.header.version","type":"keyword","normalization":"","example":"","description":"Version of the ELF header."},{"field":"threat.indicator.file.elf.imports","type":"flattened","normalization":"array","example":"","description":"List of imported element names and types."},{"field":"threat.indicator.file.elf.sections","type":"nested","normalization":"array","example":"","description":"Section information of the ELF file."},{"field":"threat.indicator.file.elf.sections.chi2","type":"long","normalization":"","example":"","description":"Chi-square probability distribution of the section."},{"field":"threat.indicator.file.elf.sections.entropy","type":"long","normalization":"","example":"","description":"Shannon entropy calculation from the section."},{"field":"threat.indicator.file.elf.sections.flags","type":"keyword","normalization":"","example":"","description":"ELF Section List flags."},{"field":"threat.indicator.file.elf.sections.name","type":"keyword","normalization":"","example":"","description":"ELF Section List name."},{"field":"threat.indicator.file.elf.sections.physical_offset","type":"keyword","normalization":"","example":"","description":"ELF Section List offset."},{"field":"threat.indicator.file.elf.sections.physical_size","type":"long","normalization":"","example":"","description":"ELF Section List physical size."},{"field":"threat.indicator.file.elf.sections.type","type":"keyword","normalization":"","example":"","description":"ELF Section List type."},{"field":"threat.indicator.file.elf.sections.virtual_address","type":"long","normalization":"","example":"","description":"ELF Section List virtual address."},{"field":"threat.indicator.file.elf.sections.virtual_size","type":"long","normalization":"","example":"","description":"ELF Section List virtual size."},{"field":"threat.indicator.file.elf.segments","type":"nested","normalization":"array","example":"","description":"ELF object segment list."},{"field":"threat.indicator.file.elf.segments.sections","type":"keyword","normalization":"","example":"","description":"ELF object segment sections."},{"field":"threat.indicator.file.elf.segments.type","type":"keyword","normalization":"","example":"","description":"ELF object segment type."},{"field":"threat.indicator.file.elf.shared_libraries","type":"keyword","normalization":"array","example":"","description":"List of shared libraries used by this ELF object."},{"field":"threat.indicator.file.elf.telfhash","type":"keyword","normalization":"","example":"","description":"telfhash hash for ELF file."},{"field":"threat.indicator.file.extension","type":"keyword","normalization":"","example":"png","description":"File extension, excluding the leading dot."},{"field":"threat.indicator.file.fork_name","type":"keyword","normalization":"","example":"Zone.Identifer","description":"A fork is additional data associated with a filesystem object."},{"field":"threat.indicator.file.gid","type":"keyword","normalization":"","example":1001,"description":"Primary group ID (GID) of the file."},{"field":"threat.indicator.file.group","type":"keyword","normalization":"","example":"alice","description":"Primary group name of the file."},{"field":"threat.indicator.file.hash.md5","type":"keyword","normalization":"","example":"","description":"MD5 hash."},{"field":"threat.indicator.file.hash.sha1","type":"keyword","normalization":"","example":"","description":"SHA1 hash."},{"field":"threat.indicator.file.hash.sha256","type":"keyword","normalization":"","example":"","description":"SHA256 hash."},{"field":"threat.indicator.file.hash.sha384","type":"keyword","normalization":"","example":"","description":"SHA384 hash."},{"field":"threat.indicator.file.hash.sha512","type":"keyword","normalization":"","example":"","description":"SHA512 hash."},{"field":"threat.indicator.file.hash.ssdeep","type":"keyword","normalization":"","example":"","description":"SSDEEP hash."},{"field":"threat.indicator.file.hash.tlsh","type":"keyword","normalization":"","example":"","description":"TLSH hash."},{"field":"threat.indicator.file.inode","type":"keyword","normalization":"","example":256383,"description":"Inode representing the file in the filesystem."},{"field":"threat.indicator.file.mime_type","type":"keyword","normalization":"","example":"","description":"Media type of file, document, or arrangement of bytes."},{"field":"threat.indicator.file.mode","type":"keyword","normalization":"","example":"0640","description":"Mode of the file in octal representation."},{"field":"threat.indicator.file.mtime","type":"date","normalization":"","example":"","description":"Last time the file content was modified."},{"field":"threat.indicator.file.name","type":"keyword","normalization":"","example":"example.png","description":"Name of the file including the extension, without the directory."},{"field":"threat.indicator.file.owner","type":"keyword","normalization":"","example":"alice","description":"File owner's username."},{"field":"threat.indicator.file.path","type":"keyword","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"threat.indicator.file.path.text","type":"match_only_text","normalization":"","example":"/home/alice/example.png","description":"Full path to the file, including the file name."},{"field":"threat.indicator.file.pe.architecture","type":"keyword","normalization":"","example":"x64","description":"CPU architecture target for the file."},{"field":"threat.indicator.file.pe.company","type":"keyword","normalization":"","example":"Microsoft Corporation","description":"Internal company name of the file, provided at compile-time."},{"field":"threat.indicator.file.pe.description","type":"keyword","normalization":"","example":"Paint","description":"Internal description of the file, provided at compile-time."},{"field":"threat.indicator.file.pe.file_version","type":"keyword","normalization":"","example":"6.3.9600.17415","description":"Process name."},{"field":"threat.indicator.file.pe.imphash","type":"keyword","normalization":"","example":"0c6803c4e922103c4dca5963aad36ddf","description":"A hash of the imports in a PE file."},{"field":"threat.indicator.file.pe.original_file_name","type":"keyword","normalization":"","example":"MSPAINT.EXE","description":"Internal name of the file, provided at compile-time."},{"field":"threat.indicator.file.pe.pehash","type":"keyword","normalization":"","example":"73ff189b63cd6be375a7ff25179a38d347651975","description":"A hash of the PE header and data from one or more PE sections."},{"field":"threat.indicator.file.pe.product","type":"keyword","normalization":"","example":"Microsoft® Windows® Operating System","description":"Internal product name of the file, provided at compile-time."},{"field":"threat.indicator.file.size","type":"long","normalization":"","example":16384,"description":"File size in bytes."},{"field":"threat.indicator.file.target_path","type":"keyword","normalization":"","example":"","description":"Target path for symlinks."},{"field":"threat.indicator.file.target_path.text","type":"match_only_text","normalization":"","example":"","description":"Target path for symlinks."},{"field":"threat.indicator.file.type","type":"keyword","normalization":"","example":"file","description":"File type (file, dir, or symlink)."},{"field":"threat.indicator.file.uid","type":"keyword","normalization":"","example":1001,"description":"The user ID (UID) or security identifier (SID) of the file owner."},{"field":"threat.indicator.file.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"threat.indicator.file.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"threat.indicator.file.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"threat.indicator.file.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"threat.indicator.file.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"threat.indicator.file.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"threat.indicator.file.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"threat.indicator.file.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.indicator.file.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"threat.indicator.file.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"threat.indicator.file.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"threat.indicator.file.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"threat.indicator.file.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"threat.indicator.file.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"threat.indicator.file.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"threat.indicator.file.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"threat.indicator.file.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"threat.indicator.file.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"threat.indicator.file.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"threat.indicator.file.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"threat.indicator.file.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"threat.indicator.file.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"threat.indicator.file.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.indicator.file.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"threat.indicator.first_seen","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was first reported."},{"field":"threat.indicator.geo.city_name","type":"keyword","normalization":"","example":"Montreal","description":"City name."},{"field":"threat.indicator.geo.continent_code","type":"keyword","normalization":"","example":"NA","description":"Continent code."},{"field":"threat.indicator.geo.continent_name","type":"keyword","normalization":"","example":"North America","description":"Name of the continent."},{"field":"threat.indicator.geo.country_iso_code","type":"keyword","normalization":"","example":"CA","description":"Country ISO code."},{"field":"threat.indicator.geo.country_name","type":"keyword","normalization":"","example":"Canada","description":"Country name."},{"field":"threat.indicator.geo.location","type":"geo_point","normalization":"","example":{"lon":-73.61483,"lat":45.505918},"description":"Longitude and latitude."},{"field":"threat.indicator.geo.name","type":"keyword","normalization":"","example":"boston-dc","description":"User-defined description of a location."},{"field":"threat.indicator.geo.postal_code","type":"keyword","normalization":"","example":94040,"description":"Postal code."},{"field":"threat.indicator.geo.region_iso_code","type":"keyword","normalization":"","example":"CA-QC","description":"Region ISO code."},{"field":"threat.indicator.geo.region_name","type":"keyword","normalization":"","example":"Quebec","description":"Region name."},{"field":"threat.indicator.geo.timezone","type":"keyword","normalization":"","example":"America/Argentina/Buenos_Aires","description":"Time zone."},{"field":"threat.indicator.ip","type":"ip","normalization":"","example":"1.2.3.4","description":"Indicator IP address"},{"field":"threat.indicator.last_seen","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was last reported."},{"field":"threat.indicator.marking.tlp","type":"keyword","normalization":"","example":"WHITE","description":"Indicator TLP marking"},{"field":"threat.indicator.modified_at","type":"date","normalization":"","example":"2020-11-05T17:25:47.000Z","description":"Date/time indicator was last updated."},{"field":"threat.indicator.port","type":"long","normalization":"","example":443,"description":"Indicator port"},{"field":"threat.indicator.provider","type":"keyword","normalization":"","example":"lrz_urlhaus","description":"Indicator provider"},{"field":"threat.indicator.reference","type":"keyword","normalization":"","example":"https://system.example.com/indicator/0001234","description":"Indicator reference URL"},{"field":"threat.indicator.registry.data.bytes","type":"keyword","normalization":"","example":"ZQBuAC0AVQBTAAAAZQBuAAAAAAA=","description":"Original bytes written with base64 encoding."},{"field":"threat.indicator.registry.data.strings","type":"wildcard","normalization":"array","example":"[\"C:\\rta\\red_ttp\\bin\\myapp.exe\"]","description":"List of strings representing what was written to the registry."},{"field":"threat.indicator.registry.data.type","type":"keyword","normalization":"","example":"REG_SZ","description":"Standard registry type for encoding contents"},{"field":"threat.indicator.registry.hive","type":"keyword","normalization":"","example":"HKLM","description":"Abbreviated name for the hive."},{"field":"threat.indicator.registry.key","type":"keyword","normalization":"","example":"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe","description":"Hive-relative path of keys."},{"field":"threat.indicator.registry.path","type":"keyword","normalization":"","example":"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\winword.exe\\Debugger","description":"Full path, including hive, key and value"},{"field":"threat.indicator.registry.value","type":"keyword","normalization":"","example":"Debugger","description":"Name of the value written."},{"field":"threat.indicator.scanner_stats","type":"long","normalization":"","example":4,"description":"Scanner statistics"},{"field":"threat.indicator.sightings","type":"long","normalization":"","example":20,"description":"Number of times indicator observed"},{"field":"threat.indicator.type","type":"keyword","normalization":"","example":"ipv4-addr","description":"Type of indicator"},{"field":"threat.indicator.url.domain","type":"keyword","normalization":"","example":"www.elastic.co","description":"Domain of the url."},{"field":"threat.indicator.url.extension","type":"keyword","normalization":"","example":"png","description":"File extension from the request url, excluding the leading dot."},{"field":"threat.indicator.url.fragment","type":"keyword","normalization":"","example":"","description":"Portion of the url after the `#`."},{"field":"threat.indicator.url.full","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"threat.indicator.url.full.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"threat.indicator.url.original","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"threat.indicator.url.original.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"threat.indicator.url.password","type":"keyword","normalization":"","example":"","description":"Password of the request."},{"field":"threat.indicator.url.path","type":"wildcard","normalization":"","example":"","description":"Path of the request, such as \"/search\"."},{"field":"threat.indicator.url.port","type":"long","normalization":"","example":443,"description":"Port of the request, such as 443."},{"field":"threat.indicator.url.query","type":"keyword","normalization":"","example":"","description":"Query string of the request."},{"field":"threat.indicator.url.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered url domain, stripped of the subdomain."},{"field":"threat.indicator.url.scheme","type":"keyword","normalization":"","example":"https","description":"Scheme of the url."},{"field":"threat.indicator.url.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"threat.indicator.url.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"threat.indicator.url.username","type":"keyword","normalization":"","example":"","description":"Username of the request."},{"field":"threat.indicator.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"threat.indicator.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"threat.indicator.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"threat.indicator.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"threat.indicator.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"threat.indicator.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"threat.indicator.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"threat.indicator.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.indicator.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"threat.indicator.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"threat.indicator.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"threat.indicator.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"threat.indicator.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"threat.indicator.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"threat.indicator.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"threat.indicator.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"threat.indicator.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"threat.indicator.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"threat.indicator.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"threat.indicator.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"threat.indicator.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"threat.indicator.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"threat.indicator.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"threat.indicator.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"threat.software.alias","type":"keyword","normalization":"array","example":["X-Agent"],"description":"Alias of the software"},{"field":"threat.software.id","type":"keyword","normalization":"","example":"S0552","description":"ID of the software"},{"field":"threat.software.name","type":"keyword","normalization":"","example":"AdFind","description":"Name of the software."},{"field":"threat.software.platforms","type":"keyword","normalization":"array","example":["Windows"],"description":"Platforms of the software."},{"field":"threat.software.reference","type":"keyword","normalization":"","example":"https://attack.mitre.org/software/S0552/","description":"Software reference URL."},{"field":"threat.software.type","type":"keyword","normalization":"","example":"Tool","description":"Software type."},{"field":"threat.tactic.id","type":"keyword","normalization":"array","example":"TA0002","description":"Threat tactic id."},{"field":"threat.tactic.name","type":"keyword","normalization":"array","example":"Execution","description":"Threat tactic."},{"field":"threat.tactic.reference","type":"keyword","normalization":"array","example":"https://attack.mitre.org/tactics/TA0002/","description":"Threat tactic URL reference."},{"field":"threat.technique.id","type":"keyword","normalization":"array","example":"T1059","description":"Threat technique id."},{"field":"threat.technique.name","type":"keyword","normalization":"array","example":"Command and Scripting Interpreter","description":"Threat technique name."},{"field":"threat.technique.name.text","type":"match_only_text","normalization":"","example":"Command and Scripting Interpreter","description":"Threat technique name."},{"field":"threat.technique.reference","type":"keyword","normalization":"array","example":"https://attack.mitre.org/techniques/T1059/","description":"Threat technique URL reference."},{"field":"threat.technique.subtechnique.id","type":"keyword","normalization":"array","example":"T1059.001","description":"Threat subtechnique id."},{"field":"threat.technique.subtechnique.name","type":"keyword","normalization":"array","example":"PowerShell","description":"Threat subtechnique name."},{"field":"threat.technique.subtechnique.name.text","type":"match_only_text","normalization":"","example":"PowerShell","description":"Threat subtechnique name."},{"field":"threat.technique.subtechnique.reference","type":"keyword","normalization":"array","example":"https://attack.mitre.org/techniques/T1059/001/","description":"Threat subtechnique URL reference."},{"field":"tls.cipher","type":"keyword","normalization":"","example":"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256","description":"String indicating the cipher used during the current connection."},{"field":"tls.client.certificate","type":"keyword","normalization":"","example":"MII...","description":"PEM-encoded stand-alone certificate offered by the client."},{"field":"tls.client.certificate_chain","type":"keyword","normalization":"array","example":["MII...","MII..."],"description":"Array of PEM-encoded certificates that make up the certificate chain offered by the client."},{"field":"tls.client.hash.md5","type":"keyword","normalization":"","example":"0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC","description":"Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the client."},{"field":"tls.client.hash.sha1","type":"keyword","normalization":"","example":"9E393D93138888D288266C2D915214D1D1CCEB2A","description":"Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the client."},{"field":"tls.client.hash.sha256","type":"keyword","normalization":"","example":"0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0","description":"Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the client."},{"field":"tls.client.issuer","type":"keyword","normalization":"","example":"CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com","description":"Distinguished name of subject of the issuer of the x.509 certificate presented by the client."},{"field":"tls.client.ja3","type":"keyword","normalization":"","example":"d4e5b18d6b55c71272893221c96ba240","description":"A hash that identifies clients based on how they perform an SSL/TLS handshake."},{"field":"tls.client.not_after","type":"date","normalization":"","example":"2021-01-01T00:00:00.000Z","description":"Date/Time indicating when client certificate is no longer considered valid."},{"field":"tls.client.not_before","type":"date","normalization":"","example":"1970-01-01T00:00:00.000Z","description":"Date/Time indicating when client certificate is first considered valid."},{"field":"tls.client.server_name","type":"keyword","normalization":"","example":"www.elastic.co","description":"Hostname the client is trying to connect to. Also called the SNI."},{"field":"tls.client.subject","type":"keyword","normalization":"","example":"CN=myclient, OU=Documentation Team, DC=example, DC=com","description":"Distinguished name of subject of the x.509 certificate presented by the client."},{"field":"tls.client.supported_ciphers","type":"keyword","normalization":"array","example":["TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","..."],"description":"Array of ciphers offered by the client during the client hello."},{"field":"tls.client.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"tls.client.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"tls.client.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"tls.client.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"tls.client.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"tls.client.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"tls.client.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"tls.client.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"tls.client.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"tls.client.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"tls.client.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"tls.client.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"tls.client.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"tls.client.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"tls.client.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"tls.client.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"tls.client.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"tls.client.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"tls.client.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"tls.client.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"tls.client.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"tls.client.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"tls.client.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"tls.client.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"tls.curve","type":"keyword","normalization":"","example":"secp256r1","description":"String indicating the curve used for the given cipher, when applicable."},{"field":"tls.established","type":"boolean","normalization":"","example":"","description":"Boolean flag indicating if the TLS negotiation was successful and transitioned to an encrypted tunnel."},{"field":"tls.next_protocol","type":"keyword","normalization":"","example":"http/1.1","description":"String indicating the protocol being tunneled."},{"field":"tls.resumed","type":"boolean","normalization":"","example":"","description":"Boolean flag indicating if this TLS connection was resumed from an existing TLS negotiation."},{"field":"tls.server.certificate","type":"keyword","normalization":"","example":"MII...","description":"PEM-encoded stand-alone certificate offered by the server."},{"field":"tls.server.certificate_chain","type":"keyword","normalization":"array","example":["MII...","MII..."],"description":"Array of PEM-encoded certificates that make up the certificate chain offered by the server."},{"field":"tls.server.hash.md5","type":"keyword","normalization":"","example":"0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC","description":"Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the server."},{"field":"tls.server.hash.sha1","type":"keyword","normalization":"","example":"9E393D93138888D288266C2D915214D1D1CCEB2A","description":"Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the server."},{"field":"tls.server.hash.sha256","type":"keyword","normalization":"","example":"0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0","description":"Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the server."},{"field":"tls.server.issuer","type":"keyword","normalization":"","example":"CN=Example Root CA, OU=Infrastructure Team, DC=example, DC=com","description":"Subject of the issuer of the x.509 certificate presented by the server."},{"field":"tls.server.ja3s","type":"keyword","normalization":"","example":"394441ab65754e2207b1e1b457b3641d","description":"A hash that identifies servers based on how they perform an SSL/TLS handshake."},{"field":"tls.server.not_after","type":"date","normalization":"","example":"2021-01-01T00:00:00.000Z","description":"Timestamp indicating when server certificate is no longer considered valid."},{"field":"tls.server.not_before","type":"date","normalization":"","example":"1970-01-01T00:00:00.000Z","description":"Timestamp indicating when server certificate is first considered valid."},{"field":"tls.server.subject","type":"keyword","normalization":"","example":"CN=www.example.com, OU=Infrastructure Team, DC=example, DC=com","description":"Subject of the x.509 certificate presented by the server."},{"field":"tls.server.x509.alternative_names","type":"keyword","normalization":"array","example":"*.elastic.co","description":"List of subject alternative names (SAN)."},{"field":"tls.server.x509.issuer.common_name","type":"keyword","normalization":"array","example":"Example SHA2 High Assurance Server CA","description":"List of common name (CN) of issuing certificate authority."},{"field":"tls.server.x509.issuer.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) codes"},{"field":"tls.server.x509.issuer.distinguished_name","type":"keyword","normalization":"","example":"C=US, O=Example Inc, OU=www.example.com, CN=Example SHA2 High Assurance Server CA","description":"Distinguished name (DN) of issuing certificate authority."},{"field":"tls.server.x509.issuer.locality","type":"keyword","normalization":"array","example":"Mountain View","description":"List of locality names (L)"},{"field":"tls.server.x509.issuer.organization","type":"keyword","normalization":"array","example":"Example Inc","description":"List of organizations (O) of issuing certificate authority."},{"field":"tls.server.x509.issuer.organizational_unit","type":"keyword","normalization":"array","example":"www.example.com","description":"List of organizational units (OU) of issuing certificate authority."},{"field":"tls.server.x509.issuer.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"tls.server.x509.not_after","type":"date","normalization":"","example":"2020-07-16T03:15:39Z","description":"Time at which the certificate is no longer considered valid."},{"field":"tls.server.x509.not_before","type":"date","normalization":"","example":"2019-08-16T01:40:25Z","description":"Time at which the certificate is first considered valid."},{"field":"tls.server.x509.public_key_algorithm","type":"keyword","normalization":"","example":"RSA","description":"Algorithm used to generate the public key."},{"field":"tls.server.x509.public_key_curve","type":"keyword","normalization":"","example":"nistp521","description":"The curve used by the elliptic curve public key algorithm. This is algorithm specific."},{"field":"tls.server.x509.public_key_exponent","type":"long","normalization":"","example":65537,"description":"Exponent used to derive the public key. This is algorithm specific."},{"field":"tls.server.x509.public_key_size","type":"long","normalization":"","example":2048,"description":"The size of the public key space in bits."},{"field":"tls.server.x509.serial_number","type":"keyword","normalization":"","example":"55FBB9C7DEBF09809D12CCAA","description":"Unique serial number issued by the certificate authority."},{"field":"tls.server.x509.signature_algorithm","type":"keyword","normalization":"","example":"SHA256-RSA","description":"Identifier for certificate signature algorithm."},{"field":"tls.server.x509.subject.common_name","type":"keyword","normalization":"array","example":"shared.global.example.net","description":"List of common names (CN) of subject."},{"field":"tls.server.x509.subject.country","type":"keyword","normalization":"array","example":"US","description":"List of country \\(C) code"},{"field":"tls.server.x509.subject.distinguished_name","type":"keyword","normalization":"","example":"C=US, ST=California, L=San Francisco, O=Example, Inc., CN=shared.global.example.net","description":"Distinguished name (DN) of the certificate subject entity."},{"field":"tls.server.x509.subject.locality","type":"keyword","normalization":"array","example":"San Francisco","description":"List of locality names (L)"},{"field":"tls.server.x509.subject.organization","type":"keyword","normalization":"array","example":"Example, Inc.","description":"List of organizations (O) of subject."},{"field":"tls.server.x509.subject.organizational_unit","type":"keyword","normalization":"array","example":"","description":"List of organizational units (OU) of subject."},{"field":"tls.server.x509.subject.state_or_province","type":"keyword","normalization":"array","example":"California","description":"List of state or province names (ST, S, or P)"},{"field":"tls.server.x509.version_number","type":"keyword","normalization":"","example":3,"description":"Version of x509 format."},{"field":"tls.version","type":"keyword","normalization":"","example":1.2,"description":"Numeric part of the version parsed from the original string."},{"field":"tls.version_protocol","type":"keyword","normalization":"","example":"tls","description":"Normalized lowercase protocol name parsed from original string."},{"field":"trace.id","type":"keyword","normalization":"","example":"4bf92f3577b34da6a3ce929d0e0e4736","description":"Unique identifier of the trace."},{"field":"transaction.id","type":"keyword","normalization":"","example":"00f067aa0ba902b7","description":"Unique identifier of the transaction within the scope of its trace."},{"field":"url.domain","type":"keyword","normalization":"","example":"www.elastic.co","description":"Domain of the url."},{"field":"url.extension","type":"keyword","normalization":"","example":"png","description":"File extension from the request url, excluding the leading dot."},{"field":"url.fragment","type":"keyword","normalization":"","example":"","description":"Portion of the url after the `#`."},{"field":"url.full","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"url.full.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top","description":"Full unparsed URL."},{"field":"url.original","type":"wildcard","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"url.original.text","type":"match_only_text","normalization":"","example":"https://www.elastic.co:443/search?q=elasticsearch#top or /search?q=elasticsearch","description":"Unmodified original url as seen in the event source."},{"field":"url.password","type":"keyword","normalization":"","example":"","description":"Password of the request."},{"field":"url.path","type":"wildcard","normalization":"","example":"","description":"Path of the request, such as \"/search\"."},{"field":"url.port","type":"long","normalization":"","example":443,"description":"Port of the request, such as 443."},{"field":"url.query","type":"keyword","normalization":"","example":"","description":"Query string of the request."},{"field":"url.registered_domain","type":"keyword","normalization":"","example":"example.com","description":"The highest registered url domain, stripped of the subdomain."},{"field":"url.scheme","type":"keyword","normalization":"","example":"https","description":"Scheme of the url."},{"field":"url.subdomain","type":"keyword","normalization":"","example":"east","description":"The subdomain of the domain."},{"field":"url.top_level_domain","type":"keyword","normalization":"","example":"co.uk","description":"The effective top level domain (com, org, net, co.uk)."},{"field":"url.username","type":"keyword","normalization":"","example":"","description":"Username of the request."},{"field":"user.changes.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"user.changes.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"user.changes.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.changes.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.changes.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"user.changes.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"user.changes.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"user.changes.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"user.changes.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"user.changes.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.changes.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.changes.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"user.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"user.effective.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"user.effective.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"user.effective.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.effective.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.effective.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"user.effective.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"user.effective.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"user.effective.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"user.effective.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"user.effective.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.effective.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.effective.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"user.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"user.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"user.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"user.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"user.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"user.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"user.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.risk.calculated_level","type":"keyword","normalization":"","example":"High","description":"A risk classification level calculated by an internal system as part of entity analytics and entity risk scoring."},{"field":"user.risk.calculated_score","type":"float","normalization":"","example":880.73,"description":"A risk classification score calculated by an internal system as part of entity analytics and entity risk scoring."},{"field":"user.risk.calculated_score_norm","type":"float","normalization":"","example":88.73,"description":"A normalized risk score calculated by an internal system."},{"field":"user.risk.static_level","type":"keyword","normalization":"","example":"High","description":"A risk classification level obtained from outside the system, such as from some external Threat Intelligence Platform."},{"field":"user.risk.static_score","type":"float","normalization":"","example":830,"description":"A risk classification score obtained from outside the system, such as from some external Threat Intelligence Platform."},{"field":"user.risk.static_score_norm","type":"float","normalization":"","example":83,"description":"A normalized risk score calculated by an external system."},{"field":"user.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"user.target.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the user is a member of."},{"field":"user.target.email","type":"keyword","normalization":"","example":"","description":"User email address."},{"field":"user.target.full_name","type":"keyword","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.target.full_name.text","type":"match_only_text","normalization":"","example":"Albert Einstein","description":"User's full name, if available."},{"field":"user.target.group.domain","type":"keyword","normalization":"","example":"","description":"Name of the directory the group is a member of."},{"field":"user.target.group.id","type":"keyword","normalization":"","example":"","description":"Unique identifier for the group on the system/platform."},{"field":"user.target.group.name","type":"keyword","normalization":"","example":"","description":"Name of the group."},{"field":"user.target.hash","type":"keyword","normalization":"","example":"","description":"Unique user hash to correlate information for a user in anonymized form."},{"field":"user.target.id","type":"keyword","normalization":"","example":"S-1-5-21-202424912787-2692429404-2351956786-1000","description":"Unique identifier of the user."},{"field":"user.target.name","type":"keyword","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.target.name.text","type":"match_only_text","normalization":"","example":"a.einstein","description":"Short name or login of the user."},{"field":"user.target.roles","type":"keyword","normalization":"array","example":["kibana_admin","reporting_user"],"description":"Array of user roles at the time of the event."},{"field":"user_agent.device.name","type":"keyword","normalization":"","example":"iPhone","description":"Name of the device."},{"field":"user_agent.name","type":"keyword","normalization":"","example":"Safari","description":"Name of the user agent."},{"field":"user_agent.original","type":"keyword","normalization":"","example":"Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1","description":"Unparsed user_agent string."},{"field":"user_agent.original.text","type":"match_only_text","normalization":"","example":"Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1","description":"Unparsed user_agent string."},{"field":"user_agent.os.family","type":"keyword","normalization":"","example":"debian","description":"OS family (such as redhat, debian, freebsd, windows)."},{"field":"user_agent.os.full","type":"keyword","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"user_agent.os.full.text","type":"match_only_text","normalization":"","example":"Mac OS Mojave","description":"Operating system name, including the version or code name."},{"field":"user_agent.os.kernel","type":"keyword","normalization":"","example":"4.4.0-112-generic","description":"Operating system kernel version as a raw string."},{"field":"user_agent.os.name","type":"keyword","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"user_agent.os.name.text","type":"match_only_text","normalization":"","example":"Mac OS X","description":"Operating system name, without the version."},{"field":"user_agent.os.platform","type":"keyword","normalization":"","example":"darwin","description":"Operating system platform (such centos, ubuntu, windows)."},{"field":"user_agent.os.type","type":"keyword","normalization":"","example":"macos","description":"Which commercial OS family (one of: linux, macos, unix, windows, ios or android)."},{"field":"user_agent.os.version","type":"keyword","normalization":"","example":"10.14.1","description":"Operating system version as a raw string."},{"field":"user_agent.version","type":"keyword","normalization":"","example":12,"description":"Version of the user agent."},{"field":"vulnerability.category","type":"keyword","normalization":"array","example":["Firewall"],"description":"Category of a vulnerability."},{"field":"vulnerability.classification","type":"keyword","normalization":"","example":"CVSS","description":"Classification of the vulnerability."},{"field":"vulnerability.description","type":"keyword","normalization":"","example":"In macOS before 2.12.6, there is a vulnerability in the RPC...","description":"Description of the vulnerability."},{"field":"vulnerability.description.text","type":"match_only_text","normalization":"","example":"In macOS before 2.12.6, there is a vulnerability in the RPC...","description":"Description of the vulnerability."},{"field":"vulnerability.enumeration","type":"keyword","normalization":"","example":"CVE","description":"Identifier of the vulnerability."},{"field":"vulnerability.id","type":"keyword","normalization":"","example":"CVE-2019-00001","description":"ID of the vulnerability."},{"field":"vulnerability.reference","type":"keyword","normalization":"","example":"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-6111","description":"Reference of the vulnerability."},{"field":"vulnerability.report_id","type":"keyword","normalization":"","example":20191018.0001,"description":"Scan identification number."},{"field":"vulnerability.scanner.vendor","type":"keyword","normalization":"","example":"Tenable","description":"Name of the scanner vendor."},{"field":"vulnerability.score.base","type":"float","normalization":"","example":5.5,"description":"Vulnerability Base score."},{"field":"vulnerability.score.environmental","type":"float","normalization":"","example":5.5,"description":"Vulnerability Environmental score."},{"field":"vulnerability.score.temporal","type":"float","normalization":"","example":"","description":"Vulnerability Temporal score."},{"field":"vulnerability.score.version","type":"keyword","normalization":"","example":2,"description":"CVSS version."},{"field":"vulnerability.severity","type":"keyword","normalization":"","example":"Critical","description":"Severity of the vulnerability."}] \ No newline at end of file diff --git a/x-pack/plugins/osquery/public/discover/pack_view_in_discover.tsx b/x-pack/plugins/osquery/public/discover/pack_view_in_discover.tsx new file mode 100644 index 0000000000000..c6506126c83fe --- /dev/null +++ b/x-pack/plugins/osquery/public/discover/pack_view_in_discover.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 moment from 'moment-timezone'; +import { usePackQueryLastResults } from '../packs/use_pack_query_last_results'; +import { ViewResultsActionButtonType } from '../live_queries/form/pack_queries_status_table'; +import { ViewResultsInDiscoverAction } from './view_results_in_discover'; + +interface PackViewInActionProps { + item: { + id: string; + interval: number; + action_id?: string; + agents: string[]; + }; + actionId?: string; +} +const PackViewInDiscoverActionComponent: React.FC = ({ item }) => { + const { action_id: actionId, agents: agentIds, interval } = item; + const { data: lastResultsData } = usePackQueryLastResults({ + actionId, + interval, + }); + + const startDate = lastResultsData?.['@timestamp'] + ? moment(lastResultsData?.['@timestamp'][0]).subtract(interval, 'seconds').toISOString() + : `now-${interval}s`; + const endDate = lastResultsData?.['@timestamp'] + ? moment(lastResultsData?.['@timestamp'][0]).toISOString() + : 'now'; + + return ( + + ); +}; + +export const PackViewInDiscoverAction = React.memo(PackViewInDiscoverActionComponent); diff --git a/x-pack/plugins/osquery/public/discover/view_results_in_discover.tsx b/x-pack/plugins/osquery/public/discover/view_results_in_discover.tsx new file mode 100644 index 0000000000000..2106f11b89220 --- /dev/null +++ b/x-pack/plugins/osquery/public/discover/view_results_in_discover.tsx @@ -0,0 +1,141 @@ +/* + * 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, useState } from 'react'; +import { EuiButtonEmpty, EuiButtonIcon, EuiToolTip } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { FilterStateStore } from '@kbn/es-query'; +import { useKibana } from '../common/lib/kibana'; +import { useLogsDataView } from '../common/hooks/use_logs_data_view'; +import { ViewResultsActionButtonType } from '../live_queries/form/pack_queries_status_table'; + +interface ViewResultsInDiscoverActionProps { + actionId?: string; + agentIds?: string[]; + buttonType: ViewResultsActionButtonType; + endDate?: string; + startDate?: string; + mode?: string; +} + +const ViewResultsInDiscoverActionComponent: React.FC = ({ + actionId, + agentIds, + buttonType, + endDate, + startDate, +}) => { + const { discover, application } = useKibana().services; + const locator = discover?.locator; + const discoverPermissions = application.capabilities.discover; + const { data: logsDataView } = useLogsDataView({ skip: !actionId }); + + const [discoverUrl, setDiscoverUrl] = useState(''); + + useEffect(() => { + const getDiscoverUrl = async () => { + if (!locator || !logsDataView) return; + + const agentIdsQuery = agentIds?.length + ? { + bool: { + minimum_should_match: 1, + should: agentIds.map((agentId) => ({ match_phrase: { 'agent.id': agentId } })), + }, + } + : null; + + const newUrl = await locator.getUrl({ + indexPatternId: logsDataView.id, + filters: [ + { + meta: { + index: logsDataView.id, + alias: null, + negate: false, + disabled: false, + type: 'phrase', + key: 'action_id', + params: { query: actionId }, + }, + query: { match_phrase: { action_id: actionId } }, + $state: { store: FilterStateStore.APP_STATE }, + }, + ...(agentIdsQuery + ? [ + { + $state: { store: FilterStateStore.APP_STATE }, + meta: { + alias: 'agent IDs', + disabled: false, + index: logsDataView.id, + key: 'query', + negate: false, + type: 'custom', + value: JSON.stringify(agentIdsQuery), + }, + query: agentIdsQuery, + }, + ] + : []), + ], + refreshInterval: { + pause: true, + value: 0, + }, + timeRange: + startDate && endDate + ? { + to: endDate, + from: startDate, + mode: 'absolute', + } + : { + to: 'now', + from: 'now-1d', + mode: 'relative', + }, + }); + setDiscoverUrl(newUrl); + }; + + getDiscoverUrl(); + }, [actionId, agentIds, endDate, startDate, locator, logsDataView]); + + if (!discoverPermissions.show) { + return null; + } + + if (buttonType === ViewResultsActionButtonType.button) { + return ( + + {VIEW_IN_DISCOVER} + + ); + } + + return ( + + + + ); +}; + +const VIEW_IN_DISCOVER = i18n.translate( + 'xpack.osquery.pack.queriesTable.viewDiscoverResultsActionAriaLabel', + { + defaultMessage: 'View in Discover', + } +); + +export const ViewResultsInDiscoverAction = React.memo(ViewResultsInDiscoverActionComponent); diff --git a/x-pack/plugins/osquery/public/form/results_type_field.tsx b/x-pack/plugins/osquery/public/form/results_type_field.tsx index 55bbe69397f97..ccc1961259c38 100644 --- a/x-pack/plugins/osquery/public/form/results_type_field.tsx +++ b/x-pack/plugins/osquery/public/form/results_type_field.tsx @@ -34,7 +34,7 @@ const DIFFERENTIAL_OPTION = { inputDisplay: ( ), }; diff --git a/x-pack/plugins/osquery/public/lens/pack_view_in_lens.tsx b/x-pack/plugins/osquery/public/lens/pack_view_in_lens.tsx new file mode 100644 index 0000000000000..6e1cac3eda86f --- /dev/null +++ b/x-pack/plugins/osquery/public/lens/pack_view_in_lens.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 moment from 'moment-timezone'; +import { usePackQueryLastResults } from '../packs/use_pack_query_last_results'; +import { ViewResultsActionButtonType } from '../live_queries/form/pack_queries_status_table'; +import { ViewResultsInLensAction } from './view_results_in_lens'; + +interface PackViewInActionProps { + item: { + id: string; + interval: number; + action_id?: string; + agents: string[]; + }; + actionId?: string; +} +const PackViewInLensActionComponent: React.FC = ({ item }) => { + const { action_id: actionId, agents: agentIds, interval } = item; + const { data: lastResultsData } = usePackQueryLastResults({ + actionId, + interval, + }); + + const startDate = lastResultsData?.['@timestamp'] + ? moment(lastResultsData?.['@timestamp'][0]).subtract(interval, 'seconds').toISOString() + : `now-${interval}s`; + const endDate = lastResultsData?.['@timestamp'] + ? moment(lastResultsData?.['@timestamp'][0]).toISOString() + : 'now'; + + return ( + + ); +}; + +export const PackViewInLensAction = React.memo(PackViewInLensActionComponent); diff --git a/x-pack/plugins/osquery/public/lens/view_results_in_lens.tsx b/x-pack/plugins/osquery/public/lens/view_results_in_lens.tsx new file mode 100644 index 0000000000000..080c078f6a290 --- /dev/null +++ b/x-pack/plugins/osquery/public/lens/view_results_in_lens.tsx @@ -0,0 +1,234 @@ +/* + * 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, { useCallback, useMemo } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiButtonEmpty, EuiButtonIcon, EuiToolTip } from '@elastic/eui'; +import type { + PersistedIndexPatternLayer, + PieVisualizationState, + TermsIndexPatternColumn, + TypedLensByValueInput, +} from '@kbn/lens-plugin/public'; +import { DOCUMENT_FIELD_NAME as RECORDS_FIELD } from '@kbn/lens-plugin/common/constants'; +import { FilterStateStore } from '@kbn/es-query'; +import { ViewResultsActionButtonType } from '../live_queries/form/pack_queries_status_table'; +import type { LogsDataView } from '../common/hooks/use_logs_data_view'; +import { useKibana } from '../common/lib/kibana'; +import { useLogsDataView } from '../common/hooks/use_logs_data_view'; + +interface ViewResultsInLensActionProps { + actionId?: string; + agentIds?: string[]; + buttonType: ViewResultsActionButtonType; + endDate?: string; + startDate?: string; + mode?: string; +} + +const ViewResultsInLensActionComponent: React.FC = ({ + actionId, + agentIds, + buttonType, + endDate, + startDate, + mode, +}) => { + const lensService = useKibana().services.lens; + const { data: logsDataView } = useLogsDataView({ skip: !actionId }); + + const handleClick = useCallback( + (event) => { + event.preventDefault(); + + if (logsDataView) { + lensService?.navigateToPrefilledEditor( + { + id: '', + timeRange: { + from: startDate ?? 'now-1d', + to: endDate ?? 'now', + mode: mode ?? (startDate || endDate) ? 'absolute' : 'relative', + }, + attributes: getLensAttributes(logsDataView, actionId, agentIds), + }, + { + openInNewTab: true, + skipAppLeave: true, + } + ); + } + }, + [actionId, agentIds, endDate, lensService, logsDataView, mode, startDate] + ); + + const isDisabled = useMemo(() => !actionId || !logsDataView, [actionId, logsDataView]); + + if (buttonType === ViewResultsActionButtonType.button) { + return ( + + {VIEW_IN_LENS} + + ); + } + + return ( + + + + ); +}; + +function getLensAttributes( + logsDataView: LogsDataView, + actionId?: string, + agentIds?: string[] +): TypedLensByValueInput['attributes'] { + const dataLayer: PersistedIndexPatternLayer = { + columnOrder: ['8690befd-fd69-4246-af4a-dd485d2a3b38', 'ed999e9d-204c-465b-897f-fe1a125b39ed'], + columns: { + '8690befd-fd69-4246-af4a-dd485d2a3b38': { + sourceField: 'type', + isBucketed: true, + dataType: 'string', + scale: 'ordinal', + operationType: 'terms', + label: 'Top values of type', + params: { + otherBucket: true, + size: 5, + missingBucket: false, + orderBy: { + columnId: 'ed999e9d-204c-465b-897f-fe1a125b39ed', + type: 'column', + }, + orderDirection: 'desc', + }, + } as TermsIndexPatternColumn, + 'ed999e9d-204c-465b-897f-fe1a125b39ed': { + sourceField: RECORDS_FIELD, + isBucketed: false, + dataType: 'number', + scale: 'ratio', + operationType: 'count', + label: 'Count of records', + }, + }, + incompleteColumns: {}, + }; + + const xyConfig: PieVisualizationState = { + shape: 'pie', + layers: [ + { + layerType: 'data', + legendDisplay: 'default', + nestedLegend: false, + layerId: 'layer1', + metric: 'ed999e9d-204c-465b-897f-fe1a125b39ed', + numberDisplay: 'percent', + primaryGroups: ['8690befd-fd69-4246-af4a-dd485d2a3b38'], + categoryDisplay: 'default', + }, + ], + }; + + const agentIdsQuery = agentIds?.length + ? { + bool: { + minimum_should_match: 1, + should: agentIds?.map((agentId) => ({ match_phrase: { 'agent.id': agentId } })), + }, + } + : undefined; + + return { + visualizationType: 'lnsPie', + title: `Action ${actionId} results`, + references: [ + { + id: logsDataView.id, + name: 'indexpattern-datasource-current-indexpattern', + type: 'index-pattern', + }, + { + id: logsDataView.id, + name: 'indexpattern-datasource-layer-layer1', + type: 'index-pattern', + }, + { + name: 'filter-index-pattern-0', + id: logsDataView.id, + type: 'index-pattern', + }, + ], + state: { + datasourceStates: { + indexpattern: { + layers: { + layer1: dataLayer, + }, + }, + }, + filters: [ + { + $state: { store: FilterStateStore.APP_STATE }, + meta: { + index: 'filter-index-pattern-0', + negate: false, + alias: null, + disabled: false, + params: { + query: actionId, + }, + type: 'phrase', + key: 'action_id', + }, + query: { + match_phrase: { + action_id: actionId, + }, + }, + }, + ...(agentIdsQuery + ? [ + { + $state: { store: FilterStateStore.APP_STATE }, + meta: { + alias: 'agent IDs', + disabled: false, + index: 'filter-index-pattern-0', + key: 'query', + negate: false, + type: 'custom', + value: JSON.stringify(agentIdsQuery), + }, + query: agentIdsQuery, + }, + ] + : []), + ], + query: { language: 'kuery', query: '' }, + visualization: xyConfig, + }, + }; +} + +const VIEW_IN_LENS = i18n.translate( + 'xpack.osquery.pack.queriesTable.viewLensResultsActionAriaLabel', + { + defaultMessage: 'View in Lens', + } +); + +export const ViewResultsInLensAction = React.memo(ViewResultsInLensActionComponent); diff --git a/x-pack/plugins/osquery/public/live_queries/form/index.tsx b/x-pack/plugins/osquery/public/live_queries/form/index.tsx index 4a6a204cec0b4..aa3a1bd336607 100644 --- a/x-pack/plugins/osquery/public/live_queries/form/index.tsx +++ b/x-pack/plugins/osquery/public/live_queries/form/index.tsx @@ -12,6 +12,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useForm as useHookForm, FormProvider } from 'react-hook-form'; import { isEmpty, find, pickBy } from 'lodash'; +import { AddToCaseWrapper } from '../../cases/add_to_cases'; import type { AddToTimelinePayload } from '../../timelines/get_add_to_timeline'; import { QueryPackSelectable } from './query_pack_selectable'; import type { SavedQuerySOFormData } from '../../saved_queries/form/use_saved_query_form'; @@ -25,10 +26,10 @@ import type { AgentSelection } from '../../agents/types'; import { LiveQueryQueryField } from './live_query_query_field'; import { AgentsTableField } from './agents_table_field'; import { savedQueryDataSerializer } from '../../saved_queries/form/use_saved_query_form'; -import { AddToCaseButton } from '../../cases/add_to_cases_button'; import { PackFieldWrapper } from '../../shared_components/osquery_response_action_type/pack_field_wrapper'; export interface LiveQueryFormFields { + alertIds?: string[]; query?: string; agentSelection: AgentSelection; savedQueryId?: string | null; @@ -39,6 +40,7 @@ export interface LiveQueryFormFields { interface DefaultLiveQueryFormFields { query?: string; agentSelection?: AgentSelection; + alertIds?: string[]; savedQueryId?: string | null; ecs_mapping?: ECSMapping; packId?: string; @@ -119,6 +121,7 @@ const LiveQueryFormComponent: React.FC = ({ useEffect(() => { register('savedQueryId'); + register('alertIds'); }, [register]); const queryStatus = useMemo(() => { @@ -135,19 +138,20 @@ const LiveQueryFormComponent: React.FC = ({ ); const onSubmit = useCallback( - (values: LiveQueryFormFields) => { + async (values: LiveQueryFormFields) => { const serializedData = pickBy( { agentSelection: values.agentSelection, saved_query_id: values.savedQueryId, query: values.query, + alert_ids: values.alertIds, pack_id: values?.packId?.length ? values?.packId[0] : undefined, ecs_mapping: values.ecs_mapping, }, (value) => !isEmpty(value) ) as unknown as LiveQueryFormFields; - mutateAsync(serializedData); + await mutateAsync(serializedData); }, [mutateAsync] ); @@ -159,8 +163,6 @@ const LiveQueryFormComponent: React.FC = ({ const { data: packsData, isFetched: isPackDataFetched } = usePacks({}); - const handleSubmitForm = useMemo(() => handleSubmit(onSubmit), [handleSubmit, onSubmit]); - const submitButtonContent = useMemo( () => ( @@ -181,8 +183,9 @@ const LiveQueryFormComponent: React.FC = ({ = ({ handleShowSaveQueryFlyout, enabled, isSubmitting, - handleSubmitForm, + handleSubmit, + onSubmit, ] ); @@ -213,7 +217,7 @@ const LiveQueryFormComponent: React.FC = ({ (payload) => { if (liveQueryActionId) { return ( - = ({ setValue('agentSelection', defaultValue.agentSelection); } + if (defaultValue?.alertIds?.length) { + setValue('alertIds', defaultValue.alertIds); + } + if (defaultValue?.packId && canRunPacks) { setQueryType('pack'); @@ -297,6 +305,7 @@ const LiveQueryFormComponent: React.FC = ({ resetField('query'); resetField('ecs_mapping'); resetField('savedQueryId'); + resetField('alertIds'); clearErrors(); } }, [queryType, cleanupLiveQuery, resetField, setValue, clearErrors, defaultValue]); @@ -329,7 +338,7 @@ const LiveQueryFormComponent: React.FC = ({ ) : ( <> - + {submitButtonContent} {resultsStepContent} diff --git a/x-pack/plugins/osquery/public/live_queries/form/pack_queries_status_table.tsx b/x-pack/plugins/osquery/public/live_queries/form/pack_queries_status_table.tsx index 81a7537e22afc..3d5b888412c33 100644 --- a/x-pack/plugins/osquery/public/live_queries/form/pack_queries_status_table.tsx +++ b/x-pack/plugins/osquery/public/live_queries/form/pack_queries_status_table.tsx @@ -10,7 +10,6 @@ import type { ReactElement } from 'react'; import React, { useCallback, useEffect, useState, useMemo } from 'react'; import { EuiBasicTable, - EuiButtonEmpty, EuiCodeBlock, EuiButtonIcon, EuiToolTip, @@ -23,31 +22,16 @@ import { EuiText, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import moment from 'moment-timezone'; - -import type { - TypedLensByValueInput, - PersistedIndexPatternLayer, - PieVisualizationState, - TermsIndexPatternColumn, -} from '@kbn/lens-plugin/public'; -import { DOCUMENT_FIELD_NAME as RECORDS_FIELD } from '@kbn/lens-plugin/common/constants'; -import { FilterStateStore } from '@kbn/es-query'; import styled from 'styled-components'; import type { ECSMapping } from '@kbn/osquery-io-ts-types'; -import { SECURITY_APP_NAME } from '../../timelines/get_add_to_timeline'; import type { AddToTimelinePayload } from '../../timelines/get_add_to_timeline'; import { PackResultsHeader } from './pack_results_header'; import { Direction } from '../../../common/search_strategy'; import { removeMultilines } from '../../../common/utils/build_query/remove_multilines'; -import { useKibana } from '../../common/lib/kibana'; -import { usePackQueryLastResults } from '../../packs/use_pack_query_last_results'; import { ResultTabs } from '../../routes/saved_queries/edit/tabs'; import type { PackItem } from '../../packs/types'; -import type { LogsDataView } from '../../common/hooks/use_logs_data_view'; -import { useLogsDataView } from '../../common/hooks/use_logs_data_view'; - -const CASES_OWNER: string[] = []; +import { PackViewInLensAction } from '../../lens/pack_view_in_lens'; +import { PackViewInDiscoverAction } from '../../discover/pack_view_in_discover'; const TruncateTooltipText = styled.div` width: 100%; @@ -68,346 +52,11 @@ const StyledEuiBasicTable = styled(EuiBasicTable)` } `; -const VIEW_IN_DISCOVER = i18n.translate( - 'xpack.osquery.pack.queriesTable.viewDiscoverResultsActionAriaLabel', - { - defaultMessage: 'View in Discover', - } -); - -const VIEW_IN_LENS = i18n.translate( - 'xpack.osquery.pack.queriesTable.viewLensResultsActionAriaLabel', - { - defaultMessage: 'View in Lens', - } -); - export enum ViewResultsActionButtonType { icon = 'icon', button = 'button', } -interface ViewResultsInDiscoverActionProps { - actionId?: string; - agentIds?: string[]; - buttonType: ViewResultsActionButtonType; - endDate?: string; - startDate?: string; - mode?: string; -} - -function getLensAttributes( - logsDataView: LogsDataView, - actionId?: string, - agentIds?: string[] -): TypedLensByValueInput['attributes'] { - const dataLayer: PersistedIndexPatternLayer = { - columnOrder: ['8690befd-fd69-4246-af4a-dd485d2a3b38', 'ed999e9d-204c-465b-897f-fe1a125b39ed'], - columns: { - '8690befd-fd69-4246-af4a-dd485d2a3b38': { - sourceField: 'type', - isBucketed: true, - dataType: 'string', - scale: 'ordinal', - operationType: 'terms', - label: 'Top values of type', - params: { - otherBucket: true, - size: 5, - missingBucket: false, - orderBy: { - columnId: 'ed999e9d-204c-465b-897f-fe1a125b39ed', - type: 'column', - }, - orderDirection: 'desc', - }, - } as TermsIndexPatternColumn, - 'ed999e9d-204c-465b-897f-fe1a125b39ed': { - sourceField: RECORDS_FIELD, - isBucketed: false, - dataType: 'number', - scale: 'ratio', - operationType: 'count', - label: 'Count of records', - }, - }, - incompleteColumns: {}, - }; - - const xyConfig: PieVisualizationState = { - shape: 'pie', - layers: [ - { - layerType: 'data', - legendDisplay: 'default', - nestedLegend: false, - layerId: 'layer1', - metric: 'ed999e9d-204c-465b-897f-fe1a125b39ed', - numberDisplay: 'percent', - primaryGroups: ['8690befd-fd69-4246-af4a-dd485d2a3b38'], - categoryDisplay: 'default', - }, - ], - }; - - const agentIdsQuery = agentIds?.length - ? { - bool: { - minimum_should_match: 1, - should: agentIds?.map((agentId) => ({ match_phrase: { 'agent.id': agentId } })), - }, - } - : undefined; - - return { - visualizationType: 'lnsPie', - title: `Action ${actionId} results`, - references: [ - { - id: logsDataView.id, - name: 'indexpattern-datasource-current-indexpattern', - type: 'index-pattern', - }, - { - id: logsDataView.id, - name: 'indexpattern-datasource-layer-layer1', - type: 'index-pattern', - }, - { - name: 'filter-index-pattern-0', - id: logsDataView.id, - type: 'index-pattern', - }, - ], - state: { - datasourceStates: { - indexpattern: { - layers: { - layer1: dataLayer, - }, - }, - }, - filters: [ - { - $state: { store: FilterStateStore.APP_STATE }, - meta: { - index: 'filter-index-pattern-0', - negate: false, - alias: null, - disabled: false, - params: { - query: actionId, - }, - type: 'phrase', - key: 'action_id', - }, - query: { - match_phrase: { - action_id: actionId, - }, - }, - }, - ...(agentIdsQuery - ? [ - { - $state: { store: FilterStateStore.APP_STATE }, - meta: { - alias: 'agent IDs', - disabled: false, - index: 'filter-index-pattern-0', - key: 'query', - negate: false, - type: 'custom', - value: JSON.stringify(agentIdsQuery), - }, - query: agentIdsQuery, - }, - ] - : []), - ], - query: { language: 'kuery', query: '' }, - visualization: xyConfig, - }, - }; -} - -const ViewResultsInLensActionComponent: React.FC = ({ - actionId, - agentIds, - buttonType, - endDate, - startDate, - mode, -}) => { - const lensService = useKibana().services.lens; - const isLensAvailable = lensService?.canUseEditor(); - const { data: logsDataView } = useLogsDataView({ skip: !actionId }); - - const handleClick = useCallback( - (event) => { - event.preventDefault(); - - if (logsDataView) { - lensService?.navigateToPrefilledEditor( - { - id: '', - timeRange: { - from: startDate ?? 'now-1d', - to: endDate ?? 'now', - mode: mode ?? (startDate || endDate) ? 'absolute' : 'relative', - }, - attributes: getLensAttributes(logsDataView, actionId, agentIds), - }, - { - openInNewTab: true, - skipAppLeave: true, - } - ); - } - }, - [actionId, agentIds, endDate, lensService, logsDataView, mode, startDate] - ); - - const isDisabled = useMemo(() => !actionId || !logsDataView, [actionId, logsDataView]); - - if (!isLensAvailable) { - return null; - } - - if (buttonType === ViewResultsActionButtonType.button) { - return ( - - {VIEW_IN_LENS} - - ); - } - - return ( - - - - ); -}; - -export const ViewResultsInLensAction = React.memo(ViewResultsInLensActionComponent); - -const ViewResultsInDiscoverActionComponent: React.FC = ({ - actionId, - agentIds, - buttonType, - endDate, - startDate, -}) => { - const { discover, application } = useKibana().services; - const locator = discover?.locator; - const discoverPermissions = application.capabilities.discover; - const { data: logsDataView } = useLogsDataView({ skip: !actionId }); - - const [discoverUrl, setDiscoverUrl] = useState(''); - - useEffect(() => { - const getDiscoverUrl = async () => { - if (!locator || !logsDataView) return; - - const agentIdsQuery = agentIds?.length - ? { - bool: { - minimum_should_match: 1, - should: agentIds.map((agentId) => ({ match_phrase: { 'agent.id': agentId } })), - }, - } - : null; - - const newUrl = await locator.getUrl({ - indexPatternId: logsDataView.id, - filters: [ - { - meta: { - index: logsDataView.id, - alias: null, - negate: false, - disabled: false, - type: 'phrase', - key: 'action_id', - params: { query: actionId }, - }, - query: { match_phrase: { action_id: actionId } }, - $state: { store: FilterStateStore.APP_STATE }, - }, - ...(agentIdsQuery - ? [ - { - $state: { store: FilterStateStore.APP_STATE }, - meta: { - alias: 'agent IDs', - disabled: false, - index: logsDataView.id, - key: 'query', - negate: false, - type: 'custom', - value: JSON.stringify(agentIdsQuery), - }, - query: agentIdsQuery, - }, - ] - : []), - ], - refreshInterval: { - pause: true, - value: 0, - }, - timeRange: - startDate && endDate - ? { - to: endDate, - from: startDate, - mode: 'absolute', - } - : { - to: 'now', - from: 'now-1d', - mode: 'relative', - }, - }); - setDiscoverUrl(newUrl); - }; - - getDiscoverUrl(); - }, [actionId, agentIds, endDate, startDate, locator, logsDataView]); - - if (!discoverPermissions.show) { - return null; - } - - if (buttonType === ViewResultsActionButtonType.button) { - return ( - - {VIEW_IN_DISCOVER} - - ); - } - - return ( - - - - ); -}; - -export const ViewResultsInDiscoverAction = React.memo(ViewResultsInDiscoverActionComponent); - interface DocsColumnResultsProps { count?: number; isLive?: boolean; @@ -450,72 +99,6 @@ const AgentsColumnResults: React.FC = ({ ); -interface PackViewInActionProps { - item: { - id: string; - interval: number; - action_id?: string; - agents: string[]; - }; - actionId?: string; -} - -const PackViewInDiscoverActionComponent: React.FC = ({ item }) => { - const { action_id: actionId, agents: agentIds, interval } = item; - const { data: lastResultsData } = usePackQueryLastResults({ - actionId, - interval, - }); - - const startDate = lastResultsData?.['@timestamp'] - ? moment(lastResultsData?.['@timestamp'][0]).subtract(interval, 'seconds').toISOString() - : `now-${interval}s`; - const endDate = lastResultsData?.['@timestamp'] - ? moment(lastResultsData?.['@timestamp'][0]).toISOString() - : 'now'; - - return ( - - ); -}; - -const PackViewInDiscoverAction = React.memo(PackViewInDiscoverActionComponent); - -const PackViewInLensActionComponent: React.FC = ({ item }) => { - const { action_id: actionId, agents: agentIds, interval } = item; - const { data: lastResultsData } = usePackQueryLastResults({ - actionId, - interval, - }); - - const startDate = lastResultsData?.['@timestamp'] - ? moment(lastResultsData?.['@timestamp'][0]).subtract(interval, 'seconds').toISOString() - : `now-${interval}s`; - const endDate = lastResultsData?.['@timestamp'] - ? moment(lastResultsData?.['@timestamp'][0]).toISOString() - : 'now'; - - return ( - - ); -}; - -const PackViewInLensAction = React.memo(PackViewInLensActionComponent); - type PackQueryStatusItem = Partial<{ action_id: string; id: string; @@ -542,10 +125,12 @@ interface PackQueriesStatusTableProps { actionId, isIcon, isDisabled, + queryId, }: { actionId?: string; isIcon?: boolean; isDisabled?: boolean; + queryId?: string; }) => ReactElement; showResultsHeader?: boolean; } @@ -562,10 +147,6 @@ const PackQueriesStatusTableComponent: React.FC = ( showResultsHeader, }) => { const [itemIdToExpandedRowMap, setItemIdToExpandedRowMap] = useState>({}); - const { cases, timelines, appName } = useKibana().services; - const casePermissions = cases.helpers.canUseCases(); - const CasesContext = cases.ui.getCasesContext(); - const renderIDColumn = useCallback( (id: string) => ( @@ -619,11 +200,15 @@ const PackQueriesStatusTableComponent: React.FC = ( const renderLensResultsAction = useCallback((item) => , []); const handleAddToCase = useCallback( - (payload: { actionId: string; isIcon?: boolean }) => + (payload: { actionId?: string; isIcon?: boolean; queryId: string }) => // eslint-disable-next-line react/display-name () => { if (addToCase) { - return addToCase({ actionId: payload.actionId, isIcon: payload?.isIcon }); + return addToCase({ + actionId: payload.actionId, + isIcon: payload.isIcon, + queryId: payload.queryId, + }); } return <>; @@ -648,7 +233,7 @@ const PackQueriesStatusTableComponent: React.FC = ( agentIds={agentIds} failedAgentsCount={item?.failed ?? 0} addToTimeline={addToTimeline} - addToCase={addToCase && handleAddToCase({ actionId: item.action_id })} + addToCase={addToCase && handleAddToCase({ queryId: item.action_id, actionId })} /> @@ -658,7 +243,7 @@ const PackQueriesStatusTableComponent: React.FC = ( return itemIdToExpandedRowMapValues; }); }, - [startDate, expirationDate, agentIds, addToTimeline, addToCase, handleAddToCase] + [startDate, expirationDate, agentIds, addToTimeline, addToCase, handleAddToCase, actionId] ); const renderToggleResultsAction = useCallback( @@ -677,28 +262,37 @@ const PackQueriesStatusTableComponent: React.FC = ( const getItemId = useCallback((item: PackItem) => get(item, 'id'), []); - const columns = useMemo(() => { - const resultActions = [ - { - render: renderDiscoverResultsAction, - }, - { - render: renderLensResultsAction, - }, - { - available: () => !!addToCase, - render: (item: { action_id: string }) => - addToCase && - addToCase({ actionId: item.action_id, isIcon: true, isDisabled: !item.action_id }), - }, - { - available: () => addToTimeline && timelines && appName === SECURITY_APP_NAME, - render: (item: { action_id: string }) => - addToTimeline && addToTimeline({ query: ['action_id', item.action_id], isIcon: true }), - }, - ]; + const renderResultActions = useCallback( + (row: { action_id: string }) => { + const resultActions = [ + { + render: renderDiscoverResultsAction, + }, + { + render: renderLensResultsAction, + }, + { + render: (item: { action_id: string }) => + addToTimeline && addToTimeline({ query: ['action_id', item.action_id], isIcon: true }), + }, + { + render: (item: { action_id: string }) => + addToCase && + addToCase({ + actionId, + queryId: item.action_id, + isIcon: true, + isDisabled: !item.action_id, + }), + }, + ]; - return [ + return resultActions.map((action) => action.render(row)); + }, + [actionId, addToCase, addToTimeline, renderDiscoverResultsAction, renderLensResultsAction] + ); + const columns = useMemo( + () => [ { field: 'id', name: i18n.translate('xpack.osquery.pack.queriesTable.idColumnTitle', { @@ -734,7 +328,7 @@ const PackQueriesStatusTableComponent: React.FC = ( defaultMessage: 'View results', }), width: '90px', - actions: resultActions, + render: renderResultActions, }, { id: 'actions', @@ -747,21 +341,16 @@ const PackQueriesStatusTableComponent: React.FC = ( }, ], }, - ]; - }, [ - renderDiscoverResultsAction, - renderLensResultsAction, - renderIDColumn, - renderQueryColumn, - renderDocsColumn, - renderAgentsColumn, - renderToggleResultsAction, - addToCase, - addToTimeline, - timelines, - appName, - ]); - + ], + [ + renderIDColumn, + renderQueryColumn, + renderDocsColumn, + renderAgentsColumn, + renderResultActions, + renderToggleResultsAction, + ] + ); const sorting = useMemo( () => ({ sort: { @@ -798,7 +387,7 @@ const PackQueriesStatusTableComponent: React.FC = ( ); return ( - + <> {showResultsHeader && ( )} @@ -811,7 +400,7 @@ const PackQueriesStatusTableComponent: React.FC = ( itemIdToExpandedRowMap={itemIdToExpandedRowMap} isExpandable /> - + ); }; diff --git a/x-pack/plugins/osquery/public/live_queries/form/pack_results_header.tsx b/x-pack/plugins/osquery/public/live_queries/form/pack_results_header.tsx index 854548fdb58e4..b4892a0387e8e 100644 --- a/x-pack/plugins/osquery/public/live_queries/form/pack_results_header.tsx +++ b/x-pack/plugins/osquery/public/live_queries/form/pack_results_header.tsx @@ -35,6 +35,7 @@ const StyledIconsList = styled(EuiFlexItem)` export const PackResultsHeader = ({ actionId, addToCase }: PackResultsHeadersProps) => ( <> + diff --git a/x-pack/plugins/osquery/public/live_queries/index.tsx b/x-pack/plugins/osquery/public/live_queries/index.tsx index cdb0dccd1a2eb..67b6194065c81 100644 --- a/x-pack/plugins/osquery/public/live_queries/index.tsx +++ b/x-pack/plugins/osquery/public/live_queries/index.tsx @@ -21,6 +21,7 @@ import type { AgentSelection } from '../agents/types'; interface LiveQueryProps { agentId?: string; agentIds?: string[]; + alertIds?: string[]; agentPolicyIds?: string[]; onSuccess?: () => void; query?: string; @@ -40,6 +41,7 @@ interface LiveQueryProps { const LiveQueryComponent: React.FC = ({ agentId, agentIds, + alertIds, agentPolicyIds, onSuccess, query, @@ -77,6 +79,7 @@ const LiveQueryComponent: React.FC = ({ const defaultValue = useMemo(() => { const initialValue = { ...(initialAgentSelection ? { agentSelection: initialAgentSelection } : {}), + alertIds, query, savedQueryId, ecs_mapping, @@ -84,7 +87,7 @@ const LiveQueryComponent: React.FC = ({ }; return !isEmpty(pickBy(initialValue, (value) => !isEmpty(value))) ? initialValue : undefined; - }, [ecs_mapping, initialAgentSelection, packId, query, savedQueryId]); + }, [alertIds, ecs_mapping, initialAgentSelection, packId, query, savedQueryId]); if (isLoading) { return ; diff --git a/x-pack/plugins/osquery/public/packs/form/index.tsx b/x-pack/plugins/osquery/public/packs/form/index.tsx index 594c539c389cf..ac3892fe9748b 100644 --- a/x-pack/plugins/osquery/public/packs/form/index.tsx +++ b/x-pack/plugins/osquery/public/packs/form/index.tsx @@ -155,7 +155,7 @@ const PackFormComponent: React.FC = ({ - + diff --git a/x-pack/plugins/osquery/public/packs/packs_table.tsx b/x-pack/plugins/osquery/public/packs/packs_table.tsx index 5e3e58dc7b4a4..69cfb3e40ef2e 100644 --- a/x-pack/plugins/osquery/public/packs/packs_table.tsx +++ b/x-pack/plugins/osquery/public/packs/packs_table.tsx @@ -126,9 +126,20 @@ const PacksTableComponent = () => { ); const renderPlayAction = useCallback( - (item, enabled) => ( - - ), + (item, enabled) => { + const playText = i18n.translate('xpack.osquery.packs.table.runActionAriaLabel', { + defaultMessage: 'Run {packName}', + values: { + packName: item.attributes.name, + }, + }); + + return ( + + + + ); + }, [handlePlayClick] ); diff --git a/x-pack/plugins/osquery/public/packs/queries/ecs_mapping_editor_field.tsx b/x-pack/plugins/osquery/public/packs/queries/ecs_mapping_editor_field.tsx index 259c131e48ca1..d8cc8f93e56ed 100644 --- a/x-pack/plugins/osquery/public/packs/queries/ecs_mapping_editor_field.tsx +++ b/x-pack/plugins/osquery/public/packs/queries/ecs_mapping_editor_field.tsx @@ -49,7 +49,7 @@ import { convertECSMappingToArray, convertECSMappingToObject, } from '../../../common/schemas/common/utils'; -import ECSSchema from '../../common/schemas/ecs/v8.4.0.json'; +import ECSSchema from '../../common/schemas/ecs/v8.5.0.json'; import osquerySchema from '../../common/schemas/osquery/v5.4.0.json'; import { FieldIcon } from '../../common/lib/kibana'; @@ -728,19 +728,13 @@ interface OsqueryColumn { export const ECSMappingEditorField = React.memo(({ euiFieldProps }: ECSMappingEditorFieldProps) => { const { - setError, - clearErrors, watch: watchRoot, register: registerRoot, setValue: setValueRoot, formState: { errors: errorsRoot }, } = useFormContext<{ query: string; ecs_mapping: ECSMapping }>(); - useEffect(() => { - registerRoot('ecs_mapping'); - }, [registerRoot]); - - const [query, ecsMapping] = watchRoot(['query', 'ecs_mapping'], { ecs_mapping: {} }); + const [query, ecsMapping] = watchRoot(['query', 'ecs_mapping']); const { control, trigger, watch, formState, resetField, getFieldState } = useForm<{ ecsMappingArray: ECSMappingArray; }>({ @@ -761,6 +755,16 @@ export const ECSMappingEditorField = React.memo(({ euiFieldProps }: ECSMappingEd const ecsMappingArrayState = getFieldState('ecsMappingArray', formState); const [osquerySchemaOptions, setOsquerySchemaOptions] = useState([]); + useEffect(() => { + registerRoot('ecs_mapping', { + validate: () => { + const nonEmptyErrors = reject(ecsMappingArrayState.error, isEmpty) as InternalFieldErrors[]; + + return !nonEmptyErrors.length; + }, + }); + }, [ecsMappingArrayState.error, errorsRoot, registerRoot]); + useEffect(() => { const subscription = watchRoot((data, payload) => { if (payload.name === 'ecs_mapping') { @@ -1019,10 +1023,16 @@ export const ECSMappingEditorField = React.memo(({ euiFieldProps }: ECSMappingEd orderBy(suggestions, ['value.suggestion_label', 'value.tableOrder'], ['asc', 'desc']), 'label' ); - setOsquerySchemaOptions((prevValue) => - !deepEqual(prevValue, newOptions) ? newOptions : prevValue - ); - }, [query]); + setOsquerySchemaOptions((prevValue) => { + if (!deepEqual(prevValue, newOptions)) { + trigger(); + + return newOptions; + } + + return prevValue; + }); + }, [query, trigger]); useEffect(() => { const parsedMapping = convertECSMappingToObject(formValue.ecsMappingArray); @@ -1033,27 +1043,6 @@ export const ECSMappingEditorField = React.memo(({ euiFieldProps }: ECSMappingEd } }, [setValueRoot, formValue, ecsMappingArrayState.isDirty, ecsMapping]); - useEffect(() => { - if (!formState.isValid) { - const nonEmptyErrors = reject(ecsMappingArrayState.error, isEmpty) as InternalFieldErrors[]; - if (nonEmptyErrors.length) { - setError('ecs_mapping', { - type: nonEmptyErrors[0].key?.type ?? 'custom', - message: nonEmptyErrors[0].key?.message ?? '', - }); - } - } else { - clearErrors('ecs_mapping'); - } - }, [ - errorsRoot, - clearErrors, - formState.isValid, - formState.errors, - setError, - ecsMappingArrayState.error, - ]); - return ( <> diff --git a/x-pack/plugins/osquery/public/packs/queries/query_flyout.tsx b/x-pack/plugins/osquery/public/packs/queries/query_flyout.tsx index d709b4f639e6d..1d6b52fcf2802 100644 --- a/x-pack/plugins/osquery/public/packs/queries/query_flyout.tsx +++ b/x-pack/plugins/osquery/public/packs/queries/query_flyout.tsx @@ -62,9 +62,9 @@ const QueryFlyoutComponent: React.FC = ({ formState: { isSubmitting }, resetField, } = hooksForm; - const onSubmit = (payload: PackQueryFormData) => { + const onSubmit = async (payload: PackQueryFormData) => { const serializedData: PackSOQueryFormData = serializer(payload); - onSave(serializedData); + await onSave(serializedData); onClose(); }; @@ -79,7 +79,7 @@ const QueryFlyoutComponent: React.FC = ({ resetField('version', { defaultValue: savedQuery.version ? [savedQuery.version] : [] }); resetField('interval', { defaultValue: savedQuery.interval ? savedQuery.interval : 3600 }); resetField('snapshot', { defaultValue: savedQuery.snapshot ?? true }); - resetField('removed'); + resetField('removed', { defaultValue: savedQuery.removed }); resetField('ecs_mapping', { defaultValue: savedQuery.ecs_mapping ?? {} }); } }, diff --git a/x-pack/plugins/osquery/public/routes/live_queries/details/index.tsx b/x-pack/plugins/osquery/public/routes/live_queries/details/index.tsx index a4c58074c76e1..bf35a529137f8 100644 --- a/x-pack/plugins/osquery/public/routes/live_queries/details/index.tsx +++ b/x-pack/plugins/osquery/public/routes/live_queries/details/index.tsx @@ -10,13 +10,18 @@ import { FormattedMessage } from '@kbn/i18n-react'; import React, { useCallback, useLayoutEffect, useMemo, useState } from 'react'; import { useParams } from 'react-router-dom'; -import { AddToCaseButton } from '../../../cases/add_to_cases_button'; +import styled from 'styled-components'; +import { AddToCaseWrapper } from '../../../cases/add_to_cases'; import { useRouterNavigate } from '../../../common/lib/kibana'; import { WithHeaderLayout } from '../../../components/layouts'; import { useLiveQueryDetails } from '../../../actions/use_live_query_details'; import { useBreadcrumbs } from '../../../common/hooks/use_breadcrumbs'; import { PackQueriesStatusTable } from '../../../live_queries/form/pack_queries_status_table'; +const StyledTableWrapper = styled(EuiFlexItem)` + padding-left: 10px; +`; + const LiveQueryDetailsPageComponent = () => { const { actionId } = useParams<{ actionId: string }>(); useBreadcrumbs('live_query_details', { liveQueryId: actionId }); @@ -55,7 +60,7 @@ const LiveQueryDetailsPageComponent = () => { }, [data?.status]); const addToCaseButton = useCallback( (payload) => ( - { return ( - + + + ); }; diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx index 1b24b4a71eeb5..ef945b92a0af2 100644 --- a/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx +++ b/x-pack/plugins/osquery/public/routes/saved_queries/edit/form.tsx @@ -49,10 +49,10 @@ const EditSavedQueryFormComponent: React.FC = ({ formState: { isSubmitting }, } = hooksForm; - const onSubmit = (payload: SavedQueryFormData) => { + const onSubmit = async (payload: SavedQueryFormData) => { const serializedData = serializer(payload); try { - handleSubmit(serializedData); + await handleSubmit(serializedData); // eslint-disable-next-line no-empty } catch (e) {} }; diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/edit/tabs.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/edit/tabs.tsx index 49501bc24b708..f4de8b04cb472 100644 --- a/x-pack/plugins/osquery/public/routes/saved_queries/edit/tabs.tsx +++ b/x-pack/plugins/osquery/public/routes/saved_queries/edit/tabs.tsx @@ -10,13 +10,10 @@ import React, { useMemo } from 'react'; import type { ReactElement } from 'react'; import type { ECSMapping } from '@kbn/osquery-io-ts-types'; -import { useKibana } from '../../../common/lib/kibana'; import type { AddToTimelinePayload } from '../../../timelines/get_add_to_timeline'; import { ResultsTable } from '../../../results/results_table'; import { ActionResultsSummary } from '../../../action_results/action_results_summary'; -const CASES_OWNER: string[] = []; - interface ResultTabsProps { actionId: string; agentIds?: string[]; @@ -38,10 +35,6 @@ const ResultTabsComponent: React.FC = ({ addToTimeline, addToCase, }) => { - const { cases } = useKibana().services; - const casePermissions = cases.helpers.canUseCases(); - const CasesContext = cases.ui.getCasesContext(); - const tabs = useMemo( () => [ { @@ -85,16 +78,14 @@ const ResultTabsComponent: React.FC = ({ ); return ( - - - + ); }; diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/list/index.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/list/index.tsx index f142c653656aa..276f2f2598d1e 100644 --- a/x-pack/plugins/osquery/public/routes/saved_queries/list/index.tsx +++ b/x-pack/plugins/osquery/public/routes/saved_queries/list/index.tsx @@ -61,19 +61,27 @@ const PlayButtonComponent: React.FC = ({ disabled = false, save [push, savedQuery] ); - return ( - + i18n.translate('xpack.osquery.savedQueryList.queriesTable.runActionAriaLabel', { defaultMessage: 'Run {savedQueryName}', values: { - savedQueryName: savedQuery.attributes.name, + savedQueryName: savedQuery.attributes.id, }, - })} - /> + }), + [savedQuery] + ); + + return ( + + + ); }; @@ -92,19 +100,27 @@ const EditButtonComponent: React.FC = ({ }) => { const buttonProps = useRouterNavigate(`saved_queries/${savedQueryId}`); - return ( - + i18n.translate('xpack.osquery.savedQueryList.queriesTable.editActionAriaLabel', { defaultMessage: 'Edit {savedQueryName}', values: { savedQueryName, }, - })} - /> + }), + [savedQueryName] + ); + + return ( + + + ); }; @@ -124,7 +140,7 @@ const SavedQueriesPageComponent = () => { const renderEditAction = useCallback( (item: SavedQuerySO) => ( - + ), [] ); diff --git a/x-pack/plugins/osquery/public/routes/saved_queries/new/form.tsx b/x-pack/plugins/osquery/public/routes/saved_queries/new/form.tsx index 350c35b2b3fa5..6763b5a1c73c4 100644 --- a/x-pack/plugins/osquery/public/routes/saved_queries/new/form.tsx +++ b/x-pack/plugins/osquery/public/routes/saved_queries/new/form.tsx @@ -47,9 +47,9 @@ const NewSavedQueryFormComponent: React.FC = ({ formState: { isSubmitting, errors }, } = hooksForm; - const onSubmit = (payload: SavedQueryFormData) => { + const onSubmit = async (payload: SavedQueryFormData) => { const serializedData = serializer(payload); - handleSubmit(serializedData); + await handleSubmit(serializedData); }; return ( diff --git a/x-pack/plugins/osquery/public/saved_queries/form/use_saved_query_form.tsx b/x-pack/plugins/osquery/public/saved_queries/form/use_saved_query_form.tsx index 3392f2af037c2..76bdd77d17b17 100644 --- a/x-pack/plugins/osquery/public/saved_queries/form/use_saved_query_form.tsx +++ b/x-pack/plugins/osquery/public/saved_queries/form/use_saved_query_form.tsx @@ -72,11 +72,6 @@ export const savedQueryDataSerializer = (payload: SavedQueryFormData): SavedQuer draft.interval = draft.interval + ''; } - if (draft.snapshot) { - delete draft.snapshot; - delete draft.removed; - } - return draft; }); diff --git a/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx b/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx index 6bb8d6f5a563d..3095428d478dc 100644 --- a/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx +++ b/x-pack/plugins/osquery/public/shared_components/osquery_action/index.tsx @@ -6,17 +6,12 @@ */ import { EuiLoadingContent, EuiEmptyPrompt, EuiCode } from '@elastic/eui'; -import React, { useMemo } from 'react'; +import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; +import { OsqueryEmptyPrompt, OsqueryNotAvailablePrompt } from '../prompts'; import type { AddToTimelinePayload } from '../../timelines/get_add_to_timeline'; -import { - AGENT_STATUS_ERROR, - EMPTY_PROMPT, - NOT_AVAILABLE, - PERMISSION_DENIED, - SHORT_EMPTY_TITLE, -} from './translations'; +import { AGENT_STATUS_ERROR, PERMISSION_DENIED, SHORT_EMPTY_TITLE } from './translations'; import { useKibana } from '../../common/lib/kibana'; import { LiveQuery } from '../../live_queries'; import { OsqueryIcon } from '../../components/osquery_icon'; @@ -39,22 +34,11 @@ const OsqueryActionComponent: React.FC = ({ }) => { const permissions = useKibana().services.application.capabilities.osquery; - const emptyPrompt = useMemo( - () => ( - } - title={

{SHORT_EMPTY_TITLE}

} - titleSize="xs" - body={

{EMPTY_PROMPT}

} - /> - ), - [] - ); const { osqueryAvailable, agentFetched, isLoading, policyFetched, policyLoading, agentData } = useIsOsqueryAvailable(agentId); if (agentId && agentFetched && !agentData) { - return emptyPrompt; + return ; } if ( @@ -91,14 +75,7 @@ const OsqueryActionComponent: React.FC = ({ } if (agentId && !osqueryAvailable) { - return ( - } - title={

{SHORT_EMPTY_TITLE}

} - titleSize="xs" - body={

{NOT_AVAILABLE}

} - /> - ); + return ; } if (agentId && agentData?.status !== 'online') { diff --git a/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_result.test.tsx b/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_result.test.tsx index e33207a12d907..772df753c8978 100644 --- a/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_result.test.tsx +++ b/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_result.test.tsx @@ -20,7 +20,7 @@ import { DETAILS_ID, DETAILS_QUERY, DETAILS_TIMESTAMP, - mockCasesContext, + getMockedKibanaConfig, } from './test_utils'; jest.mock('../../common/lib/kibana'); @@ -43,34 +43,8 @@ const defaultProps = { queryId: '', }; const mockKibana = (permissionType: unknown = defaultPermissions) => { - useKibanaMock.mockReturnValue({ - services: { - application: { - capabilities: permissionType, - }, - cases: { - helpers: { - canUseCases: jest.fn(), - }, - ui: { - getCasesContext: jest.fn().mockImplementation(() => mockCasesContext), - }, - }, - data: { - dataViews: { - getCanSaveSync: jest.fn(), - hasData: { - hasESData: jest.fn(), - hasUserDataView: jest.fn(), - hasDataView: jest.fn(), - }, - }, - }, - notifications: { - toasts: jest.fn(), - }, - }, - } as unknown as ReturnType); + const mockedKibana = getMockedKibanaConfig(permissionType); + useKibanaMock.mockReturnValue(mockedKibana); }; const renderWithContext = (Element: React.ReactElement) => diff --git a/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_result.tsx b/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_result.tsx index 998de8a15cfca..b0d0691c14f7d 100644 --- a/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_result.tsx +++ b/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_result.tsx @@ -6,9 +6,10 @@ */ import { EuiComment, EuiSpacer } from '@elastic/eui'; -import React from 'react'; +import React, { useCallback } from 'react'; import { FormattedRelative } from '@kbn/i18n-react'; +import { AddToCaseWrapper } from '../../cases/add_to_cases'; import type { OsqueryActionResultsProps } from './types'; import { useLiveQueryDetails } from '../../actions/use_live_query_details'; import { ATTACHED_QUERY } from '../../agents/translations'; @@ -22,7 +23,6 @@ interface OsqueryResultProps extends Omit export const OsqueryResult = ({ actionId, - queryId, ruleName, addToTimeline, agentIds, @@ -30,10 +30,22 @@ export const OsqueryResult = ({ }: OsqueryResultProps) => { const { data } = useLiveQueryDetails({ actionId, - // isLive, - // ...(queryId ? { queryIds: [queryId] } : {}), }); + const addToCaseButton = useCallback( + (payload) => ( + + ), + [data?.agents, actionId] + ); + return (
@@ -51,6 +63,7 @@ export const OsqueryResult = ({ expirationDate={data?.expiration} agentIds={agentIds} addToTimeline={addToTimeline} + addToCase={addToCaseButton} /> diff --git a/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_results.test.tsx b/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_results.test.tsx index 9e2b74e000705..5190d10dc1c7e 100644 --- a/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_results.test.tsx +++ b/x-pack/plugins/osquery/public/shared_components/osquery_results/osquery_results.test.tsx @@ -17,7 +17,7 @@ import * as useAllLiveQueries from '../../actions/use_all_live_queries'; import * as useLiveQueryDetails from '../../actions/use_live_query_details'; import { PERMISSION_DENIED } from '../osquery_action/translations'; import * as privileges from '../../action_results/use_action_privileges'; -import { defaultLiveQueryDetails, DETAILS_QUERY, mockCasesContext } from './test_utils'; +import { defaultLiveQueryDetails, DETAILS_QUERY, getMockedKibanaConfig } from './test_utils'; jest.mock('../../common/lib/kibana'); @@ -49,34 +49,8 @@ const defaultPermissions = { }; const mockKibana = (permissionType: unknown = defaultPermissions) => { - useKibanaMock.mockReturnValue({ - services: { - application: { - capabilities: permissionType, - }, - cases: { - helpers: { - canUseCases: jest.fn(), - }, - ui: { - getCasesContext: jest.fn().mockImplementation(() => mockCasesContext), - }, - }, - data: { - dataViews: { - getCanSaveSync: jest.fn(), - hasData: { - hasESData: jest.fn(), - hasUserDataView: jest.fn(), - hasDataView: jest.fn(), - }, - }, - }, - notifications: { - toasts: jest.fn(), - }, - }, - } as unknown as ReturnType); + const mockedKibana = getMockedKibanaConfig(permissionType); + useKibanaMock.mockReturnValue(mockedKibana); }; const renderWithContext = (Element: React.ReactElement) => diff --git a/x-pack/plugins/osquery/public/shared_components/osquery_results/test_utils.tsx b/x-pack/plugins/osquery/public/shared_components/osquery_results/test_utils.tsx index 4de58a4ed9aad..c1c991becc8ac 100644 --- a/x-pack/plugins/osquery/public/shared_components/osquery_results/test_utils.tsx +++ b/x-pack/plugins/osquery/public/shared_components/osquery_results/test_utils.tsx @@ -6,6 +6,7 @@ */ import React from 'react'; +import type { useKibana } from '../../common/lib/kibana'; export const DETAILS_QUERY = 'select * from uptime'; export const DETAILS_ID = 'test-id'; @@ -38,4 +39,41 @@ export const defaultLiveQueryDetails = { }, } as never; +export const getMockedKibanaConfig = (permissionType: unknown) => + ({ + services: { + application: { + capabilities: permissionType, + }, + cases: { + helpers: { + canUseCases: jest.fn().mockImplementation(() => ({ + read: true, + update: true, + push: true, + })), + }, + ui: { + getCasesContext: jest.fn().mockImplementation(() => mockCasesContext), + }, + hooks: { + getUseCasesAddToExistingCaseModal: jest.fn(), + }, + }, + data: { + dataViews: { + getCanSaveSync: jest.fn(), + hasData: { + hasESData: jest.fn(), + hasUserDataView: jest.fn(), + hasDataView: jest.fn(), + }, + }, + }, + notifications: { + toasts: jest.fn(), + }, + }, + } as unknown as ReturnType); + export const mockCasesContext: React.FC = (props) => <>{props?.children ?? null}; diff --git a/x-pack/plugins/osquery/public/shared_components/prompts.tsx b/x-pack/plugins/osquery/public/shared_components/prompts.tsx new file mode 100644 index 0000000000000..992de7c9ab14b --- /dev/null +++ b/x-pack/plugins/osquery/public/shared_components/prompts.tsx @@ -0,0 +1,29 @@ +/* + * 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 { EuiEmptyPrompt } from '@elastic/eui'; +import { OsqueryIcon } from '../components/osquery_icon'; +import { EMPTY_PROMPT, NOT_AVAILABLE, SHORT_EMPTY_TITLE } from './osquery_action/translations'; + +export const OsqueryEmptyPrompt = () => ( + } + title={

{SHORT_EMPTY_TITLE}

} + titleSize="xs" + body={

{EMPTY_PROMPT}

} + /> +); + +export const OsqueryNotAvailablePrompt = () => ( + } + title={

{SHORT_EMPTY_TITLE}

} + titleSize="xs" + body={

{NOT_AVAILABLE}

} + /> +); diff --git a/x-pack/plugins/osquery/scripts/roles_users/t1_analyst/role.json b/x-pack/plugins/osquery/scripts/roles_users/t1_analyst/role.json index 12d5c2607f9ab..5087ba9005a3c 100644 --- a/x-pack/plugins/osquery/scripts/roles_users/t1_analyst/role.json +++ b/x-pack/plugins/osquery/scripts/roles_users/t1_analyst/role.json @@ -1,6 +1,15 @@ { "elasticsearch": { + "cluster": ["manage"], "indices": [ + { + "names": [".items-*", ".lists-*", ".alerts-security.alerts-*", ".siem-signals-*"], + "privileges": ["manage", "read", "write", "view_index_metadata", "maintenance"] + }, + { + "names": ["*"], + "privileges": ["read"] + }, { "names": ["logs-osquery_manager*"], "privileges": ["read"] @@ -10,6 +19,7 @@ "kibana": [ { "feature": { + "siem": ["all"], "osquery": ["read", "run_saved_queries" ] }, "spaces": ["*"] diff --git a/x-pack/plugins/osquery/scripts/schema_formatter/ecs_formatter.ts b/x-pack/plugins/osquery/scripts/schema_formatter/ecs_formatter.ts index 27d8a0eecd17c..553c4e9de10fd 100644 --- a/x-pack/plugins/osquery/scripts/schema_formatter/ecs_formatter.ts +++ b/x-pack/plugins/osquery/scripts/schema_formatter/ecs_formatter.ts @@ -40,7 +40,7 @@ const RESTRICTED_FIELDS = [ run( async ({ flags }) => { - const schemaPath = path.resolve(`../../public/common/schemas/ecs/`); + const schemaPath = path.resolve(`./public/common/schemas/ecs/`); const schemaFile = path.join(schemaPath, flags.schema_version as string); const schemaData = await require(schemaFile); diff --git a/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts b/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts index 8350355816459..19b5b13495718 100644 --- a/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts +++ b/x-pack/plugins/osquery/server/lib/osquery_app_context_services.ts @@ -14,6 +14,7 @@ import type { AgentPolicyServiceInterface, PackagePolicyClient, } from '@kbn/fleet-plugin/server'; +import type { RuleRegistryPluginStartContract } from '@kbn/rule-registry-plugin/server'; import type { ConfigType } from '../../common/config'; import type { TelemetryEventsSender } from './telemetry/sender'; @@ -26,6 +27,7 @@ export type OsqueryAppContextServiceStartContract = Partial< logger: Logger; config: ConfigType; registerIngestCallback?: FleetStartContract['registerExternalCallback']; + ruleRegistryService?: RuleRegistryPluginStartContract; }; /** @@ -37,12 +39,14 @@ export class OsqueryAppContextService { private packageService: PackageService | undefined; private packagePolicyService: PackagePolicyClient | undefined; private agentPolicyService: AgentPolicyServiceInterface | undefined; + private ruleRegistryService: RuleRegistryPluginStartContract | undefined; public start(dependencies: OsqueryAppContextServiceStartContract) { this.agentService = dependencies.agentService; this.packageService = dependencies.packageService; this.packagePolicyService = dependencies.packagePolicyService; this.agentPolicyService = dependencies.agentPolicyService; + this.ruleRegistryService = dependencies.ruleRegistryService; } // eslint-disable-next-line @typescript-eslint/no-empty-function @@ -63,6 +67,10 @@ export class OsqueryAppContextService { public getAgentPolicyService(): AgentPolicyServiceInterface | undefined { return this.agentPolicyService; } + + public getRuleRegistryService(): RuleRegistryPluginStartContract | undefined { + return this.ruleRegistryService; + } } /** diff --git a/x-pack/plugins/osquery/server/plugin.ts b/x-pack/plugins/osquery/server/plugin.ts index 655de66243416..601e0e29a3a83 100644 --- a/x-pack/plugins/osquery/server/plugin.ts +++ b/x-pack/plugins/osquery/server/plugin.ts @@ -100,6 +100,7 @@ export class OsqueryPlugin implements Plugin { router.post( @@ -37,7 +43,41 @@ export const createLiveQueryRoute = (router: IRouter, osqueryContext: OsqueryApp ); if (isInvalid) { - return response.forbidden(); + if (request.body.alert_ids?.length) { + try { + const client = await osqueryContext.service + .getRuleRegistryService() + ?.getRacClientWithRequest(request); + + const alertData = await client?.get({ id: request.body.alert_ids[0] }); + + if (alertData?.['kibana.alert.rule.note']) { + const parsedAlertInvestigationGuide = unified() + .use([[markdown, {}], OsqueryParser]) + .parse(alertData?.['kibana.alert.rule.note']); + + const osqueryQueries = filter(parsedAlertInvestigationGuide?.children as object, [ + 'type', + 'osquery', + ]); + + const requestQueryExistsInTheInvestigationGuide = some( + osqueryQueries, + (payload: { + configuration: { query: string; ecs_mapping: ECSMappingOrUndefined }; + }) => + payload?.configuration?.query === request.body.query && + deepEqual(payload?.configuration?.ecs_mapping, request.body.ecs_mapping) + ); + + if (!requestQueryExistsInTheInvestigationGuide) throw new Error(); + } + } catch (error) { + return response.forbidden(); + } + } else { + return response.forbidden(); + } } try { diff --git a/x-pack/plugins/osquery/server/routes/live_query/osquery_parser.ts b/x-pack/plugins/osquery/server/routes/live_query/osquery_parser.ts new file mode 100644 index 0000000000000..afc51949f3c70 --- /dev/null +++ b/x-pack/plugins/osquery/server/routes/live_query/osquery_parser.ts @@ -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 type { RemarkTokenizer } from '@elastic/eui'; +import type { Plugin } from 'unified'; + +export const parser: Plugin = function () { + const Parser = this.Parser; + const tokenizers = Parser.prototype.blockTokenizers; + const methods = Parser.prototype.blockMethods; + + const tokenizeOsquery: RemarkTokenizer = function (eat, value, silent) { + if (value.startsWith('!{osquery') === false) return false; + + const nextChar = value[9]; + + if (nextChar !== '{' && nextChar !== '}') return false; // this isn't actually a osquery + + if (silent) { + return true; + } + + // is there a configuration? + const hasConfiguration = nextChar === '{'; + + let match = '!{osquery'; + let configuration = {}; + + if (hasConfiguration) { + let configurationString = ''; + + let openObjects = 0; + + for (let i = 9; i < value.length; i++) { + const char = value[i]; + if (char === '{') { + openObjects++; + configurationString += char; + } else if (char === '}') { + openObjects--; + if (openObjects === -1) { + break; + } + + configurationString += char; + } else { + configurationString += char; + } + } + + match += configurationString; + try { + configuration = JSON.parse(configurationString); + } catch (e) { + const now = eat.now(); + this.file.fail(`Unable to parse osquery JSON configuration: ${e}`, { + line: now.line, + column: now.column + 9, + }); + } + } + + match += '}'; + + return eat(match)({ + type: 'osquery', + configuration, + }); + }; + + tokenizers.osquery = tokenizeOsquery; + methods.splice(methods.indexOf('text'), 0, 'osquery'); +}; diff --git a/x-pack/plugins/osquery/server/routes/pack/create_pack_route.ts b/x-pack/plugins/osquery/server/routes/pack/create_pack_route.ts index c60c6d476974b..3dda3cdb36b0d 100644 --- a/x-pack/plugins/osquery/server/routes/pack/create_pack_route.ts +++ b/x-pack/plugins/osquery/server/routes/pack/create_pack_route.ts @@ -144,7 +144,10 @@ export const createPackRoute = (router: IRouter, osqueryContext: OsqueryAppConte } set(draft, `inputs[0].config.osquery.value.packs.${packSO.attributes.name}`, { - queries: convertSOQueriesToPack(queries, { removeMultiLines: true }), + queries: convertSOQueriesToPack(queries, { + removeMultiLines: true, + removeResultType: true, + }), }); return draft; diff --git a/x-pack/plugins/osquery/server/routes/pack/update_pack_route.ts b/x-pack/plugins/osquery/server/routes/pack/update_pack_route.ts index c113cbeb36c32..5b0d76131ee28 100644 --- a/x-pack/plugins/osquery/server/routes/pack/update_pack_route.ts +++ b/x-pack/plugins/osquery/server/routes/pack/update_pack_route.ts @@ -285,6 +285,7 @@ export const updatePackRoute = (router: IRouter, osqueryContext: OsqueryAppConte { queries: convertSOQueriesToPack(updatedPackSO.attributes.queries, { removeMultiLines: true, + removeResultType: true, }), } ); @@ -315,7 +316,9 @@ export const updatePackRoute = (router: IRouter, osqueryContext: OsqueryAppConte draft, `inputs[0].config.osquery.value.packs.${updatedPackSO.attributes.name}`, { - queries: updatedPackSO.attributes.queries, + queries: convertSOQueriesToPack(updatedPackSO.attributes.queries, { + removeResultType: true, + }), } ); diff --git a/x-pack/plugins/osquery/server/routes/pack/utils.test.ts b/x-pack/plugins/osquery/server/routes/pack/utils.test.ts index 05aff28073937..3ddb074a6edbd 100644 --- a/x-pack/plugins/osquery/server/routes/pack/utils.test.ts +++ b/x-pack/plugins/osquery/server/routes/pack/utils.test.ts @@ -42,15 +42,45 @@ describe('Pack utils', () => { describe('convertSOQueriesToPack', () => { test('converts to pack with empty ecs_mapping', () => { const convertedQueries = convertSOQueriesToPack(getTestQueries()); - expect(convertedQueries).toStrictEqual(getTestQueries({})); + expect(convertedQueries).toStrictEqual(getTestQueries()); }); test('converts to pack with converting query to single line', () => { const convertedQueries = convertSOQueriesToPack(getTestQueries(), { removeMultiLines: true }); - expect(convertedQueries).toStrictEqual(oneLiner); + expect(convertedQueries).toStrictEqual({ + ...oneLiner, + }); }); test('converts to object with pack names after query.id', () => { const convertedQueries = convertSOQueriesToPack(getTestQueries({ id: 'testId' })); expect(convertedQueries).toStrictEqual(getTestQueries({}, 'testId')); }); + test('converts with results snapshot set false', () => { + const convertedQueries = convertSOQueriesToPack( + getTestQueries({ snapshot: false, removed: true }), + { removeResultType: true } + ); + expect(convertedQueries).toStrictEqual(getTestQueries({ removed: true, snapshot: false })); + }); + test('converts with results snapshot set true and removed false', () => { + const convertedQueries = convertSOQueriesToPack( + getTestQueries({ snapshot: true, removed: true }), + { removeResultType: true } + ); + expect(convertedQueries).toStrictEqual(getTestQueries({})); + }); + test('converts with results snapshot set true but removed false', () => { + const convertedQueries = convertSOQueriesToPack( + getTestQueries({ snapshot: true, removed: false }), + { removeResultType: true } + ); + expect(convertedQueries).toStrictEqual(getTestQueries({})); + }); + test('converts with both results set to false', () => { + const convertedQueries = convertSOQueriesToPack( + getTestQueries({ snapshot: false, removed: false }), + { removeResultType: true } + ); + expect(convertedQueries).toStrictEqual(getTestQueries({ removed: false, snapshot: false })); + }); }); }); diff --git a/x-pack/plugins/osquery/server/routes/pack/utils.ts b/x-pack/plugins/osquery/server/routes/pack/utils.ts index fe1ded84f4466..4342cdb3ead8e 100644 --- a/x-pack/plugins/osquery/server/routes/pack/utils.ts +++ b/x-pack/plugins/osquery/server/routes/pack/utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { isEmpty, pick, reduce } from 'lodash'; +import { isEmpty, pick, reduce, isArray } from 'lodash'; import { DEFAULT_PLATFORM } from '../../../common/constants'; import { removeMultilines } from '../../../common/utils/build_query/remove_multilines'; import { convertECSMappingToArray, convertECSMappingToObject } from '../utils'; @@ -37,18 +37,29 @@ export const convertPackQueriesToSO = (queries) => }> ); -// @ts-expect-error update types -export const convertSOQueriesToPack = (queries, options?: { removeMultiLines?: boolean }) => +export const convertSOQueriesToPack = ( + // @ts-expect-error update types + queries, + options?: { removeMultiLines?: boolean; removeResultType?: boolean } +) => reduce( queries, // eslint-disable-next-line @typescript-eslint/naming-convention - (acc, { id: queryId, ecs_mapping, query, platform, ...rest }, key) => { + (acc, { id: queryId, ecs_mapping, query, platform, removed, snapshot, ...rest }, key) => { + const resultType = !snapshot ? { removed, snapshot } : {}; const index = queryId ? queryId : key; acc[index] = { ...rest, query: options?.removeMultiLines ? removeMultilines(query) : query, - ...(!isEmpty(ecs_mapping) ? { ecs_mapping: convertECSMappingToObject(ecs_mapping) } : {}), + ...(!isEmpty(ecs_mapping) + ? isArray(ecs_mapping) + ? { ecs_mapping: convertECSMappingToObject(ecs_mapping) } + : { ecs_mapping } + : {}), ...(platform === DEFAULT_PLATFORM || platform === undefined ? {} : { platform }), + ...(options?.removeResultType + ? resultType + : { ...(snapshot ? { snapshot } : {}), ...(removed ? { removed } : {}) }), }; return acc; diff --git a/x-pack/plugins/osquery/server/routes/saved_query/create_saved_query_route.ts b/x-pack/plugins/osquery/server/routes/saved_query/create_saved_query_route.ts index 206719927281b..4ad6146328a1c 100644 --- a/x-pack/plugins/osquery/server/routes/saved_query/create_saved_query_route.ts +++ b/x-pack/plugins/osquery/server/routes/saved_query/create_saved_query_route.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { isEmpty, pickBy, some } from 'lodash'; +import { isEmpty, pickBy, some, isBoolean } from 'lodash'; import type { IRouter } from '@kbn/core/server'; import { PLUGIN_ID } from '../../../common'; import type { CreateSavedQueryRequestSchemaDecoded } from '../../../common/schemas/routes/saved_query/create_saved_query_request_schema'; @@ -76,7 +76,7 @@ export const createSavedQueryRoute = (router: IRouter, osqueryContext: OsqueryAp updated_by: currentUser, updated_at: new Date().toISOString(), }, - (value) => !isEmpty(value) || value === false + (value) => !isEmpty(value) || isBoolean(value) ) ); diff --git a/x-pack/plugins/osquery/server/types.ts b/x-pack/plugins/osquery/server/types.ts index 162ce9e7095d9..ef0bdacf0dfd2 100644 --- a/x-pack/plugins/osquery/server/types.ts +++ b/x-pack/plugins/osquery/server/types.ts @@ -20,6 +20,7 @@ import type { TaskManagerStartContract as TaskManagerPluginStart, } from '@kbn/task-manager-plugin/server'; import type { PluginStart as DataViewsPluginStart } from '@kbn/data-views-plugin/server'; +import type { RuleRegistryPluginStartContract } from '@kbn/rule-registry-plugin/server'; import type { CreateLiveQueryRequestBodySchema } from '../common/schemas/routes/live_query'; export interface OsqueryPluginSetup { @@ -46,4 +47,5 @@ export interface StartPlugins { fleet?: FleetStartContract; taskManager?: TaskManagerPluginStart; telemetry?: TelemetryPluginStart; + ruleRegistry?: RuleRegistryPluginStartContract; } diff --git a/x-pack/plugins/profiling/public/components/flame_graphs_view/flamegraph_information_window.tsx b/x-pack/plugins/profiling/public/components/flame_graphs_view/flamegraph_information_window.tsx index 824e6d1476a14..39795474763be 100644 --- a/x-pack/plugins/profiling/public/components/flame_graphs_view/flamegraph_information_window.tsx +++ b/x-pack/plugins/profiling/public/components/flame_graphs_view/flamegraph_information_window.tsx @@ -25,11 +25,10 @@ interface Props { exeFileName: string; functionName: string; sourceFileName: string; - samples: number; - childSamples: number; + countInclusive: number; + countExclusive: number; }; - sampledTraces: number; - totalTraces: number; + totalSamples: number; totalSeconds: number; onClose: () => void; status: AsyncStatus; @@ -105,8 +104,7 @@ function FlamegraphFrameInformationPanel({ export function FlamegraphInformationWindow({ onClose, frame, - sampledTraces, - totalTraces, + totalSamples, totalSeconds, status, }: Props) { @@ -122,14 +120,13 @@ export function FlamegraphInformationWindow({ ); } - const { childSamples, exeFileName, samples, functionName, sourceFileName } = frame; + const { exeFileName, functionName, sourceFileName, countInclusive, countExclusive } = frame; const impactRows = getImpactRows({ - samples, - childSamples, - sampledTraces, + countInclusive, + countExclusive, + totalSamples, totalSeconds, - totalTraces, }); return ( diff --git a/x-pack/plugins/profiling/public/components/flame_graphs_view/get_impact_rows.ts b/x-pack/plugins/profiling/public/components/flame_graphs_view/get_impact_rows.ts index 8ca1347e4497f..40d3bfc02c1f2 100644 --- a/x-pack/plugins/profiling/public/components/flame_graphs_view/get_impact_rows.ts +++ b/x-pack/plugins/profiling/public/components/flame_graphs_view/get_impact_rows.ts @@ -8,6 +8,7 @@ import { i18n } from '@kbn/i18n'; import { asCost } from '../../utils/formatters/as_cost'; import { asDuration } from '../../utils/formatters/as_duration'; +import { asNumber } from '../../utils/formatters/as_number'; import { asPercentage } from '../../utils/formatters/as_percentage'; import { asWeight } from '../../utils/formatters/as_weight'; @@ -23,21 +24,19 @@ const CO2_PER_KWH = 0.92; const CORE_COST_PER_HOUR = 0.0425; export function getImpactRows({ - samples, - childSamples, - sampledTraces, - totalTraces, + countInclusive, + countExclusive, + totalSamples, totalSeconds, }: { - samples: number; - childSamples: number; - sampledTraces: number; - totalTraces: number; + countInclusive: number; + countExclusive: number; + totalSamples: number; totalSeconds: number; }) { - const percentage = samples / sampledTraces; - const percentageNoChildren = (samples - childSamples) / sampledTraces; - const totalCoreSeconds = totalTraces / 20; + const percentage = countInclusive / totalSamples; + const percentageNoChildren = countExclusive / totalSamples; + const totalCoreSeconds = totalSamples / 20; const coreSeconds = totalCoreSeconds * percentage; const coreSecondsNoChildren = totalCoreSeconds * percentageNoChildren; const coreHours = coreSeconds / (60 * 60); @@ -70,10 +69,16 @@ export function getImpactRows({ value: asPercentage(percentageNoChildren), }, { - label: i18n.translate('xpack.profiling.flameGraphInformationWindow.samplesLabel', { + label: i18n.translate('xpack.profiling.flameGraphInformationWindow.samplesInclusiveLabel', { defaultMessage: 'Samples', }), - value: samples, + value: asNumber(countInclusive), + }, + { + label: i18n.translate('xpack.profiling.flameGraphInformationWindow.samplesExclusiveLabel', { + defaultMessage: 'Samples (excl. children)', + }), + value: asNumber(countExclusive), }, { label: i18n.translate( diff --git a/x-pack/plugins/profiling/public/components/flamegraph.tsx b/x-pack/plugins/profiling/public/components/flamegraph.tsx index 9abac27ef9fb2..5ffe72646f01c 100644 --- a/x-pack/plugins/profiling/public/components/flamegraph.tsx +++ b/x-pack/plugins/profiling/public/components/flamegraph.tsx @@ -31,11 +31,9 @@ function TooltipRow({ formatAsPercentage: boolean; showChange: boolean; }) { - const valueLabel = formatAsPercentage ? asPercentage(value, 2) : value.toString(); + const valueLabel = formatAsPercentage ? asPercentage(value) : value.toString(); const comparisonLabel = - formatAsPercentage && isNumber(comparison) - ? asPercentage(comparison, 2) - : comparison?.toString(); + formatAsPercentage && isNumber(comparison) ? asPercentage(comparison) : comparison?.toString(); const diff = showChange && isNumber(comparison) ? comparison - value : undefined; @@ -46,7 +44,7 @@ function TooltipRow({ defaultMessage: 'no change', }); } else if (formatAsPercentage && diff !== undefined) { - diffLabel = asPercentage(diff, 2); + diffLabel = asPercentage(diff); } return ( @@ -226,10 +224,8 @@ export const FlameGraph: React.FC = ({ exeFileName: highlightedFrame.ExeFileName, sourceFileName: highlightedFrame.SourceFilename, functionName: highlightedFrame.FunctionName, - samples: primaryFlamegraph.Samples[highlightedVmIndex], - childSamples: - primaryFlamegraph.Samples[highlightedVmIndex] - - primaryFlamegraph.CountExclusive[highlightedVmIndex], + countInclusive: primaryFlamegraph.Samples[highlightedVmIndex], + countExclusive: primaryFlamegraph.CountExclusive[highlightedVmIndex], } : undefined; @@ -315,8 +311,7 @@ export const FlameGraph: React.FC = ({ frame={selected} status={highlightedFrameStatus} totalSeconds={primaryFlamegraph?.TotalSeconds ?? 0} - totalTraces={primaryFlamegraph?.TotalTraces ?? 0} - sampledTraces={primaryFlamegraph?.SampledTraces ?? 0} + totalSamples={totalSamples} onClose={() => { setShowInformationWindow(false); }} diff --git a/x-pack/plugins/profiling/public/components/subchart.tsx b/x-pack/plugins/profiling/public/components/subchart.tsx index caafeb5e3d481..0dc017bbdf5f3 100644 --- a/x-pack/plugins/profiling/public/components/subchart.tsx +++ b/x-pack/plugins/profiling/public/components/subchart.tsx @@ -194,7 +194,7 @@ export const SubChart: React.FC = ({ )} - {asPercentage(percentage / 100, 2)} + {asPercentage(percentage / 100)} diff --git a/x-pack/plugins/profiling/public/utils/formatters/as_cost.ts b/x-pack/plugins/profiling/public/utils/formatters/as_cost.ts index 148eba4785263..ea2afc3f50f58 100644 --- a/x-pack/plugins/profiling/public/utils/formatters/as_cost.ts +++ b/x-pack/plugins/profiling/public/utils/formatters/as_cost.ts @@ -5,6 +5,8 @@ * 2.0. */ -export function asCost(value: number, precision: number = 2, unit: string = '$') { - return `${value.toPrecision(precision)}${unit}`; +import { asNumber } from './as_number'; + +export function asCost(value: number, unit: string = '$') { + return `${asNumber(value)}${unit}`; } diff --git a/x-pack/plugins/profiling/public/utils/formatters/as_duration.ts b/x-pack/plugins/profiling/public/utils/formatters/as_duration.ts index ba0839f06e779..833602cc38203 100644 --- a/x-pack/plugins/profiling/public/utils/formatters/as_duration.ts +++ b/x-pack/plugins/profiling/public/utils/formatters/as_duration.ts @@ -4,9 +4,25 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { i18n } from '@kbn/i18n'; import moment from 'moment'; +moment.relativeTimeRounding((t) => { + const DIGITS = 2; // like: 2.56 minutes + return Math.round(t * Math.pow(10, DIGITS)) / Math.pow(10, DIGITS); +}); +moment.relativeTimeThreshold('y', 365); +moment.relativeTimeThreshold('M', 12); +moment.relativeTimeThreshold('w', 4); +moment.relativeTimeThreshold('d', 31); +moment.relativeTimeThreshold('h', 24); +moment.relativeTimeThreshold('m', 60); +moment.relativeTimeThreshold('s', 60); +moment.relativeTimeThreshold('ss', 0); + export function asDuration(valueInSeconds: number) { + if (valueInSeconds === 0) { + return i18n.translate('xpack.profiling.zeroSeconds', { defaultMessage: '0 seconds' }); + } return moment.duration(valueInSeconds * 1000).humanize(); } diff --git a/x-pack/plugins/profiling/public/utils/formatters/as_number.test.ts b/x-pack/plugins/profiling/public/utils/formatters/as_number.test.ts new file mode 100644 index 0000000000000..c30def19eb8e3 --- /dev/null +++ b/x-pack/plugins/profiling/public/utils/formatters/as_number.test.ts @@ -0,0 +1,31 @@ +/* + * 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 { asNumber } from './as_number'; + +describe('asNumber', () => { + it('rounds numbers appropriately', () => { + expect(asNumber(999)).toBe('999'); + + expect(asNumber(1.11)).toBe('1.11'); + + expect(asNumber(0.001)).toBe('~0.00'); + + expect(asNumber(0)).toBe('0'); + }); + + it('adds k/m/b where needed', () => { + expect(asNumber(999.999)).toBe('1k'); + + expect(asNumber(4.5e5)).toBe('450k'); + + expect(asNumber(4.5001e5)).toBe('450.01k'); + + expect(asNumber(2.4991e7)).toBe('24.99m'); + + expect(asNumber(9e9)).toBe('9b'); + }); +}); diff --git a/x-pack/plugins/profiling/public/utils/formatters/as_number.ts b/x-pack/plugins/profiling/public/utils/formatters/as_number.ts new file mode 100644 index 0000000000000..f7b67bafbf7f7 --- /dev/null +++ b/x-pack/plugins/profiling/public/utils/formatters/as_number.ts @@ -0,0 +1,30 @@ +/* + * 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 function asNumber(value: number): string { + if (value === 0) { + return '0'; + } + + value = Math.round(value * 100) / 100; + if (value < 0.01) { + return '~0.00'; + } + if (value < 1e3) { + return value.toString(); + } + + if (value < 1e6) { + return `${asNumber(value / 1e3)}k`; + } + + if (value < 1e9) { + return `${asNumber(value / 1e6)}m`; + } + + return `${asNumber(value / 1e9)}b`; +} diff --git a/x-pack/plugins/profiling/public/utils/formatters/as_percentage.ts b/x-pack/plugins/profiling/public/utils/formatters/as_percentage.ts index f4c3a84b6275f..6b3af016b44c1 100644 --- a/x-pack/plugins/profiling/public/utils/formatters/as_percentage.ts +++ b/x-pack/plugins/profiling/public/utils/formatters/as_percentage.ts @@ -5,6 +5,8 @@ * 2.0. */ -export function asPercentage(value: number, precision: number = 0) { - return `${Number(value * 100).toFixed(precision)}%`; +import { asNumber } from './as_number'; + +export function asPercentage(value: number) { + return `${asNumber(value * 100)}%`; } diff --git a/x-pack/plugins/profiling/public/utils/formatters/as_weight.ts b/x-pack/plugins/profiling/public/utils/formatters/as_weight.ts index 82a6cbd4f64b0..fa938a9351f3f 100644 --- a/x-pack/plugins/profiling/public/utils/formatters/as_weight.ts +++ b/x-pack/plugins/profiling/public/utils/formatters/as_weight.ts @@ -6,12 +6,13 @@ */ import { i18n } from '@kbn/i18n'; +import { asNumber } from './as_number'; const ONE_POUND_TO_A_KILO = 0.45359237; -export function asWeight(valueInPounds: number, precision: number = 2) { - const lbs = valueInPounds.toPrecision(precision); - const kgs = Number(valueInPounds * ONE_POUND_TO_A_KILO).toPrecision(precision); +export function asWeight(valueInPounds: number) { + const lbs = asNumber(valueInPounds); + const kgs = asNumber(Number(valueInPounds * ONE_POUND_TO_A_KILO)); return i18n.translate('xpack.profiling.formatters.weight', { defaultMessage: `{lbs} lbs / {kgs} kg`, diff --git a/x-pack/plugins/security/common/model/authenticated_user.mock.ts b/x-pack/plugins/security/common/model/authenticated_user.mock.ts index 73641d2fa5983..84b300d5c982b 100644 --- a/x-pack/plugins/security/common/model/authenticated_user.mock.ts +++ b/x-pack/plugins/security/common/model/authenticated_user.mock.ts @@ -24,6 +24,7 @@ export function mockAuthenticatedUser(user: MockAuthenticatedUserProps = {}) { authentication_provider: { type: 'basic', name: 'basic1' }, authentication_type: 'realm', elastic_cloud_user: false, + profile_uid: 'uid', metadata: { _reserved: false }, ...user, }; diff --git a/x-pack/plugins/security/common/model/authenticated_user.ts b/x-pack/plugins/security/common/model/authenticated_user.ts index 7f7e965994e4b..fd78b250a5ccc 100644 --- a/x-pack/plugins/security/common/model/authenticated_user.ts +++ b/x-pack/plugins/security/common/model/authenticated_user.ts @@ -57,6 +57,11 @@ export interface AuthenticatedUser extends User { * Indicates whether user is authenticated via Elastic Cloud built-in SAML realm. */ elastic_cloud_user: boolean; + + /** + * User profile ID of this user. + */ + profile_uid?: string; } export function isUserAnonymous(user: Pick) { diff --git a/x-pack/plugins/security/server/audit/audit_events.test.ts b/x-pack/plugins/security/server/audit/audit_events.test.ts index 73523b4a3e009..1f9ab461e0b00 100644 --- a/x-pack/plugins/security/server/audit/audit_events.test.ts +++ b/x-pack/plugins/security/server/audit/audit_events.test.ts @@ -240,6 +240,7 @@ describe('#userLoginEvent', () => { authenticationProvider: 'basic1', authenticationType: 'basic', sessionId: '123', + userProfileId: 'uid', }) ).toMatchInlineSnapshot(` Object { @@ -261,6 +262,7 @@ describe('#userLoginEvent', () => { }, "message": "User [user] has logged in using basic provider [name=basic1]", "user": Object { + "id": "uid", "name": "user", "roles": Array [ "user-role", @@ -311,6 +313,7 @@ describe('#userLogoutEvent', () => { userLogoutEvent({ username: 'elastic', provider: { name: 'basic1', type: 'basic' }, + userProfileId: 'uid', }) ).toMatchInlineSnapshot(` Object { @@ -327,6 +330,7 @@ describe('#userLogoutEvent', () => { }, "message": "User [elastic] is logging out using basic provider [name=basic1]", "user": Object { + "id": "uid", "name": "elastic", }, } diff --git a/x-pack/plugins/security/server/audit/audit_events.ts b/x-pack/plugins/security/server/audit/audit_events.ts index dd767df83b692..deb4b356c9f95 100644 --- a/x-pack/plugins/security/server/audit/audit_events.ts +++ b/x-pack/plugins/security/server/audit/audit_events.ts @@ -98,6 +98,7 @@ export interface UserLoginParams { authenticationProvider?: string; authenticationType?: string; sessionId?: string; + userProfileId?: string; } export function userLoginEvent({ @@ -105,6 +106,7 @@ export function userLoginEvent({ authenticationProvider, authenticationType, sessionId, + userProfileId, }: UserLoginParams): AuditEvent { return { message: authenticationResult.user @@ -116,6 +118,7 @@ export function userLoginEvent({ outcome: authenticationResult.user ? 'success' : 'failure', }, user: authenticationResult.user && { + id: userProfileId, name: authenticationResult.user.username, roles: authenticationResult.user.roles as string[], }, @@ -137,9 +140,14 @@ export function userLoginEvent({ export interface UserLogoutParams { username?: string; provider: AuthenticationProvider; + userProfileId?: string; } -export function userLogoutEvent({ username, provider }: UserLogoutParams): AuditEvent { +export function userLogoutEvent({ + username, + provider, + userProfileId, +}: UserLogoutParams): AuditEvent { return { message: `User [${username}] is logging out using ${provider.type} provider [name=${provider.name}]`, event: { @@ -147,11 +155,13 @@ export function userLogoutEvent({ username, provider }: UserLogoutParams): Audit category: ['authentication'], outcome: 'unknown', }, - user: username - ? { - name: username, - } - : undefined, + user: + userProfileId || username + ? { + id: userProfileId, + name: username, + } + : undefined, kibana: { authentication_provider: provider.name, authentication_type: provider.type, diff --git a/x-pack/plugins/security/server/audit/audit_service.test.ts b/x-pack/plugins/security/server/audit/audit_service.test.ts index d750fa2fc36b9..dfd42c2260c5e 100644 --- a/x-pack/plugins/security/server/audit/audit_service.test.ts +++ b/x-pack/plugins/security/server/audit/audit_service.test.ts @@ -38,7 +38,9 @@ const createAuditConfig = (settings: Partial) => { const config = createAuditConfig({ enabled: true }); const { logging } = coreMock.createSetup(); const http = httpServiceMock.createSetupContract(); -const getCurrentUser = jest.fn().mockReturnValue({ username: 'jdoe', roles: ['admin'] }); +const getCurrentUser = jest + .fn() + .mockReturnValue({ username: 'jdoe', roles: ['admin'], profile_uid: 'uid' }); const getSpaceId = jest.fn().mockReturnValue('default'); const getSID = jest.fn().mockResolvedValue('SESSION_ID'); const recordAuditLoggingUsage = jest.fn(); @@ -192,7 +194,7 @@ describe('#asScoped', () => { event: { action: 'ACTION' }, kibana: { space_id: 'default', session_id: 'SESSION_ID' }, trace: { id: 'REQUEST_ID' }, - user: { name: 'jdoe', roles: ['admin'] }, + user: { id: 'uid', name: 'jdoe', roles: ['admin'] }, }); audit.stop(); }); diff --git a/x-pack/plugins/security/server/audit/audit_service.ts b/x-pack/plugins/security/server/audit/audit_service.ts index 89b288d07e9fe..ff8a09df40198 100644 --- a/x-pack/plugins/security/server/audit/audit_service.ts +++ b/x-pack/plugins/security/server/audit/audit_service.ts @@ -166,6 +166,7 @@ export class AuditService { ...event, user: (user && { + id: user.profile_uid, name: user.username, roles: user.roles as string[], }) || diff --git a/x-pack/plugins/security/server/authentication/authentication_service.test.ts b/x-pack/plugins/security/server/authentication/authentication_service.test.ts index 0f2657a419a0a..55357be756e7e 100644 --- a/x-pack/plugins/security/server/authentication/authentication_service.test.ts +++ b/x-pack/plugins/security/server/authentication/authentication_service.test.ts @@ -273,6 +273,33 @@ describe('AuthenticationService', () => { expect(authenticate).toHaveBeenCalledWith(mockRequest); }); + it('sets authenticated state correctly with user profile id', async () => { + const mockRequest = httpServerMock.createKibanaRequest(); + const mockResponse = httpServerMock.createLifecycleResponseFactory(); + const mockUser = mockAuthenticatedUser(); + const mockAuthHeaders = { authorization: 'Basic xxx' }; + const mockAuthResponseHeaders = { 'WWW-Authenticate': 'Negotiate' }; + + authenticate.mockResolvedValue( + AuthenticationResult.succeeded( + { ...mockUser, profile_uid: 'USER_PROFILE_ID' }, + { + authHeaders: mockAuthHeaders, + authResponseHeaders: mockAuthResponseHeaders, + } + ) + ); + + await authHandler(mockRequest, mockResponse, mockAuthToolkit); + + expect(mockAuthToolkit.authenticated).toHaveBeenCalledTimes(1); + expect(mockAuthToolkit.authenticated).toHaveBeenCalledWith({ + state: { ...mockUser, profile_uid: 'USER_PROFILE_ID' }, + requestHeaders: mockAuthHeaders, + responseHeaders: mockAuthResponseHeaders, + }); + }); + it('redirects user if redirection is requested by the authenticator preserving authentication response headers if any', async () => { const mockResponse = httpServerMock.createLifecycleResponseFactory(); authenticate.mockResolvedValue( diff --git a/x-pack/plugins/security/server/authentication/authenticator.test.ts b/x-pack/plugins/security/server/authentication/authenticator.test.ts index 1c62b5ae44dd9..1c160bb4dfa48 100644 --- a/x-pack/plugins/security/server/authentication/authenticator.test.ts +++ b/x-pack/plugins/security/server/authentication/authenticator.test.ts @@ -39,7 +39,7 @@ import type { UserProfileGrant } from '../user_profile'; import { userProfileServiceMock } from '../user_profile/user_profile_service.mock'; import { AuthenticationResult } from './authentication_result'; import type { AuthenticatorOptions } from './authenticator'; -import { Authenticator } from './authenticator'; +import { Authenticator, enrichWithUserProfileId } from './authenticator'; import { DeauthenticationResult } from './deauthentication_result'; import type { BasicAuthenticationProvider, SAMLAuthenticationProvider } from './providers'; @@ -379,6 +379,29 @@ describe('Authenticator', () => { expectAuditEvents({ action: 'user_login', outcome: 'success' }); }); + it('returns user enriched with user profile id.', async () => { + const request = httpServerMock.createKibanaRequest(); + const user = mockAuthenticatedUser({ profile_uid: undefined }); + mockOptions.session.create.mockResolvedValue( + sessionMock.createValue({ + userProfileId: 'PROFILE_ID', + }) + ); + + mockBasicAuthenticationProvider.login.mockResolvedValue( + AuthenticationResult.succeeded(user, { + state: {}, // to ensure a new session is created + }) + ); + + const result = await authenticator.login(request, { provider: { type: 'basic' }, value: {} }); + expect(result.user).toEqual( + expect.objectContaining({ + profile_uid: 'PROFILE_ID', + }) + ); + }); + describe('user_login audit events', () => { // Every other test case includes audit event assertions, but the user_login event is a bit special. // We have these separate, detailed test cases to ensure that the session ID is included for user_login success events. @@ -2560,3 +2583,65 @@ describe('Authenticator', () => { }); }); }); + +describe('enrichWithUserProfileId', () => { + it('should enrich succeeded authentication results with user profile id', () => { + const authenticationResult = AuthenticationResult.succeeded( + mockAuthenticatedUser({ profile_uid: undefined }) + ); + const sessionValue = sessionMock.createValue({ userProfileId: 'uid' }); + expect(enrichWithUserProfileId(authenticationResult, sessionValue)).toEqual( + expect.objectContaining({ + user: expect.objectContaining({ + profile_uid: 'uid', + }), + }) + ); + }); + + it('should enrich redirected authentication results with user profile id', () => { + const authenticationResult = AuthenticationResult.redirectTo('/redirect/to', { + user: mockAuthenticatedUser({ profile_uid: undefined }), + }); + const sessionValue = sessionMock.createValue({ userProfileId: 'uid' }); + expect(enrichWithUserProfileId(authenticationResult, sessionValue)).toEqual( + expect.objectContaining({ + user: expect.objectContaining({ + profile_uid: 'uid', + }), + }) + ); + }); + + it('should not change unhandled authentication results', () => { + const authenticationResult = AuthenticationResult.notHandled(); + const sessionValue = sessionMock.createValue(); + expect(enrichWithUserProfileId(authenticationResult, sessionValue)).toBe(authenticationResult); + }); + + it('should not change failed authentication results', () => { + const authenticationResult = AuthenticationResult.failed(new Error('Authentication error')); + const sessionValue = sessionMock.createValue(); + expect(enrichWithUserProfileId(authenticationResult, sessionValue)).toBe(authenticationResult); + }); + + it('should not change redirected authentication results without user', () => { + const authenticationResult = AuthenticationResult.redirectTo('/redirect/to'); + const sessionValue = sessionMock.createValue(); + expect(enrichWithUserProfileId(authenticationResult, sessionValue)).toBe(authenticationResult); + }); + + it('should not change succeeded authentication result if session has no user profile id', () => { + const authenticationResult = AuthenticationResult.succeeded(mockAuthenticatedUser()); + const sessionValue = sessionMock.createValue({ userProfileId: undefined }); + expect(enrichWithUserProfileId(authenticationResult, sessionValue)).toBe(authenticationResult); + }); + + it('should not change succeeded authentication result if user profile ids already match', () => { + const authenticationResult = AuthenticationResult.succeeded( + mockAuthenticatedUser({ profile_uid: 'uid' }) + ); + const sessionValue = sessionMock.createValue({ userProfileId: 'uid' }); + expect(enrichWithUserProfileId(authenticationResult, sessionValue)).toBe(authenticationResult); + }); +}); diff --git a/x-pack/plugins/security/server/authentication/authenticator.ts b/x-pack/plugins/security/server/authentication/authenticator.ts index 735224fd83720..0e925530d10a6 100644 --- a/x-pack/plugins/security/server/authentication/authenticator.ts +++ b/x-pack/plugins/security/server/authentication/authenticator.ts @@ -335,11 +335,14 @@ export class Authenticator { existingSessionValue, }); - return this.handlePreAccessRedirects( - request, - authenticationResult, - sessionUpdateResult, - attempt.redirectURL + return enrichWithUserProfileId( + this.handlePreAccessRedirects( + request, + authenticationResult, + sessionUpdateResult, + attempt.redirectURL + ), + sessionUpdateResult ? sessionUpdateResult.value : null ); } } @@ -351,7 +354,7 @@ export class Authenticator { * Performs request authentication using configured chain of authentication providers. * @param request Request instance. */ - async authenticate(request: KibanaRequest) { + async authenticate(request: KibanaRequest): Promise { assertRequest(request); const existingSessionValue = await this.getSessionValue(request); @@ -399,10 +402,12 @@ export class Authenticator { authenticationResult, existingSessionValue, }); - - return canRedirectRequest(request) - ? this.handlePreAccessRedirects(request, authenticationResult, sessionUpdateResult) - : authenticationResult; + return enrichWithUserProfileId( + canRedirectRequest(request) + ? this.handlePreAccessRedirects(request, authenticationResult, sessionUpdateResult) + : authenticationResult, + sessionUpdateResult ? sessionUpdateResult.value : null + ); } } @@ -427,11 +432,15 @@ export class Authenticator { const provider = this.providers.get(existingSessionValue.provider.name)!; const authenticationResult = await provider.authenticate(request, existingSessionValue.state); if (!authenticationResult.notHandled()) { - await this.updateSessionValue(request, { + const sessionUpdateResult = await this.updateSessionValue(request, { provider: existingSessionValue.provider, authenticationResult, existingSessionValue, }); + + if (sessionUpdateResult) { + return enrichWithUserProfileId(authenticationResult, sessionUpdateResult.value); + } } return authenticationResult; @@ -631,6 +640,7 @@ export class Authenticator { const auditLogger = this.options.audit.asScoped(request); auditLogger.log( userLoginEvent({ + userProfileId: existingSessionValue?.userProfileId, sessionId: existingSessionValue?.sid, authenticationResult, authenticationProvider: provider.name, @@ -737,7 +747,7 @@ export class Authenticator { } } - let newSessionValue; + let newSessionValue: Readonly | null; if (!existingSessionValue) { newSessionValue = await this.session.create(request, { username: authenticationResult.user?.username, @@ -756,6 +766,7 @@ export class Authenticator { const auditLogger = this.options.audit.asScoped(request); auditLogger.log( userLoginEvent({ + userProfileId, // We must explicitly specify the `userProfileId` here since we just created the session and it can't be inferred from the request context. sessionId: newSessionValue?.sid, // We must explicitly specify the `sessionId` here since we just created the session and it can't be inferred from the request context. authenticationResult, authenticationProvider: provider.name, @@ -796,12 +807,7 @@ export class Authenticator { }: InvalidateSessionValueParams) { if (isSessionAuthenticated(sessionValue) && !skipAuditEvent) { const auditLogger = this.options.audit.asScoped(request); - auditLogger.log( - userLogoutEvent({ - username: sessionValue.username, - provider: sessionValue.provider, - }) - ); + auditLogger.log(userLogoutEvent(sessionValue)); } await this.session.invalidate(request, { match: 'current' }); @@ -946,3 +952,37 @@ export class Authenticator { : `${this.options.basePath.serverBasePath}/security/logged_out?${searchParams.toString()}`; } } + +export function enrichWithUserProfileId( + authenticationResult: AuthenticationResult, + sessionValue: SessionValue | null +) { + if ( + !authenticationResult.user || + !sessionValue?.userProfileId || + authenticationResult.user.profile_uid === sessionValue.userProfileId + ) { + return authenticationResult; + } + + const enrichedUser: AuthenticatedUser = { + ...authenticationResult.user, + profile_uid: sessionValue.userProfileId, + }; + + if (authenticationResult.redirected()) { + return AuthenticationResult.redirectTo(authenticationResult.redirectURL!, { + user: enrichedUser, + userProfileGrant: authenticationResult.userProfileGrant, + authResponseHeaders: authenticationResult.authResponseHeaders, + state: authenticationResult.state, + }); + } + + return AuthenticationResult.succeeded(enrichedUser, { + userProfileGrant: authenticationResult.userProfileGrant, + authHeaders: authenticationResult.authHeaders, + authResponseHeaders: authenticationResult.authResponseHeaders, + state: authenticationResult.state, + }); +} 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 708ca11ca8f78..aca2a5dd77e6c 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/privileges/feature_privilege_builder/alerting.test.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.test.ts index 8272c9220e103..cd18a28e0d373 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.test.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.test.ts @@ -90,6 +90,7 @@ describe(`feature_privilege_builder`, () => { "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getAlertSummary", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getExecutionLog", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/find", + "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getRuleExecutionKPI", ] `); }); @@ -174,6 +175,7 @@ describe(`feature_privilege_builder`, () => { "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getAlertSummary", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getExecutionLog", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/find", + "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getRuleExecutionKPI", "alerting:1.0.0-zeta1:alert-type/my-feature/alert/get", "alerting:1.0.0-zeta1:alert-type/my-feature/alert/find", "alerting:1.0.0-zeta1:alert-type/my-feature/alert/getAuthorizedAlertsIndices", @@ -218,6 +220,7 @@ describe(`feature_privilege_builder`, () => { "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getAlertSummary", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getExecutionLog", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/find", + "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getRuleExecutionKPI", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/create", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/delete", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/update", @@ -316,6 +319,7 @@ describe(`feature_privilege_builder`, () => { "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getAlertSummary", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getExecutionLog", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/find", + "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getRuleExecutionKPI", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/create", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/delete", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/update", @@ -374,6 +378,7 @@ describe(`feature_privilege_builder`, () => { "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getAlertSummary", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getExecutionLog", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/find", + "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getRuleExecutionKPI", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/create", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/delete", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/update", @@ -392,6 +397,7 @@ describe(`feature_privilege_builder`, () => { "alerting:1.0.0-zeta1:readonly-alert-type/my-feature/rule/getAlertSummary", "alerting:1.0.0-zeta1:readonly-alert-type/my-feature/rule/getExecutionLog", "alerting:1.0.0-zeta1:readonly-alert-type/my-feature/rule/find", + "alerting:1.0.0-zeta1:readonly-alert-type/my-feature/rule/getRuleExecutionKPI", ] `); }); @@ -480,6 +486,7 @@ describe(`feature_privilege_builder`, () => { "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getAlertSummary", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getExecutionLog", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/find", + "alerting:1.0.0-zeta1:alert-type/my-feature/rule/getRuleExecutionKPI", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/create", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/delete", "alerting:1.0.0-zeta1:alert-type/my-feature/rule/update", @@ -498,6 +505,7 @@ describe(`feature_privilege_builder`, () => { "alerting:1.0.0-zeta1:readonly-alert-type/my-feature/rule/getAlertSummary", "alerting:1.0.0-zeta1:readonly-alert-type/my-feature/rule/getExecutionLog", "alerting:1.0.0-zeta1:readonly-alert-type/my-feature/rule/find", + "alerting:1.0.0-zeta1:readonly-alert-type/my-feature/rule/getRuleExecutionKPI", "alerting:1.0.0-zeta1:another-alert-type/my-feature/alert/get", "alerting:1.0.0-zeta1:another-alert-type/my-feature/alert/find", "alerting:1.0.0-zeta1:another-alert-type/my-feature/alert/getAuthorizedAlertsIndices", diff --git a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.ts b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.ts index 542dfd1267d4c..a11a4fa77bcdd 100644 --- a/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.ts +++ b/x-pack/plugins/security/server/authorization/privileges/feature_privilege_builder/alerting.ts @@ -17,7 +17,14 @@ enum AlertingEntity { } const readOperations: Record = { - rule: ['get', 'getRuleState', 'getAlertSummary', 'getExecutionLog', 'find'], + rule: [ + 'get', + 'getRuleState', + 'getAlertSummary', + 'getExecutionLog', + 'find', + 'getRuleExecutionKPI', + ], alert: ['get', 'find', 'getAuthorizedAlertsIndices'], }; 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 d5bce1e146eb1..8111246f0776d 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 11b45f62f05d6..ef59cacd31bfc 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 e15574d5af4ef..14f59df15db39 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/detection_engine/rule_monitoring/model/execution_metrics.ts b/x-pack/plugins/security_solution/common/detection_engine/rule_monitoring/model/execution_metrics.ts index c6bb71970e599..b15c76119e441 100644 --- a/x-pack/plugins/security_solution/common/detection_engine/rule_monitoring/model/execution_metrics.ts +++ b/x-pack/plugins/security_solution/common/detection_engine/rule_monitoring/model/execution_metrics.ts @@ -12,8 +12,17 @@ export type DurationMetric = t.TypeOf; export const DurationMetric = PositiveInteger; export type RuleExecutionMetrics = t.TypeOf; + +/** + @property total_search_duration_ms - "total time spent performing ES searches as measured by Kibana; + includes network latency and time spent serializing/deserializing request/response", + @property total_indexing_duration_ms - "total time spent indexing documents during current rule execution cycle", + @property total_enrichment_duration_ms - total time spent enriching documents during current rule execution cycle + @property execution_gap_duration_s - "duration in seconds of execution gap" +*/ export const RuleExecutionMetrics = t.partial({ total_search_duration_ms: DurationMetric, total_indexing_duration_ms: DurationMetric, + total_enrichment_duration_ms: DurationMetric, execution_gap_duration_s: DurationMetric, }); 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 b9c0dcff2054a..e5b2f78c25472 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 bc40bd11f5d79..dde2a7f92b1e0 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 e237e4ba1fe9c..b8ca15d69d1a6 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 5a773d49134da..cefd43fe5f99e 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/bulk_edit_rules_data_view.cy.ts b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/bulk_edit_rules_data_view.cy.ts new file mode 100644 index 0000000000000..766c8d9483f0a --- /dev/null +++ b/x-pack/plugins/security_solution/cypress/e2e/detection_rules/bulk_edit_rules_data_view.cy.ts @@ -0,0 +1,177 @@ +/* + * 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 { + RULES_BULK_EDIT_DATA_VIEWS_WARNING, + RULES_BULK_EDIT_OVERWRITE_DATA_VIEW_CHECKBOX, +} from '../../screens/rules_bulk_edit'; + +import { DATA_VIEW_DETAILS, INDEX_PATTERNS_DETAILS } from '../../screens/rule_details'; + +import { + waitForRulesTableToBeLoaded, + goToRuleDetails, + selectNumberOfRules, +} from '../../tasks/alerts_detection_rules'; + +import { + typeIndexPatterns, + waitForBulkEditActionToFinish, + submitBulkEditForm, + checkOverwriteDataViewCheckbox, + checkOverwriteIndexPatternsCheckbox, + openBulkEditAddIndexPatternsForm, + openBulkEditDeleteIndexPatternsForm, +} from '../../tasks/rules_bulk_edit'; + +import { hasIndexPatterns, getDetails, assertDetailsNotExist } from '../../tasks/rule_details'; +import { login, visitWithoutDateRange } from '../../tasks/login'; + +import { SECURITY_DETECTIONS_RULES_URL } from '../../urls/navigation'; +import { + createCustomRule, + createCustomIndicatorRule, + createEventCorrelationRule, + createThresholdRule, + createNewTermsRule, + createSavedQueryRule, +} from '../../tasks/api_calls/rules'; +import { cleanKibana, deleteAlertsAndRules, postDataView } from '../../tasks/common'; + +import { + getEqlRule, + getNewThreatIndicatorRule, + getNewRule, + getNewThresholdRule, + getNewTermsRule, +} from '../../objects/rule'; + +import { esArchiverResetKibana } from '../../tasks/es_archiver'; + +const DATA_VIEW_ID = 'auditbeat'; + +const expectedIndexPatterns = ['index-1-*', 'index-2-*']; + +const expectedNumberOfCustomRulesToBeEdited = 6; + +const indexDataSource = { dataView: DATA_VIEW_ID, type: 'dataView' } as const; + +const defaultRuleData = { + dataSource: indexDataSource, +}; + +describe('Detection rules, bulk edit, data view', () => { + before(() => { + cleanKibana(); + login(); + }); + beforeEach(() => { + deleteAlertsAndRules(); + esArchiverResetKibana(); + + postDataView(DATA_VIEW_ID); + + createCustomRule({ ...getNewRule(), ...defaultRuleData }, '1'); + createEventCorrelationRule({ ...getEqlRule(), ...defaultRuleData }, '2'); + createCustomIndicatorRule({ ...getNewThreatIndicatorRule(), ...defaultRuleData }, '3'); + createThresholdRule({ ...getNewThresholdRule(), ...defaultRuleData }, '4'); + createNewTermsRule({ ...getNewTermsRule(), ...defaultRuleData }, '5'); + createSavedQueryRule({ ...getNewRule(), ...defaultRuleData, savedId: 'mocked' }, '6'); + + visitWithoutDateRange(SECURITY_DETECTIONS_RULES_URL); + + waitForRulesTableToBeLoaded(); + }); + + it('Add index patterns to custom rules with configured data view', () => { + selectNumberOfRules(expectedNumberOfCustomRulesToBeEdited); + + openBulkEditAddIndexPatternsForm(); + typeIndexPatterns(expectedIndexPatterns); + submitBulkEditForm(); + + waitForBulkEditActionToFinish({ rulesCount: expectedNumberOfCustomRulesToBeEdited }); + + // check if rule still has data view and index patterns field does not exist + goToRuleDetails(); + getDetails(DATA_VIEW_DETAILS).contains(DATA_VIEW_ID); + assertDetailsNotExist(INDEX_PATTERNS_DETAILS); + }); + + it('Add index patterns to custom rules with configured data view when data view checkbox is checked', () => { + selectNumberOfRules(expectedNumberOfCustomRulesToBeEdited); + + openBulkEditAddIndexPatternsForm(); + typeIndexPatterns(expectedIndexPatterns); + + // click on data view overwrite checkbox, ensure warning is displayed + cy.get(RULES_BULK_EDIT_DATA_VIEWS_WARNING).should('not.exist'); + checkOverwriteDataViewCheckbox(); + cy.get(RULES_BULK_EDIT_DATA_VIEWS_WARNING).should('be.visible'); + + submitBulkEditForm(); + + waitForBulkEditActionToFinish({ rulesCount: expectedNumberOfCustomRulesToBeEdited }); + + // check if rule has been updated with index patterns and data view does not exist + goToRuleDetails(); + hasIndexPatterns(expectedIndexPatterns.join('')); + assertDetailsNotExist(DATA_VIEW_DETAILS); + }); + + it('Overwrite index patterns in custom rules with configured data view', () => { + selectNumberOfRules(expectedNumberOfCustomRulesToBeEdited); + + openBulkEditAddIndexPatternsForm(); + typeIndexPatterns(expectedIndexPatterns); + checkOverwriteIndexPatternsCheckbox(); + submitBulkEditForm(); + + waitForBulkEditActionToFinish({ rulesCount: expectedNumberOfCustomRulesToBeEdited }); + + // check if rule still has data view and index patterns field does not exist + goToRuleDetails(); + getDetails(DATA_VIEW_DETAILS).contains(DATA_VIEW_ID); + assertDetailsNotExist(INDEX_PATTERNS_DETAILS); + }); + + it('Overwrite index patterns in custom rules with configured data view when data view checkbox is checked', () => { + selectNumberOfRules(expectedNumberOfCustomRulesToBeEdited); + + openBulkEditAddIndexPatternsForm(); + typeIndexPatterns(expectedIndexPatterns); + checkOverwriteIndexPatternsCheckbox(); + checkOverwriteDataViewCheckbox(); + + submitBulkEditForm(); + + waitForBulkEditActionToFinish({ rulesCount: expectedNumberOfCustomRulesToBeEdited }); + + // check if rule has been overwritten with index patterns and data view does not exist + goToRuleDetails(); + hasIndexPatterns(expectedIndexPatterns.join('')); + assertDetailsNotExist(DATA_VIEW_DETAILS); + }); + + it('Delete index patterns in custom rules with configured data view', () => { + selectNumberOfRules(expectedNumberOfCustomRulesToBeEdited); + + openBulkEditDeleteIndexPatternsForm(); + typeIndexPatterns(expectedIndexPatterns); + + // in delete form data view checkbox is absent + cy.get(RULES_BULK_EDIT_OVERWRITE_DATA_VIEW_CHECKBOX).should('not.exist'); + + submitBulkEditForm(); + + waitForBulkEditActionToFinish({ rulesCount: expectedNumberOfCustomRulesToBeEdited }); + + // check if rule still has data view and index patterns field does not exist + goToRuleDetails(); + getDetails(DATA_VIEW_DETAILS).contains(DATA_VIEW_ID); + }); +}); 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 bdc76cc5f0a59..a594d7f3ffc2f 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 77a4ae274e6e4..727c7257b6682 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 5027fe09a8d3e..7a4117f0d58a3 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 310efde996da3..4812dcc2a626a 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 7c3ba64536faf..4ffab681d4aaa 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 764d8d0b688ac..2c0507ca38157 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 701efb2706bf3..68973fdc56941 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 b5c6b5cd341ec..f6a80a8a15f42 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,9 +126,14 @@ describe('Related integrations', () => { }; before(() => { - cleanPackages(); - installAwsCloudFrontWithPolicy(); + cleanFleet().then(() => { + installAwsCloudFrontWithPolicy(); + }); + }); + + beforeEach(() => { visit(DETECTIONS_RULE_MANAGEMENT_URL); + waitForRulesTableToShow(); }); it('should display a badge with the installed integrations on the rule management page', () => { @@ -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 0000000000000..b0f78cc76881c --- /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 4e2b42c7b7ee1..59efa1cced40c 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 5c2abeab06026..39c93e6f80383 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 7b9d543e480ee..245e220c340c6 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 e46e8a75a4341..96928ff49da40 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/screens/rules_bulk_edit.ts b/x-pack/plugins/security_solution/cypress/screens/rules_bulk_edit.ts index 34e4f9515b27f..6f4056034a053 100644 --- a/x-pack/plugins/security_solution/cypress/screens/rules_bulk_edit.ts +++ b/x-pack/plugins/security_solution/cypress/screens/rules_bulk_edit.ts @@ -32,6 +32,9 @@ export const RULES_BULK_EDIT_INDEX_PATTERNS = '[data-test-subj="bulkEditRulesInd export const RULES_BULK_EDIT_OVERWRITE_INDEX_PATTERNS_CHECKBOX = '[data-test-subj="bulkEditRulesOverwriteIndexPatterns"]'; +export const RULES_BULK_EDIT_OVERWRITE_DATA_VIEW_CHECKBOX = + '[data-test-subj="bulkEditRulesOverwriteRulesWithDataViews"]'; + export const RULES_BULK_EDIT_TAGS = '[data-test-subj="bulkEditRulesTags"]'; export const RULES_BULK_EDIT_OVERWRITE_TAGS_CHECKBOX = @@ -48,6 +51,9 @@ export const RULES_BULK_EDIT_TIMELINE_TEMPLATES_SELECTOR = export const RULES_BULK_EDIT_TIMELINE_TEMPLATES_WARNING = '[data-test-subj="bulkEditRulesTimelineTemplateWarning"]'; +export const RULES_BULK_EDIT_DATA_VIEWS_WARNING = + '[data-test-subj="bulkEditRulesDataViewsWarning"]'; + export const RULES_BULK_EDIT_SCHEDULES_WARNING = '[data-test-subj="bulkEditRulesSchedulesWarning"]'; export const UPDATE_SCHEDULE_INTERVAL_INPUT = 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 4432059c7f20f..b8e38d3e11e0e 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 0000000000000..7e2cef6654034 --- /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 0000000000000..da5ab6ba488d4 --- /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 4fb076f11f445..1909030b726d3 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,193 +40,214 @@ 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 : '', + index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, + data_view_id: rule.dataSource.type === 'dataView' ? rule.dataSource.dataView : undefined, query: rule.customQuery, language: 'kuery', 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') => { - if (rule.dataSource.type === 'indexPatterns') { - cy.request({ - method: 'POST', - url: 'api/detection_engine/rules', - body: { - rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), - description: rule.description, - interval: `${rule.runsEvery.interval}${rule.runsEvery.type}`, - from: `now-${rule.lookBack.interval}${rule.lookBack.type}`, - name: rule.name, - severity: rule.severity.toLocaleLowerCase(), - type: 'eql', - index: rule.dataSource.index, - query: rule.customQuery, - language: 'eql', - enabled: true, - tags: rule.tags, - }, - headers: { 'kbn-xsrf': 'cypress-creds' }, - }); - } + 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: riskScore, + description: rule.description, + interval: `${rule.runsEvery?.interval}${rule.runsEvery?.type}`, + from: `now-${rule.lookBack?.interval}${rule.lookBack?.type}`, + name: rule.name, + severity, + type: 'eql', + index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, + data_view_id: rule.dataSource.type === 'dataView' ? rule.dataSource.dataView : undefined, + query: rule.customQuery, + language: 'eql', + enabled: true, + tags: rule.tags, + }, + headers: { 'kbn-xsrf': 'cypress-creds' }, + }); }; export const createThresholdRule = (rule: ThresholdRule, ruleId = 'rule_testing') => { - if (rule.dataSource.type === 'indexPatterns') { - cy.request({ - method: 'POST', - url: 'api/detection_engine/rules', - body: { - rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), - description: rule.description, - interval: `${rule.runsEvery.interval}${rule.runsEvery.type}`, - from: `now-${rule.lookBack.interval}${rule.lookBack.type}`, - name: rule.name, - severity: rule.severity.toLocaleLowerCase(), - type: 'threshold', - index: rule.dataSource.index, - query: rule.customQuery, - threshold: { - field: [rule.thresholdField], - value: parseInt(rule.threshold, 10), - cardinality: [], - }, - enabled: true, - tags: rule.tags, + 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: riskScore, + description: rule.description, + interval: `${rule.runsEvery?.interval}${rule.runsEvery?.type}`, + from: `now-${rule.lookBack?.interval}${rule.lookBack?.type}`, + name: rule.name, + severity, + type: 'threshold', + index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, + data_view_id: rule.dataSource.type === 'dataView' ? rule.dataSource.dataView : undefined, + query: rule.customQuery, + threshold: { + field: [rule.thresholdField], + value: parseInt(rule.threshold, 10), + cardinality: [], }, - headers: { 'kbn-xsrf': 'cypress-creds' }, - }); - } + enabled: true, + tags: rule.tags, + }, + headers: { 'kbn-xsrf': 'cypress-creds' }, + }); }; export const createNewTermsRule = (rule: NewTermsRule, ruleId = 'rule_testing') => { - if (rule.dataSource.type === 'indexPatterns') { - cy.request({ - method: 'POST', - url: 'api/detection_engine/rules', - body: { - rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), - description: rule.description, - interval: `${rule.runsEvery.interval}${rule.runsEvery.type}`, - from: `now-${rule.lookBack.interval}${rule.lookBack.type}`, - name: rule.name, - severity: rule.severity.toLocaleLowerCase(), - type: 'new_terms', - index: rule.dataSource.index, - query: rule.customQuery, - new_terms_fields: rule.newTermsFields, - history_window_start: `now-${rule.historyWindowSize.interval}${rule.historyWindowSize.type}`, - enabled: true, - tags: rule.tags, - }, - headers: { 'kbn-xsrf': 'cypress-creds' }, - }); - } + 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: riskScore, + description: rule.description, + interval: `${rule.runsEvery?.interval}${rule.runsEvery?.type}`, + from: `now-${rule.lookBack?.interval}${rule.lookBack?.type}`, + name: rule.name, + severity, + type: 'new_terms', + index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, + data_view_id: rule.dataSource.type === 'dataView' ? rule.dataSource.dataView : undefined, + query: rule.customQuery, + new_terms_fields: rule.newTermsFields, + history_window_start: `now-${rule.historyWindowSize.interval}${rule.historyWindowSize.type}`, + enabled: true, + tags: rule.tags, + }, + headers: { 'kbn-xsrf': 'cypress-creds' }, + }); }; 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 : '', + index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, + data_view_id: rule.dataSource.type === 'dataView' ? rule.dataSource.dataView : undefined, saved_id: rule.savedId, language: 'kuery', 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') => { - if (rule.dataSource.type === 'indexPatterns') { - cy.request({ - method: 'POST', - url: 'api/detection_engine/rules', - body: { - rule_id: ruleId, - risk_score: parseInt(rule.riskScore, 10), - 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(), - type: 'threat_match', - timeline_id: rule.timeline.templateTimelineId, - timeline_title: rule.timeline.title, - threat_mapping: [ - { - entries: [ - { - field: rule.indicatorMappingField, - type: 'mapping', - value: rule.indicatorIndexField, - }, - ], - }, - ], - threat_query: '*:*', - threat_language: 'kuery', - threat_filters: [], - threat_index: rule.indicatorIndexPattern, - threat_indicator_path: rule.threatIndicatorPath, - from: 'now-50000h', - index: rule.dataSource.index, - query: rule.customQuery || '*:*', - language: 'kuery', - enabled: true, - tags: rule.tags, - }, - headers: { 'kbn-xsrf': 'cypress-creds' }, - failOnStatusCode: false, - }); - } + 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: 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, + type: 'threat_match', + timeline_id: timeline?.templateTimelineId, + timeline_title: timeline?.title, + threat_mapping: [ + { + entries: [ + { + field: rule.indicatorMappingField, + type: 'mapping', + value: rule.indicatorIndexField, + }, + ], + }, + ], + threat_query: '*:*', + threat_language: 'kuery', + threat_filters: [], + threat_index: rule.indicatorIndexPattern, + threat_indicator_path: rule.threatIndicatorPath, + from: 'now-50000h', + index: rule.dataSource.type === 'indexPatterns' ? rule.dataSource.index : undefined, + data_view_id: rule.dataSource.type === 'dataView' ? rule.dataSource.dataView : undefined, + query: rule.customQuery || '*:*', + language: 'kuery', + enabled: true, + tags: rule.tags, + }, + headers: { 'kbn-xsrf': 'cypress-creds' }, + failOnStatusCode: false, + }); }; export const createCustomRuleEnabled = ( @@ -235,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, @@ -266,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 cd9525e95b0b2..e576c25cc256a 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 2b7e8e0b3375e..8f59172220717 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 1da83a591aa12..0150d0c83c3d5 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/cypress/tasks/rule_details.ts b/x-pack/plugins/security_solution/cypress/tasks/rule_details.ts index 75668b49aa207..0bd06911acf7d 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/rule_details.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/rule_details.ts @@ -158,6 +158,9 @@ export const goBackToAllRulesTable = () => { export const getDetails = (title: string | RegExp) => cy.get(DETAILS_TITLE).contains(title).next(DETAILS_DESCRIPTION); +export const assertDetailsNotExist = (title: string | RegExp) => + cy.get(DETAILS_TITLE).contains(title).should('not.exist'); + export const hasIndexPatterns = (indexPatterns: string) => { cy.get(DEFINITION_DETAILS).within(() => { getDetails(INDEX_PATTERNS_DETAILS).should('have.text', indexPatterns); diff --git a/x-pack/plugins/security_solution/cypress/tasks/rules_bulk_edit.ts b/x-pack/plugins/security_solution/cypress/tasks/rules_bulk_edit.ts index 5b3ae403f4a0b..0000a84f26683 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/rules_bulk_edit.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/rules_bulk_edit.ts @@ -30,6 +30,7 @@ import { APPLY_TIMELINE_RULE_BULK_MENU_ITEM, RULES_BULK_EDIT_OVERWRITE_TAGS_CHECKBOX, RULES_BULK_EDIT_OVERWRITE_INDEX_PATTERNS_CHECKBOX, + RULES_BULK_EDIT_OVERWRITE_DATA_VIEW_CHECKBOX, RULES_BULK_EDIT_TIMELINE_TEMPLATES_SELECTOR, UPDATE_SCHEDULE_MENU_ITEM, UPDATE_SCHEDULE_INTERVAL_INPUT, @@ -159,6 +160,14 @@ export const checkOverwriteIndexPatternsCheckbox = () => { .should('be.checked'); }; +export const checkOverwriteDataViewCheckbox = () => { + cy.get(RULES_BULK_EDIT_OVERWRITE_DATA_VIEW_CHECKBOX) + .should('have.text', 'Apply changes to rules configured with data views') + .click() + .get('input') + .should('be.checked'); +}; + export const selectTimelineTemplate = (timelineTitle: string) => { cy.get(RULES_BULK_EDIT_TIMELINE_TEMPLATES_SELECTOR).click(); cy.get(TIMELINE_SEARCHBOX).type(`${timelineTitle}{enter}`).should('not.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 0000000000000..046faf5e6198c --- /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 2320b85113c3c..0000000000000 --- 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 0000000000000..a02c7729f4e0a --- /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 68d2d9a65157e..6f24803165acd 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 485f36b0416af..b3ba2febe5d76 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 c97878cf6f5e9..0000000000000 --- 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/events_tab/events_query_tab_body.test.tsx b/x-pack/plugins/security_solution/public/common/components/events_tab/events_query_tab_body.test.tsx index 2058cd4a7c614..cb12aaa7f0e79 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_tab/events_query_tab_body.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_tab/events_query_tab_body.test.tsx @@ -14,6 +14,13 @@ import type { EventsQueryTabBodyComponentProps } from './events_query_tab_body'; import { EventsQueryTabBody, ALERTS_EVENTS_HISTOGRAM_ID } from './events_query_tab_body'; import { useGlobalFullScreen } from '../../containers/use_full_screen'; import * as tGridActions from '@kbn/timelines-plugin/public/store/t_grid/actions'; +import { licenseService } from '../../hooks/use_license'; +import { mockHistory } from '../../mock/router'; + +const mockGetDefaultControlColumn = jest.fn(); +jest.mock('../../../timelines/components/timeline/body/control_columns', () => ({ + getDefaultControlColumn: (props: number) => mockGetDefaultControlColumn(props), +})); jest.mock('../../lib/kibana', () => { const original = jest.requireActual('../../lib/kibana'); @@ -33,6 +40,11 @@ jest.mock('../../lib/kibana', () => { }; }); +jest.mock('react-router-dom', () => ({ + ...jest.requireActual('react-router-dom'), + useHistory: () => mockHistory, +})); + const FakeStatefulEventsViewer = ({ additionalFilters }: { additionalFilters: JSX.Element }) => (
{additionalFilters} @@ -47,6 +59,19 @@ jest.mock('../../containers/use_full_screen', () => ({ }), })); +jest.mock('../../hooks/use_license', () => { + const licenseServiceInstance = { + isPlatinumPlus: jest.fn(), + isEnterprise: jest.fn(() => false), + }; + return { + licenseService: licenseServiceInstance, + useLicense: () => { + return licenseServiceInstance; + }, + }; +}); + describe('EventsQueryTabBody', () => { const commonProps: EventsQueryTabBodyComponentProps = { indexNames: ['test-index'], @@ -69,6 +94,7 @@ describe('EventsQueryTabBody', () => { ); expect(queryByText('MockedStatefulEventsViewer')).toBeInTheDocument(); + expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(4); }); it('renders the matrix histogram when globalFullScreen is false', () => { @@ -147,4 +173,28 @@ describe('EventsQueryTabBody', () => { expect(spy).toHaveBeenCalled(); }); + + it('only have 4 columns on Action bar for non-Enterprise user', () => { + render( + + + + ); + + expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(4); + }); + + it('shows 5 columns on Action bar for Enterprise user', () => { + const licenseServiceMock = licenseService as jest.Mocked; + + licenseServiceMock.isEnterprise.mockReturnValue(true); + + render( + + + + ); + + expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(5); + }); }); diff --git a/x-pack/plugins/security_solution/public/common/components/events_tab/events_query_tab_body.tsx b/x-pack/plugins/security_solution/public/common/components/events_tab/events_query_tab_body.tsx index db663c1f0fc6d..07c9995ddbd9e 100644 --- a/x-pack/plugins/security_solution/public/common/components/events_tab/events_query_tab_body.tsx +++ b/x-pack/plugins/security_solution/public/common/components/events_tab/events_query_tab_body.tsx @@ -42,6 +42,11 @@ import { useLicense } from '../../hooks/use_license'; import { useUiSetting$ } from '../../lib/kibana'; import { defaultAlertsFilters } from '../events_viewer/external_alerts_filter'; +import { + useGetInitialUrlParamValue, + useReplaceUrlParams, +} from '../../utils/global_query_string/helpers'; + export const ALERTS_EVENTS_HISTOGRAM_ID = 'alertsOrEventsHistogramQuery'; type QueryTabBodyProps = UserQueryTabBodyProps | HostQueryTabBodyProps | NetworkQueryTabBodyProps; @@ -55,6 +60,8 @@ export type EventsQueryTabBodyComponentProps = QueryTabBodyProps & { timelineId: TimelineId; }; +const EXTERNAL_ALERTS_URL_PARAM = 'onlyExternalAlerts'; + const EventsQueryTabBodyComponent: React.FC = ({ deleteQuery, endDate, @@ -70,7 +77,6 @@ const EventsQueryTabBodyComponent: React.FC = const { globalFullScreen } = useGlobalFullScreen(); const tGridEnabled = useIsExperimentalFeatureEnabled('tGridEnabled'); const [defaultNumberFormat] = useUiSetting$(DEFAULT_NUMBER_FORMAT); - const [showExternalAlerts, setShowExternalAlerts] = useState(false); const isEnterprisePlus = useLicense().isEnterprise(); const ACTION_BUTTON_COUNT = isEnterprisePlus ? 5 : 4; const leadingControlColumns = useMemo( @@ -78,6 +84,14 @@ const EventsQueryTabBodyComponent: React.FC = [ACTION_BUTTON_COUNT] ); + const showExternalAlertsInitialUrlState = useExternalAlertsInitialUrlState(); + + const [showExternalAlerts, setShowExternalAlerts] = useState( + showExternalAlertsInitialUrlState ?? false + ); + + useSyncExternalAlertsUrlState(showExternalAlerts); + const toggleExternalAlerts = useCallback(() => setShowExternalAlerts((s) => !s), []); const getHistogramSubtitle = useMemo( () => getSubtitleFunction(defaultNumberFormat, showExternalAlerts), @@ -178,3 +192,43 @@ EventsQueryTabBodyComponent.displayName = 'EventsQueryTabBodyComponent'; export const EventsQueryTabBody = React.memo(EventsQueryTabBodyComponent); EventsQueryTabBody.displayName = 'EventsQueryTabBody'; + +const useExternalAlertsInitialUrlState = () => { + const replaceUrlParams = useReplaceUrlParams(); + + const getInitialUrlParamValue = useGetInitialUrlParamValue(EXTERNAL_ALERTS_URL_PARAM); + + const { decodedParam: showExternalAlertsInitialUrlState } = useMemo( + () => getInitialUrlParamValue(), + [getInitialUrlParamValue] + ); + + useEffect(() => { + // Only called on component unmount + return () => { + replaceUrlParams([ + { + key: EXTERNAL_ALERTS_URL_PARAM, + value: null, + }, + ]); + }; + }, [replaceUrlParams]); + + return showExternalAlertsInitialUrlState; +}; + +/** + * Update URL state when showExternalAlerts value changes + */ +const useSyncExternalAlertsUrlState = (showExternalAlerts: boolean) => { + const replaceUrlParams = useReplaceUrlParams(); + useEffect(() => { + replaceUrlParams([ + { + key: EXTERNAL_ALERTS_URL_PARAM, + value: showExternalAlerts ? 'true' : null, + }, + ]); + }, [showExternalAlerts, replaceUrlParams]); +}; diff --git a/x-pack/plugins/security_solution/public/common/components/links/index.tsx b/x-pack/plugins/security_solution/public/common/components/links/index.tsx index 7e7c33a2bebdf..ea11bb96ebf97 100644 --- a/x-pack/plugins/security_solution/public/common/components/links/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/links/index.tsx @@ -48,6 +48,9 @@ export const DEFAULT_NUMBER_OF_LINK = 5; /** The default max-height of the Reputation Links popover used to show "+n More" items (e.g. `+9 More`) */ export const DEFAULT_MORE_MAX_HEIGHT = '200px'; +const isModified = (event: MouseEvent) => + event.metaKey || event.altKey || event.ctrlKey || event.shiftKey; + // Internal Links const UserDetailsLinkComponent: React.FC<{ children?: React.ReactNode; @@ -543,6 +546,10 @@ export const useGetSecuritySolutionLinkProps = (): GetSecuritySolutionProps => { return { href: url, onClick: (ev: MouseEvent) => { + if (isModified(ev)) { + return; + } + ev.preventDefault(); navigateTo({ url }); if (onClickProps) { diff --git a/x-pack/plugins/security_solution/public/common/components/markdown_editor/plugins/osquery/index.tsx b/x-pack/plugins/security_solution/public/common/components/markdown_editor/plugins/osquery/index.tsx index 7b96f3886159c..3d046e349de31 100644 --- a/x-pack/plugins/security_solution/public/common/components/markdown_editor/plugins/osquery/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/markdown_editor/plugins/osquery/index.tsx @@ -29,7 +29,7 @@ import { LabelField } from './label_field'; import OsqueryLogo from './osquery_icon/osquery.svg'; import { OsqueryFlyout } from '../../../../../detections/components/osquery/osquery_flyout'; import { BasicAlertDataContext } from '../../../event_details/investigation_guide_view'; -import { convertECSMappingToObject } from './utils'; +import { OsqueryNotAvailablePrompt } from './not_available_prompt'; const StyledEuiButton = styled(EuiButton)` > span > img { @@ -49,7 +49,12 @@ const OsqueryEditorComponent = ({ }; }>) => { const isEditMode = node != null; - const { osquery } = useKibana().services; + const { + osquery, + application: { + capabilities: { osquery: osqueryPermissions }, + }, + } = useKibana().services; const formMethods = useForm<{ label: string; query: string; @@ -70,7 +75,7 @@ const OsqueryEditorComponent = ({ { query: data.query, label: data.label, - ecs_mapping: convertECSMappingToObject(data.ecs_mapping), + ecs_mapping: data.ecs_mapping, }, (value) => !isEmpty(value) ) @@ -83,6 +88,17 @@ const OsqueryEditorComponent = ({ [onSave] ); + const noOsqueryPermissions = useMemo( + () => + (!osqueryPermissions.runSavedQueries || !osqueryPermissions.readSavedQueries) && + !osqueryPermissions.writeLiveQueries, + [ + osqueryPermissions.readSavedQueries, + osqueryPermissions.runSavedQueries, + osqueryPermissions.writeLiveQueries, + ] + ); + const OsqueryActionForm = useMemo(() => { if (osquery?.LiveQueryField) { const { LiveQueryField } = osquery; @@ -98,6 +114,10 @@ const OsqueryEditorComponent = ({ return null; }, [formMethods, osquery]); + if (noOsqueryPermissions) { + return ; + } + return ( <> @@ -241,7 +261,7 @@ const RunOsqueryButtonRenderer = ({ }; }) => { const [showFlyout, setShowFlyout] = useState(false); - const { agentId } = useContext(BasicAlertDataContext); + const { agentId, alertId } = useContext(BasicAlertDataContext); const handleOpen = useCallback(() => setShowFlyout(true), [setShowFlyout]); @@ -258,6 +278,7 @@ const RunOsqueryButtonRenderer = ({ {showFlyout && ( ( + {PERMISSION_DENIED}} + titleSize="xs" + body={ +

+ {'osquery'}, + }} + /> +

+ } + /> +); diff --git a/x-pack/plugins/security_solution/public/common/components/markdown_editor/plugins/osquery/utils.ts b/x-pack/plugins/security_solution/public/common/components/markdown_editor/plugins/osquery/utils.ts deleted file mode 100644 index 77e2f14c51420..0000000000000 --- a/x-pack/plugins/security_solution/public/common/components/markdown_editor/plugins/osquery/utils.ts +++ /dev/null @@ -1,31 +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 { isEmpty, reduce } from 'lodash'; - -export const convertECSMappingToObject = ( - ecsMapping: Array<{ - key: string; - result: { - type: string; - value: string; - }; - }> -) => - reduce( - ecsMapping, - (acc, value) => { - if (!isEmpty(value?.key) && !isEmpty(value.result?.type) && !isEmpty(value.result?.value)) { - acc[value.key] = { - [value.result.type]: value.result.value, - }; - } - - return acc; - }, - {} as Record - ); 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 53c21172f0318..ee93861db2d7e 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 0062e7baa4118..a78fda1e90fa7 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 13ec1df29ae01..f4391f13fd21c 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 340f63e71bc74..3a74d4614d991 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 dffb9c646d7ce..47eb0d9cb61d6 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 b492ee51e42af..1baafecd663da 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/risk_score_onboarding/risk_score_restart_button.test.tsx b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_restart_button.test.tsx index 16269911f6632..7a50761cfa300 100644 --- a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_restart_button.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_restart_button.test.tsx @@ -15,6 +15,8 @@ import { restartRiskScoreTransforms } from './utils'; jest.mock('./utils'); +const mockRestartRiskScoreTransforms = restartRiskScoreTransforms as jest.Mock; + describe('RiskScoreRestartButton', () => { const mockRefetch = jest.fn(); beforeEach(() => { @@ -33,7 +35,7 @@ describe('RiskScoreRestartButton', () => { ); }); - it('calls restartRiskScoreTransforms', async () => { + it('calls restartRiskScoreTransforms with correct entity', async () => { render( @@ -43,8 +45,10 @@ describe('RiskScoreRestartButton', () => { await act(async () => { await userEvent.click(screen.getByTestId(`restart_${riskScoreEntity}_risk_score`)); }); - - expect(restartRiskScoreTransforms).toHaveBeenCalled(); + expect(mockRestartRiskScoreTransforms).toHaveBeenCalled(); + expect(mockRestartRiskScoreTransforms.mock.calls[0][0].riskScoreEntity).toEqual( + riskScoreEntity + ); }); it('Update button state while installing', async () => { diff --git a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_restart_button.tsx b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_restart_button.tsx index 679bbe38c8181..59b2cd7854a3e 100644 --- a/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_restart_button.tsx +++ b/x-pack/plugins/security_solution/public/common/components/risk_score/risk_score_onboarding/risk_score_restart_button.tsx @@ -9,7 +9,7 @@ import { EuiButton } from '@elastic/eui'; import React, { useCallback } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; +import type { RiskScoreEntity } from '../../../../../common/search_strategy'; import { useSpaceId } from '../../../hooks/use_space_id'; import { useKibana } from '../../../lib/kibana'; import type { inputsModel } from '../../../store'; @@ -39,11 +39,11 @@ const RiskScoreRestartButtonComponent = ({ notifications, refetch, renderDocLink, - riskScoreEntity: RiskScoreEntity.host, + riskScoreEntity, spaceId, theme, }); - }, [fetch, http, notifications, refetch, renderDocLink, spaceId, theme]); + }, [fetch, http, notifications, refetch, renderDocLink, riskScoreEntity, spaceId, theme]); return ( + 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/sessions_viewer/index.test.tsx b/x-pack/plugins/security_solution/public/common/components/sessions_viewer/index.test.tsx index a89a618972326..47a1bc4fa6514 100644 --- a/x-pack/plugins/security_solution/public/common/components/sessions_viewer/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/sessions_viewer/index.test.tsx @@ -14,6 +14,7 @@ import { TimelineId } from '@kbn/timelines-plugin/common'; import type { SessionsComponentsProps } from './types'; import type { TimelineModel } from '../../../timelines/store/timeline/model'; import { useGetUserCasesPermissions } from '../../lib/kibana'; +import { licenseService } from '../../hooks/use_license'; jest.mock('../../lib/kibana'); @@ -47,10 +48,28 @@ type Props = Partial & { entityType: EntityType; }; +const mockGetDefaultControlColumn = jest.fn(); +jest.mock('../../../timelines/components/timeline/body/control_columns', () => ({ + getDefaultControlColumn: (props: number) => mockGetDefaultControlColumn(props), +})); + const TEST_PREFIX = 'security_solution:sessions_viewer:sessions_view'; const callFilters = jest.fn(); +jest.mock('../../hooks/use_license', () => { + const licenseServiceInstance = { + isPlatinumPlus: jest.fn(), + isEnterprise: jest.fn(() => false), + }; + return { + licenseService: licenseServiceInstance, + useLicense: () => { + return licenseServiceInstance; + }, + }; +}); + // creating a dummy component for testing TGrid to avoid mocking all the implementation details // but still test if the TGrid will render properly const SessionsViewerTGrid: React.FC = ({ columns, start, end, id, filters, entityType }) => { @@ -144,4 +163,42 @@ describe('SessionsView', () => { ]); }); }); + it('Action tab should have 4 columns for non Enterprise users', async () => { + render( + + + + ); + + await waitFor(() => { + expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(4); + }); + }); + + it('Action tab should have 5 columns for Enterprise or above users', async () => { + const licenseServiceMock = licenseService as jest.Mocked; + + licenseServiceMock.isEnterprise.mockReturnValue(true); + render( + + + + ); + + await waitFor(() => { + expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(5); + }); + }); + + it('Action tab should have 5 columns when accessed via K8S dahsboard', async () => { + render( + + + + ); + + await waitFor(() => { + expect(mockGetDefaultControlColumn).toHaveBeenCalledWith(5); + }); + }); }); 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 0000000000000..187f743f0b468 --- /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 126f3e3870ab1..ea05c31d6f481 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/components/visualization_actions/lens_attributes/common/__snapshots__/authentication.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/authentication.test.ts.snap new file mode 100644 index 0000000000000..747487203066b --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/authentication.test.ts.snap @@ -0,0 +1,276 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`authenticationLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-3fd0c5d5-f762-4a27-8c56-14eee0223e13", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-bef502be-e5ff-442f-9e3e-229f86ca2afa", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "6f4dbdc7-35b6-4e20-ac53-1272167e3919", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "3fd0c5d5-f762-4a27-8c56-14eee0223e13": Object { + "columnOrder": Array [ + "b41a2958-650b-470a-84c4-c6fd8f0c6d37", + "5417777d-d9d9-4268-9cdc-eb29b873bd65", + ], + "columns": Object { + "5417777d-d9d9-4268-9cdc-eb29b873bd65": Object { + "customLabel": true, + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "event.outcome : \\"success\\"", + }, + "isBucketed": false, + "label": "Success", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + "b41a2958-650b-470a-84c4-c6fd8f0c6d37": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + }, + "incompleteColumns": Object {}, + }, + "bef502be-e5ff-442f-9e3e-229f86ca2afa": Object { + "columnOrder": Array [ + "cded27f7-8ef8-458c-8d9b-70db48ae340d", + "a3bf9dc1-c8d2-42d6-9e60-31892a4c509e", + ], + "columns": Object { + "a3bf9dc1-c8d2-42d6-9e60-31892a4c509e": Object { + "customLabel": true, + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "event.outcome : \\"failure\\"", + }, + "isBucketed": false, + "label": "Failure", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + "cded27f7-8ef8-458c-8d9b-70db48ae340d": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "index": "6f4dbdc7-35b6-4e20-ac53-1272167e3919", + "key": "query", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"must\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}", + }, + "query": Object { + "bool": Object { + "must": Array [ + Object { + "term": Object { + "event.category": "authentication", + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.name", + "negate": false, + "params": Object { + "query": "mockHost", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.name": "mockHost", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "host.name", + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": false, + "yLeft": false, + "yRight": true, + }, + "layers": Array [ + Object { + "accessors": Array [ + "5417777d-d9d9-4268-9cdc-eb29b873bd65", + ], + "layerId": "3fd0c5d5-f762-4a27-8c56-14eee0223e13", + "layerType": "data", + "position": "top", + "seriesType": "bar_stacked", + "showGridlines": false, + "xAccessor": "b41a2958-650b-470a-84c4-c6fd8f0c6d37", + "yConfig": Array [ + Object { + "color": "#54b399", + "forAccessor": "5417777d-d9d9-4268-9cdc-eb29b873bd65", + }, + ], + }, + Object { + "accessors": Array [ + "a3bf9dc1-c8d2-42d6-9e60-31892a4c509e", + ], + "layerId": "bef502be-e5ff-442f-9e3e-229f86ca2afa", + "layerType": "data", + "seriesType": "bar_stacked", + "xAccessor": "cded27f7-8ef8-458c-8d9b-70db48ae340d", + "yConfig": Array [ + Object { + "color": "#da8b45", + "forAccessor": "a3bf9dc1-c8d2-42d6-9e60-31892a4c509e", + }, + ], + }, + ], + "legend": Object { + "isVisible": true, + "position": "right", + }, + "preferredSeriesType": "bar_stacked", + "title": "Empty XY chart", + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "Authentication", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/external_alert.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/external_alert.test.ts.snap new file mode 100644 index 0000000000000..ac42b228012fe --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/__snapshots__/external_alert.test.ts.snap @@ -0,0 +1,231 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`getExternalAlertLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-a3c54471-615f-4ff9-9fda-69b5b2ea3eef", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "723c4653-681b-4105-956e-abef287bf025", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "a04472fc-94a3-4b8d-ae05-9d30ea8fbd6a", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "a3c54471-615f-4ff9-9fda-69b5b2ea3eef": Object { + "columnOrder": Array [ + "42334c6e-98d9-47a2-b4cb-a445abb44c93", + "37bdf546-3c11-4b08-8c5d-e37debc44f1d", + "0a923af2-c880-4aa3-aa93-a0b9c2801f6d", + ], + "columns": Object { + "0a923af2-c880-4aa3-aa93-a0b9c2801f6d": Object { + "dataType": "number", + "isBucketed": false, + "label": "Count of records", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + "37bdf546-3c11-4b08-8c5d-e37debc44f1d": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + "42334c6e-98d9-47a2-b4cb-a445abb44c93": Object { + "dataType": "string", + "isBucketed": true, + "label": "Top values of event.dataset", + "operationType": "terms", + "params": Object { + "missingBucket": false, + "orderBy": Object { + "columnId": "0a923af2-c880-4aa3-aa93-a0b9c2801f6d", + "type": "column", + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": Object { + "id": "terms", + }, + "size": 10, + }, + "scale": "ordinal", + "sourceField": "event.dataset", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "index": "a04472fc-94a3-4b8d-ae05-9d30ea8fbd6a", + "key": "event.kind", + "negate": false, + "params": Object { + "query": "alert", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "event.kind": "alert", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.name", + "negate": false, + "params": Object { + "query": "mockHost", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.name": "mockHost", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "host.name", + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "layers": Array [ + Object { + "accessors": Array [ + "0a923af2-c880-4aa3-aa93-a0b9c2801f6d", + ], + "layerId": "a3c54471-615f-4ff9-9fda-69b5b2ea3eef", + "layerType": "data", + "position": "top", + "seriesType": "bar_stacked", + "showGridlines": false, + "splitAccessor": "42334c6e-98d9-47a2-b4cb-a445abb44c93", + "xAccessor": "37bdf546-3c11-4b08-8c5d-e37debc44f1d", + }, + ], + "legend": Object { + "isVisible": true, + "position": "right", + }, + "preferredSeriesType": "bar_stacked", + "title": "Empty XY chart", + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "External alerts", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.test.ts new file mode 100644 index 0000000000000..808789db397e9 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { authenticationLensAttributes } from './authentication'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'hosts', + tabName: 'events', + }, + ]), +})); + +describe('authenticationLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: authenticationLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.ts index 199f78d372cd8..15d7f029ae612 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/authentication.ts @@ -5,6 +5,10 @@ * 2.0. */ +import { + AUTHENCICATION_FAILURE_CHART_LABEL, + AUTHENCICATION_SUCCESS_CHART_LABEL, +} from '../../translations'; import type { LensAttributes } from '../../types'; export const authenticationLensAttributes: LensAttributes = { @@ -110,7 +114,7 @@ export const authenticationLensAttributes: LensAttributes = { }, }, '5417777d-d9d9-4268-9cdc-eb29b873bd65': { - label: 'Success', + label: AUTHENCICATION_SUCCESS_CHART_LABEL, dataType: 'number', operationType: 'count', isBucketed: false, @@ -143,7 +147,7 @@ export const authenticationLensAttributes: LensAttributes = { }, }, 'a3bf9dc1-c8d2-42d6-9e60-31892a4c509e': { - label: 'Failure', + label: AUTHENCICATION_FAILURE_CHART_LABEL, dataType: 'number', operationType: 'count', isBucketed: false, diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.test.ts new file mode 100644 index 0000000000000..da890c4d49fe0 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { getExternalAlertLensAttributes } from './external_alert'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'hosts', + tabName: 'events', + }, + ]), +})); + +describe('getExternalAlertLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + getLensAttributes: getExternalAlertLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.ts index e24db03b3302f..a815d442b043e 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/common/external_alert.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { COUNT, TOP_VALUE } from '../../translations'; import type { GetLensAttributes, LensAttributes } from '../../types'; export const getExternalAlertLensAttributes: GetLensAttributes = ( @@ -86,7 +87,7 @@ export const getExternalAlertLensAttributes: GetLensAttributes = ( }, }, '0a923af2-c880-4aa3-aa93-a0b9c2801f6d': { - label: 'Count of records', + label: COUNT, dataType: 'number', operationType: 'count', isBucketed: false, @@ -94,7 +95,7 @@ export const getExternalAlertLensAttributes: GetLensAttributes = ( sourceField: '___records___', }, '42334c6e-98d9-47a2-b4cb-a445abb44c93': { - label: `Top values of ${stackByField}`, // could be event.category + label: TOP_VALUE(`${stackByField}`), // could be event.category dataType: 'string', operationType: 'terms', scale: 'ordinal', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/event.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/event.test.ts.snap new file mode 100644 index 0000000000000..7f3fdb6c66107 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/event.test.ts.snap @@ -0,0 +1,205 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`getEventsHistogramLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-0039eb0c-9a1a-4687-ae54-0f4e239bec75", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "0039eb0c-9a1a-4687-ae54-0f4e239bec75": Object { + "columnOrder": Array [ + "34919782-4546-43a5-b668-06ac934d3acd", + "aac9d7d0-13a3-480a-892b-08207a787926", + "e09e0380-0740-4105-becc-0a4ca12e3944", + ], + "columns": Object { + "34919782-4546-43a5-b668-06ac934d3acd": Object { + "dataType": "string", + "isBucketed": true, + "label": "Top values of event.dataset", + "operationType": "terms", + "params": Object { + "missingBucket": false, + "orderBy": Object { + "columnId": "e09e0380-0740-4105-becc-0a4ca12e3944", + "type": "column", + }, + "orderDirection": "asc", + "otherBucket": true, + "parentFormat": Object { + "id": "terms", + }, + "size": 10, + }, + "scale": "ordinal", + "sourceField": "event.dataset", + }, + "aac9d7d0-13a3-480a-892b-08207a787926": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + "e09e0380-0740-4105-becc-0a4ca12e3944": Object { + "dataType": "number", + "isBucketed": false, + "label": "Count of records", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.name", + "negate": false, + "params": Object { + "query": "mockHost", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.name": "mockHost", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "host.name", + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": false, + "yLeft": false, + "yRight": true, + }, + "layers": Array [ + Object { + "accessors": Array [ + "e09e0380-0740-4105-becc-0a4ca12e3944", + ], + "layerId": "0039eb0c-9a1a-4687-ae54-0f4e239bec75", + "layerType": "data", + "position": "top", + "seriesType": "bar_stacked", + "showGridlines": false, + "splitAccessor": "34919782-4546-43a5-b668-06ac934d3acd", + "xAccessor": "aac9d7d0-13a3-480a-892b-08207a787926", + }, + ], + "legend": Object { + "isVisible": true, + "position": "right", + }, + "preferredSeriesType": "bar_stacked", + "title": "Empty XY chart", + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "Host - events", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_area.test.ts.snap new file mode 100644 index 0000000000000..c5e4e272ec9c4 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_area.test.ts.snap @@ -0,0 +1,196 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiHostAreaLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-416b6fad-1923-4f6a-a2df-b223bb287e30", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "416b6fad-1923-4f6a-a2df-b223bb287e30": Object { + "columnOrder": Array [ + "5eea817b-67b7-4268-8ecb-7688d1094721", + "b00c65ea-32be-4163-bfc8-f795b1ef9d06", + ], + "columns": Object { + "5eea817b-67b7-4268-8ecb-7688d1094721": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + "b00c65ea-32be-4163-bfc8-f795b1ef9d06": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Unique count of host.name", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "host.name", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.name", + "negate": false, + "params": Object { + "query": "mockHost", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.name": "mockHost", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "host.name", + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": false, + "yLeft": false, + "yRight": false, + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "labelsOrientation": Object { + "x": 0, + "yLeft": 0, + "yRight": 0, + }, + "layers": Array [ + Object { + "accessors": Array [ + "b00c65ea-32be-4163-bfc8-f795b1ef9d06", + ], + "layerId": "416b6fad-1923-4f6a-a2df-b223bb287e30", + "layerType": "data", + "seriesType": "area", + "xAccessor": "5eea817b-67b7-4268-8ecb-7688d1094721", + }, + ], + "legend": Object { + "isVisible": true, + "position": "right", + }, + "preferredSeriesType": "area", + "tickLabelsVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "[Host] Hosts - area", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_metric.test.ts.snap new file mode 100644 index 0000000000000..3669de2d30109 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_host_metric.test.ts.snap @@ -0,0 +1,143 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiHostMetricLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-416b6fad-1923-4f6a-a2df-b223bb287e30", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "416b6fad-1923-4f6a-a2df-b223bb287e30": Object { + "columnOrder": Array [ + "b00c65ea-32be-4163-bfc8-f795b1ef9d06", + ], + "columns": Object { + "b00c65ea-32be-4163-bfc8-f795b1ef9d06": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": " ", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "host.name", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.name", + "negate": false, + "params": Object { + "query": "mockHost", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.name": "mockHost", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "host.name", + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "b00c65ea-32be-4163-bfc8-f795b1ef9d06", + "layerId": "416b6fad-1923-4f6a-a2df-b223bb287e30", + "layerType": "data", + }, + }, + "title": "[Host] Hosts - metric", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_area.test.ts.snap new file mode 100644 index 0000000000000..acaf78556269f --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_area.test.ts.snap @@ -0,0 +1,255 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUniqueIpsAreaLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-8be0156b-d423-4a39-adf1-f54d4c9f2e69", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-ca05ecdb-0fa4-49a8-9305-b23d91012a46", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object { + "columnOrder": Array [ + "a0cb6400-f708-46c3-ad96-24788f12dae4", + "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe", + ], + "columns": Object { + "a0cb6400-f708-46c3-ad96-24788f12dae4": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Src.", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "source.ip", + }, + }, + "incompleteColumns": Object {}, + }, + "ca05ecdb-0fa4-49a8-9305-b23d91012a46": Object { + "columnOrder": Array [ + "f95e74e6-99dd-4b11-8faf-439b4d959df9", + "e7052671-fb9e-481f-8df3-7724c98cfc6f", + ], + "columns": Object { + "e7052671-fb9e-481f-8df3-7724c98cfc6f": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Dest.", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "destination.ip", + }, + "f95e74e6-99dd-4b11-8faf-439b4d959df9": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.name", + "negate": false, + "params": Object { + "query": "mockHost", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.name": "mockHost", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "host.name", + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": false, + "yLeft": false, + "yRight": true, + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "labelsOrientation": Object { + "x": 0, + "yLeft": 0, + "yRight": 0, + }, + "layers": Array [ + Object { + "accessors": Array [ + "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe", + ], + "layerId": "8be0156b-d423-4a39-adf1-f54d4c9f2e69", + "layerType": "data", + "seriesType": "area", + "xAccessor": "a0cb6400-f708-46c3-ad96-24788f12dae4", + "yConfig": Array [ + Object { + "color": "#d36186", + "forAccessor": "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe", + }, + ], + }, + Object { + "accessors": Array [ + "e7052671-fb9e-481f-8df3-7724c98cfc6f", + ], + "layerId": "ca05ecdb-0fa4-49a8-9305-b23d91012a46", + "layerType": "data", + "seriesType": "area", + "xAccessor": "f95e74e6-99dd-4b11-8faf-439b4d959df9", + "yConfig": Array [ + Object { + "color": "#9170b8", + "forAccessor": "e7052671-fb9e-481f-8df3-7724c98cfc6f", + }, + ], + }, + ], + "legend": Object { + "isVisible": false, + "position": "right", + "showSingleSeries": false, + }, + "preferredSeriesType": "area", + "tickLabelsVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "[Host] Unique IPs - area", + "type": "lens", + "updated_at": "2022-02-09T17:44:03.359Z", + "version": "WzI5MTI5OSwzXQ==", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_bar.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_bar.test.ts.snap new file mode 100644 index 0000000000000..9f702ecb06412 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_bar.test.ts.snap @@ -0,0 +1,265 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUniqueIpsBarLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-8be0156b-d423-4a39-adf1-f54d4c9f2e69", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-ec84ba70-2adb-4647-8ef0-8ad91a0e6d4e", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object { + "columnOrder": Array [ + "f8bfa719-5c1c-4bf2-896e-c318d77fc08e", + "32f66676-f4e1-48fd-b7f8-d4de38318601", + ], + "columns": Object { + "32f66676-f4e1-48fd-b7f8-d4de38318601": Object { + "dataType": "number", + "isBucketed": false, + "label": "Unique count of source.ip", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "source.ip", + }, + "f8bfa719-5c1c-4bf2-896e-c318d77fc08e": Object { + "dataType": "string", + "isBucketed": true, + "label": "Filters", + "operationType": "filters", + "params": Object { + "filters": Array [ + Object { + "input": Object { + "language": "kuery", + "query": "", + }, + "label": "Src.", + }, + ], + }, + "scale": "ordinal", + }, + }, + "incompleteColumns": Object {}, + }, + "ec84ba70-2adb-4647-8ef0-8ad91a0e6d4e": Object { + "columnOrder": Array [ + "c72aad6a-fc9c-43dc-9194-e13ca3ee8aff", + "b7e59b08-96e6-40d1-84fd-e97b977d1c47", + ], + "columns": Object { + "b7e59b08-96e6-40d1-84fd-e97b977d1c47": Object { + "dataType": "number", + "isBucketed": false, + "label": "Unique count of destination.ip", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "destination.ip", + }, + "c72aad6a-fc9c-43dc-9194-e13ca3ee8aff": Object { + "customLabel": true, + "dataType": "string", + "isBucketed": true, + "label": "Dest.", + "operationType": "filters", + "params": Object { + "filters": Array [ + Object { + "input": Object { + "language": "kuery", + "query": "", + }, + "label": "Dest.", + }, + ], + }, + "scale": "ordinal", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.name", + "negate": false, + "params": Object { + "query": "mockHost", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.name": "mockHost", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "host.name", + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": false, + "yLeft": false, + "yRight": true, + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "labelsOrientation": Object { + "x": 0, + "yLeft": 0, + "yRight": 0, + }, + "layers": Array [ + Object { + "accessors": Array [ + "32f66676-f4e1-48fd-b7f8-d4de38318601", + ], + "layerId": "8be0156b-d423-4a39-adf1-f54d4c9f2e69", + "layerType": "data", + "seriesType": "bar_horizontal_stacked", + "xAccessor": "f8bfa719-5c1c-4bf2-896e-c318d77fc08e", + "yConfig": Array [ + Object { + "color": "#d36186", + "forAccessor": "32f66676-f4e1-48fd-b7f8-d4de38318601", + }, + ], + }, + Object { + "accessors": Array [ + "b7e59b08-96e6-40d1-84fd-e97b977d1c47", + ], + "layerId": "ec84ba70-2adb-4647-8ef0-8ad91a0e6d4e", + "layerType": "data", + "seriesType": "bar_horizontal_stacked", + "xAccessor": "c72aad6a-fc9c-43dc-9194-e13ca3ee8aff", + "yConfig": Array [ + Object { + "color": "#9170b8", + "forAccessor": "b7e59b08-96e6-40d1-84fd-e97b977d1c47", + }, + ], + }, + ], + "legend": Object { + "isVisible": false, + "position": "right", + "showSingleSeries": false, + }, + "preferredSeriesType": "bar_horizontal_stacked", + "tickLabelsVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "[Host] Unique IPs - bar", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_destination_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_destination_metric.test.ts.snap new file mode 100644 index 0000000000000..ebeb85e27a44f --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_destination_metric.test.ts.snap @@ -0,0 +1,143 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUniqueIpsDestinationMetricLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-8be0156b-d423-4a39-adf1-f54d4c9f2e69", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object { + "columnOrder": Array [ + "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe", + ], + "columns": Object { + "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": " ", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "destination.ip", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.name", + "negate": false, + "params": Object { + "query": "mockHost", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.name": "mockHost", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "host.name", + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe", + "layerId": "8be0156b-d423-4a39-adf1-f54d4c9f2e69", + "layerType": "data", + }, + }, + "title": "[Host] Unique IPs - destination metric", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_source_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_source_metric.test.ts.snap new file mode 100644 index 0000000000000..f8ec7bb8c70d7 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/__snapshots__/kpi_unique_ips_source_metric.test.ts.snap @@ -0,0 +1,143 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUniqueIpsSourceMetricLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-8be0156b-d423-4a39-adf1-f54d4c9f2e69", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "8be0156b-d423-4a39-adf1-f54d4c9f2e69": Object { + "columnOrder": Array [ + "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe", + ], + "columns": Object { + "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": " ", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "source.ip", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.name", + "negate": false, + "params": Object { + "query": "mockHost", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.name": "mockHost", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"query\\": {\\"bool\\": {\\"filter\\": [{\\"bool\\": {\\"should\\": [{\\"exists\\": {\\"field\\": \\"host.name\\"}}],\\"minimum_should_match\\": 1}}]}}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "host.name", + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "d9a6eb6b-8b78-439e-98e7-a718f8ffbebe", + "layerId": "8be0156b-d423-4a39-adf1-f54d4c9f2e69", + "layerType": "data", + }, + }, + "title": "[Host] Unique IPs - source metric", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/event.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/event.test.ts new file mode 100644 index 0000000000000..107b63716f404 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/event.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { getEventsHistogramLensAttributes } from './events'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'hosts', + tabName: 'events', + }, + ]), +})); + +describe('getEventsHistogramLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + getLensAttributes: getEventsHistogramLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.test.ts new file mode 100644 index 0000000000000..5248444872942 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiHostAreaLensAttributes } from './kpi_host_area'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'hosts', + tabName: 'events', + }, + ]), +})); + +describe('kpiHostAreaLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiHostAreaLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.ts index f4486b77390b2..64f62133e9406 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_area.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { UNIQUE_COUNT } from '../../translations'; import type { LensAttributes } from '../../types'; export const kpiHostAreaLensAttributes: LensAttributes = { @@ -32,7 +33,7 @@ export const kpiHostAreaLensAttributes: LensAttributes = { customLabel: true, dataType: 'number', isBucketed: false, - label: ' ', + label: UNIQUE_COUNT('host.name'), operationType: 'unique_count', scale: 'ratio', sourceField: 'host.name', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.test.ts new file mode 100644 index 0000000000000..06a884c15e4d6 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiHostMetricLensAttributes } from './kpi_host_metric'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'hosts', + tabName: 'events', + }, + ]), +})); + +describe('kpiHostMetricLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiHostMetricLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.ts index c5fcae45df0f0..00ab0239acb40 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_host_metric.ts @@ -40,7 +40,7 @@ export const kpiHostMetricLensAttributes: LensAttributes = { }, }, title: '[Host] Hosts - metric', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', references: [ { id: '{dataViewId}', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_area.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_area.test.ts new file mode 100644 index 0000000000000..63f50b141b5b0 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_area.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUniqueIpsAreaLensAttributes } from './kpi_unique_ips_area'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'hosts', + tabName: 'events', + }, + ]), +})); + +describe('kpiUniqueIpsAreaLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUniqueIpsAreaLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.test.ts new file mode 100644 index 0000000000000..f04f0de2b8be7 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUniqueIpsBarLensAttributes } from './kpi_unique_ips_bar'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'hosts', + tabName: 'events', + }, + ]), +})); + +describe('kpiUniqueIpsBarLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUniqueIpsBarLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.ts index b55fcb64ba49c..cf7dbf21913b5 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_bar.ts @@ -6,7 +6,7 @@ */ import type { LensAttributes } from '../../types'; -import { SOURCE_CHART_LABEL, DESTINATION_CHART_LABEL } from '../../translations'; +import { SOURCE_CHART_LABEL, DESTINATION_CHART_LABEL, UNIQUE_COUNT } from '../../translations'; export const kpiUniqueIpsBarLensAttributes: LensAttributes = { description: '', @@ -23,7 +23,7 @@ export const kpiUniqueIpsBarLensAttributes: LensAttributes = { '32f66676-f4e1-48fd-b7f8-d4de38318601': { dataType: 'number', isBucketed: false, - label: 'Unique count of source.ip', + label: UNIQUE_COUNT('source.ip'), operationType: 'unique_count', scale: 'ratio', sourceField: 'source.ip', @@ -50,7 +50,7 @@ export const kpiUniqueIpsBarLensAttributes: LensAttributes = { 'b7e59b08-96e6-40d1-84fd-e97b977d1c47': { dataType: 'number', isBucketed: false, - label: 'Unique count of destination.ip', + label: UNIQUE_COUNT('destination.ip'), operationType: 'unique_count', scale: 'ratio', sourceField: 'destination.ip', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.test.ts new file mode 100644 index 0000000000000..9dd67a2d5ab40 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUniqueIpsDestinationMetricLensAttributes } from './kpi_unique_ips_destination_metric'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'hosts', + tabName: 'events', + }, + ]), +})); + +describe('kpiUniqueIpsDestinationMetricLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUniqueIpsDestinationMetricLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.ts index ae18c08be800c..5c4aa31f65833 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_destination_metric.ts @@ -40,7 +40,7 @@ export const kpiUniqueIpsDestinationMetricLensAttributes: LensAttributes = { }, }, title: '[Host] Unique IPs - destination metric', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', references: [ { id: '{dataViewId}', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.test.ts new file mode 100644 index 0000000000000..6e69495e63a0e --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUniqueIpsSourceMetricLensAttributes } from './kpi_unique_ips_source_metric'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'hosts', + tabName: 'events', + }, + ]), +})); + +describe('kpiUniqueIpsSourceMetricLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUniqueIpsSourceMetricLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.ts index 8a0b778975ab9..4d308b95d796d 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/hosts/kpi_unique_ips_source_metric.ts @@ -40,7 +40,7 @@ export const kpiUniqueIpsSourceMetricLensAttributes: LensAttributes = { }, }, title: '[Host] Unique IPs - source metric', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', references: [ { id: '{dataViewId}', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/dns_top_domains.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/dns_top_domains.test.ts.snap new file mode 100644 index 0000000000000..6e0f9c2bbd516 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/dns_top_domains.test.ts.snap @@ -0,0 +1,245 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`dnsTopDomainsLensAttributes should render 1`] = ` +Object { + "description": "Security Solution Network DNS", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-b1c3efc6-c886-4fba-978f-3b6bb5e7948a", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "filter-index-pattern-0", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "b1c3efc6-c886-4fba-978f-3b6bb5e7948a": Object { + "columnOrder": Array [ + "e8842815-2a45-4c74-86de-c19a391e2424", + "d1452b87-0e9e-4fc0-a725-3727a18e0b37", + "2a4d5e20-f570-48e4-b9ab-ff3068919377", + ], + "columns": Object { + "2a4d5e20-f570-48e4-b9ab-ff3068919377": Object { + "dataType": "number", + "isBucketed": false, + "label": "Unique count of dns.question.registered_domain", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "dns.question.registered_domain", + }, + "d1452b87-0e9e-4fc0-a725-3727a18e0b37": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + "e8842815-2a45-4c74-86de-c19a391e2424": Object { + "dataType": "string", + "isBucketed": true, + "label": "Top values of dns.question.name", + "operationType": "terms", + "params": Object { + "missingBucket": false, + "orderBy": Object { + "columnId": "2a4d5e20-f570-48e4-b9ab-ff3068919377", + "type": "column", + }, + "orderDirection": "desc", + "otherBucket": true, + "size": 6, + }, + "scale": "ordinal", + "sourceField": "dns.question.name", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "indexRefName": "filter-index-pattern-0", + "key": "dns.question.type", + "negate": true, + "params": Object { + "query": "PTR", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "dns.question.type": "PTR", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "labelsOrientation": Object { + "x": 0, + "yLeft": 0, + "yRight": 0, + }, + "layers": Array [ + Object { + "accessors": Array [ + "2a4d5e20-f570-48e4-b9ab-ff3068919377", + ], + "layerId": "b1c3efc6-c886-4fba-978f-3b6bb5e7948a", + "layerType": "data", + "position": "top", + "seriesType": "bar", + "showGridlines": false, + "splitAccessor": "e8842815-2a45-4c74-86de-c19a391e2424", + "xAccessor": "d1452b87-0e9e-4fc0-a725-3727a18e0b37", + }, + ], + "legend": Object { + "isVisible": true, + "position": "right", + }, + "preferredSeriesType": "bar", + "tickLabelsVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "Top domains by dns.question.registered_domain", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_dns_queries.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_dns_queries.test.ts.snap new file mode 100644 index 0000000000000..39f16779abaf4 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_dns_queries.test.ts.snap @@ -0,0 +1,189 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiDnsQueriesLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-cea37c70-8f91-43bf-b9fe-72d8c049f6a3", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "196d783b-3779-4c39-898e-6606fe633d05", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "cea37c70-8f91-43bf-b9fe-72d8c049f6a3": Object { + "columnOrder": Array [ + "0374e520-eae0-4ac1-bcfe-37565e7fc9e3", + ], + "columns": Object { + "0374e520-eae0-4ac1-bcfe-37565e7fc9e3": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "index": "196d783b-3779-4c39-898e-6606fe633d05", + "key": "query", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\":\\"dns.question.name\\"}},{\\"term\\":{\\"suricata.eve.dns.type\\":{\\"value\\":\\"query\\"}}},{\\"exists\\":{\\"field\\":\\"zeek.dns.query\\"}}],\\"minimum_should_match\\":1}}", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "dns.question.name", + }, + }, + Object { + "term": Object { + "suricata.eve.dns.type": Object { + "value": "query", + }, + }, + }, + Object { + "exists": Object { + "field": "zeek.dns.query", + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "0374e520-eae0-4ac1-bcfe-37565e7fc9e3", + "colorMode": "None", + "layerId": "cea37c70-8f91-43bf-b9fe-72d8c049f6a3", + "layerType": "data", + }, + }, + "title": "[Network] DNS metric", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_network_events.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_network_events.test.ts.snap new file mode 100644 index 0000000000000..03bacfac49ad7 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_network_events.test.ts.snap @@ -0,0 +1,193 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiNetworkEventsLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-eaadfec7-deaa-4aeb-a403-3b4e516416d2", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "861af17d-be25-45a3-a82d-d6e697b76e51", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "09617767-f732-410e-af53-bebcbd0bf4b9", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "eaadfec7-deaa-4aeb-a403-3b4e516416d2": Object { + "columnOrder": Array [ + "370ebd07-5ce0-4f46-a847-0e363c50d037", + ], + "columns": Object { + "370ebd07-5ce0-4f46-a847-0e363c50d037": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": " ", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "index": "security-solution-default", + "key": "source.ip", + "negate": false, + "type": "exists", + "value": "exists", + }, + "query": Object { + "exists": Object { + "field": "source.ip", + }, + }, + }, + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "index": "security-solution-default", + "key": "destination.ip", + "negate": false, + "type": "exists", + "value": "exists", + }, + "query": Object { + "exists": Object { + "field": "destination.ip", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "370ebd07-5ce0-4f46-a847-0e363c50d037", + "layerId": "eaadfec7-deaa-4aeb-a403-3b4e516416d2", + "layerType": "data", + }, + }, + "title": "[Network] Network events", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_tls_handshakes.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_tls_handshakes.test.ts.snap new file mode 100644 index 0000000000000..6e695484fdc0f --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_tls_handshakes.test.ts.snap @@ -0,0 +1,212 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiTlsHandshakesLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-1f48a633-8eee-45ae-9471-861227e9ca03", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "1f48a633-8eee-45ae-9471-861227e9ca03": Object { + "columnOrder": Array [ + "21052b6b-5504-4084-a2e2-c17f772345cf", + ], + "columns": Object { + "21052b6b-5504-4084-a2e2-c17f772345cf": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": " ", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "index": "32ee22d9-2e77-4aee-8073-87750e92c3ee", + "key": "query", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\":\\"source.ip\\"}},{\\"exists\\":{\\"field\\":\\"destination.ip\\"}}],\\"minimum_should_match\\":1}}", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + }, + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "index": "1e93f984-9374-4755-a198-de57751533c6", + "key": "query", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\":\\"tls.version\\"}},{\\"exists\\":{\\"field\\":\\"suricata.eve.tls.version\\"}},{\\"exists\\":{\\"field\\":\\"zeek.ssl.version\\"}}],\\"minimum_should_match\\":1}}", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "tls.version", + }, + }, + Object { + "exists": Object { + "field": "suricata.eve.tls.version", + }, + }, + Object { + "exists": Object { + "field": "zeek.ssl.version", + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "21052b6b-5504-4084-a2e2-c17f772345cf", + "layerId": "1f48a633-8eee-45ae-9471-861227e9ca03", + "layerType": "data", + }, + }, + "title": "[Network] TLS handshakes", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_flow_ids.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_flow_ids.test.ts.snap new file mode 100644 index 0000000000000..1e3f1f63c40c8 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_flow_ids.test.ts.snap @@ -0,0 +1,176 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUniqueFlowIdsLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-5d46d48f-6ce8-46be-a797-17ad50642564", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "5d46d48f-6ce8-46be-a797-17ad50642564": Object { + "columnOrder": Array [ + "a27f3503-9c73-4fc1-86bb-12461dae4b70", + ], + "columns": Object { + "a27f3503-9c73-4fc1-86bb-12461dae4b70": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": " ", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "network.community_id", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "index": "c01edc8a-90ce-4d49-95f0-76954a034eb2", + "key": "query", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\":\\"source.ip\\"}},{\\"exists\\":{\\"field\\":\\"destination.ip\\"}}],\\"minimum_should_match\\":1}}", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "a27f3503-9c73-4fc1-86bb-12461dae4b70", + "layerId": "5d46d48f-6ce8-46be-a797-17ad50642564", + "layerType": "data", + }, + }, + "title": "[Network] Unique flow IDs", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_area.test.ts.snap new file mode 100644 index 0000000000000..2415dcc6c750c --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_area.test.ts.snap @@ -0,0 +1,261 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUniquePrivateIpsAreaLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-72dc4b99-b07d-4dc9-958b-081d259e11fa", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7": Object { + "columnOrder": Array [ + "662cd5e5-82bf-4325-a703-273f84b97e09", + "5f317308-cfbb-4ee5-bfb9-07653184fabf", + ], + "columns": Object { + "5f317308-cfbb-4ee5-bfb9-07653184fabf": Object { + "customLabel": true, + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "\\"source.ip\\": \\"10.0.0.0/8\\" or \\"source.ip\\": \\"192.168.0.0/16\\" or \\"source.ip\\": \\"172.16.0.0/12\\" or \\"source.ip\\": \\"fd00::/8\\"", + }, + "isBucketed": false, + "label": "Src.", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "source.ip", + }, + "662cd5e5-82bf-4325-a703-273f84b97e09": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + }, + "incompleteColumns": Object {}, + }, + "72dc4b99-b07d-4dc9-958b-081d259e11fa": Object { + "columnOrder": Array [ + "36444b8c-7e10-4069-8298-6c1b46912be2", + "ac1eb80c-ddde-46c4-a90c-400261926762", + ], + "columns": Object { + "36444b8c-7e10-4069-8298-6c1b46912be2": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + "ac1eb80c-ddde-46c4-a90c-400261926762": Object { + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "\\"destination.ip\\": \\"10.0.0.0/8\\" or \\"destination.ip\\": \\"192.168.0.0/16\\" or \\"destination.ip\\": \\"172.16.0.0/12\\" or \\"destination.ip\\": \\"fd00::/8\\"", + }, + "isBucketed": false, + "label": "Dest.", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "destination.ip", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": false, + "yLeft": false, + "yRight": true, + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "labelsOrientation": Object { + "x": 0, + "yLeft": 0, + "yRight": 0, + }, + "layers": Array [ + Object { + "accessors": Array [ + "5f317308-cfbb-4ee5-bfb9-07653184fabf", + ], + "layerId": "38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7", + "layerType": "data", + "seriesType": "area", + "xAccessor": "662cd5e5-82bf-4325-a703-273f84b97e09", + "yConfig": Array [ + Object { + "color": "#d36186", + "forAccessor": "5f317308-cfbb-4ee5-bfb9-07653184fabf", + }, + ], + }, + Object { + "accessors": Array [ + "ac1eb80c-ddde-46c4-a90c-400261926762", + ], + "layerId": "72dc4b99-b07d-4dc9-958b-081d259e11fa", + "layerType": "data", + "seriesType": "area", + "xAccessor": "36444b8c-7e10-4069-8298-6c1b46912be2", + "yConfig": Array [ + Object { + "color": "#9170b8", + "forAccessor": "ac1eb80c-ddde-46c4-a90c-400261926762", + }, + ], + }, + ], + "legend": Object { + "isVisible": false, + "position": "right", + "showSingleSeries": false, + }, + "preferredSeriesType": "area", + "tickLabelsVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "[Network] Unique private IPs - area chart", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_bar.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_bar.test.ts.snap new file mode 100644 index 0000000000000..2ea658869183c --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_bar.test.ts.snap @@ -0,0 +1,276 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUniquePrivateIpsBarLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-e406bf4f-942b-41ac-b516-edb5cef06ec8", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7": Object { + "columnOrder": Array [ + "4607c585-3af3-43b9-804f-e49b27796d79", + "d27e0966-daf9-41f4-9033-230cf1e76dc9", + ], + "columns": Object { + "4607c585-3af3-43b9-804f-e49b27796d79": Object { + "dataType": "string", + "isBucketed": true, + "label": "Filters", + "operationType": "filters", + "params": Object { + "filters": Array [ + Object { + "input": Object { + "language": "kuery", + "query": "", + }, + "label": "Dest.", + }, + ], + }, + "scale": "ordinal", + }, + "d27e0966-daf9-41f4-9033-230cf1e76dc9": Object { + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "\\"destination.ip\\": \\"10.0.0.0/8\\" or \\"destination.ip\\": \\"192.168.0.0/16\\" or \\"destination.ip\\": \\"172.16.0.0/12\\" or \\"destination.ip\\": \\"fd00::/8\\"", + }, + "isBucketed": false, + "label": "Unique count of destination.ip", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "destination.ip", + }, + }, + "incompleteColumns": Object {}, + }, + "e406bf4f-942b-41ac-b516-edb5cef06ec8": Object { + "columnOrder": Array [ + "d9c438c5-f776-4436-9d20-d62dc8c03be8", + "5acd4c9d-dc3b-4b21-9632-e4407944c36d", + ], + "columns": Object { + "5acd4c9d-dc3b-4b21-9632-e4407944c36d": Object { + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "source.ip: \\"10.0.0.0/8\\" or source.ip: \\"192.168.0.0/16\\" or source.ip: \\"172.16.0.0/12\\" or source.ip: \\"fd00::/8\\"", + }, + "isBucketed": false, + "label": "Unique count of source.ip", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "source.ip", + }, + "d9c438c5-f776-4436-9d20-d62dc8c03be8": Object { + "dataType": "string", + "isBucketed": true, + "label": "Filters", + "operationType": "filters", + "params": Object { + "filters": Array [ + Object { + "input": Object { + "language": "kuery", + "query": "", + }, + "label": "Src.", + }, + ], + }, + "scale": "ordinal", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": false, + "yLeft": false, + "yRight": true, + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "labelsOrientation": Object { + "x": 0, + "yLeft": 0, + "yRight": 0, + }, + "layers": Array [ + Object { + "accessors": Array [ + "5acd4c9d-dc3b-4b21-9632-e4407944c36d", + ], + "layerId": "e406bf4f-942b-41ac-b516-edb5cef06ec8", + "layerType": "data", + "position": "top", + "seriesType": "bar_horizontal_stacked", + "showGridlines": false, + "xAccessor": "d9c438c5-f776-4436-9d20-d62dc8c03be8", + "yConfig": Array [ + Object { + "color": "#d36186", + "forAccessor": "5acd4c9d-dc3b-4b21-9632-e4407944c36d", + }, + ], + }, + Object { + "accessors": Array [ + "d27e0966-daf9-41f4-9033-230cf1e76dc9", + ], + "layerId": "38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7", + "layerType": "data", + "seriesType": "bar_horizontal_stacked", + "xAccessor": "4607c585-3af3-43b9-804f-e49b27796d79", + "yConfig": Array [ + Object { + "color": "#9170b8", + "forAccessor": "d27e0966-daf9-41f4-9033-230cf1e76dc9", + }, + ], + }, + ], + "legend": Object { + "isVisible": false, + "position": "right", + "showSingleSeries": false, + }, + "preferredSeriesType": "bar_horizontal_stacked", + "tickLabelsVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "[Network] Unique private IPs - bar chart", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_destination_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_destination_metric.test.ts.snap new file mode 100644 index 0000000000000..37311a980c6b4 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_destination_metric.test.ts.snap @@ -0,0 +1,149 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUniquePrivateIpsDestinationMetricLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-cea37c70-8f91-43bf-b9fe-72d8c049f6a3", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "cea37c70-8f91-43bf-b9fe-72d8c049f6a3": Object { + "columnOrder": Array [ + "bd17c23e-4f83-4108-8005-2669170d064b", + ], + "columns": Object { + "bd17c23e-4f83-4108-8005-2669170d064b": Object { + "customLabel": true, + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "\\"destination.ip\\": \\"10.0.0.0/8\\" or \\"destination.ip\\": \\"192.168.0.0/16\\" or \\"destination.ip\\": \\"172.16.0.0/12\\" or \\"destination.ip\\": \\"fd00::/8\\"", + }, + "isBucketed": false, + "label": "", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "destination.ip", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "bd17c23e-4f83-4108-8005-2669170d064b", + "layerId": "cea37c70-8f91-43bf-b9fe-72d8c049f6a3", + "layerType": "data", + }, + }, + "title": "[Network] Unique private IPs - destination metric", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_source_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_source_metric.test.ts.snap new file mode 100644 index 0000000000000..2f7ba7d2997b1 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/__snapshots__/kpi_unique_private_ips_source_metric.test.ts.snap @@ -0,0 +1,149 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUniquePrivateIpsSourceMetricLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-cea37c70-8f91-43bf-b9fe-72d8c049f6a3", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "cea37c70-8f91-43bf-b9fe-72d8c049f6a3": Object { + "columnOrder": Array [ + "bd17c23e-4f83-4108-8005-2669170d064b", + ], + "columns": Object { + "bd17c23e-4f83-4108-8005-2669170d064b": Object { + "customLabel": true, + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "source.ip: \\"10.0.0.0/8\\" or source.ip: \\"192.168.0.0/16\\" or source.ip: \\"172.16.0.0/12\\" or source.ip: \\"fd00::/8\\"", + }, + "isBucketed": false, + "label": "", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "source.ip", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": "", + "disabled": false, + "key": "bool", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"bool\\":{\\"should\\":[{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"source.ip\\"}}],\\"minimum_should_match\\":1}},{\\"bool\\":{\\"should\\":[{\\"exists\\":{\\"field\\": \\"destination.ip\\"}}],\\"minimum_should_match\\":1}}],\\"minimum_should_match\\":1}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "source.ip", + }, + }, + ], + }, + }, + Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "exists": Object { + "field": "destination.ip", + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "bd17c23e-4f83-4108-8005-2669170d064b", + "layerId": "cea37c70-8f91-43bf-b9fe-72d8c049f6a3", + "layerType": "data", + }, + }, + "title": "[Network] Unique private IPs - source metric", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.test.ts new file mode 100644 index 0000000000000..a726a44e34e39 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { dnsTopDomainsLensAttributes } from './dns_top_domains'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'network', + tabName: 'events', + }, + ]), +})); + +describe('dnsTopDomainsLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: dnsTopDomainsLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts index 07a3badc3b96e..ef75bea77c3e0 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/dns_top_domains.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { TOP_VALUE, UNIQUE_COUNT } from '../../translations'; import type { LensAttributes } from '../../types'; /* Exported from Kibana Saved Object */ @@ -104,7 +105,7 @@ export const dnsTopDomainsLensAttributes: LensAttributes = { }, }, '2a4d5e20-f570-48e4-b9ab-ff3068919377': { - label: 'Unique count of dns.question.registered_domain', + label: UNIQUE_COUNT('dns.question.registered_domain'), dataType: 'number', operationType: 'unique_count', scale: 'ratio', @@ -112,7 +113,7 @@ export const dnsTopDomainsLensAttributes: LensAttributes = { isBucketed: false, }, 'e8842815-2a45-4c74-86de-c19a391e2424': { - label: 'Top values of dns.question.name', + label: TOP_VALUE('dns.question.name'), dataType: 'string', operationType: 'terms', scale: 'ordinal', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.test.ts new file mode 100644 index 0000000000000..b19b5c1f2f1ba --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiDnsQueriesLensAttributes } from './kpi_dns_queries'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'network', + tabName: 'events', + }, + ]), +})); + +describe('kpiDnsQueriesLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiDnsQueriesLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.ts index 1d6cddb7f1b61..681cd278214b1 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_dns_queries.ts @@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types'; export const kpiDnsQueriesLensAttributes: LensAttributes = { title: '[Network] DNS metric', description: '', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', state: { visualization: { layerId: 'cea37c70-8f91-43bf-b9fe-72d8c049f6a3', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.test.ts new file mode 100644 index 0000000000000..4ca26f222021a --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiNetworkEventsLensAttributes } from './kpi_network_events'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'network', + tabName: 'events', + }, + ]), +})); + +describe('kpiNetworkEventsLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiNetworkEventsLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.ts index 013ad35b31ecc..534ffeb2024e6 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_network_events.ts @@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types'; export const kpiNetworkEventsLensAttributes: LensAttributes = { title: '[Network] Network events', description: '', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', state: { visualization: { layerId: 'eaadfec7-deaa-4aeb-a403-3b4e516416d2', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.test.ts new file mode 100644 index 0000000000000..f06f478ca0e2b --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiTlsHandshakesLensAttributes } from './kpi_tls_handshakes'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'network', + tabName: 'events', + }, + ]), +})); + +describe('kpiTlsHandshakesLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiTlsHandshakesLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.ts index 343c61dbd2be1..367fe6fd40f6f 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_tls_handshakes.ts @@ -9,7 +9,7 @@ import type { LensAttributes } from '../../types'; export const kpiTlsHandshakesLensAttributes: LensAttributes = { title: '[Network] TLS handshakes', description: '', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', state: { visualization: { layerId: '1f48a633-8eee-45ae-9471-861227e9ca03', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.test.ts new file mode 100644 index 0000000000000..64b9be02a1d18 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUniqueFlowIdsLensAttributes } from './kpi_unique_flow_ids'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'network', + tabName: 'events', + }, + ]), +})); + +describe('kpiUniqueFlowIdsLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUniqueFlowIdsLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.ts index 3646e3c0a70bd..5f31645c75eca 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_flow_ids.ts @@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types'; export const kpiUniqueFlowIdsLensAttributes: LensAttributes = { title: '[Network] Unique flow IDs', description: '', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', state: { visualization: { layerId: '5d46d48f-6ce8-46be-a797-17ad50642564', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.test.ts new file mode 100644 index 0000000000000..8bb98ddaf95cf --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUniquePrivateIpsAreaLensAttributes } from './kpi_unique_private_ips_area'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'network', + tabName: 'events', + }, + ]), +})); + +describe('kpiUniquePrivateIpsAreaLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUniquePrivateIpsAreaLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.ts index 2d3792e399372..394bc227e871c 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_area.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { DESTINATION_CHART_LABEL, SOURCE_CHART_LABEL } from '../../translations'; import type { LensAttributes } from '../../types'; export const kpiUniquePrivateIpsAreaLensAttributes: LensAttributes = { @@ -97,7 +98,7 @@ export const kpiUniquePrivateIpsAreaLensAttributes: LensAttributes = { }, }, '5f317308-cfbb-4ee5-bfb9-07653184fabf': { - label: 'Src.', + label: SOURCE_CHART_LABEL, dataType: 'number', operationType: 'unique_count', scale: 'ratio', @@ -131,7 +132,7 @@ export const kpiUniquePrivateIpsAreaLensAttributes: LensAttributes = { }, }, 'ac1eb80c-ddde-46c4-a90c-400261926762': { - label: 'Dest.', + label: DESTINATION_CHART_LABEL, dataType: 'number', operationType: 'unique_count', scale: 'ratio', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.test.ts new file mode 100644 index 0000000000000..894144d383b58 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUniquePrivateIpsBarLensAttributes } from './kpi_unique_private_ips_bar'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'network', + tabName: 'events', + }, + ]), +})); + +describe('kpiUniquePrivateIpsBarLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUniquePrivateIpsBarLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.ts index bf4ad0e704081..fe4a698aedf5e 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_bar.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { SOURCE_CHART_LABEL, DESTINATION_CHART_LABEL } from '../../translations'; +import { SOURCE_CHART_LABEL, DESTINATION_CHART_LABEL, UNIQUE_COUNT } from '../../translations'; import type { LensAttributes } from '../../types'; export const kpiUniquePrivateIpsBarLensAttributes: LensAttributes = { @@ -90,7 +90,7 @@ export const kpiUniquePrivateIpsBarLensAttributes: LensAttributes = { 'e406bf4f-942b-41ac-b516-edb5cef06ec8': { columns: { '5acd4c9d-dc3b-4b21-9632-e4407944c36d': { - label: SOURCE_CHART_LABEL, + label: UNIQUE_COUNT('source.ip'), dataType: 'number', isBucketed: false, operationType: 'unique_count', @@ -130,7 +130,7 @@ export const kpiUniquePrivateIpsBarLensAttributes: LensAttributes = { '38aa6532-6bf9-4c8f-b2a6-da8d32f7d0d7': { columns: { 'd27e0966-daf9-41f4-9033-230cf1e76dc9': { - label: DESTINATION_CHART_LABEL, + label: UNIQUE_COUNT('destination.ip'), dataType: 'number', isBucketed: false, operationType: 'unique_count', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.test.ts new file mode 100644 index 0000000000000..7d65e042554b3 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUniquePrivateIpsDestinationMetricLensAttributes } from './kpi_unique_private_ips_destination_metric'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'network', + tabName: 'events', + }, + ]), +})); + +describe('kpiUniquePrivateIpsDestinationMetricLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUniquePrivateIpsDestinationMetricLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.ts index a2bccef3b624b..6e3d440619e76 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_destination_metric.ts @@ -48,7 +48,7 @@ export const kpiUniquePrivateIpsDestinationMetricLensAttributes: LensAttributes }, }, title: '[Network] Unique private IPs - destination metric', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', references: [ { id: '{dataViewId}', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.test.ts new file mode 100644 index 0000000000000..88042d8663250 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUniquePrivateIpsSourceMetricLensAttributes } from './kpi_unique_private_ips_source_metric'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'network', + tabName: 'events', + }, + ]), +})); + +describe('kpiUniquePrivateIpsSourceMetricLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUniquePrivateIpsSourceMetricLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.ts index a95745c7b96ed..3f1110d706300 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/network/kpi_unique_private_ips_source_metric.ts @@ -47,7 +47,7 @@ export const kpiUniquePrivateIpsSourceMetricLensAttributes: LensAttributes = { }, }, title: '[Network] Unique private IPs - source metric', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', references: [ { id: '{dataViewId}', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_area.test.ts.snap new file mode 100644 index 0000000000000..11df964f2eca1 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_area.test.ts.snap @@ -0,0 +1,151 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiTotalUsersAreaLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-416b6fad-1923-4f6a-a2df-b223bb287e30", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "416b6fad-1923-4f6a-a2df-b223bb287e30": Object { + "columnOrder": Array [ + "5eea817b-67b7-4268-8ecb-7688d1094721", + "b00c65ea-32be-4163-bfc8-f795b1ef9d06", + ], + "columns": Object { + "5eea817b-67b7-4268-8ecb-7688d1094721": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + "b00c65ea-32be-4163-bfc8-f795b1ef9d06": Object { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Unique count of user.name", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "user.name", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": false, + "yLeft": false, + "yRight": false, + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "labelsOrientation": Object { + "x": 0, + "yLeft": 0, + "yRight": 0, + }, + "layers": Array [ + Object { + "accessors": Array [ + "b00c65ea-32be-4163-bfc8-f795b1ef9d06", + ], + "layerId": "416b6fad-1923-4f6a-a2df-b223bb287e30", + "layerType": "data", + "seriesType": "area", + "xAccessor": "5eea817b-67b7-4268-8ecb-7688d1094721", + }, + ], + "legend": Object { + "isVisible": true, + "position": "right", + }, + "preferredSeriesType": "area", + "tickLabelsVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "[User] Users - area", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_metric.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_metric.test.ts.snap new file mode 100644 index 0000000000000..b53e1bd24d303 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_total_users_metric.test.ts.snap @@ -0,0 +1,97 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiTotalUsersMetricLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-416b6fad-1923-4f6a-a2df-b223bb287e30", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "416b6fad-1923-4f6a-a2df-b223bb287e30": Object { + "columnOrder": Array [ + "3e51b035-872c-4b44-824b-fe069c222e91", + ], + "columns": Object { + "3e51b035-872c-4b44-824b-fe069c222e91": Object { + "dataType": "number", + "isBucketed": false, + "label": " ", + "operationType": "unique_count", + "scale": "ratio", + "sourceField": "user.name", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "3e51b035-872c-4b44-824b-fe069c222e91", + "layerId": "416b6fad-1923-4f6a-a2df-b223bb287e30", + "layerType": "data", + }, + }, + "title": "[User] Users - metric", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentication_metric_failure.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentication_metric_failure.test.ts.snap new file mode 100644 index 0000000000000..37c20b7e80265 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentication_metric_failure.test.ts.snap @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUserAuthenticationsMetricFailureLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-4590dafb-4ac7-45aa-8641-47a3ff0b817c", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "4590dafb-4ac7-45aa-8641-47a3ff0b817c": Object { + "columnOrder": Array [ + "0eb97c09-a351-4280-97da-944e4bd30dd7", + ], + "columns": Object { + "0eb97c09-a351-4280-97da-944e4bd30dd7": Object { + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "event.outcome : \\"failure\\" ", + }, + "isBucketed": false, + "label": "", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "indexRefName": "filter-index-pattern-0", + "key": "query", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "term": Object { + "event.category": "authentication", + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "0eb97c09-a351-4280-97da-944e4bd30dd7", + "layerId": "4590dafb-4ac7-45aa-8641-47a3ff0b817c", + "layerType": "data", + }, + }, + "title": "[Host] User authentications - metric failure ", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_area.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_area.test.ts.snap new file mode 100644 index 0000000000000..1954bccfaffbe --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_area.test.ts.snap @@ -0,0 +1,240 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUserAuthenticationsAreaLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "{dataViewId}", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-31213ae3-905b-4e88-b987-0cccb1f3209f", + "type": "{dataViewId}", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-4590dafb-4ac7-45aa-8641-47a3ff0b817c", + "type": "{dataViewId}", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "31213ae3-905b-4e88-b987-0cccb1f3209f": Object { + "columnOrder": Array [ + "33a6163d-0c0a-451d-aa38-8ca6010dd5bf", + "2b27c80e-a20d-46f1-8fb2-79626ef4563c", + ], + "columns": Object { + "2b27c80e-a20d-46f1-8fb2-79626ef4563c": Object { + "customLabel": true, + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "event.outcome: \\"failure\\" ", + }, + "isBucketed": false, + "label": "Fail", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + "33a6163d-0c0a-451d-aa38-8ca6010dd5bf": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + }, + "incompleteColumns": Object {}, + }, + "4590dafb-4ac7-45aa-8641-47a3ff0b817c": Object { + "columnOrder": Array [ + "49a42fe6-ebe8-4adb-8eed-1966a5297b7e", + "0eb97c09-a351-4280-97da-944e4bd30dd7", + ], + "columns": Object { + "0eb97c09-a351-4280-97da-944e4bd30dd7": Object { + "customLabel": true, + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "event.outcome : \\"success\\" ", + }, + "isBucketed": false, + "label": "Succ.", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + "49a42fe6-ebe8-4adb-8eed-1966a5297b7e": Object { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": Object { + "interval": "auto", + }, + "scale": "interval", + "sourceField": "@timestamp", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "indexRefName": "filter-index-pattern-0", + "key": "query", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "term": Object { + "event.category": "authentication", + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": true, + "yLeft": false, + "yRight": true, + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "labelsOrientation": Object { + "x": 0, + "yLeft": 0, + "yRight": 0, + }, + "layers": Array [ + Object { + "accessors": Array [ + "0eb97c09-a351-4280-97da-944e4bd30dd7", + ], + "layerId": "4590dafb-4ac7-45aa-8641-47a3ff0b817c", + "layerType": "data", + "seriesType": "area", + "xAccessor": "49a42fe6-ebe8-4adb-8eed-1966a5297b7e", + "yConfig": Array [ + Object { + "color": "#54b399", + "forAccessor": "0eb97c09-a351-4280-97da-944e4bd30dd7", + }, + ], + }, + Object { + "accessors": Array [ + "2b27c80e-a20d-46f1-8fb2-79626ef4563c", + ], + "layerId": "31213ae3-905b-4e88-b987-0cccb1f3209f", + "layerType": "data", + "seriesType": "area", + "xAccessor": "33a6163d-0c0a-451d-aa38-8ca6010dd5bf", + "yConfig": Array [ + Object { + "color": "#e7664c", + "forAccessor": "2b27c80e-a20d-46f1-8fb2-79626ef4563c", + }, + ], + }, + ], + "legend": Object { + "isVisible": false, + "position": "right", + "showSingleSeries": false, + }, + "preferredSeriesType": "area", + "tickLabelsVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "[Host] User authentications - area ", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_bar.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_bar.test.ts.snap new file mode 100644 index 0000000000000..5335dca6057a6 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_bar.test.ts.snap @@ -0,0 +1,240 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUserAuthenticationsBarLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-31213ae3-905b-4e88-b987-0cccb1f3209f", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-b9acd453-f476-4467-ad38-203e37b73e55", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "31213ae3-905b-4e88-b987-0cccb1f3209f": Object { + "columnOrder": Array [ + "430e690c-9992-414f-9bce-00812d99a5e7", + "938b445a-a291-4bbc-84fe-4f47b69c20e4", + ], + "columns": Object { + "430e690c-9992-414f-9bce-00812d99a5e7": Object { + "dataType": "string", + "isBucketed": true, + "label": "Filters", + "operationType": "filters", + "params": Object { + "filters": Array [ + Object { + "input": Object { + "language": "kuery", + "query": "event.outcome : \\"success\\" ", + }, + "label": "Succ.", + }, + ], + }, + "scale": "ordinal", + }, + "938b445a-a291-4bbc-84fe-4f47b69c20e4": Object { + "dataType": "number", + "isBucketed": false, + "label": "Succ.", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + }, + "incompleteColumns": Object {}, + }, + "b9acd453-f476-4467-ad38-203e37b73e55": Object { + "columnOrder": Array [ + "e959c351-a3a2-4525-b244-9623f215a8fd", + "c8165fc3-7180-4f1b-8c87-bc3ea04c6df7", + ], + "columns": Object { + "c8165fc3-7180-4f1b-8c87-bc3ea04c6df7": Object { + "dataType": "number", + "isBucketed": false, + "label": "Fail", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + "e959c351-a3a2-4525-b244-9623f215a8fd": Object { + "customLabel": true, + "dataType": "string", + "isBucketed": true, + "label": "Fail", + "operationType": "filters", + "params": Object { + "filters": Array [ + Object { + "input": Object { + "language": "kuery", + "query": "event.outcome:\\"failure\\" ", + }, + "label": "Fail", + }, + ], + }, + "scale": "ordinal", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "indexRefName": "filter-index-pattern-0", + "key": "query", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "term": Object { + "event.category": "authentication", + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "axisTitlesVisibilitySettings": Object { + "x": false, + "yLeft": false, + "yRight": true, + }, + "fittingFunction": "None", + "gridlinesVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "labelsOrientation": Object { + "x": 0, + "yLeft": 0, + "yRight": 0, + }, + "layers": Array [ + Object { + "accessors": Array [ + "938b445a-a291-4bbc-84fe-4f47b69c20e4", + ], + "layerId": "31213ae3-905b-4e88-b987-0cccb1f3209f", + "layerType": "data", + "seriesType": "bar_horizontal_stacked", + "xAccessor": "430e690c-9992-414f-9bce-00812d99a5e7", + "yConfig": Array [], + }, + Object { + "accessors": Array [ + "c8165fc3-7180-4f1b-8c87-bc3ea04c6df7", + ], + "layerId": "b9acd453-f476-4467-ad38-203e37b73e55", + "layerType": "data", + "seriesType": "bar_horizontal_stacked", + "xAccessor": "e959c351-a3a2-4525-b244-9623f215a8fd", + "yConfig": Array [ + Object { + "color": "#e7664c", + "forAccessor": "c8165fc3-7180-4f1b-8c87-bc3ea04c6df7", + }, + ], + }, + ], + "legend": Object { + "isVisible": false, + "position": "right", + "showSingleSeries": false, + }, + "preferredSeriesType": "bar_horizontal_stacked", + "tickLabelsVisibilitySettings": Object { + "x": true, + "yLeft": true, + "yRight": true, + }, + "valueLabels": "hide", + "yLeftExtent": Object { + "mode": "full", + }, + "yRightExtent": Object { + "mode": "full", + }, + }, + }, + "title": "[Host] User authentications - bar ", + "visualizationType": "lnsXY", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_metric_success.test.ts.snap b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_metric_success.test.ts.snap new file mode 100644 index 0000000000000..4cadcaf19e91e --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/__snapshots__/kpi_user_authentications_metric_success.test.ts.snap @@ -0,0 +1,127 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`kpiUserAuthenticationsMetricSuccessLensAttributes should render 1`] = ` +Object { + "description": "", + "references": Array [ + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-current-indexpattern", + "type": "index-pattern", + }, + Object { + "id": "security-solution-my-test", + "name": "indexpattern-datasource-layer-4590dafb-4ac7-45aa-8641-47a3ff0b817c", + "type": "index-pattern", + }, + ], + "state": Object { + "datasourceStates": Object { + "indexpattern": Object { + "layers": Object { + "4590dafb-4ac7-45aa-8641-47a3ff0b817c": Object { + "columnOrder": Array [ + "0eb97c09-a351-4280-97da-944e4bd30dd7", + ], + "columns": Object { + "0eb97c09-a351-4280-97da-944e4bd30dd7": Object { + "customLabel": true, + "dataType": "number", + "filter": Object { + "language": "kuery", + "query": "event.outcome : \\"success\\" ", + }, + "isBucketed": false, + "label": " ", + "operationType": "count", + "scale": "ratio", + "sourceField": "___records___", + }, + }, + "incompleteColumns": Object {}, + }, + }, + }, + }, + "filters": Array [ + Object { + "$state": Object { + "store": "appState", + }, + "meta": Object { + "alias": null, + "disabled": false, + "indexRefName": "filter-index-pattern-0", + "key": "query", + "negate": false, + "type": "custom", + "value": "{\\"bool\\":{\\"filter\\":[{\\"term\\":{\\"event.category\\":\\"authentication\\"}}]}}", + }, + "query": Object { + "bool": Object { + "filter": Array [ + Object { + "term": Object { + "event.category": "authentication", + }, + }, + ], + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "host.id", + "negate": false, + "params": Object { + "query": "123", + }, + "type": "phrase", + }, + "query": Object { + "match_phrase": Object { + "host.id": "123", + }, + }, + }, + Object { + "meta": Object { + "alias": null, + "disabled": false, + "key": "_index", + "negate": false, + "params": Array [ + "auditbeat-mytest-*", + ], + "type": "phrases", + }, + "query": Object { + "bool": Object { + "minimum_should_match": 1, + "should": Array [ + Object { + "match_phrase": Object { + "_index": "auditbeat-mytest-*", + }, + }, + ], + }, + }, + }, + ], + "query": Object { + "language": "kql", + "query": "host.name: *", + }, + "visualization": Object { + "accessor": "0eb97c09-a351-4280-97da-944e4bd30dd7", + "layerId": "4590dafb-4ac7-45aa-8641-47a3ff0b817c", + "layerType": "data", + }, + }, + "title": "[Host] User authentications - metric success ", + "visualizationType": "lnsLegacyMetric", +} +`; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.test.ts new file mode 100644 index 0000000000000..43cb5be3a9735 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiTotalUsersAreaLensAttributes } from './kpi_total_users_area'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'users', + tabName: 'events', + }, + ]), +})); + +describe('kpiTotalUsersAreaLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiTotalUsersAreaLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.ts index d958f9304b8ab..c97748077a6be 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_area.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { UNIQUE_COUNT } from '../../translations'; import type { LensAttributes } from '../../types'; export const kpiTotalUsersAreaLensAttributes: LensAttributes = { @@ -32,7 +33,7 @@ export const kpiTotalUsersAreaLensAttributes: LensAttributes = { customLabel: true, dataType: 'number', isBucketed: false, - label: ' ', + label: UNIQUE_COUNT('user.name'), operationType: 'unique_count', scale: 'ratio', sourceField: 'user.name', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.test.ts new file mode 100644 index 0000000000000..0a5ec9891d26f --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiTotalUsersMetricLensAttributes } from './kpi_total_users_metric'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'users', + tabName: 'events', + }, + ]), +})); + +describe('kpiTotalUsersMetricLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiTotalUsersMetricLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.ts index 08e5756337dce..faa6b62e18b65 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_total_users_metric.ts @@ -19,7 +19,7 @@ export const kpiTotalUsersMetricLensAttributes: LensAttributes = { '3e51b035-872c-4b44-824b-fe069c222e91': { dataType: 'number', isBucketed: false, - label: 'Unique count of user.name', + label: ' ', operationType: 'unique_count', scale: 'ratio', sourceField: 'user.name', @@ -39,7 +39,7 @@ export const kpiTotalUsersMetricLensAttributes: LensAttributes = { }, }, title: '[User] Users - metric', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', references: [ { id: '{dataViewId}', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.test.ts new file mode 100644 index 0000000000000..e251ccf51c5e5 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUserAuthenticationsMetricFailureLensAttributes } from './kpi_user_authentication_metric_failure'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'users', + tabName: 'events', + }, + ]), +})); + +describe('kpiUserAuthenticationsMetricFailureLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUserAuthenticationsMetricFailureLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts index e4690f66998c8..3f421f8a1c30a 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentication_metric_failure.ts @@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types'; export const kpiUserAuthenticationsMetricFailureLensAttributes: LensAttributes = { title: '[Host] User authentications - metric failure ', description: '', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', state: { visualization: { accessor: '0eb97c09-a351-4280-97da-944e4bd30dd7', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.test.ts new file mode 100644 index 0000000000000..b51d3e474a705 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUserAuthenticationsAreaLensAttributes } from './kpi_user_authentications_area'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'users', + tabName: 'events', + }, + ]), +})); + +describe('kpiUserAuthenticationsAreaLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUserAuthenticationsAreaLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts index cf9902bb2413a..d96ea21489bb2 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_area.ts @@ -5,6 +5,7 @@ * 2.0. */ +import { FAIL_CHART_LABEL, SUCCESS_CHART_LABEL } from '../../translations'; import type { LensAttributes } from '../../types'; export const kpiUserAuthenticationsAreaLensAttributes: LensAttributes = { @@ -124,7 +125,7 @@ export const kpiUserAuthenticationsAreaLensAttributes: LensAttributes = { query: 'event.outcome: "failure" ', }, isBucketed: false, - label: 'Fail', + label: FAIL_CHART_LABEL, operationType: 'count', scale: 'ratio', sourceField: '___records___', @@ -157,7 +158,7 @@ export const kpiUserAuthenticationsAreaLensAttributes: LensAttributes = { query: 'event.outcome : "success" ', }, isBucketed: false, - label: 'Succ.', + label: SUCCESS_CHART_LABEL, operationType: 'count', scale: 'ratio', sourceField: '___records___', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.test.ts new file mode 100644 index 0000000000000..41590d330cd45 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_bar.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUserAuthenticationsBarLensAttributes } from './kpi_user_authentications_bar'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'users', + tabName: 'events', + }, + ]), +})); + +describe('kpiUserAuthenticationsBarLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUserAuthenticationsBarLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.test.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.test.ts new file mode 100644 index 0000000000000..570e03325ec34 --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.test.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 { renderHook } from '@testing-library/react-hooks'; +import { wrapper } from '../../mocks'; + +import { useLensAttributes } from '../../use_lens_attributes'; + +import { kpiUserAuthenticationsMetricSuccessLensAttributes } from './kpi_user_authentications_metric_success'; + +jest.mock('../../../../containers/sourcerer', () => ({ + useSourcererDataView: jest.fn().mockReturnValue({ + selectedPatterns: ['auditbeat-mytest-*'], + dataViewId: 'security-solution-my-test', + }), +})); + +jest.mock('../../../../utils/route/use_route_spy', () => ({ + useRouteSpy: jest.fn().mockReturnValue([ + { + detailName: 'mockHost', + pageName: 'users', + tabName: 'events', + }, + ]), +})); + +describe('kpiUserAuthenticationsMetricSuccessLensAttributes', () => { + it('should render', () => { + const { result } = renderHook( + () => + useLensAttributes({ + lensAttributes: kpiUserAuthenticationsMetricSuccessLensAttributes, + stackByField: 'event.dataset', + }), + { wrapper } + ); + + expect(result?.current).toMatchSnapshot(); + }); +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts index 66f30bf2378a8..3af6f5734d458 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/lens_attributes/users/kpi_user_authentications_metric_success.ts @@ -10,7 +10,7 @@ import type { LensAttributes } from '../../types'; export const kpiUserAuthenticationsMetricSuccessLensAttributes: LensAttributes = { title: '[Host] User authentications - metric success ', description: '', - visualizationType: 'lnsMetric', + visualizationType: 'lnsLegacyMetric', state: { visualization: { accessor: '0eb97c09-a351-4280-97da-944e4bd30dd7', diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/mocks.tsx b/x-pack/plugins/security_solution/public/common/components/visualization_actions/mocks.tsx new file mode 100644 index 0000000000000..7f4e7e4e6d6eb --- /dev/null +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/mocks.tsx @@ -0,0 +1,65 @@ +/* + * 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 { cloneDeep } from 'lodash/fp'; + +import { + TestProviders, + mockGlobalState, + SUB_PLUGINS_REDUCER, + kibanaObservable, + createSecuritySolutionStorageMock, +} from '../../mock'; +import type { State } from '../../store'; +import { createStore } from '../../store'; + +export const queryFromSearchBar = { + query: 'host.name: *', + language: 'kql', +}; + +export const filterFromSearchBar = [ + { + meta: { + alias: null, + negate: false, + disabled: false, + type: 'phrase', + key: 'host.id', + params: { + query: '123', + }, + }, + query: { + match_phrase: { + 'host.id': '123', + }, + }, + }, +]; + +export const mockCreateStoreWithQueryFilters = () => { + const { storage } = createSecuritySolutionStorageMock(); + + const state: State = mockGlobalState; + + const myState = cloneDeep(state); + + myState.inputs = { + ...myState.inputs, + global: { + ...myState.inputs.global, + query: queryFromSearchBar, + filters: filterFromSearchBar, + }, + }; + return createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); +}; + +export const wrapper = ({ children }: { children: React.ReactElement }) => ( + {children} +); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/translations.ts b/x-pack/plugins/security_solution/public/common/components/visualization_actions/translations.ts index 9814a98817ef4..4dcceb29323b1 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/translations.ts +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/translations.ts @@ -67,9 +67,41 @@ export const SUCCESS_CHART_LABEL = i18n.translate( } ); +export const AUTHENCICATION_SUCCESS_CHART_LABEL = i18n.translate( + 'xpack.securitySolution.visualizationActions.userAuthentications.authentication.successChartLabel', + { + defaultMessage: 'Success', + } +); + export const FAIL_CHART_LABEL = i18n.translate( 'xpack.securitySolution.visualizationActions.userAuthentications.failChartLabel', { defaultMessage: 'Fail', } ); + +export const AUTHENCICATION_FAILURE_CHART_LABEL = i18n.translate( + 'xpack.securitySolution.visualizationActions.userAuthentications.authentication.failureChartLabel', + { + defaultMessage: 'Failure', + } +); + +export const UNIQUE_COUNT = (field: string) => + i18n.translate('xpack.securitySolution.visualizationActions.uniqueCountLabel', { + values: { field }, + + defaultMessage: 'Unique count of {field}', + }); + +export const TOP_VALUE = (field: string) => + i18n.translate('xpack.securitySolution.visualizationActions.topValueLabel', { + values: { field }, + + defaultMessage: 'Top values of {field}', + }); + +export const COUNT = i18n.translate('xpack.securitySolution.visualizationActions.countLabel', { + defaultMessage: 'Count of records', +}); diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.test.tsx b/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.test.tsx index 7db97ab5526a4..76e2f54c62cea 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.test.tsx +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/use_lens_attributes.test.tsx @@ -6,21 +6,12 @@ */ import { renderHook } from '@testing-library/react-hooks'; -import React from 'react'; -import { cloneDeep } from 'lodash/fp'; -import { - TestProviders, - mockGlobalState, - SUB_PLUGINS_REDUCER, - kibanaObservable, - createSecuritySolutionStorageMock, -} from '../../mock'; import { getExternalAlertLensAttributes } from './lens_attributes/common/external_alert'; import { useLensAttributes } from './use_lens_attributes'; import { hostNameExistsFilter, getHostDetailsPageFilter, getIndexFilters } from './utils'; -import type { State } from '../../store'; -import { createStore } from '../../store'; + +import { filterFromSearchBar, queryFromSearchBar, wrapper } from './mocks'; jest.mock('../../containers/sourcerer', () => ({ useSourcererDataView: jest.fn().mockReturnValue({ @@ -40,51 +31,7 @@ jest.mock('../../utils/route/use_route_spy', () => ({ })); describe('useLensAttributes', () => { - const state: State = mockGlobalState; - const { storage } = createSecuritySolutionStorageMock(); - const queryFromSearchBar = { - query: 'host.name: *', - language: 'kql', - }; - - const filterFromSearchBar = [ - { - meta: { - alias: null, - negate: false, - disabled: false, - type: 'phrase', - key: 'host.id', - params: { - query: '123', - }, - }, - query: { - match_phrase: { - 'host.id': '123', - }, - }, - }, - ]; - let store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage); - - beforeEach(() => { - const myState = cloneDeep(state); - myState.inputs = { - ...myState.inputs, - global: { - ...myState.inputs.global, - query: queryFromSearchBar, - filters: filterFromSearchBar, - }, - }; - store = createStore(myState, SUB_PLUGINS_REDUCER, kibanaObservable, storage); - }); - it('should add query', () => { - const wrapper = ({ children }: { children: React.ReactElement }) => ( - {children} - ); const { result } = renderHook( () => useLensAttributes({ @@ -94,13 +41,10 @@ describe('useLensAttributes', () => { { wrapper } ); - expect(result?.current?.state.query).toEqual({ query: 'host.name: *', language: 'kql' }); + expect(result?.current?.state.query).toEqual(queryFromSearchBar); }); it('should add filters', () => { - const wrapper = ({ children }: { children: React.ReactElement }) => ( - {children} - ); const { result } = renderHook( () => useLensAttributes({ @@ -120,9 +64,6 @@ describe('useLensAttributes', () => { }); it('should add data view id to references', () => { - const wrapper = ({ children }: { children: React.ReactElement }) => ( - {children} - ); const { result } = renderHook( () => useLensAttributes({ 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 0000000000000..9c88f4670db42 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/common/utils/global_query_string/helpers.ts b/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.ts index 63684f1985049..a5f7e93146750 100644 --- a/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.ts +++ b/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.ts @@ -5,8 +5,12 @@ * 2.0. */ -import { parse } from 'query-string'; import { decode, encode } from 'rison-node'; +import type { ParsedQuery } from 'query-string'; +import { parse, stringify } from 'query-string'; +import { url } from '@kbn/kibana-utils-plugin/public'; +import { useHistory } from 'react-router-dom'; +import { useCallback } from 'react'; import { SecurityPageName } from '../../../app/types'; export const isDetectionsPages = (pageName: string) => @@ -40,3 +44,59 @@ export const getParamFromQueryString = ( return Array.isArray(queryParam) ? queryParam[0] : queryParam; }; + +/** + * + * Gets the value of the URL param from the query string. + * It doesn't update when the URL changes. + * + */ +export const useGetInitialUrlParamValue = (urlParamKey: string) => { + // window.location.search provides the most updated representation of the url search. + // It also guarantees that we don't overwrite URL param managed outside react-router. + const getInitialUrlParamValue = useCallback(() => { + const param = getParamFromQueryString( + getQueryStringFromLocation(window.location.search), + urlParamKey + ); + + const decodedParam = decodeRisonUrlState(param ?? undefined); + + return { param, decodedParam }; + }, [urlParamKey]); + + return getInitialUrlParamValue; +}; + +export const encodeQueryString = (urlParams: ParsedQuery): string => + stringify(url.encodeQuery(urlParams), { sort: false, encode: false }); + +export const useReplaceUrlParams = () => { + const history = useHistory(); + + const replaceUrlParams = useCallback( + (params: Array<{ key: string; value: string | null }>) => { + // window.location.search provides the most updated representation of the url search. + // It prevents unnecessary re-renders which useLocation would create because 'replaceUrlParams' does update the location. + // window.location.search also guarantees that we don't overwrite URL param managed outside react-router. + const search = window.location.search; + const urlParams = parse(search, { sort: false }); + + params.forEach(({ key, value }) => { + if (value == null || value === '') { + delete urlParams[key]; + } else { + urlParams[key] = value; + } + }); + + const newSearch = encodeQueryString(urlParams); + + if (getQueryStringFromLocation(search) !== newSearch) { + history.replace({ search: newSearch }); + } + }, + [history] + ); + return replaceUrlParams; +}; diff --git a/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.test.tsx b/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.test.tsx index a400ab24e06dd..dede5125775c4 100644 --- a/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.test.tsx +++ b/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { renderHook } from '@testing-library/react-hooks'; +import { act, renderHook } from '@testing-library/react-hooks'; import { useInitializeUrlParam, useGlobalQueryString, @@ -296,5 +296,33 @@ describe('global query string', () => { expect(mockHistory.replace).not.toHaveBeenCalledWith(); }); + + it('deletes unregistered URL params', async () => { + const urlParamKey = 'testKey'; + const value = '123'; + window.location.search = `?${urlParamKey}=${value}`; + const globalUrlParam = { + [urlParamKey]: value, + }; + const store = makeStore(globalUrlParam); + + const { waitForNextUpdate } = renderHook(() => useSyncGlobalQueryString(), { + wrapper: ({ children }: { children: React.ReactElement }) => ( + {children} + ), + }); + + mockHistory.replace.mockClear(); + + act(() => { + store.dispatch(globalUrlParamActions.deregisterUrlParam({ key: urlParamKey })); + }); + + waitForNextUpdate(); + + expect(mockHistory.replace).toHaveBeenCalledWith({ + search: ``, + }); + }); }); }); diff --git a/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.ts b/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.ts index 09588c7298c09..96834d39fd644 100644 --- a/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.ts +++ b/x-pack/plugins/security_solution/public/common/utils/global_query_string/index.ts @@ -5,20 +5,15 @@ * 2.0. */ -import type * as H from 'history'; -import type { ParsedQuery } from 'query-string'; -import { parse, stringify } from 'query-string'; import { useCallback, useEffect, useMemo } from 'react'; - -import { url } from '@kbn/kibana-utils-plugin/public'; -import { isEmpty, pickBy } from 'lodash/fp'; -import { useHistory } from 'react-router-dom'; +import { difference, isEmpty, pickBy } from 'lodash/fp'; import { useDispatch } from 'react-redux'; +import usePrevious from 'react-use/lib/usePrevious'; import { - decodeRisonUrlState, + encodeQueryString, encodeRisonUrlState, - getParamFromQueryString, - getQueryStringFromLocation, + useGetInitialUrlParamValue, + useReplaceUrlParams, } from './helpers'; import { useShallowEqualSelector } from '../../hooks/use_selector'; import { globalUrlParamActions, globalUrlParamSelectors } from '../../store/global_url_param'; @@ -43,13 +38,10 @@ export const useInitializeUrlParam = ( ) => { const dispatch = useDispatch(); + const getInitialUrlParamValue = useGetInitialUrlParamValue(urlParamKey); + useEffect(() => { - // window.location.search provides the most updated representation of the url search. - // It also guarantees that we don't overwrite URL param managed outside react-router. - const initialValue = getParamFromQueryString( - getQueryStringFromLocation(window.location.search), - urlParamKey - ); + const { param: initialValue, decodedParam: decodedInitialValue } = getInitialUrlParamValue(); dispatch( globalUrlParamActions.registerUrlParam({ @@ -59,7 +51,7 @@ export const useInitializeUrlParam = ( ); // execute consumer initialization - onInitialize(decodeRisonUrlState(initialValue ?? undefined)); + onInitialize(decodedInitialValue); return () => { dispatch(globalUrlParamActions.deregisterUrlParam({ key: urlParamKey })); @@ -103,9 +95,16 @@ export const useGlobalQueryString = (): string => { * - It updates the URL when globalUrlParam store updates. */ export const useSyncGlobalQueryString = () => { - const history = useHistory(); const [{ pageName }] = useRouteSpy(); const globalUrlParam = useShallowEqualSelector(globalUrlParamSelectors.selectGlobalUrlParam); + const previousGlobalUrlParams = usePrevious(globalUrlParam); + const replaceUrlParams = useReplaceUrlParams(); + + // Url params that got deleted from GlobalUrlParams + const unregisteredKeys = useMemo( + () => difference(Object.keys(previousGlobalUrlParams ?? {}), Object.keys(globalUrlParam)), + [previousGlobalUrlParams, globalUrlParam] + ); useEffect(() => { const linkInfo = getLinkInfo(pageName) ?? { skipUrlState: true }; @@ -114,36 +113,16 @@ export const useSyncGlobalQueryString = () => { value: linkInfo.skipUrlState ? null : value, })); - if (params.length > 0) { - // window.location.search provides the most updated representation of the url search. - // It prevents unnecessary re-renders which useLocation would create because 'replaceUrlParams' does update the location. - // window.location.search also guarantees that we don't overwrite URL param managed outside react-router. - replaceUrlParams(params, history, window.location.search); - } - }, [globalUrlParam, pageName, history]); -}; - -const encodeQueryString = (urlParams: ParsedQuery): string => - stringify(url.encodeQuery(urlParams), { sort: false, encode: false }); - -const replaceUrlParams = ( - params: Array<{ key: string; value: string | null }>, - history: H.History, - search: string -) => { - const urlParams = parse(search, { sort: false }); + // Delete unregistered Url params + unregisteredKeys.forEach((key) => { + params.push({ + key, + value: null, + }); + }); - params.forEach(({ key, value }) => { - if (value == null || value === '') { - delete urlParams[key]; - } else { - urlParams[key] = value; + if (params.length > 0) { + replaceUrlParams(params); } - }); - - const newSearch = encodeQueryString(urlParams); - - if (getQueryStringFromLocation(search) !== newSearch) { - history.replace({ search: newSearch }); - } + }, [globalUrlParam, pageName, unregisteredKeys, replaceUrlParams]); }; 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 d34cf07aa9146..139d171088ec9 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 9ba216b80f14e..ffe07bb2c5dfb 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 f30d5aeb598a0..f7628f0014d23 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/alerts_table/timeline_actions/alert_context_menu.tsx b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/alert_context_menu.tsx index 0127fe63efea7..3759178c163b3 100644 --- a/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/alert_context_menu.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/alerts_table/timeline_actions/alert_context_menu.tsx @@ -72,6 +72,8 @@ const AlertContextMenuComponent: React.FC { setPopover(false); }, []); + + const alertId = ecsRowData?.kibana?.alert ? ecsRowData?._id : null; const ruleId = get(0, ecsRowData?.kibana?.alert?.rule?.uuid); const ruleName = get(0, ecsRowData?.kibana?.alert?.rule?.name); @@ -264,7 +266,11 @@ const AlertContextMenuComponent: React.FC )} {isOsqueryFlyoutOpen && agentId && ecsRowData != null && ( - + )} ); 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 0babfc8de387d..4cc5aed8aab69 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 b22d4030384a3..3d817adb2605c 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 5149269c57d9c..0393fcf239f7d 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 9a2138786b3a8..dd2aacef77f65 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 5d1b0f58da6ae..3a732072f2be8 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/jest.config.js b/x-pack/plugins/security_solution/public/jest.config.js index 5eb349b2c16e9..afa3e1b47efd4 100644 --- a/x-pack/plugins/security_solution/public/jest.config.js +++ b/x-pack/plugins/security_solution/public/jest.config.js @@ -14,7 +14,17 @@ module.exports = { coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/security_solution/public', coverageReporters: ['text', 'html'], - collectCoverageFrom: ['/x-pack/plugins/security_solution/public/**/*.{ts,tsx}'], + collectCoverageFrom: [ + '/x-pack/plugins/security_solution/public/**/*.{ts,tsx}', + '!/x-pack/plugins/security_solution/public/*.test.{ts,tsx}', + '!/x-pack/plugins/security_solution/public/{__test__,__snapshots__,__examples__,*mock*,tests,test_helpers,integration_tests,types}/**/*', + '!/x-pack/plugins/security_solution/public/*mock*.{ts,tsx}', + '!/x-pack/plugins/security_solution/public/*.test.{ts,tsx}', + '!/x-pack/plugins/security_solution/public/*.d.ts', + '!/x-pack/plugins/security_solution/public/*.config.ts', + '!/x-pack/plugins/security_solution/public/index.{js,ts,tsx}', + ], + // See: https://github.com/elastic/kibana/issues/117255, the moduleNameMapper creates mocks to avoid memory leaks from kibana core. moduleNameMapper: { 'core/server$': '/x-pack/plugins/security_solution/server/__mocks__/core.mock.ts', diff --git a/x-pack/plugins/security_solution/public/management/components/artifact_list_page/artifact_list_page.tsx b/x-pack/plugins/security_solution/public/management/components/artifact_list_page/artifact_list_page.tsx index 0586034d15550..344dbd6cd8349 100644 --- a/x-pack/plugins/security_solution/public/management/components/artifact_list_page/artifact_list_page.tsx +++ b/x-pack/plugins/security_solution/public/management/components/artifact_list_page/artifact_list_page.tsx @@ -74,6 +74,7 @@ export interface ArtifactListPageProps { allowCardEditAction?: boolean; allowCardDeleteAction?: boolean; allowCardCreateAction?: boolean; + secondaryPageInfo?: React.ReactNode; } export const ArtifactListPage = memo( @@ -82,6 +83,7 @@ export const ArtifactListPage = memo( ArtifactFormComponent, searchableFields = DEFAULT_EXCEPTION_LIST_ITEM_SEARCHABLE_FIELDS, labels: _labels = {}, + secondaryPageInfo, onFormSubmit, flyoutSize, 'data-test-subj': dataTestSubj, @@ -240,6 +242,24 @@ export const ArtifactListPage = memo( setSelectedItemForEdit(undefined); }, []); + const description = useMemo(() => { + const subtitleText = labels.pageAboutInfo ? ( + {labels.pageAboutInfo} + ) : undefined; + const detailedPageInfoElement = secondaryPageInfo ? ( + <> + + {secondaryPageInfo} + + ) : undefined; + return ( + <> + {subtitleText} + {detailedPageInfoElement} + + ); + }, [labels.pageAboutInfo, secondaryPageInfo]); + if (isPageInitializing) { return ; } @@ -249,7 +269,7 @@ export const ArtifactListPage = memo( headerBackComponent={backButtonHeaderComponent} hideHeader={!doesDataExist} title={labels.pageTitle} - subtitle={labels.pageAboutInfo} + subtitle={description} actions={ allowCardCreateAction && ( ( primaryButtonLabel={labels.emptyStatePrimaryButtonLabel} backComponent={backButtonEmptyComponent} data-test-subj={getTestId('emptyState')} + secondaryAboutInfo={secondaryPageInfo} /> ) : ( <> diff --git a/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/artifact_delete_modal.test.ts b/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/integration_tests/artifact_delete_modal.test.ts similarity index 88% rename from x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/artifact_delete_modal.test.ts rename to x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/integration_tests/artifact_delete_modal.test.ts index 57ea165f0b85f..94e2f5c78d912 100644 --- a/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/artifact_delete_modal.test.ts +++ b/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/integration_tests/artifact_delete_modal.test.ts @@ -5,13 +5,13 @@ * 2.0. */ -import type { AppContextTestRender } from '../../../../common/mock/endpoint'; -import type { trustedAppsAllHttpMocks } from '../../../mocks'; -import type { ArtifactListPageRenderingSetup } from '../mocks'; -import { getArtifactListPageRenderingSetup } from '../mocks'; +import type { AppContextTestRender } from '../../../../../common/mock/endpoint'; +import type { trustedAppsAllHttpMocks } from '../../../../mocks'; +import type { ArtifactListPageRenderingSetup } from '../../mocks'; +import { getArtifactListPageRenderingSetup } from '../../mocks'; import { act, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { getDeferred } from '../../../mocks/utils'; +import { getDeferred } from '../../../../mocks/utils'; describe('When displaying the Delete artifact modal in the Artifact List Page', () => { let renderResult: ReturnType; @@ -77,14 +77,12 @@ describe('When displaying the Delete artifact modal in the Artifact List Page', 10000 ); - // FLAKY: https://github.com/elastic/kibana/issues/139527 - it.skip('should show Cancel and Delete buttons enabled', async () => { + it('should show Cancel and Delete buttons enabled', async () => { expect(cancelButton).toBeEnabled(); expect(submitButton).toBeEnabled(); }); - // FLAKY: https://github.com/elastic/kibana/issues/139528 - it.skip('should close modal if Cancel/Close buttons are clicked', async () => { + it('should close modal if Cancel/Close buttons are clicked', async () => { userEvent.click(cancelButton); expect(renderResult.queryByTestId('testPage-deleteModal')).toBeNull(); diff --git a/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/no_data_empty_state.tsx b/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/no_data_empty_state.tsx index e2dfd992f0e80..87fb9414b894a 100644 --- a/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/no_data_empty_state.tsx +++ b/x-pack/plugins/security_solution/public/management/components/artifact_list_page/components/no_data_empty_state.tsx @@ -7,7 +7,7 @@ import React, { memo } from 'react'; import styled, { css } from 'styled-components'; -import { EuiButton, EuiEmptyPrompt } from '@elastic/eui'; +import { EuiButton, EuiEmptyPrompt, EuiSpacer } from '@elastic/eui'; import { ManagementEmptyStateWrapper } from '../../management_empty_state_wrapper'; import { useTestIdGenerator } from '../../../hooks/use_test_id_generator'; @@ -25,6 +25,7 @@ export const NoDataEmptyState = memo<{ /** Should the Add button be disabled */ isAddDisabled?: boolean; backComponent?: React.ReactNode; + secondaryAboutInfo?: React.ReactNode; 'data-test-subj'?: string; }>( ({ @@ -35,6 +36,7 @@ export const NoDataEmptyState = memo<{ titleLabel, aboutInfo, primaryButtonLabel, + secondaryAboutInfo, }) => { const getTestId = useTestIdGenerator(dataTestSubj); @@ -44,7 +46,17 @@ export const NoDataEmptyState = memo<{ data-test-subj={dataTestSubj} iconType="plusInCircle" title={

{titleLabel}

} - body={
{aboutInfo}
} + body={ +
+ {aboutInfo} + {secondaryAboutInfo ? ( + <> + + {secondaryAboutInfo} + + ) : undefined} +
+ } actions={[ { +describe('When using the ArtifactListPage component', () => { let render: ( props?: Partial ) => ReturnType; @@ -64,6 +63,7 @@ describe.skip('When using the ArtifactListPage component', () => { await act(async () => { await waitFor(() => { expect(renderResult.getByTestId('testPage-list')).toBeTruthy(); + expect(mockedApi.responseProvider.trustedAppsList).toHaveBeenCalled(); }); }); @@ -121,11 +121,12 @@ describe.skip('When using the ArtifactListPage component', () => { }); await act(async () => { await waitFor(() => { - expect(getByTestId('tablePagination-20-rows')); + expect(getByTestId('tablePagination-20-rows')).toBeEnabled(); }); }); - act(() => { - userEvent.click(getByTestId('tablePagination-20-rows')); + + userEvent.click(getByTestId('tablePagination-20-rows'), undefined, { + skipPointerEventsCheck: true, }); await waitFor(() => { @@ -139,11 +140,17 @@ describe.skip('When using the ArtifactListPage component', () => { act(() => { switch (action) { case 'delete': - userEvent.click(renderResult.getByTestId('testPage-card-cardDeleteAction')); + userEvent.click( + renderResult.getByTestId('testPage-card-cardDeleteAction'), + undefined, + { skipPointerEventsCheck: true } + ); break; case 'edit': - userEvent.click(renderResult.getByTestId('testPage-card-cardEditAction')); + userEvent.click(renderResult.getByTestId('testPage-card-cardEditAction'), undefined, { + skipPointerEventsCheck: true, + }); break; } }); @@ -156,8 +163,7 @@ describe.skip('When using the ArtifactListPage component', () => { expect(getByTestId('testPage-flyout')).toBeTruthy(); }); - // FLAKY: https://github.com/elastic/kibana/issues/129837 - it.skip('should display the Delete modal when delete action is clicked', async () => { + it('should display the Delete modal when delete action is clicked', async () => { const { getByTestId } = await renderWithListData(); await clickCardAction('delete'); @@ -228,8 +234,7 @@ describe.skip('When using the ArtifactListPage component', () => { }); }); - // FLAKY: https://github.com/elastic/kibana/issues/129837 - it.skip('should persist policy filter to the URL params', async () => { + it('should persist policy filter to the URL params', async () => { const policyId = mockedApi.responseProvider.endpointPackagePolicyList().items[0].id; const firstPolicyTestId = `policiesSelector-popover-items-${policyId}`; @@ -247,9 +252,10 @@ describe.skip('When using the ArtifactListPage component', () => { await waitFor(() => { expect(renderResult.getByTestId(firstPolicyTestId)).toBeTruthy(); }); - userEvent.click(renderResult.getByTestId(firstPolicyTestId)); }); + userEvent.click(renderResult.getByTestId(firstPolicyTestId)); + await waitFor(() => { expect(history.location.search).toMatch(new RegExp(`includedPolicies=${policyId}`)); }); 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 e70383d8251c5..a79cc3cd7ad54 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 97689a790afa1..3b46967c33abf 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 110ddbb53b1b0..10dde22e6083a 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 f888df2099b13..12cec2dd613b5 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 d1c1ea264f863..c2052a4e6401a 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 7479e52edfb07..28fe91999662a 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 556c765296337..0133e09ac7202 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 a90f12bc2d246..36dfc76dc1d9e 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 e4dd30b468127..443eac84c6b18 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/management/pages/host_isolation_exceptions/view/components/form.test.tsx b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/integration_tests/form.test.tsx similarity index 90% rename from x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form.test.tsx rename to x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/integration_tests/form.test.tsx index 4c7ac15a504a7..ec661c9185f4d 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/form.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/components/integration_tests/form.test.tsx @@ -11,26 +11,25 @@ import type { } from '@kbn/securitysolution-io-ts-list-types'; import userEvent from '@testing-library/user-event'; import React from 'react'; -import type { AppContextTestRender } from '../../../../../common/mock/endpoint'; -import { createAppRootMockRenderer } from '../../../../../common/mock/endpoint'; -import { HostIsolationExceptionsList } from '../host_isolation_exceptions_list'; +import type { AppContextTestRender } from '../../../../../../common/mock/endpoint'; +import { createAppRootMockRenderer } from '../../../../../../common/mock/endpoint'; +import { HostIsolationExceptionsList } from '../../host_isolation_exceptions_list'; import { act, waitFor } from '@testing-library/react'; -import { HOST_ISOLATION_EXCEPTIONS_PATH } from '../../../../../../common/constants'; +import { HOST_ISOLATION_EXCEPTIONS_PATH } from '../../../../../../../common/constants'; import { exceptionsListAllHttpMocks, fleetGetEndpointPackagePolicyListHttpMock, -} from '../../../../mocks'; +} from '../../../../../mocks'; import { clickOnEffectedPolicy, isEffectedPolicySelected, -} from '../../../../components/effected_policy_select/test_utils'; -import { BY_POLICY_ARTIFACT_TAG_PREFIX } from '../../../../../../common/endpoint/service/artifacts'; +} from '../../../../../components/effected_policy_select/test_utils'; +import { BY_POLICY_ARTIFACT_TAG_PREFIX } from '../../../../../../../common/endpoint/service/artifacts'; import type { HttpFetchOptionsWithPath } from '@kbn/core/public'; -jest.mock('../../../../../common/components/user_privileges'); +jest.mock('../../../../../../common/components/user_privileges'); -// FLAKY: https://github.com/elastic/kibana/issues/140907 -describe.skip('When on the host isolation exceptions entry form', () => { +describe('When on the host isolation exceptions entry form', () => { let render: () => Promise>; let renderResult: ReturnType; let history: AppContextTestRender['history']; @@ -86,8 +85,7 @@ describe.skip('When on the host isolation exceptions entry form', () => { await render(); }); - // FLAKY: https://github.com/elastic/kibana/issues/140140 - it.skip('should render the form with empty inputs', () => { + it('should render the form with empty inputs', () => { expect(renderResult.getByTestId('hostIsolationExceptions-form-name-input')).toHaveValue(''); expect(renderResult.getByTestId('hostIsolationExceptions-form-ip-input')).toHaveValue(''); expect( @@ -146,16 +144,14 @@ describe.skip('When on the host isolation exceptions entry form', () => { ).toBe(true); }); - // FLAKY: https://github.com/elastic/kibana/issues/139776 - it.skip('should show policy as selected when user clicks on it', async () => { + it('should show policy as selected when user clicks on it', async () => { userEvent.click(renderResult.getByTestId('perPolicy')); await clickOnEffectedPolicy(renderResult); await expect(isEffectedPolicySelected(renderResult)).resolves.toBe(true); }); - // FLAKY: https://github.com/elastic/kibana/issues/139899 - it.skip('should retain the previous policy selection when switching from per-policy to global', async () => { + it('should retain the previous policy selection when switching from per-policy to global', async () => { // move to per-policy and select the first userEvent.click(renderResult.getByTestId('perPolicy')); await clickOnEffectedPolicy(renderResult); diff --git a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/integration_tests/host_isolation_exceptions_list.test.tsx similarity index 74% rename from x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx rename to x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/integration_tests/host_isolation_exceptions_list.test.tsx index 2f0fc55979090..435178f2a0252 100644 --- a/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/host_isolation_exceptions_list.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/host_isolation_exceptions/view/integration_tests/host_isolation_exceptions_list.test.tsx @@ -8,22 +8,21 @@ import { act, fireEvent, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; -import { HOST_ISOLATION_EXCEPTIONS_PATH } from '../../../../../common/constants'; -import type { AppContextTestRender } from '../../../../common/mock/endpoint'; -import { createAppRootMockRenderer } from '../../../../common/mock/endpoint'; -import { HostIsolationExceptionsList } from './host_isolation_exceptions_list'; -import { exceptionsListAllHttpMocks } from '../../../mocks/exceptions_list_http_mocks'; -import { SEARCHABLE_FIELDS } from '../constants'; -import { parseQueryFilterToKQL } from '../../../common/utils'; -import { useUserPrivileges as _useUserPrivileges } from '../../../../common/components/user_privileges'; -import { getUserPrivilegesMockDefaultValue } from '../../../../common/components/user_privileges/__mocks__'; -import { getFirstCard } from '../../../components/artifact_list_page/mocks'; - -jest.mock('../../../../common/components/user_privileges'); +import { HOST_ISOLATION_EXCEPTIONS_PATH } from '../../../../../../common/constants'; +import type { AppContextTestRender } from '../../../../../common/mock/endpoint'; +import { createAppRootMockRenderer } from '../../../../../common/mock/endpoint'; +import { HostIsolationExceptionsList } from '../host_isolation_exceptions_list'; +import { exceptionsListAllHttpMocks } from '../../../../mocks/exceptions_list_http_mocks'; +import { SEARCHABLE_FIELDS } from '../../constants'; +import { parseQueryFilterToKQL } from '../../../../common/utils'; +import { useUserPrivileges as _useUserPrivileges } from '../../../../../common/components/user_privileges'; +import { getUserPrivilegesMockDefaultValue } from '../../../../../common/components/user_privileges/__mocks__'; +import { getFirstCard } from '../../../../components/artifact_list_page/mocks'; + +jest.mock('../../../../../common/components/user_privileges'); const useUserPrivilegesMock = _useUserPrivileges as jest.Mock; -// FLAKY: https://github.com/elastic/kibana/issues/140888 -describe.skip('When on the host isolation exceptions page', () => { +describe('When on the host isolation exceptions page', () => { let render: () => ReturnType; let renderResult: ReturnType; let history: AppContextTestRender['history']; @@ -78,8 +77,7 @@ describe.skip('When on the host isolation exceptions page', () => { ); }); - // FLAKY: https://github.com/elastic/kibana/issues/135587 - it.skip('should hide the Create and Edit actions when host isolation authz is not allowed', async () => { + it('should hide the Create and Edit actions when host isolation authz is not allowed', async () => { // Use case: license downgrade scenario, where user still has entries defined, but no longer // able to create or edit them (only Delete them) const existingPrivileges = useUserPrivilegesMock(); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/endpoint_policy_create_extension/endpoint_policy_create_extension.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/endpoint_policy_create_extension/endpoint_policy_create_extension.tsx index d1223ff14826e..78da8134807f2 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/endpoint_policy_create_extension/endpoint_policy_create_extension.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/endpoint_policy_create_extension/endpoint_policy_create_extension.tsx @@ -8,13 +8,15 @@ import React, { memo, useState, useEffect, useRef, useCallback } from 'react'; import { EuiForm, - EuiCheckbox, EuiRadio, EuiSelect, EuiText, EuiTitle, EuiSpacer, EuiFormRow, + EuiCallOut, + EuiLink, + EuiCode, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import styled from 'styled-components'; @@ -28,7 +30,8 @@ import { EDR_ESSENTIAL, ENDPOINT, INTERACTIVE_ONLY, - PREVENT_MALICIOUS_BEHAVIOR, + NGAV_NOTE, + EDR_NOTE, } from './translations'; const PREFIX = 'endpoint_policy_create_extension'; @@ -41,9 +44,18 @@ const environmentMapping = { }; const endpointPresetsMapping = { - NGAV, - EDREssential: EDR_ESSENTIAL, - EDRComplete: EDR_COMPLETE, + NGAV: { + label: NGAV, + note: NGAV_NOTE, + }, + EDREssential: { + label: EDR_ESSENTIAL, + note: EDR_NOTE, + }, + EDRComplete: { + label: EDR_COMPLETE, + note: EDR_NOTE, + }, }; const cloudEventMapping = { @@ -71,14 +83,20 @@ const HelpTextWithPadding = styled.div` export const EndpointPolicyCreateExtension = memo( ({ newPolicy, onChange }) => { const isPlatinumPlus = useLicense().isPlatinumPlus(); + const isEnterprise = useLicense().isEnterprise(); // / Endpoint Radio Options (NGAV and EDRs) const [endpointPreset, setEndpointPreset] = useState('NGAV'); - const [behaviorProtectionChecked, setBehaviorProtectionChecked] = useState(false); - const [selectedCloudEvent, setSelectedCloudEvent] = useState('ALL_EVENTS'); + const [selectedCloudEvent, setSelectedCloudEvent] = useState('INTERACTIVE_ONLY'); const [selectedEnvironment, setSelectedEnvironment] = useState('endpoint'); const initialRender = useRef(true); + // Show NGAV license note when Gold and below + // Show other licenses note when Platinum and Below + const showNote = + (endpointPreset === 'NGAV' && !isPlatinumPlus) || + (endpointPreset !== 'NGAV' && !isEnterprise); + // Fleet will initialize the create form with a default name for the integrating policy, however, // for endpoint security, we want the user to explicitly type in a name, so we blank it out // only during 1st component render (thus why the eslint disabled rule below). @@ -130,11 +148,6 @@ export const EndpointPolicyCreateExtension = memo) => { setSelectedEnvironment(e?.target?.value as Environment); @@ -170,14 +176,11 @@ export const EndpointPolicyCreateExtension = memo) => { setEndpointPreset(e.target.value as EndpointPreset); }, []); - const onChangeMaliciousBehavior = useCallback((e: React.ChangeEvent) => { - setBehaviorProtectionChecked((checked) => !checked); - }, []); const getEndpointPresetsProps = useCallback( (preset: EndpointPreset) => ({ id: `${PREFIX}_endpoint_preset_${preset}`, - label: endpointPresetsMapping[preset], + label: endpointPresetsMapping[preset].label, value: preset, checked: endpointPreset === preset, onChange: onChangeEndpointPreset, @@ -217,7 +220,7 @@ export const EndpointPolicyCreateExtension = memo ), @@ -252,7 +255,7 @@ export const EndpointPolicyCreateExtension = memo } @@ -266,7 +269,7 @@ export const EndpointPolicyCreateExtension = memo } @@ -280,13 +283,42 @@ export const EndpointPolicyCreateExtension = memo } > + {showNote && ( + <> + + + +

+ {endpointPresetsMapping[endpointPreset].note}{' '} + + + + ), + }} + /> +

+
+
+ + )} ) : ( <> @@ -306,7 +338,11 @@ export const EndpointPolicyCreateExtension = memo {'nginx'}, + postgres: {'postgres'}, + }} /> } @@ -320,43 +356,17 @@ export const EndpointPolicyCreateExtension = memo {'ssh'}, + telnet: {'telnet'}, + }} /> } > - {isPlatinumPlus && ( - <> - - -

- -

-
- - -

- -

-
- - - - )} )} diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/endpoint_policy_create_extension/translations.ts b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/endpoint_policy_create_extension/translations.ts index 66688371b68de..46246176119ae 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/endpoint_policy_create_extension/translations.ts +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/ingest_manager_integration/endpoint_policy_create_extension/translations.ts @@ -10,20 +10,35 @@ import { i18n } from '@kbn/i18n'; export const NGAV = i18n.translate( 'xpack.securitySolution.createPackagePolicy.stepConfigure.endpointDropdownOptionNGAV', { - defaultMessage: 'NGAV', + defaultMessage: 'Next-Generation Antivirus (NGAV)', + } +); + +export const NGAV_NOTE = i18n.translate( + 'xpack.securitySolution.createPackagePolicy.stepConfigure.endpointDropdownOptionNGAVNote', + { + defaultMessage: 'Note: advanced protections require a platinum license level.', } ); export const EDR_ESSENTIAL = i18n.translate( 'xpack.securitySolution.createPackagePolicy.stepConfigure.endpointDropdownOptionEDREssential', { - defaultMessage: 'EDR Essential', + defaultMessage: 'Essential EDR (Endpoint Detection & Response)', } ); export const EDR_COMPLETE = i18n.translate( 'xpack.securitySolution.createPackagePolicy.stepConfigure.endpointDropdownOptionEDRComplete', { - defaultMessage: 'EDR Complete', + defaultMessage: 'Complete EDR (Endpoint Detection & Response)', + } +); + +export const EDR_NOTE = i18n.translate( + 'xpack.securitySolution.createPackagePolicy.stepConfigure.endpointDropdownOptionEDRNote', + { + defaultMessage: + 'Note: advanced protections require a platinum license, and full response capabilities require an enterprise license.', } ); @@ -51,9 +66,3 @@ export const ALL_EVENTS = i18n.translate( defaultMessage: 'All events', } ); -export const PREVENT_MALICIOUS_BEHAVIOR = i18n.translate( - 'xpack.securitySolution.createPackagePolicy.stepConfigure.cloudEventFiltersPreventionMaliciousBehavior', - { - defaultMessage: 'Prevent Malicious Behavior', - } -); diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/artifacts_docs_link.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/artifacts_docs_link.tsx new file mode 100644 index 0000000000000..aed23a9f1e30e --- /dev/null +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/artifacts_docs_link.tsx @@ -0,0 +1,40 @@ +/* + * 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, { memo } from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { EuiLink } from '@elastic/eui'; +import { useKibana } from '../../../../../common/lib/kibana'; + +export const TrustedAppsArtifactsDocsLink = memo(() => { + const { + docLinks: { + links: { securitySolution }, + }, + } = useKibana().services; + + return ( + <> + + + + + + + ); +}); + +TrustedAppsArtifactsDocsLink.displayName = 'TrustedAppsArtifactsDocsLink'; diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.tsx index 333e0da92cceb..90e1dcc1c0c89 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/components/form.tsx @@ -71,6 +71,7 @@ import { } from '../../../../../../common/endpoint/service/artifacts/constants'; import type { ArtifactFormComponentProps } from '../../../../components/artifact_list_page'; import { isGlobalPolicyEffected } from '../../../../components/effected_policy_select/utils'; +import { TrustedAppsArtifactsDocsLink } from './artifacts_docs_link'; interface FieldValidationState { /** If this fields state is invalid. Drives display of errors on the UI */ @@ -419,7 +420,15 @@ export const TrustedAppsForm = memo( {mode === 'create' && ( -

{DETAILS_HEADER_DESCRIPTION}

+

+ {DETAILS_HEADER_DESCRIPTION} + { + <> + + + + } +

)} diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/translations.ts b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/translations.ts index c19b3c78d0f8c..02ada2533f9b8 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/translations.ts +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/translations.ts @@ -25,7 +25,7 @@ export const DETAILS_HEADER_DESCRIPTION = i18n.translate( 'xpack.securitySolution.trustedApps.details.header.description', { defaultMessage: - 'Trusted applications improve performance or alleviate conflicts with other applications running on your hosts.', + 'Add a trusted application to improve performance or alleviate conflicts with other applications running on your hosts. Trusted applications may still generate alerts in some cases.', } ); diff --git a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_list.tsx b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_list.tsx index acb4c4ae13bce..33912a5b795c4 100644 --- a/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_list.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_apps_list.tsx @@ -17,6 +17,7 @@ import { ArtifactListPage } from '../../../components/artifact_list_page'; import { TrustedAppsApiClient } from '../service'; import { TrustedAppsForm } from './components/form'; import { SEARCHABLE_FIELDS } from '../constants'; +import { TrustedAppsArtifactsDocsLink } from './components/artifacts_docs_link'; const TRUSTED_APPS_PAGE_LABELS: ArtifactListPageProps['labels'] = { pageTitle: i18n.translate('xpack.securitySolution.trustedApps.pageTitle', { @@ -24,7 +25,7 @@ const TRUSTED_APPS_PAGE_LABELS: ArtifactListPageProps['labels'] = { }), pageAboutInfo: i18n.translate('xpack.securitySolution.trustedApps.pageAboutInfo', { defaultMessage: - 'Trusted applications improve performance or alleviate conflicts with other applications running on your hosts.', + 'Add a trusted application to improve performance or alleviate conflicts with other applications running on your hosts. Trusted applications may still generate alerts in some cases.', }), pageAddButtonTitle: i18n.translate('xpack.securitySolution.trustedApps.pageAddButtonTitle', { defaultMessage: 'Add trusted application', @@ -92,7 +93,7 @@ const TRUSTED_APPS_PAGE_LABELS: ArtifactListPageProps['labels'] = { }), emptyStateInfo: i18n.translate('xpack.securitySolution.trustedApps.emptyStateInfo', { defaultMessage: - 'Add a trusted application to improve performance or alleviate conflicts with other applications running on your hosts.', + 'Add a trusted application to improve performance or alleviate conflicts with other applications running on your hosts. Trusted applications may still generate alerts in some cases.', }), emptyStatePrimaryButtonLabel: i18n.translate( 'xpack.securitySolution.trustedApps.emptyStatePrimaryButtonLabel', @@ -117,6 +118,7 @@ export const TrustedAppsList = memo(() => { labels={TRUSTED_APPS_PAGE_LABELS} data-test-subj="trustedAppsListPage" searchableFields={SEARCHABLE_FIELDS} + secondaryPageInfo={} /> ); }); 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 c7e7eb411d4f8..b60264b39eaee 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 4f4edd279a568..0000000000000 --- 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 a53ad8d558667..0000000000000 --- 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 998a356bf4f73..055a172e54b73 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 0000000000000..f5b9d0fcafc2a --- /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 58% 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 794b33c6b33ef..b7796d442569d 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 @@ -5,18 +5,26 @@ * 2.0. */ import React, { useEffect, useMemo, useState } from 'react'; -import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiPanel } from '@elastic/eui'; +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,29 +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( () => ({ @@ -67,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, @@ -84,7 +140,7 @@ const EntityAnalyticsHostRiskScoresComponent = () => { const [ isTableLoading, { data, inspect, refetch, isDeprecated, isLicenseValid, isModuleEnabled }, - ] = useHostRiskScore({ + ] = entity.riskScoreHook({ filterQuery: severityFilter, skip: !toggleStatus, pagination: { @@ -95,7 +151,7 @@ const EntityAnalyticsHostRiskScoresComponent = () => { }); useQueryInspector({ - queryId: TABLE_QUERY_ID, + queryId: TABLE_QUERY_ID(riskEntity), loading: isTableLoading, refetch, setQuery, @@ -107,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(); @@ -130,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} @@ -175,15 +221,15 @@ const EntityAnalyticsHostRiskScoresComponent = () => { {i18n.VIEW_ALL} @@ -202,15 +248,18 @@ const EntityAnalyticsHostRiskScoresComponent = () => { items={data ?? []} columns={columns} loading={isTableLoading} - id={TABLE_QUERY_ID} + id={TABLE_QUERY_ID(riskEntity)} /> )} - + {(isTableLoading || isKpiLoading) && ( + + )} + ); }; -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 0000000000000..9ca0f659e14f4 --- /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 05f532617d5cc..0000000000000 --- 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 6ddfd912e832f..0000000000000 --- 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 3b3905d4604a6..0000000000000 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/user_risk_score/index.tsx +++ /dev/null @@ -1,216 +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, EuiPanel } 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'; - -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 && ( - - - - - - - - - )} - - - ); -}; - -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 058033758549a..0000000000000 --- 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 70c304e031163..fe221ee9b0988 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 68b40f581d384..8cd4ee428aeac 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 3ef48810d6094..94fcd69e962c6 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 55dc208ec11c8..d4c4e2b17d115 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 d16e1bec3c36c..ef22f0f60edce 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 2c4181add11cb..a3d3251e4100e 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 9c5671640f87a..00b16daa46109 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 0099ed0df3f09..4cb6507c559f3 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/threat_intelligence/routes.tsx b/x-pack/plugins/security_solution/public/threat_intelligence/routes.tsx index 774d5ea06a350..239ec92d0badd 100644 --- a/x-pack/plugins/security_solution/public/threat_intelligence/routes.tsx +++ b/x-pack/plugins/security_solution/public/threat_intelligence/routes.tsx @@ -11,8 +11,9 @@ import type { SecuritySolutionPluginContext } from '@kbn/threat-intelligence-plu import { THREAT_INTELLIGENCE_BASE_PATH } from '@kbn/threat-intelligence-plugin/public'; import type { SourcererDataView } from '@kbn/threat-intelligence-plugin/public/types'; import type { Store } from 'redux'; +import { useSelector } from 'react-redux'; import { useInvestigateInTimeline } from './use_investigate_in_timeline'; -import { getStore } from '../common/store'; +import { getStore, inputsSelectors } from '../common/store'; import { useKibana } from '../common/lib/kibana'; import { FiltersGlobal } from '../common/components/filters_global'; import { SpyRoute } from '../common/utils/route/spy_routes'; @@ -21,6 +22,8 @@ import { SecurityPageName } from '../app/types'; import type { SecuritySubPluginRoutes } from '../app/types'; import { useSourcererDataView } from '../common/containers/sourcerer'; import { SecuritySolutionPageWrapper } from '../common/components/page_wrapper'; +import { SiemSearchBar } from '../common/components/search_bar'; +import { useGlobalTime } from '../common/containers/use_global_time'; const ThreatIntelligence = memo(() => { const { threatIntelligence } = useKibana().services; @@ -37,6 +40,12 @@ const ThreatIntelligence = memo(() => { sourcererDataView: sourcererDataView as unknown as SourcererDataView, getSecuritySolutionStore: securitySolutionStore, getUseInvestigateInTimeline: useInvestigateInTimeline, + + useQuery: () => useSelector(inputsSelectors.globalQuerySelector()), + useFilters: () => useSelector(inputsSelectors.globalFiltersQuerySelector()), + useGlobalTime, + + SiemSearchBar, }; return ( diff --git a/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/flyout/footer.tsx b/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/flyout/footer.tsx index d768f8aa94645..5c0e1cd813ed1 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/flyout/footer.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/side_panel/event_details/flyout/footer.tsx @@ -63,6 +63,7 @@ export const FlyoutFooterComponent = React.memo( timelineQuery, refetchFlyoutData, }: FlyoutFooterProps & PropsFromRedux) => { + const alertId = detailsEcsData?.kibana?.alert ? detailsEcsData?._id : null; const ruleIndex = useMemo( () => find({ category: 'signal', field: 'signal.rule.index' }, detailsData)?.values ?? @@ -173,7 +174,11 @@ export const FlyoutFooterComponent = React.memo( /> )} {isOsqueryFlyoutOpenWithAgentId && detailsEcsData != null && ( - + )} ); diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.test.tsx b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.test.tsx index 004850ede7d88..7bc64b9900640 100644 --- a/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.test.tsx +++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/body/actions/index.test.tsx @@ -7,12 +7,13 @@ import { mount } from 'enzyme'; import React from 'react'; - +import { TimelineId } from '../../../../../../common/types/timeline'; import { TestProviders, mockTimelineModel, mockTimelineData } from '../../../../../common/mock'; import { Actions, isAlert } from '.'; import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features'; import { mockCasesContract } from '@kbn/cases-plugin/public/mocks'; import { useShallowEqualSelector } from '../../../../../common/hooks/use_selector'; +import { licenseService } from '../../../../../common/hooks/use_license'; jest.mock('../../../../../detections/components/user_info', () => ({ useUserData: jest.fn().mockReturnValue([{ canUserCRUD: true, hasIndexWrite: true }]), @@ -63,6 +64,19 @@ jest.mock('../../../../../common/lib/kibana', () => { }; }); +jest.mock('../../../../../common/hooks/use_license', () => { + const licenseServiceInstance = { + isPlatinumPlus: jest.fn(), + isEnterprise: jest.fn(() => false), + }; + return { + licenseService: licenseServiceInstance, + useLicense: () => { + return licenseServiceInstance; + }, + }; +}); + const defaultProps = { ariaRowindex: 2, checked: false, @@ -122,6 +136,7 @@ describe('Actions', () => { expect(wrapper.find('[data-test-subj="select-event"]').exists()).toBe(false); }); + describe('Alert context menu enabled?', () => { test('it disables for eventType=raw', () => { const wrapper = mount( @@ -225,6 +240,65 @@ describe('Actions', () => { expect(wrapper.find('[data-test-subj="view-in-analyzer"]').exists()).toBe(false); }); + + test('it should not show session view button on action tabs for basic users', () => { + const ecsData = { + ...mockTimelineData[0].ecs, + event: { kind: ['alert'] }, + agent: { type: ['endpoint'] }, + process: { entry_leader: { entity_id: ['test_id'] } }, + }; + + const wrapper = mount( + + + + ); + + expect(wrapper.find('[data-test-subj="session-view-button"]').exists()).toEqual(false); + }); + + test('it should show session view button on action tabs when user access the session viewer via K8S dashboard', () => { + const ecsData = { + ...mockTimelineData[0].ecs, + event: { kind: ['alert'] }, + agent: { type: ['endpoint'] }, + process: { entry_leader: { entity_id: ['test_id'] } }, + }; + + const wrapper = mount( + + + + ); + + expect(wrapper.find('[data-test-subj="session-view-button"]').exists()).toEqual(true); + }); + + test('it should show session view button on action tabs for enterprise users', () => { + const licenseServiceMock = licenseService as jest.Mocked; + + licenseServiceMock.isEnterprise.mockReturnValue(true); + + const ecsData = { + ...mockTimelineData[0].ecs, + event: { kind: ['alert'] }, + agent: { type: ['endpoint'] }, + process: { entry_leader: { entity_id: ['test_id'] } }, + }; + + const wrapper = mount( + + + + ); + + expect(wrapper.find('[data-test-subj="session-view-button"]').exists()).toEqual(true); + }); }); describe('isAlert', () => { 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 831ca2bdc76f6..06edd96073866 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 245150f4fb49d..984f737d9f97d 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 f08b82a490718..67d527817abf4 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 eb53a6a4338a8..461f707e336b3 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 80c7a5a6ff6c8..23705d6bc43be 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/fleet_integration/handlers/create_default_policy.ts b/x-pack/plugins/security_solution/server/fleet_integration/handlers/create_default_policy.ts index 8ffd33e070d98..a2da989a9c08d 100644 --- a/x-pack/plugins/security_solution/server/fleet_integration/handlers/create_default_policy.ts +++ b/x-pack/plugins/security_solution/server/fleet_integration/handlers/create_default_policy.ts @@ -13,11 +13,7 @@ import type { LicenseService } from '../../../common/license/license'; import { isAtLeast } from '../../../common/license/license'; import { ProtectionModes } from '../../../common/endpoint/types'; import type { PolicyConfig } from '../../../common/endpoint/types'; -import type { - AnyPolicyCreateConfig, - PolicyCreateCloudConfig, - PolicyCreateEndpointConfig, -} from '../types'; +import type { AnyPolicyCreateConfig, PolicyCreateEndpointConfig } from '../types'; import { ENDPOINT_CONFIG_PRESET_EDR_ESSENTIAL, ENDPOINT_CONFIG_PRESET_NGAV } from '../constants'; /** @@ -32,7 +28,7 @@ export const createDefaultPolicy = ( : policyConfigFactoryWithoutPaidFeatures(); if (config?.type === 'cloud') { - return getCloudPolicyWithIntegrationConfig(policy, config); + return getCloudPolicyConfig(policy); } return getEndpointPolicyWithIntegrationConfig(policy, config); @@ -95,37 +91,20 @@ const getEndpointPolicyWithIntegrationConfig = ( /** * Retrieve policy for cloud based on the on the cloud integration config */ -const getCloudPolicyWithIntegrationConfig = ( - policy: PolicyConfig, - config: PolicyCreateCloudConfig -): PolicyConfig => { - /** - * Check if the protection is supported, then retrieve Behavior Protection mode based on cloud settings - */ - const getBehaviorProtectionMode = () => { - if (!policy.linux.behavior_protection.supported) { - return ProtectionModes.off; - } - - return config.cloudConfig.preventions.behavior_protection - ? ProtectionModes.prevent - : ProtectionModes.off; - }; - +const getCloudPolicyConfig = (policy: PolicyConfig): PolicyConfig => { + // Disabling all protections, since it's not yet supported on Cloud integrations const protections = { - // Disabling memory_protection, since it's not supported on Cloud integrations memory_protection: { supported: false, mode: ProtectionModes.off, }, malware: { ...policy.linux.malware, - // Disabling Malware protection, since it's not supported on Cloud integrations due to performance reasons mode: ProtectionModes.off, }, behavior_protection: { ...policy.linux.behavior_protection, - mode: getBehaviorProtectionMode(), + mode: ProtectionModes.off, }, }; diff --git a/x-pack/plugins/security_solution/server/fleet_integration/handlers/validate_integration_config.ts b/x-pack/plugins/security_solution/server/fleet_integration/handlers/validate_integration_config.ts index 76bd3e8af93fb..bc58358565817 100644 --- a/x-pack/plugins/security_solution/server/fleet_integration/handlers/validate_integration_config.ts +++ b/x-pack/plugins/security_solution/server/fleet_integration/handlers/validate_integration_config.ts @@ -46,18 +46,6 @@ const validateEndpointIntegrationConfig = ( } }; const validateCloudIntegrationConfig = (config: PolicyCreateCloudConfig, logger: Logger): void => { - if (!config?.cloudConfig?.preventions) { - logger.warn( - 'missing cloudConfig preventions: {preventions : behavior_protection: true / false}' - ); - throwError('invalid value for cloudConfig: missing preventions '); - } - if (typeof config.cloudConfig.preventions.behavior_protection !== 'boolean') { - logger.warn( - `invalid value for cloudConfig preventions behavior_protection: ${config.cloudConfig.preventions.behavior_protection}` - ); - throwError('invalid value for cloudConfig preventions behavior_protection'); - } if (!config?.eventFilters) { logger.warn( `eventFilters is required for cloud integration: {eventFilters : nonInteractiveSession: true / false}` diff --git a/x-pack/plugins/security_solution/server/fleet_integration/types.ts b/x-pack/plugins/security_solution/server/fleet_integration/types.ts index 2d012832f1ae2..0c7a7c17951e6 100644 --- a/x-pack/plugins/security_solution/server/fleet_integration/types.ts +++ b/x-pack/plugins/security_solution/server/fleet_integration/types.ts @@ -18,12 +18,6 @@ export interface PolicyCreateEventFilters { export interface PolicyCreateCloudConfig { type: 'cloud'; - cloudConfig: { - preventions: { - malware: boolean; - behavior_protection: boolean; - }; - }; eventFilters?: PolicyCreateEventFilters; } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts index a147118b782d5..15b6ffe47d349 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/routes/rules/preview_rules_route.ts @@ -182,7 +182,6 @@ export const previewRulesRoute = async ( | 'getState' | 'replaceState' | 'scheduleActions' - | 'scheduleActionsWithSubGroup' | 'setContext' | 'getContext' | 'hasContext' diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/client_for_executors/client.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/client_for_executors/client.ts index 4116848b1ffcf..3c712847851fd 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/client_for_executors/client.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/client_for_executors/client.ts @@ -222,6 +222,7 @@ const normalizeStatusChangeArgs = (args: StatusChangeArgs): NormalizedStatusChan ? { total_search_duration_ms: normalizeDurations(metrics.searchDurations), total_indexing_duration_ms: normalizeDurations(metrics.indexingDurations), + total_enrichment_duration_ms: normalizeDurations(metrics.enrichmentDurations), execution_gap_duration_s: normalizeGap(metrics.executionGap), } : undefined, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/client_for_executors/client_interface.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/client_for_executors/client_interface.ts index 22392e699fcea..5e48a43e949c3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/client_for_executors/client_interface.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/client_for_executors/client_interface.ts @@ -115,5 +115,6 @@ export interface StatusChangeArgs { export interface MetricsArgs { searchDurations?: string[]; indexingDurations?: string[]; + enrichmentDurations?: string[]; executionGap?: Duration; } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/execution_saved_object/saved_objects_type.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/execution_saved_object/saved_objects_type.ts index ac3b28e87e0d9..1e0a2e74cadcd 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/execution_saved_object/saved_objects_type.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/execution_saved_object/saved_objects_type.ts @@ -58,6 +58,9 @@ const ruleExecutionMappings: SavedObjectsType['mappings'] = { total_indexing_duration_ms: { type: 'long', }, + total_enrichment_duration_ms: { + type: 'long', + }, execution_gap_duration_s: { type: 'long', }, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/create_security_rule_type_wrapper.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/create_security_rule_type_wrapper.ts index ae3f310d841c3..05813ed1ee29c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/create_security_rule_type_wrapper.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/create_security_rule_type_wrapper.ts @@ -343,6 +343,7 @@ export const createSecurityRuleTypeWrapper: CreateSecurityRuleTypeWrapper = const warningMessages = result.warningMessages.concat(runResult.warningMessages); result = { bulkCreateTimes: result.bulkCreateTimes.concat(runResult.bulkCreateTimes), + enrichmentTimes: result.enrichmentTimes.concat(runResult.enrichmentTimes), createdSignals, createdSignalsCount: createdSignals.length, errors: result.errors.concat(runResult.errors), @@ -358,6 +359,7 @@ export const createSecurityRuleTypeWrapper: CreateSecurityRuleTypeWrapper = } else { result = { bulkCreateTimes: [], + enrichmentTimes: [], createdSignals: [], createdSignalsCount: 0, errors: [], @@ -434,6 +436,7 @@ export const createSecurityRuleTypeWrapper: CreateSecurityRuleTypeWrapper = metrics: { searchDurations: result.searchAfterTimes, indexingDurations: result.bulkCreateTimes, + enrichmentDurations: result.enrichmentTimes, }, }); } @@ -452,6 +455,7 @@ export const createSecurityRuleTypeWrapper: CreateSecurityRuleTypeWrapper = metrics: { searchDurations: result.searchAfterTimes, indexingDurations: result.bulkCreateTimes, + enrichmentDurations: result.enrichmentTimes, }, }); } @@ -464,6 +468,7 @@ export const createSecurityRuleTypeWrapper: CreateSecurityRuleTypeWrapper = metrics: { searchDurations: result.searchAfterTimes, indexingDurations: result.bulkCreateTimes, + enrichmentDurations: result.enrichmentTimes, }, }); diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/bulk_create_factory.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/bulk_create_factory.ts index 81f15364ff128..95bc32571f6ea 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/bulk_create_factory.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/bulk_create_factory.ts @@ -21,6 +21,7 @@ import type { export interface GenericBulkCreateResponse { success: boolean; bulkCreateDuration: string; + enrichmentDuration: string; createdItemsCount: number; createdItems: Array & { _id: string; _index: string }>; errors: string[]; @@ -45,6 +46,7 @@ export const bulkCreateFactory = return { errors: [], success: true, + enrichmentDuration: '0', bulkCreateDuration: '0', createdItemsCount: 0, createdItems: [], @@ -54,6 +56,24 @@ export const bulkCreateFactory = const start = performance.now(); + let enrichmentsTimeStart = 0; + let enrichmentsTimeFinish = 0; + let enrichAlertsWrapper: typeof enrichAlerts; + if (enrichAlerts) { + enrichAlertsWrapper = async (alerts, params) => { + enrichmentsTimeStart = performance.now(); + try { + const enrichedAlerts = await enrichAlerts(alerts, params); + return enrichedAlerts; + } catch (error) { + ruleExecutionLogger.error(`Enrichments failed ${error}`); + throw error; + } finally { + enrichmentsTimeFinish = performance.now(); + } + }; + } + const { createdAlerts, errors, alertsWereTruncated } = await alertWithPersistence( wrappedDocs.map((doc) => ({ _id: doc._id, @@ -62,7 +82,7 @@ export const bulkCreateFactory = })), refreshForBulkCreate, maxAlerts, - enrichAlerts + enrichAlertsWrapper ); const end = performance.now(); @@ -78,6 +98,7 @@ export const bulkCreateFactory = return { errors: Object.keys(errors), success: false, + enrichmentDuration: makeFloatString(enrichmentsTimeFinish - enrichmentsTimeStart), bulkCreateDuration: makeFloatString(end - start), createdItemsCount: createdAlerts.length, createdItems: createdAlerts, @@ -88,6 +109,7 @@ export const bulkCreateFactory = errors: [], success: true, bulkCreateDuration: makeFloatString(end - start), + enrichmentDuration: makeFloatString(enrichmentsTimeFinish - enrichmentsTimeStart), createdItemsCount: createdAlerts.length, createdItems: createdAlerts, alertsWereTruncated, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts index 403d6542f4f0c..e1af3077ec3e3 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/types.ts @@ -42,6 +42,7 @@ import type { IRuleExecutionLogForExecutors, IRuleExecutionLogService } from '.. export interface SecurityAlertTypeReturnValue { bulkCreateTimes: string[]; + enrichmentTimes: string[]; createdSignalsCount: number; createdSignals: unknown[]; errors: string[]; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/index.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/index.ts index 5d2dcd4a4b3d2..8f23da386f5c7 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/index.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/index.ts @@ -10,6 +10,7 @@ import type { SecurityAlertTypeReturnValue } from '../types'; export const createResultObject = (state: TState) => { const result: SecurityAlertTypeReturnValue = { + enrichmentTimes: [], bulkCreateTimes: [], createdSignalsCount: 0, createdSignals: [], 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 dce3794eaa274..1c18ffdb366ad 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 170799f184f48..bde0e521ccc84 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 0a81f7147a6f2..374cd565a4cdd 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 7786d21c92e1b..84b930fc30b37 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 ecf97a03e2241..f6c591d8922dd 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 2872c1aa509e9..ef67f834a05e3 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 f3858c18a6e24..ab64a125a5449 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 cdc1899aef253..854e7c05f1ee3 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 5a51259d349a8..1e0e64288a25d 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 490b96665a83b..1ecaf2dd8bfd3 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 7ecff1cab054f..0424bd7254237 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 2140870e22d1f..70cfa845453b7 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 b4cb0de511fa2..bda2c0ad53d27 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 b14caa11172a1..e4d55e511c982 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 58dcd2838e887..25fbb268525b3 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 a9838a1be2f72..a5a2a5c4b5f66 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 fa80873d0029a..e28873764450a 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 2ec5b4d9a877b..e48cd55b3dc3d 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 a8f3ebcb02bda..0b21f4e30fe2b 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 08ce349cf9a29..1fe8760875987 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 c81d9e99eb401..db1954bf32d48 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 42cb730b4bd5a..24fbf972f262c 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 5a369c99e1e1f..48b117098e890 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 df742d5e50db7..a94413ddbd695 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 430a6e5f760cf..15d9cfc43b4ff 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 2b85723e10a17..ea752fb3e7534 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 09c799005d1c2..d7d398b93b8c4 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 050a8949db393..391c7550cebef 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 8b409bdb63681..23ffd879c111c 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 cb0f9d549a04e..c9612870bcdd3 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 97867f74d0557..abe9271b83015 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 6fc0a85d8e9cc..b6945f8b9f10f 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 9113f5907dd3b..a60d5015f4c6d 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 6677ce569b493..17cd9c6e16003 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 75bbc1e8b3342..178c5c42f0d67 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 9104509c8576e..1bfe183a5a45a 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 4eb08d21f5e69..b0ec864e40857 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 9acd6f767b61f..405215618b17b 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 8548f32e06a08..909a8474c2080 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 36545e9bff9e6..5f52bf06a19d9 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 f1e0e99c67eca..d0ffb0a05279e 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 4269f229a2ae4..8c5cfff14d6c0 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 93ca073a171ae..3c9adaefa823e 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 d49edc4f123b0..f3debd68ebe0c 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 3b0ca907a7e4c..da1e2ccb8925a 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 41e6366756a05..8f93b61c574a6 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 b93701685a119..781bc1d2e9be7 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 bf1890f548c56..32e148dc25d61 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 283b83874d89c..eee336c3d9b49 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 e0470117bd114..1bb6d123de889 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 f8f9cfad37be4..2a334c80ab68e 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 76b058e65a1ca..54cb615d71560 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 c4f344846bd8f..5926141fdabba 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 e2b483fc9298d..ab75552f7a068 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 018c8d0c9d6d6..8c0b5fbbb435e 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 ddb123498fa8e..d69005491d5e7 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 5186e952ab841..dab57a174fc5b 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 af1c51fa0a15d..c4f932ad4f6cc 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 bc5cc6202093e..bc1faac1570eb 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 63901b5d86aa4..5f5974ad79b95 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 3845a4e1c9a1c..92d1e2ee110f6 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 8847290e99c88..098fc20b7dd0f 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 dfff4d9976356..7896aa38be705 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 167baa27c2fe1..7124819843f76 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 e988bc58b4fe5..c615e34089ee6 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 4ba9330f4a475..81d8782e6ce59 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 040e7791483ee..86cd009618c3a 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 7cdd8c780f786..295fb493e6ed2 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 f3a771f184e66..15a51b88c0975 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 199d7de64979e..1a69f862b6954 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 17aeae26a9836..358419263a30e 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 1cada93687ba6..b61983f423a63 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 493e8dbbd0600..139e05bebcc54 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 72a518d5542e0..f537c79c427e5 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 378a43273394a..9f34837071f79 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 b1e136776c8d7..59eb206ec6bb9 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 59c500d798376..42671c621d45c 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 84cafb61d094d..829a7a90c4228 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 1d4397fbf23dd..badcfa517ab20 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 12b267935e024..a4bda89c20be5 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 d8de82c5251a9..62f31b39b9628 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 f8f9895aa9915..c0d9a50a8a5ca 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 00154239c029f..dd7a0d6c59264 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 0017b57c6dbc5..62cffaebe5b00 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 5931b6c32f0ae..4f6ac0d2e6e9c 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 3e344f4a0b872..2da17b0259f6b 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 264907bd84b60..fc9a4124e2d43 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 59a472b0713d2..0c2c25e53bc31 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 888b6b54cb17d..a8cf9c9f21d74 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 584f87b741a28..93281b57f4294 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 80ad1350df659..a46154a969efb 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 5734ffe4c312a..b0519a0afa475 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 04870a18138e7..3b188fb8a1ad1 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 6f280977acbe9..78989e7934a49 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 c581b4cd72b60..1ba9aa185a726 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 fe9dec0ced231..4f6e6aea313a1 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 e8a6f08922570..640c048d79ce2 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 23531bad359b1..f9a09d4eb6e05 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 ec518694a2549..8648402625a35 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 735baec178a6f..791efdc6463e4 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 6095c3c3a3923..cf2dd80c5fd30 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 49c4f32551554..99bb18ad43560 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 e5b9b9d2b3d0d..f16bdaa569c19 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 79792cad4e962..0c8c3ab14c16a 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 1419e6c36cd2b..ae82beafce000 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 b572bfdbbaef6..0954bde765041 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 70551d2c173d9..790e19aaf182c 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 bf7c616bb33ff..c816403377b76 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 853116822a349..c6fdccd640393 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 85f7502f26e0a..7fc0083fc13c6 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 155afc369af24..9c7dcff92bb1b 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 18b277adc56db..bb3527fac3d49 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 15e02efcb8e4c..dc5ce6e246bf6 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 453c189f75d16..f7603f5b2f8e7 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 d090ae229addd..bf74fe3509c42 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 d06a073fd504c..e92a0cc3ea63d 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 c2d57924a39e4..7d39ad47973d1 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 d46d34a762cce..4ea3feedaa359 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 01a68b944d294..8828b5037ca25 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 7612d79572c17..929d341001807 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 159e0bd1b9e16..c100bcc9bc97a 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 ad92d1b3498e5..eebc12c092152 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 94ad9f0b4bb86..f071d0121932a 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 7d8a1b23585e6..f9ff2bdd02b81 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 ac24c0321f6e3..a69b1acdaff73 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 34722a9bed968..a6b58f03c5bfb 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 64e64c1d919d9..b728070308848 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 33d212c9c5e94..77a7e0080caba 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 2e0c53cead87e..cfade77b3e429 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 cf7557102e203..ce6ef31fa4a10 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 78fea7b5dafe2..2cc55e2b14ffc 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 299fba09b77fc..86093446957ee 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 1cbed1359e9ee..021614c0631c1 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 71f2addd91d80..18fe87682f81e 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 e903dce0ff465..be6ab836b1c0c 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 148ba8c09e88a..4d22e033ac124 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 34870bf55be7d..bd21d631ba81e 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 e1eec9d4e5908..66147953d146d 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 a5b8762ec1aaf..c0338b37b53e3 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 585b74cb73e42..0d230518055f9 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 ccbf96ab79d0a..af6d6bfcb2c5f 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 7518dcdf9a5fe..1fbf08e86b14f 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 a7a9e7ad8f2dc..51088c01c08e2 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 e2f81083938b4..68ba968207510 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 91c5a8b9bc20d..88329c459385f 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 7dfc8b953a4ba..fddf8ca8bed65 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 80720e7aff6ce..fcda83a95bed6 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 f510200c25a6b..f083d6bd84e5b 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 4d33c73f6bbe9..69734f6c2ff47 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 0dddfad517537..b1c3453554cf8 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 3376e777cf48c..0d9d6775ef00b 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 2c39c99f55123..69728373e6c44 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 c9aaa61d367e0..d30dabdd112d7 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 be09aceb67c9d..a2b738be6655e 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 86825d008eeac..9eba65a1e99df 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 3b828c3b868f8..b1d854bc74021 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 e25ef8e452d7e..775470992ae53 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 7e1366d93687f..b14935910b065 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 b9f1fe4cbd7ca..bff307fea840b 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 435ad2fdc4329..fdd4c46e53a2e 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 e843d62e13014..76e89a5d47170 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 09d17c5f088da..d23c3db3c249b 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 8b21e5358f71b..b1cabdf2dc002 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 ea562c183756e..b5dde67696611 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 1acb6b4097abe..034dd2cca73e3 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 633c904fe746c..648c9fb76e85c 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 8ff2741303bd5..d9878e325c37b 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 485c55e14f22b..3535cad547648 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 6297c5b5ca250..05e60d2470536 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 6767d2da121c2..d102a801655e8 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 177f4f5c09e98..c3de284691700 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 13c04ef97a791..6cd4776337537 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 8c880e9dcb09f..b0193afd93c9f 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 49487238f21f8..678d0feea17b0 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 3283c14d9aca0..6375be698d4af 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 8dca090e0f9a6..2110c9652e3b0 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 c62d4384302e7..05ce6140607c7 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 43d7e004867dd..03e739c86e575 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 49ed26fdd2d49..2f5858bf331e2 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 9855381acc3ac..69c6f31579b85 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 4fb01f45f6d5a..a7f57e93cbaf2 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 ed398ed5e9ea2..066b0cbfe8d84 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 21015597f946d..e8119d810dbc8 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 deed8fb00637c..23173232a65da 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 bb5dbe031c7df..3484db354a1d0 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 71d918844b943..6ee8411d989f1 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 1f949b57edc12..41d7c2e58474b 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 90601a72b1b34..fba42b17b4fbb 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 01b6ebd880189..058ff41c7444a 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 d6acdcbc3d06a..b90ac6954163e 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 f0a963883b26d..588708bcef4c8 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 9673e704e4772..fa217cf1cfd87 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 b632697515ada..6e6bbe4bdef10 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/security_solution/server/lib/detection_engine/signals/preview/alert_instance_factory_stub.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/preview/alert_instance_factory_stub.ts index b73119d15077a..a3cf4ebc95d7c 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/preview/alert_instance_factory_stub.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/preview/alert_instance_factory_stub.ts @@ -37,16 +37,6 @@ export const alertInstanceFactoryStub = < meta: { lastScheduledActions: { group: 'default', date: new Date() } }, }); }, - scheduleActionsWithSubGroup( - actionGroup: TActionGroupIds, - subgroup: string, - alertcontext: TInstanceContext - ) { - return new Alert('', { - state: {} as TInstanceState, - meta: { lastScheduledActions: { group: 'default', date: new Date() } }, - }); - }, setContext(alertContext: TInstanceContext) { return new Alert('', { state: {} as TInstanceState, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/create_threat_signals.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/create_threat_signals.ts index d80e5cba026b0..0ab6ec2a01dda 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/create_threat_signals.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/create_threat_signals.ts @@ -65,6 +65,7 @@ export const createThreatSignals = async ({ let results: SearchAfterAndBulkCreateReturnType = { success: true, warning: false, + enrichmentTimes: [], bulkCreateTimes: [], searchAfterTimes: [], lastLookBackDate: null, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/utils.test.ts index 981868589e4a1..0bcdc8450a830 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/utils.test.ts @@ -55,6 +55,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -67,6 +68,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -83,6 +85,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -95,6 +98,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -111,6 +115,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -123,6 +128,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -139,6 +145,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -151,6 +158,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -162,6 +170,7 @@ describe('utils', () => { expect.objectContaining({ searchAfterTimes: ['60'], bulkCreateTimes: ['50'], + enrichmentTimes: ['6'], }) ); }); @@ -172,6 +181,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -184,6 +194,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -296,6 +307,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -307,6 +319,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['30'], // max value from existingResult.searchAfterTimes bulkCreateTimes: ['25'], // max value from existingResult.bulkCreateTimes + enrichmentTimes: ['3'], // max value from existingResult.enrichmentTimes lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -323,6 +336,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -334,6 +348,7 @@ describe('utils', () => { warning: false, searchAfterTimes: [], bulkCreateTimes: [], + enrichmentTimes: [], lastLookBackDate: undefined, createdSignalsCount: 0, createdSignals: [], @@ -345,6 +360,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['30'], // max value from existingResult.searchAfterTimes bulkCreateTimes: ['25'], // max value from existingResult.bulkCreateTimes + enrichmentTimes: ['3'], // max value from existingResult.enrichmentTimes lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -362,6 +378,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], // max is 30 bulkCreateTimes: ['5', '15', '25'], // max is 25 + enrichmentTimes: ['1', '2', '3'], // max is 3 lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -373,6 +390,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), createdSignalsCount: 5, createdSignals: Array(5).fill(sampleSignalHit()), @@ -384,6 +402,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['40', '5', '15'], bulkCreateTimes: ['50', '5', '15'], + enrichmentTimes: ['4', '2', '3'], lastLookBackDate: new Date('2020-09-16T04:34:32.390Z'), createdSignalsCount: 8, createdSignals: Array(8).fill(sampleSignalHit()), @@ -396,6 +415,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['70'], // max value between newResult1 and newResult2 + max array value of existingResult (40 + 30 = 70) bulkCreateTimes: ['75'], // max value between newResult1 and newResult2 + max array value of existingResult (50 + 25 = 75) + enrichmentTimes: ['7'], // max value between newResult1 and newResult2 + max array value of existingResult (4 + 3 = 7) lastLookBackDate: new Date('2020-09-16T04:34:32.390Z'), // max lastLookBackDate createdSignalsCount: 16, // all the signals counted together (8 + 5 + 3) createdSignals: Array(16).fill(sampleSignalHit()), @@ -413,6 +433,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], // max is 30 bulkCreateTimes: ['5', '15', '25'], // max is 25 + enrichmentTimes: ['1', '2', '3'], // max is 3 lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -424,6 +445,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), createdSignalsCount: 5, createdSignals: Array(5).fill(sampleSignalHit()), @@ -435,6 +457,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['40', '5', '15'], bulkCreateTimes: ['50', '5', '15'], + enrichmentTimes: ['5', '2', '3'], lastLookBackDate: new Date('2020-09-16T04:34:32.390Z'), createdSignalsCount: 8, createdSignals: Array(8).fill(sampleSignalHit()), @@ -447,6 +470,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['70'], // max value between newResult1 and newResult2 + max array value of existingResult (40 + 30 = 70) bulkCreateTimes: ['75'], // max value between newResult1 and newResult2 + max array value of existingResult (50 + 25 = 75) + enrichmentTimes: ['8'], // max value between newResult1 and newResult2 + max array value of existingResult (50 + 3 = 8) lastLookBackDate: new Date('2020-09-16T04:34:32.390Z'), // max lastLookBackDate createdSignalsCount: 16, // all the signals counted together (8 + 5 + 3) createdSignals: Array(16).fill(sampleSignalHit()), @@ -464,6 +488,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], // max is 30 bulkCreateTimes: ['5', '15', '25'], // max is 25 + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -475,6 +500,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), createdSignalsCount: 5, createdSignals: Array(5).fill(sampleSignalHit()), @@ -486,6 +512,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['40', '5', '15'], bulkCreateTimes: ['50', '5', '15'], + enrichmentTimes: ['5', '2', '3'], lastLookBackDate: null, createdSignalsCount: 8, createdSignals: Array(8).fill(sampleSignalHit()), @@ -498,6 +525,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['70'], // max value between newResult1 and newResult2 + max array value of existingResult (40 + 30 = 70) bulkCreateTimes: ['75'], // max value between newResult1 and newResult2 + max array value of existingResult (50 + 25 = 75) + enrichmentTimes: ['8'], // max value between newResult1 and newResult2 + max array value of existingResult (5 + 3 = 8) lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), // max lastLookBackDate createdSignalsCount: 16, // all the signals counted together (8 + 5 + 3) createdSignals: Array(16).fill(sampleSignalHit()), @@ -515,6 +543,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -527,6 +556,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['5', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -543,6 +573,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -555,6 +586,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -571,6 +603,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -583,6 +616,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -599,6 +633,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -611,6 +646,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -632,6 +668,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: undefined, createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), @@ -644,6 +681,7 @@ describe('utils', () => { warning: false, searchAfterTimes: ['10', '20', '30'], bulkCreateTimes: ['5', '15', '25'], + enrichmentTimes: ['1', '2', '3'], lastLookBackDate: new Date('2020-09-16T03:34:32.390Z'), createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/utils.ts index bfba9a6fd22a1..a73ead0bf946d 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/threat_mapping/utils.ts @@ -70,6 +70,7 @@ export const combineResults = ( ): SearchAfterAndBulkCreateReturnType => ({ success: currentResult.success === false ? false : newResult.success, warning: currentResult.warning || newResult.warning, + enrichmentTimes: calculateAdditiveMax(currentResult.enrichmentTimes, newResult.enrichmentTimes), bulkCreateTimes: calculateAdditiveMax(currentResult.bulkCreateTimes, newResult.bulkCreateTimes), searchAfterTimes: calculateAdditiveMax( currentResult.searchAfterTimes, @@ -94,6 +95,7 @@ export const combineConcurrentResults = ( const maxedNewResult = newResult.reduce( (accum, item) => { const maxSearchAfterTime = calculateMax(accum.searchAfterTimes, item.searchAfterTimes); + const maxEnrichmentTimes = calculateMax(accum.enrichmentTimes, item.enrichmentTimes); const maxBulkCreateTimes = calculateMax(accum.bulkCreateTimes, item.bulkCreateTimes); const lastLookBackDate = calculateMaxLookBack(accum.lastLookBackDate, item.lastLookBackDate); return { @@ -101,6 +103,7 @@ export const combineConcurrentResults = ( warning: accum.warning || item.warning, searchAfterTimes: [maxSearchAfterTime], bulkCreateTimes: [maxBulkCreateTimes], + enrichmentTimes: [maxEnrichmentTimes], lastLookBackDate, createdSignalsCount: accum.createdSignalsCount + item.createdSignalsCount, createdSignals: [...accum.createdSignals, ...item.createdSignals], @@ -113,6 +116,7 @@ export const combineConcurrentResults = ( warning: false, searchAfterTimes: [], bulkCreateTimes: [], + enrichmentTimes: [], lastLookBackDate: undefined, createdSignalsCount: 0, createdSignals: [], diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts index 93ddadf826d73..f786a28b50044 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/types.ts @@ -286,6 +286,7 @@ export interface SearchAfterAndBulkCreateReturnType { success: boolean; warning: boolean; searchAfterTimes: string[]; + enrichmentTimes: string[]; bulkCreateTimes: string[]; lastLookBackDate: Date | null | undefined; createdSignalsCount: number; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts index d5603130400c7..d80ed256a0de0 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.test.ts @@ -953,6 +953,7 @@ describe('utils', () => { }); const expected: SearchAfterAndBulkCreateReturnType = { bulkCreateTimes: [], + enrichmentTimes: [], createdSignalsCount: 0, createdSignals: [], errors: [], @@ -973,6 +974,7 @@ describe('utils', () => { }); const expected: SearchAfterAndBulkCreateReturnType = { bulkCreateTimes: [], + enrichmentTimes: [], createdSignalsCount: 0, createdSignals: [], errors: [], @@ -1291,6 +1293,7 @@ describe('utils', () => { const searchAfterReturnType = createSearchAfterReturnType(); const expected: SearchAfterAndBulkCreateReturnType = { bulkCreateTimes: [], + enrichmentTimes: [], createdSignalsCount: 0, createdSignals: [], errors: [], @@ -1306,6 +1309,7 @@ describe('utils', () => { test('createSearchAfterReturnType can override all values', () => { const searchAfterReturnType = createSearchAfterReturnType({ bulkCreateTimes: ['123'], + enrichmentTimes: [], createdSignalsCount: 5, createdSignals: Array(5).fill(sampleSignalHit()), errors: ['error 1'], @@ -1317,6 +1321,7 @@ describe('utils', () => { }); const expected: SearchAfterAndBulkCreateReturnType = { bulkCreateTimes: ['123'], + enrichmentTimes: [], createdSignalsCount: 5, createdSignals: Array(5).fill(sampleSignalHit()), errors: ['error 1'], @@ -1337,6 +1342,7 @@ describe('utils', () => { }); const expected: SearchAfterAndBulkCreateReturnType = { bulkCreateTimes: [], + enrichmentTimes: [], createdSignalsCount: 5, createdSignals: Array(5).fill(sampleSignalHit()), errors: ['error 1'], @@ -1355,6 +1361,7 @@ describe('utils', () => { const merged = mergeReturns([createSearchAfterReturnType(), createSearchAfterReturnType()]); const expected: SearchAfterAndBulkCreateReturnType = { bulkCreateTimes: [], + enrichmentTimes: [], createdSignalsCount: 0, createdSignals: [], errors: [], @@ -1411,6 +1418,7 @@ describe('utils', () => { const merged = mergeReturns([ createSearchAfterReturnType({ bulkCreateTimes: ['123'], + enrichmentTimes: [], createdSignalsCount: 3, createdSignals: Array(3).fill(sampleSignalHit()), errors: ['error 1', 'error 2'], @@ -1421,6 +1429,7 @@ describe('utils', () => { }), createSearchAfterReturnType({ bulkCreateTimes: ['456'], + enrichmentTimes: [], createdSignalsCount: 2, createdSignals: Array(2).fill(sampleSignalHit()), errors: ['error 3'], @@ -1433,6 +1442,7 @@ describe('utils', () => { ]); const expected: SearchAfterAndBulkCreateReturnType = { bulkCreateTimes: ['123', '456'], // concatenates the prev and next together + enrichmentTimes: [], createdSignalsCount: 5, // Adds the 3 and 2 together createdSignals: Array(5).fill(sampleSignalHit()), errors: ['error 1', 'error 2', 'error 3'], // concatenates the prev and next together @@ -1452,6 +1462,7 @@ describe('utils', () => { const next: GenericBulkCreateResponse = { success: false, bulkCreateDuration: '100', + enrichmentDuration: '0', createdItemsCount: 1, createdItems: [], errors: ['new error'], @@ -1469,6 +1480,7 @@ describe('utils', () => { const next: GenericBulkCreateResponse = { success: true, bulkCreateDuration: '0', + enrichmentDuration: '0', createdItemsCount: 0, createdItems: [], errors: ['error 1'], @@ -1484,6 +1496,7 @@ describe('utils', () => { const next: GenericBulkCreateResponse = { success: true, bulkCreateDuration: '0', + enrichmentDuration: '0', createdItemsCount: 0, createdItems: [], errors: ['error 2'], diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts index 6030400da2b75..24b5b068d5689 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/signals/utils.ts @@ -649,6 +649,7 @@ export const createSearchAfterReturnType = ({ success, warning, searchAfterTimes, + enrichmentTimes, bulkCreateTimes, lastLookBackDate, createdSignalsCount, @@ -659,6 +660,7 @@ export const createSearchAfterReturnType = ({ success?: boolean | undefined; warning?: boolean; searchAfterTimes?: string[] | undefined; + enrichmentTimes?: string[] | undefined; bulkCreateTimes?: string[] | undefined; lastLookBackDate?: Date | undefined; createdSignalsCount?: number | undefined; @@ -670,6 +672,7 @@ export const createSearchAfterReturnType = ({ success: success ?? true, warning: warning ?? false, searchAfterTimes: searchAfterTimes ?? [], + enrichmentTimes: enrichmentTimes ?? [], bulkCreateTimes: bulkCreateTimes ?? [], lastLookBackDate: lastLookBackDate ?? null, createdSignalsCount: createdSignalsCount ?? 0, @@ -715,6 +718,7 @@ export const addToSearchAfterReturn = ({ current.createdSignalsCount += next.createdItemsCount; current.createdSignals.push(...next.createdItems); current.bulkCreateTimes.push(next.bulkCreateDuration); + current.enrichmentTimes.push(next.enrichmentDuration); current.errors = [...new Set([...current.errors, ...next.errors])]; }; @@ -727,6 +731,7 @@ export const mergeReturns = ( warning: existingWarning, searchAfterTimes: existingSearchAfterTimes, bulkCreateTimes: existingBulkCreateTimes, + enrichmentTimes: existingEnrichmentTimes, lastLookBackDate: existingLastLookBackDate, createdSignalsCount: existingCreatedSignalsCount, createdSignals: existingCreatedSignals, @@ -738,6 +743,7 @@ export const mergeReturns = ( success: newSuccess, warning: newWarning, searchAfterTimes: newSearchAfterTimes, + enrichmentTimes: newEnrichmentTimes, bulkCreateTimes: newBulkCreateTimes, lastLookBackDate: newLastLookBackDate, createdSignalsCount: newCreatedSignalsCount, @@ -750,6 +756,7 @@ export const mergeReturns = ( success: existingSuccess && newSuccess, warning: existingWarning || newWarning, searchAfterTimes: [...existingSearchAfterTimes, ...newSearchAfterTimes], + enrichmentTimes: [...existingEnrichmentTimes, ...newEnrichmentTimes], bulkCreateTimes: [...existingBulkCreateTimes, ...newBulkCreateTimes], lastLookBackDate: newLastLookBackDate ?? existingLastLookBackDate, createdSignalsCount: existingCreatedSignalsCount + newCreatedSignalsCount, diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/artifact.ts b/x-pack/plugins/security_solution/server/lib/telemetry/artifact.ts index 46d0d6e665c4f..07ec2b6f2e49a 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/artifact.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/artifact.ts @@ -26,7 +26,7 @@ class Artifact implements IArtifact { this.receiver = receiver; this.esClusterInfo = await this.receiver.fetchClusterInfo(); const version = this.esClusterInfo?.version?.number; - this.manifestUrl = `${this.CDN_URL}/downloads/endpoint/manifest/artifacts-${version}.zip`; + this.manifestUrl = `${this.CDN_URL}/downloads/kibana/manifest/artifacts-${version}.zip`; } public async getArtifact(name: string): Promise { diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/tasks/configuration.ts b/x-pack/plugins/security_solution/server/lib/telemetry/tasks/configuration.ts index f664fccbf75d8..d266d2f1c7699 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/tasks/configuration.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/tasks/configuration.ts @@ -29,7 +29,7 @@ export function createTelemetryConfigurationTaskConfig() { taskExecutionPeriod: TaskExecutionPeriod ) => { try { - const artifactName = 'telemetry-configuration-v1'; + const artifactName = 'telemetry-buffer-and-batch-sizes-v1'; const configArtifact = (await artifactService.getArtifact( artifactName )) as unknown as TelemetryConfiguration; diff --git a/x-pack/plugins/security_solution/server/usage/collector.ts b/x-pack/plugins/security_solution/server/usage/collector.ts index e14af8c553736..6f526051f17d1 100644 --- a/x-pack/plugins/security_solution/server/usage/collector.ts +++ b/x-pack/plugins/security_solution/server/usage/collector.ts @@ -414,6 +414,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -500,6 +514,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -586,6 +614,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -672,6 +714,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -758,6 +814,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -844,6 +914,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -946,6 +1030,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1032,6 +1130,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1118,6 +1230,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1204,6 +1330,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1290,6 +1430,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1376,6 +1530,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1478,6 +1646,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1564,6 +1746,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1650,6 +1846,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1736,6 +1946,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1822,6 +2046,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', @@ -1908,6 +2146,20 @@ export const registerCollector: RegisterCollector = ({ _meta: { description: 'The min duration' }, }, }, + enrichment_duration: { + max: { + type: 'float', + _meta: { description: 'The max duration' }, + }, + avg: { + type: 'float', + _meta: { description: 'The avg duration' }, + }, + min: { + type: 'float', + _meta: { description: 'The min duration' }, + }, + }, gap_duration: { max: { type: 'float', diff --git a/x-pack/plugins/security_solution/server/usage/detections/rules/get_initial_usage.ts b/x-pack/plugins/security_solution/server/usage/detections/rules/get_initial_usage.ts index eb32c58bda6cf..3ad6b5740b53e 100644 --- a/x-pack/plugins/security_solution/server/usage/detections/rules/get_initial_usage.ts +++ b/x-pack/plugins/security_solution/server/usage/detections/rules/get_initial_usage.ts @@ -144,6 +144,7 @@ export const getInitialSingleEventMetric = (): SingleEventMetric => ({ succeeded: 0, index_duration: getInitialMaxAvgMin(), search_duration: getInitialMaxAvgMin(), + enrichment_duration: getInitialMaxAvgMin(), gap_duration: getInitialMaxAvgMin(), gap_count: 0, }); diff --git a/x-pack/plugins/security_solution/server/usage/detections/rules/get_metrics.mocks.ts b/x-pack/plugins/security_solution/server/usage/detections/rules/get_metrics.mocks.ts index 129d2b32d0b3d..83eb7df28a026 100644 --- a/x-pack/plugins/security_solution/server/usage/detections/rules/get_metrics.mocks.ts +++ b/x-pack/plugins/security_solution/server/usage/detections/rules/get_metrics.mocks.ts @@ -155,6 +155,15 @@ export const getEventLogAllRules = (): SearchResponse ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, threat_match: { @@ -2506,6 +2835,11 @@ export const getEventLogAllRulesResult = (): SingleEventLogStatusMetric => ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, machine_learning: { @@ -2529,6 +2863,11 @@ export const getEventLogAllRulesResult = (): SingleEventLogStatusMetric => ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, query: { @@ -2594,6 +2933,11 @@ export const getEventLogAllRulesResult = (): SingleEventLogStatusMetric => ({ avg: 4246.375, min: 2811, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 6, }, saved_query: { @@ -2617,6 +2961,11 @@ export const getEventLogAllRulesResult = (): SingleEventLogStatusMetric => ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, threshold: { @@ -2640,6 +2989,11 @@ export const getEventLogAllRulesResult = (): SingleEventLogStatusMetric => ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, total: { @@ -2676,6 +3030,11 @@ export const getEventLogElasticRulesResult = (): SingleEventLogStatusMetric => ( avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, threat_match: { @@ -2699,6 +3058,11 @@ export const getEventLogElasticRulesResult = (): SingleEventLogStatusMetric => ( avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, machine_learning: { @@ -2722,6 +3086,11 @@ export const getEventLogElasticRulesResult = (): SingleEventLogStatusMetric => ( avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, query: { @@ -2772,6 +3141,11 @@ export const getEventLogElasticRulesResult = (): SingleEventLogStatusMetric => ( avg: 4141.75, min: 2811, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 4, }, saved_query: { @@ -2795,6 +3169,11 @@ export const getEventLogElasticRulesResult = (): SingleEventLogStatusMetric => ( avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, threshold: { @@ -2818,6 +3197,11 @@ export const getEventLogElasticRulesResult = (): SingleEventLogStatusMetric => ( avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, total: { @@ -2854,6 +3238,11 @@ export const getEventLogCustomRulesResult = (): SingleEventLogStatusMetric => ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, threat_match: { @@ -2877,6 +3266,11 @@ export const getEventLogCustomRulesResult = (): SingleEventLogStatusMetric => ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, machine_learning: { @@ -2900,6 +3294,11 @@ export const getEventLogCustomRulesResult = (): SingleEventLogStatusMetric => ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, query: { @@ -2940,6 +3339,11 @@ export const getEventLogCustomRulesResult = (): SingleEventLogStatusMetric => ({ avg: 4351, min: 3051, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 2, }, saved_query: { @@ -2963,6 +3367,11 @@ export const getEventLogCustomRulesResult = (): SingleEventLogStatusMetric => ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, threshold: { @@ -2986,6 +3395,11 @@ export const getEventLogCustomRulesResult = (): SingleEventLogStatusMetric => ({ avg: 0, min: 0, }, + enrichment_duration: { + max: 0, + avg: 0, + min: 0, + }, gap_count: 0, }, total: { diff --git a/x-pack/plugins/security_solution/server/usage/detections/rules/types.ts b/x-pack/plugins/security_solution/server/usage/detections/rules/types.ts index 499c79b11fcfa..84fb656f793d4 100644 --- a/x-pack/plugins/security_solution/server/usage/detections/rules/types.ts +++ b/x-pack/plugins/security_solution/server/usage/detections/rules/types.ts @@ -85,6 +85,7 @@ export interface SingleEventMetric { succeeded: number; index_duration: MaxAvgMin; search_duration: MaxAvgMin; + enrichment_duration: MaxAvgMin; gap_duration: MaxAvgMin; gap_count: number; } diff --git a/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_type_metrics.test.ts b/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_type_metrics.test.ts index 09a988fbf02ef..693e3579d7c3a 100644 --- a/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_type_metrics.test.ts +++ b/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_type_metrics.test.ts @@ -68,6 +68,21 @@ describe('get_event_log_agg_by_rule_type_metrics', () => { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }); }); diff --git a/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_type_metrics.ts b/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_type_metrics.ts index 6fe8103e29a0d..957f56809d64f 100644 --- a/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_type_metrics.ts +++ b/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_type_metrics.ts @@ -74,6 +74,21 @@ export const getEventLogAggByRuleTypeMetrics = ( field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }; }; diff --git a/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_types_metrics.test.ts b/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_types_metrics.test.ts index 22261ac48812c..4673ca1b6bcb8 100644 --- a/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_types_metrics.test.ts +++ b/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_rule_types_metrics.test.ts @@ -74,6 +74,21 @@ describe('get_event_log_agg_by_rule_types_metrics', () => { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }, }); @@ -139,6 +154,21 @@ describe('get_event_log_agg_by_rule_types_metrics', () => { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }, }); @@ -204,6 +234,21 @@ describe('get_event_log_agg_by_rule_types_metrics', () => { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }, 'siem.indicatorRule': { @@ -263,6 +308,21 @@ describe('get_event_log_agg_by_rule_types_metrics', () => { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }, }); diff --git a/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_statuses.test.ts b/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_statuses.test.ts index 7d474769bd79f..a87046660fe16 100644 --- a/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_statuses.test.ts +++ b/x-pack/plugins/security_solution/server/usage/queries/utils/get_event_log_agg_by_statuses.test.ts @@ -137,6 +137,21 @@ describe('get_event_log_agg_by_statuses', () => { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }, }, @@ -246,6 +261,21 @@ describe('get_event_log_agg_by_statuses', () => { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }, }, @@ -418,6 +448,21 @@ describe('get_event_log_agg_by_statuses', () => { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }, 'siem.thresholdRule': { @@ -477,6 +522,21 @@ describe('get_event_log_agg_by_statuses', () => { field: 'kibana.alert.rule.execution.metrics.total_search_duration_ms', }, }, + maxTotalEnrichmentDuration: { + max: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + minTotalEnrichmentDuration: { + min: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, + avgTotalEnrichmentDuration: { + avg: { + field: 'kibana.alert.rule.execution.metrics.total_enrichment_duration_ms', + }, + }, }, }, }, diff --git a/x-pack/plugins/security_solution/server/usage/queries/utils/transform_single_rule_metric.test.ts b/x-pack/plugins/security_solution/server/usage/queries/utils/transform_single_rule_metric.test.ts index c64f0833fe851..9c5810011a975 100644 --- a/x-pack/plugins/security_solution/server/usage/queries/utils/transform_single_rule_metric.test.ts +++ b/x-pack/plugins/security_solution/server/usage/queries/utils/transform_single_rule_metric.test.ts @@ -85,6 +85,15 @@ describe('transform_single_rule_metric', () => { minTotalSearchDuration: { value: 12, }, + minTotalEnrichmentDuration: { + value: 4, + }, + maxTotalEnrichmentDuration: { + value: 2, + }, + avgTotalEnrichmentDuration: { + value: 12, + }, }, }); @@ -131,6 +140,11 @@ describe('transform_single_rule_metric', () => { avg: 2, min: 9, }, + enrichment_duration: { + max: 2, + avg: 12, + min: 4, + }, gap_count: 4, }); }); diff --git a/x-pack/plugins/security_solution/server/usage/queries/utils/transform_single_rule_metric.ts b/x-pack/plugins/security_solution/server/usage/queries/utils/transform_single_rule_metric.ts index bebd867fb195f..5b3b6f8b7ebb2 100644 --- a/x-pack/plugins/security_solution/server/usage/queries/utils/transform_single_rule_metric.ts +++ b/x-pack/plugins/security_solution/server/usage/queries/utils/transform_single_rule_metric.ts @@ -52,6 +52,11 @@ export const transformSingleRuleMetric = ({ avg: singleMetric.avgTotalSearchDuration.value ?? 0.0, min: singleMetric.minTotalSearchDuration.value ?? 0.0, }, + enrichment_duration: { + max: singleMetric?.maxTotalEnrichmentDuration?.value ?? 0.0, + avg: singleMetric?.avgTotalEnrichmentDuration?.value ?? 0.0, + min: singleMetric?.minTotalEnrichmentDuration?.value ?? 0.0, + }, gap_duration: { max: singleMetric.maxGapDuration.value ?? 0.0, avg: singleMetric.avgGapDuration.value ?? 0.0, diff --git a/x-pack/plugins/security_solution/server/usage/types.ts b/x-pack/plugins/security_solution/server/usage/types.ts index fe7711196303c..a6db2e3d71e91 100644 --- a/x-pack/plugins/security_solution/server/usage/types.ts +++ b/x-pack/plugins/security_solution/server/usage/types.ts @@ -121,6 +121,15 @@ export interface SingleExecutionMetricAgg { minTotalSearchDuration: { value: number | null; }; + maxTotalEnrichmentDuration: { + value: number | null; + }; + avgTotalEnrichmentDuration: { + value: number | null; + }; + minTotalEnrichmentDuration: { + value: number | null; + }; } export interface EventLogTypeStatusAggs { diff --git a/x-pack/plugins/session_view/common/constants.ts b/x-pack/plugins/session_view/common/constants.ts index 85e714cd27cb3..e7efb0b1f11f6 100644 --- a/x-pack/plugins/session_view/common/constants.ts +++ b/x-pack/plugins/session_view/common/constants.ts @@ -48,8 +48,7 @@ export const ALERT_STATUS = { export const LOCAL_STORAGE_DISPLAY_OPTIONS_KEY = 'sessionView:displayOptions'; export const MOUSE_EVENT_PLACEHOLDER = { stopPropagation: () => undefined } as React.MouseEvent; export const DEBOUNCE_TIMEOUT = 500; -export const DEFAULT_TTY_PLAYSPEED_MS = 50; // milliseconds per render loop -export const TTY_LINES_PER_FRAME = 5; // number of lines to print to xterm on each render loop +export const DEFAULT_TTY_PLAYSPEED_MS = 30; // milliseconds per render loop export const TTY_LINES_PRE_SEEK = 200; // number of lines to redraw before the point we are seeking to. export const DEFAULT_TTY_FONT_SIZE = 11; export const DEFAULT_TTY_ROWS = 66; diff --git a/x-pack/plugins/session_view/public/components/session_view/index.test.tsx b/x-pack/plugins/session_view/public/components/session_view/index.test.tsx index e4650ca2eb4f1..8e970b8f50cc6 100644 --- a/x-pack/plugins/session_view/public/components/session_view/index.test.tsx +++ b/x-pack/plugins/session_view/public/components/session_view/index.test.tsx @@ -39,6 +39,8 @@ describe('SessionView component', () => { dispatchEvent: jest.fn(), })), }); + + global.ResizeObserver = require('resize-observer-polyfill'); }); beforeEach(() => { diff --git a/x-pack/plugins/session_view/public/components/session_view_detail_panel/index.tsx b/x-pack/plugins/session_view/public/components/session_view_detail_panel/index.tsx index 947af14db0d2f..7eb01bfb5223f 100644 --- a/x-pack/plugins/session_view/public/components/session_view_detail_panel/index.tsx +++ b/x-pack/plugins/session_view/public/components/session_view_detail_panel/index.tsx @@ -66,10 +66,10 @@ export const SessionViewDetailPanel = ({ }), content: ( ), }, diff --git a/x-pack/plugins/session_view/public/components/tty_player/hooks.test.tsx b/x-pack/plugins/session_view/public/components/tty_player/hooks.test.tsx index 004bd5bc757e0..9f7201492520c 100644 --- a/x-pack/plugins/session_view/public/components/tty_player/hooks.test.tsx +++ b/x-pack/plugins/session_view/public/components/tty_player/hooks.test.tsx @@ -8,11 +8,7 @@ import { renderHook, act } from '@testing-library/react-hooks'; import { sessionViewIOEventsMock } from '../../../common/mocks/responses/session_view_io_events.mock'; import { useIOLines, useXtermPlayer, XtermPlayerDeps } from './hooks'; import { ProcessEventsPage } from '../../../common/types/process_tree'; -import { - DEFAULT_TTY_FONT_SIZE, - DEFAULT_TTY_PLAYSPEED_MS, - TTY_LINES_PER_FRAME, -} from '../../../common/constants'; +import { DEFAULT_TTY_FONT_SIZE, DEFAULT_TTY_PLAYSPEED_MS } from '../../../common/constants'; const VIM_LINE_START = 22; @@ -132,9 +128,7 @@ describe('TTYPlayer/hooks', () => { jest.advanceTimersByTime(DEFAULT_TTY_PLAYSPEED_MS * 10); }); - const expectedLineNumber = Math.min(initialProps.lines.length - 1, TTY_LINES_PER_FRAME * 10); - - expect(result.current.currentLine).toBe(expectedLineNumber); + expect(result.current.currentLine).toBe(10); }); it('allows the user to stop', async () => { @@ -150,9 +144,7 @@ describe('TTYPlayer/hooks', () => { act(() => { jest.advanceTimersByTime(DEFAULT_TTY_PLAYSPEED_MS * 10); }); - const expectedLineNumber = Math.min(initialProps.lines.length - 1, TTY_LINES_PER_FRAME * 10); - - expect(result.current.currentLine).toBe(expectedLineNumber); // should not have advanced + expect(result.current.currentLine).toBe(10); // should not have advanced }); it('should stop when it reaches the end of the array of lines', async () => { @@ -167,6 +159,54 @@ describe('TTYPlayer/hooks', () => { expect(result.current.currentLine).toBe(initialProps.lines.length - 1); }); + it('should not print the first line twice after playback starts', async () => { + const { result, rerender } = renderHook((props) => useXtermPlayer(props), { + initialProps, + }); + + rerender({ ...initialProps, isPlaying: true }); + act(() => { + // advance render loop + jest.advanceTimersByTime(DEFAULT_TTY_PLAYSPEED_MS); + }); + rerender({ ...initialProps, isPlaying: false }); + + expect(result.current.terminal.buffer.active.getLine(0)?.translateToString(true)).toBe('256'); + }); + + it('ensure the first few render loops have printed the right lines', async () => { + const { result, rerender } = renderHook((props) => useXtermPlayer(props), { + initialProps, + }); + + const LOOPS = 6; + + rerender({ ...initialProps, isPlaying: true }); + + act(() => { + // advance render loop + jest.advanceTimersByTime(DEFAULT_TTY_PLAYSPEED_MS * LOOPS); + }); + + rerender({ ...initialProps, isPlaying: false }); + + expect(result.current.terminal.buffer.active.getLine(0)?.translateToString(true)).toBe('256'); + expect(result.current.terminal.buffer.active.getLine(1)?.translateToString(true)).toBe(','); + expect(result.current.terminal.buffer.active.getLine(2)?.translateToString(true)).toBe( + ' Some Companies Puppet instance' + ); + expect(result.current.terminal.buffer.active.getLine(3)?.translateToString(true)).toBe( + ' | | | CentOS Stream release 8 on x86_64' + ); + expect(result.current.terminal.buffer.active.getLine(4)?.translateToString(true)).toBe( + ' *********************** Load average: 1.23, 1.01, 0.63' + ); + expect(result.current.terminal.buffer.active.getLine(5)?.translateToString(true)).toBe( + ' ************************ ' + ); + expect(result.current.currentLine).toBe(LOOPS); + }); + it('will allow a plain text search highlight on the last line printed', async () => { const { result: xTermResult } = renderHook((props) => useXtermPlayer(props), { initialProps, diff --git a/x-pack/plugins/session_view/public/components/tty_player/hooks.ts b/x-pack/plugins/session_view/public/components/tty_player/hooks.ts index 08f163903b0a5..b6891f1dd1d49 100644 --- a/x-pack/plugins/session_view/public/components/tty_player/hooks.ts +++ b/x-pack/plugins/session_view/public/components/tty_player/hooks.ts @@ -29,7 +29,6 @@ import { DEFAULT_TTY_ROWS, DEFAULT_TTY_COLS, TTY_LINE_SPLITTER_REGEX, - TTY_LINES_PER_FRAME, TTY_LINES_PRE_SEEK, } from '../../../common/constants'; @@ -226,6 +225,7 @@ export const useXtermPlayer = ({ if (clear) { linesToPrint = lines.slice(Math.max(0, lineNumber - TTY_LINES_PRE_SEEK), lineNumber + 1); + try { terminal.reset(); terminal.clear(); @@ -234,7 +234,7 @@ export const useXtermPlayer = ({ // there is some random race condition with the jump to feature that causes these calls to error out. } } else { - linesToPrint = lines.slice(lineNumber, lineNumber + TTY_LINES_PER_FRAME); + linesToPrint = lines.slice(lineNumber, lineNumber + 1); } linesToPrint.forEach((line, index) => { @@ -243,7 +243,7 @@ export const useXtermPlayer = ({ } }); }, - [terminal, lines] + [lines, terminal] ); useEffect(() => { @@ -281,12 +281,11 @@ export const useXtermPlayer = ({ useEffect(() => { if (isPlaying) { const timer = setTimeout(() => { - render(currentLine, false); - - if (currentLine === lines.length - 1) { + if (!hasNextPage && currentLine === lines.length - 1) { setIsPlaying(false); } else { - const nextLine = Math.min(lines.length - 1, currentLine + TTY_LINES_PER_FRAME); + const nextLine = Math.min(lines.length - 1, currentLine + 1); + render(nextLine, false); setCurrentLine(nextLine); } }, playSpeed); diff --git a/x-pack/plugins/session_view/public/components/tty_player/index.test.tsx b/x-pack/plugins/session_view/public/components/tty_player/index.test.tsx index a3b5518347ac6..f3332ae5bb7f8 100644 --- a/x-pack/plugins/session_view/public/components/tty_player/index.test.tsx +++ b/x-pack/plugins/session_view/public/components/tty_player/index.test.tsx @@ -28,6 +28,8 @@ describe('TTYPlayer component', () => { dispatchEvent: jest.fn(), })), }); + + global.ResizeObserver = require('resize-observer-polyfill'); }); let render: () => ReturnType; diff --git a/x-pack/plugins/session_view/public/components/tty_player/index.tsx b/x-pack/plugins/session_view/public/components/tty_player/index.tsx index ba57fc9d845cc..c77efc9d8c152 100644 --- a/x-pack/plugins/session_view/public/components/tty_player/index.tsx +++ b/x-pack/plugins/session_view/public/components/tty_player/index.tsx @@ -13,6 +13,7 @@ import { EuiButton, EuiBetaBadge, } from '@elastic/eui'; +import useResizeObserver from 'use-resize-observer'; import { throttle } from 'lodash'; import { ProcessEvent } from '../../../common/types/process_tree'; import { TTYSearchBar } from '../tty_search_bar'; @@ -45,7 +46,7 @@ export const TTYPlayer = ({ autoSeekToEntityId, }: TTYPlayerDeps) => { const ref = useRef(null); - const scrollRef = useRef(null); + const { ref: scrollRef, height: containerHeight = 1 } = useResizeObserver({}); const { data, fetchNextPage, hasNextPage, isFetching, refetch } = useFetchIOEvents(sessionEntityId); @@ -134,7 +135,12 @@ export const TTYPlayer = ({ - + @@ -183,7 +189,7 @@ export const TTYPlayer = ({ textSizer={ { lines, seekToLine: jest.fn(), xTermSearchFn: jest.fn(), + setIsPlaying: jest.fn(), }; }); @@ -59,6 +60,7 @@ describe('TTYSearchBar component', () => { expect(props.xTermSearchFn).toHaveBeenCalledTimes(2); expect(props.xTermSearchFn).toHaveBeenNthCalledWith(1, '', 0); expect(props.xTermSearchFn).toHaveBeenNthCalledWith(2, '-h', 6); + expect(props.setIsPlaying).toHaveBeenCalledWith(false); }); it('calls seekToline and xTermSearchFn when currentMatch changes', async () => { @@ -85,6 +87,7 @@ describe('TTYSearchBar component', () => { expect(props.xTermSearchFn).toHaveBeenNthCalledWith(1, '', 0); expect(props.xTermSearchFn).toHaveBeenNthCalledWith(2, '-h', 6); expect(props.xTermSearchFn).toHaveBeenNthCalledWith(3, '-h', 13); + expect(props.setIsPlaying).toHaveBeenCalledTimes(3); }); it('calls xTermSearchFn with empty query when search is cleared', async () => { @@ -101,5 +104,6 @@ describe('TTYSearchBar component', () => { await new Promise((r) => setTimeout(r, 100)); expect(props.xTermSearchFn).toHaveBeenNthCalledWith(3, '', 0); + expect(props.setIsPlaying).toHaveBeenCalledWith(false); }); }); diff --git a/x-pack/plugins/session_view/public/components/tty_search_bar/index.tsx b/x-pack/plugins/session_view/public/components/tty_search_bar/index.tsx index e41b3b967cfac..18b829127ab2d 100644 --- a/x-pack/plugins/session_view/public/components/tty_search_bar/index.tsx +++ b/x-pack/plugins/session_view/public/components/tty_search_bar/index.tsx @@ -19,15 +19,24 @@ export interface TTYSearchBarDeps { lines: IOLine[]; seekToLine(index: number): void; xTermSearchFn(query: string, index: number): void; + setIsPlaying(value: boolean): void; } -export const TTYSearchBar = ({ lines, seekToLine, xTermSearchFn }: TTYSearchBarDeps) => { +const STRIP_NEWLINES_REGEX = /^(\r\n|\r|\n|\n\r)/; + +export const TTYSearchBar = ({ + lines, + seekToLine, + xTermSearchFn, + setIsPlaying, +}: TTYSearchBarDeps) => { const [currentMatch, setCurrentMatch] = useState(null); const [searchQuery, setSearchQuery] = useState(''); const jumpToMatch = useCallback( (match) => { if (match) { + setIsPlaying(false); const goToLine = lines.indexOf(match.line); seekToLine(goToLine); } @@ -40,7 +49,7 @@ export const TTYSearchBar = ({ lines, seekToLine, xTermSearchFn }: TTYSearchBarD clearTimeout(timeout); }; }, - [lines, seekToLine, xTermSearchFn, searchQuery] + [setIsPlaying, lines, seekToLine, xTermSearchFn, searchQuery] ); const searchResults = useMemo(() => { @@ -53,7 +62,7 @@ export const TTYSearchBar = ({ lines, seekToLine, xTermSearchFn }: TTYSearchBarD const cursorMovement = current.value.match(/^\x1b\[\d+;(\d+)(H|d)/); const regex = new RegExp(searchQuery.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'ig'); const lineMatches = stripAnsi(current.value) - .replace(/^\r|\r?\n/, '') + .replace(STRIP_NEWLINES_REGEX, '') .matchAll(regex); if (lineMatches) { @@ -90,10 +99,14 @@ export const TTYSearchBar = ({ lines, seekToLine, xTermSearchFn }: TTYSearchBarD return matches; }, [searchQuery, lines, jumpToMatch, xTermSearchFn]); - const onSearch = useCallback((query) => { - setSearchQuery(query); - setCurrentMatch(null); - }, []); + const onSearch = useCallback( + (query) => { + setIsPlaying(false); + setSearchQuery(query); + setCurrentMatch(null); + }, + [setIsPlaying] + ); const onSetCurrentMatch = useCallback( (index) => { diff --git a/x-pack/plugins/session_view/public/components/tty_text_sizer/index.test.tsx b/x-pack/plugins/session_view/public/components/tty_text_sizer/index.test.tsx index 489b9da9a7d52..a534cb151a95f 100644 --- a/x-pack/plugins/session_view/public/components/tty_text_sizer/index.test.tsx +++ b/x-pack/plugins/session_view/public/components/tty_text_sizer/index.test.tsx @@ -79,9 +79,15 @@ describe('TTYTextSizer component', () => { it('emits a font size to fit to full screen, when isFullscreen = true', async () => { renderResult = mockedContext.render( - + ); + const zoomFitBtn = renderResult.queryByTestId('sessionView:TTYZoomFit'); + + if (zoomFitBtn) { + userEvent.click(zoomFitBtn); + } + expect(props.onFontSizeChanged).toHaveBeenCalledTimes(1); expect(props.onFontSizeChanged).toHaveBeenCalledWith(FULL_SCREEN_FONT_SIZE); }); diff --git a/x-pack/plugins/session_view/public/components/tty_text_sizer/index.tsx b/x-pack/plugins/session_view/public/components/tty_text_sizer/index.tsx index 42531fc7f5e6c..a2454f8cac28b 100644 --- a/x-pack/plugins/session_view/public/components/tty_text_sizer/index.tsx +++ b/x-pack/plugins/session_view/public/components/tty_text_sizer/index.tsx @@ -65,13 +65,7 @@ export const TTYTextSizer = ({ onFontSizeChanged(newSize); } } - }, [containerHeight, fit, fontSize, onFontSizeChanged, tty?.rows]); - - useEffect(() => { - if (isFullscreen) { - setFit(true); - } - }, [isFullscreen]); + }, [isFullscreen, containerHeight, fit, fontSize, onFontSizeChanged, tty?.rows]); const onToggleFit = useCallback(() => { const newValue = !fit; @@ -100,7 +94,8 @@ export const TTYTextSizer = ({ display={fit ? 'fill' : 'empty'} iconType={fit ? 'expand' : 'minimize'} onClick={onToggleFit} - {...commonButtonProps} + size="s" + color="ghost" /> diff --git a/x-pack/plugins/session_view/server/routes/get_total_io_bytes_route.ts b/x-pack/plugins/session_view/server/routes/get_total_io_bytes_route.ts index 4987c284b6339..081969b66ca43 100644 --- a/x-pack/plugins/session_view/server/routes/get_total_io_bytes_route.ts +++ b/x-pack/plugins/session_view/server/routes/get_total_io_bytes_route.ts @@ -4,16 +4,13 @@ */ import { schema } from '@kbn/config-schema'; import { IRouter } from '@kbn/core/server'; -import { EVENT_ACTION, TIMESTAMP } from '@kbn/rule-data-utils'; +import { EVENT_ACTION } from '@kbn/rule-data-utils'; import { GET_TOTAL_IO_BYTES_ROUTE, PROCESS_EVENTS_INDEX, TOTAL_BYTES_CAPTURED_PROPERTY, - TTY_CHAR_DEVICE_MAJOR_PROPERTY, - TTY_CHAR_DEVICE_MINOR_PROPERTY, - HOST_ID_PROPERTY, + ENTRY_SESSION_ENTITY_ID_PROPERTY, } from '../../common/constants'; -import { getTTYQueryPredicates } from './io_events_route'; export const registerGetTotalIOBytesRoute = (router: IRouter) => { router.get( @@ -30,30 +27,14 @@ export const registerGetTotalIOBytesRoute = (router: IRouter) => { const { sessionEntityId } = request.query; try { - const ttyPredicates = await getTTYQueryPredicates(client, sessionEntityId); - - if (!ttyPredicates) { - return response.ok({ body: { total: 0 } }); - } - const search = await client.search({ index: [PROCESS_EVENTS_INDEX], body: { query: { bool: { must: [ - { term: { [TTY_CHAR_DEVICE_MAJOR_PROPERTY]: ttyPredicates.ttyMajor } }, - { term: { [TTY_CHAR_DEVICE_MINOR_PROPERTY]: ttyPredicates.ttyMinor } }, - { term: { [HOST_ID_PROPERTY]: ttyPredicates.hostId } }, + { term: { [ENTRY_SESSION_ENTITY_ID_PROPERTY]: sessionEntityId } }, { term: { [EVENT_ACTION]: 'text_output' } }, - { - range: { - [TIMESTAMP]: { - gte: ttyPredicates.range[0], - lte: ttyPredicates.range[1], - }, - }, - }, ], }, }, diff --git a/x-pack/plugins/session_view/server/routes/io_events_route.ts b/x-pack/plugins/session_view/server/routes/io_events_route.ts index 52a24708126a5..7a88eacdeed7e 100644 --- a/x-pack/plugins/session_view/server/routes/io_events_route.ts +++ b/x-pack/plugins/session_view/server/routes/io_events_route.ts @@ -8,75 +8,17 @@ import { schema } from '@kbn/config-schema'; import { IRouter } from '@kbn/core/server'; import { EVENT_ACTION, TIMESTAMP } from '@kbn/rule-data-utils'; import type { ElasticsearchClient } from '@kbn/core/server'; -import { parse } from '@kbn/datemath'; import { Aggregate } from '../../common/types/aggregate'; -import { EventAction, EventKind, ProcessEvent } from '../../common/types/process_tree'; +import { EventAction, EventKind } from '../../common/types/process_tree'; import { IO_EVENTS_ROUTE, IO_EVENTS_PER_PAGE, PROCESS_EVENTS_INDEX, ENTRY_SESSION_ENTITY_ID_PROPERTY, - TTY_CHAR_DEVICE_MAJOR_PROPERTY, - TTY_CHAR_DEVICE_MINOR_PROPERTY, - HOST_ID_PROPERTY, PROCESS_ENTITY_ID_PROPERTY, PROCESS_EVENTS_PER_PAGE, } from '../../common/constants'; -/** - * Grabs the most recent event for the session and extracts the TTY char_device - * major/minor numbers, boot id, and session date range to use in querying for tty IO events. - * This is done so that any process from any session that writes to this TTY at the time of - * this session will be shown in the TTY Player. e.g. wall - */ -export const getTTYQueryPredicates = async ( - client: ElasticsearchClient, - sessionEntityId: string -) => { - const lastEventQuery = await client.search({ - index: [PROCESS_EVENTS_INDEX], - body: { - query: { - bool: { - minimum_should_match: 1, - should: [ - { term: { [EVENT_ACTION]: 'fork' } }, - { term: { [EVENT_ACTION]: 'exec' } }, - { term: { [EVENT_ACTION]: 'end' } }, - { term: { [EVENT_ACTION]: 'text_output' } }, - ], - must: [{ term: { [ENTRY_SESSION_ENTITY_ID_PROPERTY]: sessionEntityId } }], - }, - }, - size: 1, - sort: [{ [TIMESTAMP]: 'desc' }], - }, - }); - - const lastEventHits = lastEventQuery.hits.hits; - - if (lastEventHits.length > 0) { - const lastEvent: ProcessEvent = lastEventHits[0]._source as ProcessEvent; - const lastEventTime = lastEvent['@timestamp']; - const rangeEnd = - (lastEventTime && parse(lastEventTime)?.toISOString()) || new Date().toISOString(); - const range = [lastEvent?.process?.entry_leader?.start, rangeEnd]; - const tty = lastEvent?.process?.entry_leader?.tty; - const hostId = lastEvent?.host?.id; - - if (tty?.char_device?.major !== undefined && tty?.char_device?.minor !== undefined && hostId) { - return { - ttyMajor: tty.char_device.major, - ttyMinor: tty.char_device.minor, - hostId, - range, - }; - } - } - - return null; -}; - export const registerIOEventsRoute = (router: IRouter) => { router.get( { @@ -94,30 +36,14 @@ export const registerIOEventsRoute = (router: IRouter) => { const { sessionEntityId, cursor, pageSize = IO_EVENTS_PER_PAGE } = request.query; try { - const ttyPredicates = await getTTYQueryPredicates(client, sessionEntityId); - - if (!ttyPredicates) { - return response.ok({ body: { total: 0, events: [] } }); - } - const search = await client.search({ index: [PROCESS_EVENTS_INDEX], body: { query: { bool: { must: [ - { term: { [TTY_CHAR_DEVICE_MAJOR_PROPERTY]: ttyPredicates.ttyMajor } }, - { term: { [TTY_CHAR_DEVICE_MINOR_PROPERTY]: ttyPredicates.ttyMinor } }, - { term: { [HOST_ID_PROPERTY]: ttyPredicates.hostId } }, + { term: { [ENTRY_SESSION_ENTITY_ID_PROPERTY]: sessionEntityId } }, { term: { [EVENT_ACTION]: 'text_output' } }, - { - range: { - [TIMESTAMP]: { - gte: ttyPredicates.range[0]?.toString(), - lte: ttyPredicates.range[1]?.toString(), - }, - }, - }, ], }, }, diff --git a/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts b/x-pack/plugins/synthetics/common/constants/monitor_defaults.ts index 1d142bbe33c68..a926cba109e62 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/constants/synthetics/rest_api.ts b/x-pack/plugins/synthetics/common/constants/synthetics/rest_api.ts index 7b9a1fe380a69..adea7f323e432 100644 --- a/x-pack/plugins/synthetics/common/constants/synthetics/rest_api.ts +++ b/x-pack/plugins/synthetics/common/constants/synthetics/rest_api.ts @@ -8,4 +8,5 @@ export enum SYNTHETICS_API_URLS { SYNTHETICS_OVERVIEW = '/internal/synthetics/overview', PINGS = '/internal/synthetics/pings', + OVERVIEW_STATUS = `/internal/synthetics/overview/status`, } diff --git a/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts b/x-pack/plugins/synthetics/common/formatters/browser/formatters.ts index f05003f650deb..409f2b44343e8 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,10 +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.CUSTOM_HEARTBEAT_ID]: 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 89bf8793302ba..739c7184e7221 100644 --- a/x-pack/plugins/synthetics/common/formatters/common/formatters.ts +++ b/x-pack/plugins/synthetics/common/formatters/common/formatters.ts @@ -29,6 +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 0dc9b795717a0..5eeb5888255dc 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 5b3737229a129..bec7ceb444845 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/index.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/index.ts index 73355d3144eac..a658a1b8a34ef 100644 --- a/x-pack/plugins/synthetics/common/runtime_types/monitor_management/index.ts +++ b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/index.ts @@ -12,3 +12,4 @@ export * from './monitor_meta_data'; export * from './monitor_types'; export * from './monitor_types_project'; export * from './locations'; +export * from './synthetics_overview_status'; 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 58e3a31df8a37..bbb6eb1bb30d6 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,9 @@ 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, }), ]); @@ -93,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, ]); @@ -150,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, ]); @@ -216,9 +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.CUSTOM_HEARTBEAT_ID]: 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/common/runtime_types/monitor_management/monitor_types_project.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types_project.ts index 6abcf4b832135..cba2f506189e6 100644 --- a/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types_project.ts +++ b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/monitor_types_project.ts @@ -30,7 +30,6 @@ export const ProjectMonitorCodec = t.intersection([ screenshot: ScreenshotOptionCodec, tags: t.union([t.string, t.array(t.string)]), ignoreHTTPSErrors: t.boolean, - apmServiceName: t.string, playwrightOptions: t.record(t.string, t.unknown), filter: t.interface({ match: t.string, diff --git a/x-pack/plugins/threat_intelligence/common/types/component_type.ts b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/synthetics_overview_status.ts similarity index 55% rename from x-pack/plugins/threat_intelligence/common/types/component_type.ts rename to x-pack/plugins/synthetics/common/runtime_types/monitor_management/synthetics_overview_status.ts index d5982b15c3518..afd6579788a99 100644 --- a/x-pack/plugins/threat_intelligence/common/types/component_type.ts +++ b/x-pack/plugins/synthetics/common/runtime_types/monitor_management/synthetics_overview_status.ts @@ -5,10 +5,12 @@ * 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', -} +import * as t from 'io-ts'; + +export const OverviewStatusType = t.type({ + up: t.number, + down: t.number, + disabledCount: t.number, +}); + +export type OverviewStatus = t.TypeOf; diff --git a/x-pack/plugins/synthetics/e2e/journeys/data_view_permissions.ts b/x-pack/plugins/synthetics/e2e/journeys/data_view_permissions.ts index aa29b92b7ea25..e5714234de690 100644 --- a/x-pack/plugins/synthetics/e2e/journeys/data_view_permissions.ts +++ b/x-pack/plugins/synthetics/e2e/journeys/data_view_permissions.ts @@ -6,7 +6,7 @@ */ import { journey, step, expect, before } from '@elastic/synthetics'; -import { callKibana } from '@kbn/apm-plugin/scripts/create_apm_users/helpers/call_kibana'; +import { callKibana } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/helpers/call_kibana'; import { byTestId, waitForLoadingToFinish } from '@kbn/observability-plugin/e2e/utils'; import { loginPageProvider } from '../page_objects/login'; 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 4b4e778b87b9b..6ff7cd651b334 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 be1123b12d417..e5e7c6bbe3781 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 af6799068c278..d37fb8c2a3001 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 932c6344c4716..1267c2ab43c52 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/components/monitors_page/overview/overview/overview_grid.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/overview_grid.tsx index 898e68ba84001..359f292079fdb 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/overview_grid.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/overview_grid.tsx @@ -7,10 +7,17 @@ import React, { useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { i18n } from '@kbn/i18n'; -import { EuiFlexItem, EuiFlexGrid, EuiSpacer, EuiTablePagination } from '@elastic/eui'; +import { + EuiFlexItem, + EuiFlexGrid, + EuiSpacer, + EuiTablePagination, + EuiFlexGroup, +} from '@elastic/eui'; import { selectOverviewState, setOverviewPerPageAction } from '../../../../state/overview'; import { OverviewPaginationInfo } from './overview_pagination_info'; import { OverviewGridItem } from './overview_grid_item'; +import { OverviewStatus } from './overview_status'; export const OverviewGrid = () => { const { @@ -32,6 +39,12 @@ export const OverviewGrid = () => { return loaded ? ( <> + + + + + + diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/overview_status.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/overview_status.tsx new file mode 100644 index 0000000000000..fd7583fe02fab --- /dev/null +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/overview_status.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 { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiSpacer, EuiStat, EuiTitle } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import React, { useEffect } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { clearOverviewStatusErrorAction, selectOverviewStatus } from '../../../../state'; +import { kibanaService } from '../../../../../../utils/kibana_service'; + +function title(t?: number) { + return t ?? '-'; +} + +export function OverviewStatus() { + const { status, statusError } = useSelector(selectOverviewStatus); + const dispatch = useDispatch(); + + useEffect(() => { + if (statusError) { + dispatch(clearOverviewStatusErrorAction()); + kibanaService.toasts.addError(statusError.body as Error, { + title: errorToastTitle, + toastLifeTimeMs: 5000, + }); + } + }, [dispatch, statusError]); + + return ( + + +

{headingText}

+
+ + + + + + + + + + + + +
+ ); +} + +const headingText = i18n.translate('xpack.synthetics.overview.status.headingText', { + defaultMessage: 'Current status', +}); + +const upDescription = i18n.translate('xpack.synthetics.overview.status.up.description', { + defaultMessage: 'Up', +}); + +const downDescription = i18n.translate('xpack.synthetics.overview.status.down.description', { + defaultMessage: 'Down', +}); + +const disabledDescription = i18n.translate( + 'xpack.synthetics.overview.status.disabled.description', + { + defaultMessage: 'Disabled', + } +); + +const errorToastTitle = i18n.translate('xpack.synthetics.overview.status.error.title', { + defaultMessage: 'Unable to get monitor status metrics', +}); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview_page.tsx b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview_page.tsx index 4eb864e7a2a3c..893850e76cb84 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview_page.tsx +++ b/x-pack/plugins/synthetics/public/apps/synthetics/components/monitors_page/overview/overview_page.tsx @@ -14,6 +14,7 @@ import { useEnablement } from '../../../hooks'; import { useSyntheticsRefreshContext } from '../../../contexts/synthetics_refresh_context'; import { fetchMonitorOverviewAction, + fetchOverviewStatusAction, selectOverviewState, selectServiceLocationsState, } from '../../../state'; @@ -52,6 +53,7 @@ export const OverviewPage: React.FC = () => { useEffect(() => { dispatch(fetchMonitorOverviewAction.get(pageState)); + dispatch(fetchOverviewStatusAction.get()); }, [dispatch, pageState]); const { 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 6fed27f2df6b5..e00b54ec4b75d 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/index_status/actions.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/actions.ts index 36e2e2514910e..e522af3bfed7c 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/actions.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/actions.ts @@ -5,10 +5,11 @@ * 2.0. */ -import type { IHttpFetchError } from '@kbn/core-http-browser'; import { createAction } from '@reduxjs/toolkit'; import { StatesIndexStatus } from '../../../../../common/runtime_types'; +import { IHttpSerializedFetchError } from '../utils/http_error'; export const getIndexStatus = createAction('[INDEX STATUS] GET'); export const getIndexStatusSuccess = createAction('[INDEX STATUS] GET SUCCESS'); -export const getIndexStatusFail = createAction('[INDEX STATUS] GET FAIL'); +export const getIndexStatusFail = + createAction('[INDEX STATUS] GET FAIL'); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/index.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/index.ts index f5351c65d0d6b..19ef8f94938a3 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/index.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/index_status/index.ts @@ -6,7 +6,7 @@ */ import { createReducer } from '@reduxjs/toolkit'; -import { IHttpSerializedFetchError, serializeHttpFetchError } from '../utils/http_error'; +import { IHttpSerializedFetchError } from '../utils/http_error'; import { StatesIndexStatus } from '../../../../../common/runtime_types'; import { getIndexStatus, getIndexStatusSuccess, getIndexStatusFail } from './actions'; @@ -33,7 +33,7 @@ export const indexStatusReducer = createReducer(initialState, (builder) => { state.loading = false; }) .addCase(getIndexStatusFail, (state, action) => { - state.error = serializeHttpFetchError(action.payload); + state.error = action.payload; state.loading = false; }); }); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_details/index.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_details/index.ts index a2d9379df778e..b1fb95d5d5ee4 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_details/index.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_details/index.ts @@ -5,9 +5,8 @@ * 2.0. */ -import { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public'; import { createReducer } from '@reduxjs/toolkit'; -import { IHttpSerializedFetchError, serializeHttpFetchError } from '../utils/http_error'; +import { IHttpSerializedFetchError } from '../utils/http_error'; import { getMonitorRecentPingsAction, setMonitorDetailsLocationAction, @@ -47,7 +46,7 @@ export const monitorDetailsReducer = createReducer(initialState, (builder) => { state.loading = false; }) .addCase(getMonitorRecentPingsAction.fail, (state, action) => { - state.error = serializeHttpFetchError(action.payload as IHttpFetchError); + state.error = action.payload; state.loading = false; }) @@ -59,7 +58,7 @@ export const monitorDetailsReducer = createReducer(initialState, (builder) => { state.syntheticsMonitorLoading = false; }) .addCase(getMonitorAction.fail, (state, action) => { - state.error = serializeHttpFetchError(action.payload as IHttpFetchError); + state.error = action.payload; state.syntheticsMonitorLoading = false; }); }); 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 3315719a6bb16..5a8c38284e034 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 @@ -5,14 +5,13 @@ * 2.0. */ -import { IHttpFetchError } from '@kbn/core-http-browser'; import { createAction } from '@reduxjs/toolkit'; import { EncryptedSyntheticsMonitor, MonitorManagementListResult, - MonitorOverviewItem, } from '../../../../../common/runtime_types'; import { createAsyncAction } from '../utils/actions'; +import { IHttpSerializedFetchError } from '../utils/http_error'; import { MonitorListPageState } from './models'; @@ -23,14 +22,15 @@ export const fetchMonitorListAction = createAsyncAction< export interface UpsertMonitorRequest { id: string; - monitor: EncryptedSyntheticsMonitor | MonitorOverviewItem; + monitor: Partial; } export const fetchUpsertMonitorAction = createAction('fetchUpsertMonitor'); export const fetchUpsertSuccessAction = createAction<{ id: string; attributes: { enabled: boolean }; }>('fetchUpsertMonitorSuccess'); -export const fetchUpsertFailureAction = createAction<{ id: string; error: IHttpFetchError }>( - 'fetchUpsertMonitorFailure' -); +export const fetchUpsertFailureAction = createAction<{ + id: string; + error: IHttpSerializedFetchError; +}>('fetchUpsertMonitorFailure'); export const clearMonitorUpsertStatus = createAction('clearMonitorUpsertStatus'); 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 5e4e2e1bc1a67..f6a99fd3e02ed 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/state/monitor_list/effects.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/effects.ts index 0dee2edfd7903..67aaa4ec982ed 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/effects.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/effects.ts @@ -5,10 +5,10 @@ * 2.0. */ -import { IHttpFetchError } from '@kbn/core-http-browser'; import { PayloadAction } from '@reduxjs/toolkit'; import { call, put, takeEvery, takeLeading } from 'redux-saga/effects'; import { fetchEffectFactory } from '../utils/fetch_effect'; +import { serializeHttpFetchError } from '../utils/http_error'; import { fetchMonitorListAction, fetchUpsertFailureAction, @@ -40,7 +40,7 @@ export function* upsertMonitorEffect() { ); } catch (error) { yield put( - fetchUpsertFailureAction({ id: action.payload.id, error: error as IHttpFetchError }) + fetchUpsertFailureAction({ id: action.payload.id, error: serializeHttpFetchError(error) }) ); } } diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/index.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/index.ts index e1f564c0d0a3f..997f853c9bfc5 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/index.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/monitor_list/index.ts @@ -10,7 +10,7 @@ import { FETCH_STATUS } from '@kbn/observability-plugin/public'; import { ConfigKey, MonitorManagementListResult } from '../../../../../common/runtime_types'; -import { IHttpSerializedFetchError, serializeHttpFetchError } from '../utils/http_error'; +import { IHttpSerializedFetchError } from '../utils/http_error'; import { MonitorListPageState } from './models'; import { @@ -58,7 +58,7 @@ export const monitorListReducer = createReducer(initialState, (builder) => { }) .addCase(fetchMonitorListAction.fail, (state, action) => { state.loading = false; - state.error = serializeHttpFetchError(action.payload); + state.error = action.payload; }) .addCase(fetchUpsertMonitorAction, (state, action) => { state.monitorUpsertStatuses[action.payload.id] = { diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/actions.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/actions.ts index 0215e3b6553a0..c89179a41806e 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/actions.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/actions.ts @@ -8,7 +8,7 @@ import { createAction } from '@reduxjs/toolkit'; import { createAsyncAction } from '../utils/actions'; import { MonitorOverviewPageState } from './models'; -import { MonitorOverviewResult } from '../../../../../common/runtime_types'; +import { MonitorOverviewResult, OverviewStatus } from '../../../../../common/runtime_types'; export const fetchMonitorOverviewAction = createAsyncAction< MonitorOverviewPageState, @@ -21,3 +21,9 @@ export const quietFetchOverviewAction = createAsyncAction< MonitorOverviewPageState, MonitorOverviewResult >('quietFetchOverviewAction'); + +export const fetchOverviewStatusAction = createAsyncAction( + 'fetchOverviewStatusAction' +); + +export const clearOverviewStatusErrorAction = createAction('clearOverviewStatusErrorAction'); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/api.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/api.ts index f9d3511a4f5af..ecd91b16bb940 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/api.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/api.ts @@ -9,6 +9,8 @@ import { SYNTHETICS_API_URLS } from '../../../../../common/constants'; import { MonitorOverviewResult, MonitorOverviewResultCodec, + OverviewStatus, + OverviewStatusType, } from '../../../../../common/runtime_types'; import { apiService } from '../../../../utils/api_service'; @@ -23,3 +25,6 @@ export const fetchMonitorOverview = async ( MonitorOverviewResultCodec ); }; + +export const fetchOverviewStatus = async (): Promise => + apiService.get(SYNTHETICS_API_URLS.OVERVIEW_STATUS, {}, OverviewStatusType); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/effects.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/effects.ts index 3eaae0fe2b2cf..56b056a93110c 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/effects.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/effects.ts @@ -5,10 +5,15 @@ * 2.0. */ -import { takeLeading } from 'redux-saga/effects'; +import { takeLatest, takeLeading } from 'redux-saga/effects'; +import { fetchUpsertSuccessAction } from '../monitor_list'; import { fetchEffectFactory } from '../utils/fetch_effect'; -import { fetchMonitorOverviewAction, quietFetchOverviewAction } from './actions'; -import { fetchMonitorOverview } from './api'; +import { + fetchMonitorOverviewAction, + fetchOverviewStatusAction, + quietFetchOverviewAction, +} from './actions'; +import { fetchMonitorOverview, fetchOverviewStatus } from './api'; export function* fetchMonitorOverviewEffect() { yield takeLeading( @@ -31,3 +36,14 @@ export function* quietFetchOverviewEffect() { ) ); } + +export function* fetchOverviewStatusEffect() { + yield takeLatest( + [fetchOverviewStatusAction.get, fetchUpsertSuccessAction], + fetchEffectFactory( + fetchOverviewStatus, + fetchOverviewStatusAction.success, + fetchOverviewStatusAction.fail + ) + ); +} diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/index.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/index.ts index a464a988c50d6..aa4a8db73b98c 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/index.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/index.ts @@ -7,13 +7,15 @@ import { createReducer } from '@reduxjs/toolkit'; -import { MonitorOverviewResult } from '../../../../../common/runtime_types'; +import { MonitorOverviewResult, OverviewStatus } from '../../../../../common/runtime_types'; -import { IHttpSerializedFetchError, serializeHttpFetchError } from '../utils/http_error'; +import { IHttpSerializedFetchError } from '../utils/http_error'; import { MonitorOverviewPageState } from './models'; import { + clearOverviewStatusErrorAction, fetchMonitorOverviewAction, + fetchOverviewStatusAction, quietFetchOverviewAction, setOverviewPerPageAction, } from './actions'; @@ -24,6 +26,8 @@ export interface MonitorOverviewState { loading: boolean; loaded: boolean; error: IHttpSerializedFetchError | null; + status: OverviewStatus | null; + statusError: IHttpSerializedFetchError | null; } const initialState: MonitorOverviewState = { @@ -38,6 +42,8 @@ const initialState: MonitorOverviewState = { loading: false, loaded: false, error: null, + status: null, + statusError: null, }; export const monitorOverviewReducer = createReducer(initialState, (builder) => { @@ -54,13 +60,13 @@ export const monitorOverviewReducer = createReducer(initialState, (builder) => { }) .addCase(fetchMonitorOverviewAction.fail, (state, action) => { state.loading = false; - state.error = serializeHttpFetchError(action.payload); + state.error = action.payload; }) .addCase(quietFetchOverviewAction.success, (state, action) => { state.data = action.payload; }) .addCase(quietFetchOverviewAction.fail, (state, action) => { - state.error = serializeHttpFetchError(action.payload); + state.error = action.payload; }) .addCase(setOverviewPerPageAction, (state, action) => { state.pageState = { @@ -68,6 +74,15 @@ export const monitorOverviewReducer = createReducer(initialState, (builder) => { perPage: action.payload, }; state.loaded = false; + }) + .addCase(fetchOverviewStatusAction.success, (state, action) => { + state.status = action.payload; + }) + .addCase(fetchOverviewStatusAction.fail, (state, action) => { + state.statusError = serializeHttpFetchError(action.payload); + }) + .addCase(clearOverviewStatusErrorAction, (state) => { + state.statusError = null; }); }); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/selectors.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/selectors.ts index aec2633788fea..dc7f42deb3489 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/selectors.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/overview/selectors.ts @@ -11,3 +11,6 @@ import { SyntheticsAppState } from '../root_reducer'; export const selectOverviewState = (state: SyntheticsAppState) => state.overview; export const selectOverviewDataState = createSelector(selectOverviewState, (state) => state.data); +export const selectOverviewStatus = ({ + overview: { status, statusError }, +}: SyntheticsAppState) => ({ status, statusError }); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/root_effect.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/root_effect.ts index 1345f6c2b4c39..50b94bd670838 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/root_effect.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/root_effect.ts @@ -10,7 +10,11 @@ import { fetchSyntheticsMonitorEffect } from './monitor_details'; import { fetchIndexStatusEffect } from './index_status'; import { fetchSyntheticsEnablementEffect } from './synthetics_enablement'; import { fetchMonitorListEffect, upsertMonitorEffect } from './monitor_list'; -import { fetchMonitorOverviewEffect, quietFetchOverviewEffect } from './overview'; +import { + fetchMonitorOverviewEffect, + quietFetchOverviewEffect, + fetchOverviewStatusEffect, +} from './overview'; import { fetchServiceLocationsEffect } from './service_locations'; import { browserJourneyEffects } from './browser_journey'; @@ -25,5 +29,6 @@ export const rootEffect = function* root(): Generator { fork(fetchMonitorOverviewEffect), fork(quietFetchOverviewEffect), fork(browserJourneyEffects), + fork(fetchOverviewStatusEffect), ]); }; diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/service_locations/actions.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/service_locations/actions.ts index 794e16d0292c5..dbdd53d4cbcb7 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/service_locations/actions.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/service_locations/actions.ts @@ -7,10 +7,13 @@ import { createAction } from '@reduxjs/toolkit'; import { ServiceLocations, ThrottlingOptions } from '../../../../../common/runtime_types'; +import { IHttpSerializedFetchError } from '../utils/http_error'; export const getServiceLocations = createAction('[SERVICE LOCATIONS] GET'); export const getServiceLocationsSuccess = createAction<{ throttling: ThrottlingOptions | undefined; locations: ServiceLocations; }>('[SERVICE LOCATIONS] GET SUCCESS'); -export const getServiceLocationsFailure = createAction('[SERVICE LOCATIONS] GET FAILURE'); +export const getServiceLocationsFailure = createAction( + '[SERVICE LOCATIONS] GET FAILURE' +); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/service_locations/index.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/service_locations/index.ts index e13fe756ec7fd..9a338458e603f 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/service_locations/index.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/service_locations/index.ts @@ -11,6 +11,7 @@ import { ServiceLocations, ThrottlingOptions, } from '../../../../../common/runtime_types'; +import { IHttpSerializedFetchError } from '../utils/http_error'; import { getServiceLocations, @@ -22,7 +23,7 @@ export interface ServiceLocationsState { locations: ServiceLocations; throttling: ThrottlingOptions | null; loading: boolean; - error: Error | null; + error: IHttpSerializedFetchError | null; locationsLoaded?: boolean; } diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/synthetics_enablement/actions.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/synthetics_enablement/actions.ts index c38fadc0952a6..0c7abffd1b289 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/synthetics_enablement/actions.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/synthetics_enablement/actions.ts @@ -7,23 +7,24 @@ import { createAction } from '@reduxjs/toolkit'; import { MonitorManagementEnablementResult } from '../../../../../common/runtime_types'; +import { IHttpSerializedFetchError } from '../utils/http_error'; export const getSyntheticsEnablement = createAction('[SYNTHETICS_ENABLEMENT] GET'); export const getSyntheticsEnablementSuccess = createAction( '[SYNTHETICS_ENABLEMENT] GET SUCCESS' ); -export const getSyntheticsEnablementFailure = createAction( +export const getSyntheticsEnablementFailure = createAction( '[SYNTHETICS_ENABLEMENT] GET FAILURE' ); export const disableSynthetics = createAction('[SYNTHETICS_ENABLEMENT] DISABLE'); export const disableSyntheticsSuccess = createAction<{}>('[SYNTHETICS_ENABLEMENT] DISABLE SUCCESS'); -export const disableSyntheticsFailure = createAction( +export const disableSyntheticsFailure = createAction( '[SYNTHETICS_ENABLEMENT] DISABLE FAILURE' ); export const enableSynthetics = createAction('[SYNTHETICS_ENABLEMENT] ENABLE'); export const enableSyntheticsSuccess = createAction<{}>('[SYNTHETICS_ENABLEMENT] ENABLE SUCCESS'); -export const enableSyntheticsFailure = createAction( +export const enableSyntheticsFailure = createAction( '[SYNTHETICS_ENABLEMENT] ENABLE FAILURE' ); diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/synthetics_enablement/index.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/synthetics_enablement/index.ts index 62ed85ad17e86..3bf9ff69bf005 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/synthetics_enablement/index.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/synthetics_enablement/index.ts @@ -18,10 +18,11 @@ import { getSyntheticsEnablementFailure, } from './actions'; import { MonitorManagementEnablementResult } from '../../../../../common/runtime_types'; +import { IHttpSerializedFetchError } from '../utils/http_error'; export interface SyntheticsEnablementState { loading: boolean; - error: Error | null; + error: IHttpSerializedFetchError | null; enablement: MonitorManagementEnablementResult | null; } diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/utils/actions.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/utils/actions.ts index 416c3134d6034..35e93fd91484e 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/utils/actions.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/utils/actions.ts @@ -6,13 +6,13 @@ */ import { createAction } from '@reduxjs/toolkit'; -import type { IHttpFetchError } from '@kbn/core-http-browser'; +import type { IHttpSerializedFetchError } from './http_error'; export function createAsyncAction(actionStr: string) { return { get: createAction(actionStr), success: createAction(`${actionStr}_SUCCESS`), - fail: createAction(`${actionStr}_FAIL`), + fail: createAction(`${actionStr}_FAIL`), }; } diff --git a/x-pack/plugins/synthetics/public/apps/synthetics/state/utils/fetch_effect.ts b/x-pack/plugins/synthetics/public/apps/synthetics/state/utils/fetch_effect.ts index b07f1fa542633..294da718a6fd3 100644 --- a/x-pack/plugins/synthetics/public/apps/synthetics/state/utils/fetch_effect.ts +++ b/x-pack/plugins/synthetics/public/apps/synthetics/state/utils/fetch_effect.ts @@ -8,6 +8,7 @@ import { call, put } from 'redux-saga/effects'; import { PayloadAction } from '@reduxjs/toolkit'; import type { IHttpFetchError } from '@kbn/core-http-browser'; +import { IHttpSerializedFetchError, serializeHttpFetchError } from './http_error'; /** * Factory function for a fetch effect. It expects three action creators, @@ -23,7 +24,7 @@ import type { IHttpFetchError } from '@kbn/core-http-browser'; export function fetchEffectFactory( fetch: (request: T) => Promise, success: (response: R) => PayloadAction, - fail: (error: IHttpFetchError) => PayloadAction + fail: (error: IHttpSerializedFetchError) => PayloadAction ) { return function* (action: PayloadAction): Generator { try { @@ -32,14 +33,14 @@ export function fetchEffectFactory( // eslint-disable-next-line no-console console.error(response); - yield put(fail(response as IHttpFetchError)); + yield put(fail(serializeHttpFetchError(response as IHttpFetchError))); } else { yield put(success(response as R)); } } catch (error) { // eslint-disable-next-line no-console console.error(error); - yield put(fail(error as IHttpFetchError)); + yield put(fail(serializeHttpFetchError(error))); } }; } 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 57ce5e39a8dbd..6031707c1fd19 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'; /** @@ -94,6 +96,8 @@ export const mockState: SyntheticsAppState = { error: null, loaded: false, loading: false, + status: null, + statusError: null, }, syntheticsEnablement: { loading: false, error: null, enablement: null }, monitorDetails: getMonitorDetailsMockSlice(), @@ -338,8 +342,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 b4486e65c5396..9989a4d5df13a 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 a8b59b16a3460..d1d9917f19c3a 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,10 +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.CUSTOM_HEARTBEAT_ID]: getBrowserNormalizer(ConfigKey.CUSTOM_HEARTBEAT_ID), - [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 14fab3caeb132..d05730c5dbe17 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,4 +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 f7e7ad3eeac2e..a783639f1ab18 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 ae36de49fb57c..86efeeae69206 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/public/legacy_uptime/state/private_locations/index.ts b/x-pack/plugins/synthetics/public/legacy_uptime/state/private_locations/index.ts index 0ff45023143ec..831f8a9cbf6bb 100644 --- a/x-pack/plugins/synthetics/public/legacy_uptime/state/private_locations/index.ts +++ b/x-pack/plugins/synthetics/public/legacy_uptime/state/private_locations/index.ts @@ -5,9 +5,9 @@ * 2.0. */ -import { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public'; import { createReducer } from '@reduxjs/toolkit'; import { AgentPolicy } from '@kbn/fleet-plugin/common'; +import { IHttpSerializedFetchError } from '../../../apps/synthetics/state'; import { getAgentPoliciesAction, setAddingNewPrivateLocation, @@ -24,7 +24,7 @@ export interface AgentPoliciesList { export interface AgentPoliciesState { data: AgentPoliciesList | null; loading: boolean; - error: IHttpFetchError | null; + error: IHttpSerializedFetchError | null; isManageFlyoutOpen?: boolean; isAddingNewPrivateLocation?: boolean; } @@ -47,7 +47,7 @@ export const agentPoliciesReducer = createReducer(initialState, (builder) => { state.loading = false; }) .addCase(getAgentPoliciesAction.fail, (state, action) => { - state.error = action.payload as IHttpFetchError; + state.error = action.payload; state.loading = false; }) .addCase(setManageFlyoutOpen, (state, action) => { diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/adapters/framework/adapter_types.ts index 0044e0f5ddcec..90f12b7368120 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/adapters/framework/adapter_types.ts @@ -30,14 +30,14 @@ import { CloudSetup } from '@kbn/cloud-plugin/server'; import { SpacesPluginSetup } from '@kbn/spaces-plugin/server'; import { FleetStartContract } from '@kbn/fleet-plugin/server'; import { BfetchServerSetup } from '@kbn/bfetch-plugin/server'; -import { UptimeESClient } from '../../lib'; +import { UptimeEsClient } from '../../lib'; import type { TelemetryEventsSender } from '../../telemetry/sender'; import type { UptimeRouter } from '../../../../types'; import { UptimeConfig } from '../../../../../common/config'; export type UMElasticsearchQueryFn = ( params: { - uptimeEsClient: UptimeESClient; + uptimeEsClient: UptimeEsClient; esClient?: IScopedClusterClient; } & P ) => Promise; @@ -60,7 +60,7 @@ export interface UptimeServerSetup { kibanaVersion: string; logger: Logger; telemetry: TelemetryEventsSender; - uptimeEsClient: UptimeESClient; + uptimeEsClient: UptimeEsClient; basePath: IBasePath; isDev?: boolean; } diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/adapters/telemetry/kibana_telemetry_adapter.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/adapters/telemetry/kibana_telemetry_adapter.ts index 3aaff60ff3529..cd852fc537d6a 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/adapters/telemetry/kibana_telemetry_adapter.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/adapters/telemetry/kibana_telemetry_adapter.ts @@ -10,7 +10,7 @@ import { SavedObjectsClientContract } from '@kbn/core/server'; import { CollectorFetchContext, UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; import { PageViewParams, UptimeTelemetry, Usage } from './types'; import { savedObjectsAdapter } from '../../saved_objects/saved_objects'; -import { UptimeESClient, createUptimeESClient } from '../../lib'; +import { UptimeEsClient, createUptimeESClient } from '../../lib'; import { createEsQuery } from '../../../../../common/utils/es_search'; interface UptimeTelemetryCollector { @@ -212,7 +212,7 @@ export class KibanaTelemetryAdapter { } public static async countNoOfUniqueMonitorAndLocations( - callCluster: UptimeESClient, + callCluster: UptimeEsClient, savedObjectsClient: SavedObjectsClientContract ) { const dynamicSettings = await savedObjectsAdapter.getUptimeDynamicSettings(savedObjectsClient); @@ -309,7 +309,7 @@ export class KibanaTelemetryAdapter { return bucket; } - public static async countNoOfUniqueFleetManagedMonitors(callCluster: UptimeESClient) { + public static async countNoOfUniqueFleetManagedMonitors(callCluster: UptimeEsClient) { const params = { index: 'synthetics-*', body: { diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/alerts/status_check.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/alerts/status_check.ts index b7f107d8c0f71..e119f9bde62f0 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/alerts/status_check.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/alerts/status_check.ts @@ -36,7 +36,7 @@ import { } from '../requests/get_monitor_status'; import { UNNAMED_LOCATION } from '../../../../common/constants'; import { getUptimeIndexPattern, IndexPatternTitleAndFields } from '../requests/get_index_pattern'; -import { UMServerLibs, UptimeESClient, createUptimeESClient } from '../lib'; +import { UMServerLibs, UptimeEsClient, createUptimeESClient } from '../lib'; import { ALERT_REASON_MSG, MESSAGE, @@ -115,7 +115,7 @@ export const generateFilterDSL = async ( }; export const formatFilterString = async ( - uptimeEsClient: UptimeESClient, + uptimeEsClient: UptimeEsClient, filters: StatusCheckFilters, search: string, libs?: UMServerLibs diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/lib.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/lib.ts index c6c7ea0889025..aebe13affddd4 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/lib.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/lib.ts @@ -38,7 +38,7 @@ export interface CountResponse { indices: string; } -export type UptimeESClient = ReturnType; +export type UptimeEsClient = ReturnType; export const inspectableEsQueriesMap = new WeakMap(); diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_certs.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_certs.ts index ac6963dba85bc..d3d0f512621c9 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_certs.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_certs.ts @@ -12,7 +12,7 @@ import { getCertsRequestBody, processCertsResult, } from '../../../../common/requests/get_certs_request_body'; -import { UptimeESClient } from '../lib'; +import { UptimeEsClient } from '../lib'; export const getCerts: UMElasticsearchQueryFn = async ( requestParams @@ -25,7 +25,7 @@ export const getCerts: UMElasticsearchQueryFn = asyn export type CertificatesResults = PromiseType>; const getCertsResults = async ( - requestParams: GetCertsParams & { uptimeEsClient: UptimeESClient } + requestParams: GetCertsParams & { uptimeEsClient: UptimeEsClient } ) => { const { uptimeEsClient } = requestParams; diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_index_pattern.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_index_pattern.ts index 539a2be1b7d1a..6e9dcf2c4ba85 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_index_pattern.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_index_pattern.ts @@ -6,7 +6,7 @@ */ import { FieldDescriptor, IndexPatternsFetcher } from '@kbn/data-plugin/server'; -import { UptimeESClient } from '../lib'; +import { UptimeEsClient } from '../lib'; import { savedObjectsAdapter } from '../saved_objects/saved_objects'; export interface IndexPatternTitleAndFields { @@ -17,7 +17,7 @@ export interface IndexPatternTitleAndFields { export const getUptimeIndexPattern = async ({ uptimeEsClient, }: { - uptimeEsClient: UptimeESClient; + uptimeEsClient: UptimeEsClient; }): Promise => { const indexPatternsFetcher = new IndexPatternsFetcher(uptimeEsClient.baseESClient); diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_monitor_details.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_monitor_details.ts index 6a7af17e4bfad..cc6096a9b22b7 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_monitor_details.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_monitor_details.ts @@ -10,7 +10,7 @@ import { CLIENT_ALERT_TYPES } from '../../../../common/constants/alerts'; import { UMElasticsearchQueryFn } from '../adapters'; import { MonitorDetails, Ping } from '../../../../common/runtime_types'; import { formatFilterString } from '../alerts/status_check'; -import { UptimeESClient } from '../lib'; +import { UptimeEsClient } from '../lib'; import { createEsQuery } from '../../../../common/utils/es_search'; export interface GetMonitorDetailsParams { @@ -25,7 +25,7 @@ export const getMonitorAlerts = async ({ rulesClient, monitorId, }: { - uptimeEsClient: UptimeESClient; + uptimeEsClient: UptimeEsClient; rulesClient: any; monitorId: string; }) => { diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_monitor_status.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_monitor_status.ts index 7305d3ef19ede..93d03029ee5a4 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_monitor_status.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_monitor_status.ts @@ -13,7 +13,7 @@ import { asMutableArray } from '../../../../common/utils/as_mutable_array'; import { UMElasticsearchQueryFn } from '../adapters'; import { Ping } from '../../../../common/runtime_types/ping'; import { createEsQuery } from '../../../../common/utils/es_search'; -import { UptimeESClient } from '../lib'; +import { UptimeEsClient } from '../lib'; import { UNNAMED_LOCATION } from '../../../../common/constants'; export interface GetMonitorStatusParams { @@ -83,7 +83,7 @@ const executeQueryParams = async ({ timestampRange: GetMonitorStatusParams['timestampRange']; filters: GetMonitorStatusParams['filters']; afterKey?: AfterKey; - uptimeEsClient: UptimeESClient; + uptimeEsClient: UptimeEsClient; locations: string[]; }) => { const queryParams = createEsQuery({ diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_snapshot_counts.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_snapshot_counts.ts index 14adbd1e7f744..2dda847a023ec 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_snapshot_counts.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/get_snapshot_counts.ts @@ -48,7 +48,7 @@ const statusCount = async (context: QueryContext): Promise => { { body: statusCountBody(await context.dateAndCustomFilters(), context), }, - 'geSnapshotCount' + 'getSnapshotCount' ); return ( diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/search/query_context.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/search/query_context.ts index 1424191ea826a..345dd4a1e4dbe 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/search/query_context.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/search/query_context.ts @@ -9,11 +9,11 @@ import moment from 'moment'; import type { ESFilter } from '@kbn/es-types'; import { CursorPagination } from './types'; import { CursorDirection, SortOrder } from '../../../../../common/runtime_types'; -import { UptimeESClient } from '../../lib'; +import { UptimeEsClient } from '../../lib'; import { parseRelativeDate } from '../../../../../common/lib/get_histogram_interval'; export class QueryContext { - callES: UptimeESClient; + callES: UptimeEsClient; dateRangeStart: string; dateRangeEnd: string; pagination: CursorPagination; @@ -24,7 +24,7 @@ export class QueryContext { query?: string; constructor( - database: UptimeESClient, + database: UptimeEsClient, dateRangeStart: string, dateRangeEnd: string, pagination: CursorPagination, diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/test_helpers.ts b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/test_helpers.ts index 96de0a435ee72..b33bc80419021 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/test_helpers.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/lib/requests/test_helpers.ts @@ -9,7 +9,7 @@ import { AggregationsAggregate } from '@elastic/elasticsearch/lib/api/typesWithB import type { ElasticsearchClientMock } from '@kbn/core-elasticsearch-client-server-mocks'; import { elasticsearchServiceMock, savedObjectsClientMock } from '@kbn/core/server/mocks'; -import { createUptimeESClient, UptimeESClient } from '../lib'; +import { createUptimeESClient, UptimeEsClient } from '../lib'; export interface MultiPageCriteria { after_key?: K; @@ -59,7 +59,7 @@ export const setupMockEsCompositeQuery = ( interface UptimeEsMockClient { esClient: ElasticsearchClientMock; - uptimeEsClient: UptimeESClient; + uptimeEsClient: UptimeEsClient; } export const getUptimeESMockClient = ( @@ -81,7 +81,7 @@ export const getUptimeESMockClient = ( export function mockSearchResult( data: unknown, aggregations: Record = {} -): UptimeESClient { +): UptimeEsClient { const { esClient: mockEsClient, uptimeEsClient } = getUptimeESMockClient(); mockEsClient.search.mockResponse({ diff --git a/x-pack/plugins/synthetics/server/legacy_uptime/routes/types.ts b/x-pack/plugins/synthetics/server/legacy_uptime/routes/types.ts index 9719f897c5c81..ed555ed90abd0 100644 --- a/x-pack/plugins/synthetics/server/legacy_uptime/routes/types.ts +++ b/x-pack/plugins/synthetics/server/legacy_uptime/routes/types.ts @@ -17,7 +17,7 @@ import { IKibanaResponse, } from '@kbn/core/server'; import { SyntheticsMonitorClient } from '../../synthetics_service/synthetics_monitor/synthetics_monitor_client'; -import { UMServerLibs, UptimeESClient } from '../lib/lib'; +import { UMServerLibs, UptimeEsClient } from '../lib/lib'; import type { UptimeRequestHandlerContext } from '../../types'; import { UptimeServerSetup } from '../lib/adapters'; @@ -100,7 +100,7 @@ export type UMRouteHandler = ({ savedObjectsClient, subject, }: { - uptimeEsClient: UptimeESClient; + uptimeEsClient: UptimeEsClient; context: UptimeRequestHandlerContext; request: SyntheticsRequest; response: KibanaResponseFactory; @@ -118,7 +118,7 @@ export type SyntheticsRouteHandler = ({ savedObjectsClient, subject: Subject, }: { - uptimeEsClient: UptimeESClient; + uptimeEsClient: UptimeEsClient; context: UptimeRequestHandlerContext; request: SyntheticsRequest; response: KibanaResponseFactory; @@ -136,7 +136,7 @@ export type SyntheticsStreamingRouteHandler = ({ savedObjectsClient, subject: Subject, }: { - uptimeEsClient: UptimeESClient; + uptimeEsClient: UptimeEsClient; context: UptimeRequestHandlerContext; request: SyntheticsRequest; savedObjectsClient: SavedObjectsClientContract; diff --git a/x-pack/plugins/synthetics/server/routes/common.ts b/x-pack/plugins/synthetics/server/routes/common.ts new file mode 100644 index 0000000000000..bdf06c8373af3 --- /dev/null +++ b/x-pack/plugins/synthetics/server/routes/common.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 { schema, TypeOf } from '@kbn/config-schema'; +import { SavedObjectsClientContract, SavedObjectsFindResponse } from '@kbn/core/server'; +import { SyntheticsService } from '../synthetics_service/synthetics_service'; +import { EncryptedSyntheticsMonitor, ServiceLocations } from '../../common/runtime_types'; +import { monitorAttributes } from '../../common/types/saved_objects'; +import { syntheticsMonitorType } from '../legacy_uptime/lib/saved_objects/synthetics_monitor'; + +const querySchema = schema.object({ + page: schema.maybe(schema.number()), + perPage: schema.maybe(schema.number()), + sortField: schema.maybe(schema.string()), + sortOrder: schema.maybe(schema.oneOf([schema.literal('desc'), schema.literal('asc')])), + query: schema.maybe(schema.string()), + filter: schema.maybe(schema.string()), + tags: schema.maybe(schema.oneOf([schema.string(), schema.arrayOf(schema.string())])), + monitorType: schema.maybe(schema.oneOf([schema.string(), schema.arrayOf(schema.string())])), + locations: schema.maybe(schema.oneOf([schema.string(), schema.arrayOf(schema.string())])), + status: schema.maybe(schema.oneOf([schema.string(), schema.arrayOf(schema.string())])), +}); + +type MonitorsQuery = TypeOf; + +export const getMonitors = ( + request: MonitorsQuery, + syntheticsService: SyntheticsService, + savedObjectsClient: SavedObjectsClientContract +): Promise> => { + const { + perPage = 50, + page, + sortField, + sortOrder, + query, + tags, + monitorType, + locations, + filter = '', + } = request as MonitorsQuery; + + const locationFilter = parseLocationFilter(syntheticsService.locations, locations); + + const filters = + getFilter('tags', tags) + + getFilter('type', monitorType) + + getFilter('locations.id', locationFilter); + + return savedObjectsClient.find({ + type: syntheticsMonitorType, + perPage, + page, + sortField: sortField === 'schedule.keyword' ? 'schedule.number' : sortField, + sortOrder, + searchFields: ['name', 'tags.text', 'locations.id.text', 'urls'], + search: query ? `${query}*` : undefined, + filter: filters + filter, + }); +}; + +const getFilter = (field: string, values?: string | string[], operator = 'OR') => { + if (!values) { + return ''; + } + + const fieldKey = `${monitorAttributes}.${field}`; + + if (Array.isArray(values)) { + return `${fieldKey}:${values.join(` ${operator} ${fieldKey}:`)}`; + } + + return `${fieldKey}:${values}`; +}; + +const parseLocationFilter = (serviceLocations: ServiceLocations, locations?: string | string[]) => { + if (!locations) { + return ''; + } + + if (Array.isArray(locations)) { + return locations + .map((loc) => findLocationItem(loc, serviceLocations)?.id ?? '') + .filter((val) => !val); + } + + return findLocationItem(locations, serviceLocations)?.id ?? ''; +}; + +export const findLocationItem = (query: string, locations: ServiceLocations) => { + return locations.find(({ id, label }) => query === id || label === query); +}; diff --git a/x-pack/plugins/synthetics/server/routes/index.ts b/x-pack/plugins/synthetics/server/routes/index.ts index 6e60de0848706..53819b5b380e5 100644 --- a/x-pack/plugins/synthetics/server/routes/index.ts +++ b/x-pack/plugins/synthetics/server/routes/index.ts @@ -26,6 +26,7 @@ import { editSyntheticsMonitorRoute } from './monitor_cruds/edit_monitor'; import { addSyntheticsMonitorRoute } from './monitor_cruds/add_monitor'; import { addSyntheticsProjectMonitorRoute } from './monitor_cruds/add_monitor_project'; import { syntheticsGetPingsRoute } from './pings'; +import { createGetCurrentStatusRoute } from './status/current_status'; import { SyntheticsRestApiRouteFactory, SyntheticsStreamingRouteFactory, @@ -48,6 +49,7 @@ export const syntheticsAppRestApiRoutes: SyntheticsRestApiRouteFactory[] = [ getServiceAllowedRoute, getAPIKeySyntheticsRoute, syntheticsGetPingsRoute, + createGetCurrentStatusRoute, ]; export const syntheticsAppStreamingApiRoutes: SyntheticsStreamingRouteFactory[] = [ 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 1016e37b87e08..1f9a55e347618 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 a16a1ba7089e5..d6b50880ed350 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/get_monitor.ts b/x-pack/plugins/synthetics/server/routes/monitor_cruds/get_monitor.ts index 6202aeef8e2e3..1d02454ce04ba 100644 --- a/x-pack/plugins/synthetics/server/routes/monitor_cruds/get_monitor.ts +++ b/x-pack/plugins/synthetics/server/routes/monitor_cruds/get_monitor.ts @@ -4,24 +4,15 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { schema, TypeOf } from '@kbn/config-schema'; -import { - SavedObjectsClientContract, - SavedObjectsErrorHelpers, - SavedObjectsFindResponse, -} from '@kbn/core/server'; -import { SyntheticsService } from '../../synthetics_service/synthetics_service'; -import { - ConfigKey, - EncryptedSyntheticsMonitor, - ServiceLocations, -} from '../../../common/runtime_types'; -import { monitorAttributes } from '../../../common/types/saved_objects'; +import { schema } from '@kbn/config-schema'; +import { SavedObjectsErrorHelpers } from '@kbn/core/server'; +import { ConfigKey } from '../../../common/runtime_types'; import { UMServerLibs } from '../../legacy_uptime/lib/lib'; import { SyntheticsRestApiRouteFactory } from '../../legacy_uptime/routes/types'; import { API_URLS, SYNTHETICS_API_URLS } from '../../../common/constants'; import { syntheticsMonitorType } from '../../legacy_uptime/lib/saved_objects/synthetics_monitor'; import { getMonitorNotFoundResponse } from '../synthetics_service/service_errors'; +import { getMonitors } from '../common'; const querySchema = schema.object({ page: schema.maybe(schema.number()), @@ -36,44 +27,6 @@ const querySchema = schema.object({ status: schema.maybe(schema.oneOf([schema.string(), schema.arrayOf(schema.string())])), }); -type MonitorsQuery = TypeOf; - -const getMonitors = ( - request: MonitorsQuery, - syntheticsService: SyntheticsService, - savedObjectsClient: SavedObjectsClientContract -): Promise> => { - const { - perPage = 50, - page, - sortField, - sortOrder, - query, - tags, - monitorType, - locations, - filter = '', - } = request as MonitorsQuery; - - const locationFilter = parseLocationFilter(syntheticsService.locations, locations); - - const filters = - getFilter('tags', tags) + - getFilter('type', monitorType) + - getFilter('locations.id', locationFilter); - - return savedObjectsClient.find({ - type: syntheticsMonitorType, - perPage, - page, - sortField: sortField === 'schedule.keyword' ? 'schedule.number' : sortField, - sortOrder, - searchFields: ['name', 'tags.text', 'locations.id.text', 'urls'], - search: query ? `${query}*` : undefined, - filter: filters + filter, - }); -}; - export const getSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'GET', path: API_URLS.SYNTHETICS_MONITORS + '/{monitorId}', @@ -152,38 +105,6 @@ export const getAllSyntheticsMonitorRoute: SyntheticsRestApiRouteFactory = () => }, }); -const getFilter = (field: string, values?: string | string[], operator = 'OR') => { - if (!values) { - return ''; - } - - const fieldKey = `${monitorAttributes}.${field}`; - - if (Array.isArray(values)) { - return `${fieldKey}:${values.join(` ${operator} ${fieldKey}:`)}`; - } - - return `${fieldKey}:${values}`; -}; - -const parseLocationFilter = (serviceLocations: ServiceLocations, locations?: string | string[]) => { - if (!locations) { - return ''; - } - - if (Array.isArray(locations)) { - return locations - .map((loc) => findLocationItem(loc, serviceLocations)?.id ?? '') - .filter((val) => !val); - } - - return findLocationItem(locations, serviceLocations)?.id ?? ''; -}; - -export const findLocationItem = (query: string, locations: ServiceLocations) => { - return locations.find(({ id, label }) => query === id || label === query); -}; - export const getSyntheticsMonitorOverviewRoute: SyntheticsRestApiRouteFactory = () => ({ method: 'GET', path: SYNTHETICS_API_URLS.SYNTHETICS_OVERVIEW, 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 8a532279dda88..76bda0f4a2f12 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 d648722e0d5cd..77cd0fa23a7ce 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/status/current_status.test.ts b/x-pack/plugins/synthetics/server/routes/status/current_status.test.ts new file mode 100644 index 0000000000000..12fdea5b9fd4d --- /dev/null +++ b/x-pack/plugins/synthetics/server/routes/status/current_status.test.ts @@ -0,0 +1,279 @@ +/* + * 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 { getUptimeESMockClient } from '../../legacy_uptime/lib/requests/test_helpers'; +import { queryMonitorStatus, periodToMs } from './current_status'; + +jest.mock('../common', () => ({ + getMonitors: jest.fn().mockReturnValue({ + per_page: 10, + saved_objects: [ + { + id: 'mon-1', + attributes: { + enabled: false, + locations: ['us-east1', 'us-west1', 'japan'], + }, + }, + { + id: 'mon-2', + attributes: { + enabled: true, + locations: ['us-east1', 'us-west1', 'japan'], + schedule: { + number: '10', + unit: 'm', + }, + }, + }, + ], + }), +})); + +jest.mock('../../legacy_uptime/lib/requests/get_snapshot_counts', () => ({ + getSnapshotCount: jest.fn().mockReturnValue({ + up: 2, + down: 1, + total: 3, + }), +})); + +describe('current status route', () => { + describe('periodToMs', () => { + it('returns 0 for unsupported unit type', () => { + // @ts-expect-error Providing invalid value to test handler in function + expect(periodToMs({ number: '10', unit: 'rad' })).toEqual(0); + }); + it('converts seconds', () => { + expect(periodToMs({ number: '10', unit: 's' })).toEqual(10_000); + }); + it('converts minutes', () => { + expect(periodToMs({ number: '1', unit: 'm' })).toEqual(60_000); + }); + it('converts hours', () => { + expect(periodToMs({ number: '1', unit: 'h' })).toEqual(3_600_000); + }); + }); + + describe('getStats', () => { + it('parses expected agg fields', async () => { + const { esClient, uptimeEsClient } = getUptimeESMockClient(); + esClient.search.mockResponseOnce( + getEsResponse([ + { + key: 'id1', + location: { + buckets: [ + { + key: 'Asia/Pacific - Japan', + status: { + hits: { + hits: [ + { + _source: { + '@timestamp': '2022-09-15T16:08:16.724Z', + monitor: { + status: 'up', + }, + summary: { + up: 1, + down: 0, + }, + }, + }, + ], + }, + }, + }, + ], + }, + }, + { + key: 'id2', + location: { + buckets: [ + { + key: 'Asia/Pacific - Japan', + status: { + hits: { + hits: [ + { + _source: { + '@timestamp': '2022-09-15T16:09:16.724Z', + monitor: { + status: 'up', + }, + summary: { + up: 1, + down: 0, + }, + }, + }, + ], + }, + }, + }, + { + key: 'Europe - Germany', + status: { + hits: { + hits: [ + { + _source: { + '@timestamp': '2022-09-15T16:19:16.724Z', + monitor: { + status: 'down', + }, + summary: { + down: 1, + up: 0, + }, + }, + }, + ], + }, + }, + }, + ], + }, + }, + ]) + ); + expect(await queryMonitorStatus(uptimeEsClient, 3, 140000, ['id1', 'id2'])).toEqual({ + down: 1, + up: 2, + }); + }); + + it('handles limits with multiple requests', async () => { + const { esClient, uptimeEsClient } = getUptimeESMockClient(); + esClient.search.mockResponseOnce( + getEsResponse([ + { + key: 'id1', + location: { + buckets: [ + { + key: 'Asia/Pacific - Japan', + status: { + hits: { + hits: [ + { + _source: { + '@timestamp': '2022-09-15T16:08:16.724Z', + monitor: { + status: 'up', + }, + summary: { + up: 1, + down: 0, + }, + }, + }, + ], + }, + }, + }, + ], + }, + }, + { + key: 'id2', + location: { + buckets: [ + { + key: 'Asia/Pacific - Japan', + status: { + hits: { + hits: [ + { + _source: { + '@timestamp': '2022-09-15T16:09:16.724Z', + monitor: { + status: 'up', + }, + summary: { + up: 1, + down: 0, + }, + }, + }, + ], + }, + }, + }, + { + key: 'Europe - Germany', + status: { + hits: { + hits: [ + { + _source: { + '@timestamp': '2022-09-15T16:19:16.724Z', + monitor: { + status: 'down', + }, + summary: { + up: 0, + down: 1, + }, + }, + }, + ], + }, + }, + }, + ], + }, + }, + ]) + ); + + /** + * By passing the function a location count of 10k, it forces the query to paginate once, + * so we are able to test that the function properly iterates through a "large" list of IDs/locations. + * + * The expectation here is we will send the test client two separate "requests", one for each of the two IDs. + */ + expect(await queryMonitorStatus(uptimeEsClient, 10000, 2500, ['id1', 'id2'])).toEqual({ + down: 1, + up: 2, + }); + expect(esClient.search).toHaveBeenCalledTimes(2); + // These assertions are to ensure that we are paginating through the IDs we use for filtering + // @ts-expect-error mock search is not lining up with expected type + expect(esClient.search.mock.calls[0][0].query.bool.filter[1].terms['monitor.id']).toEqual([ + 'id1', + ]); + // @ts-expect-error mock search is not lining up with expected type + expect(esClient.search.mock.calls[1][0].query.bool.filter[1].terms['monitor.id']).toEqual([ + 'id2', + ]); + }); + }); +}); + +function getEsResponse(buckets: any[]) { + return { + took: 605, + timed_out: false, + _shards: { + total: 3, + successful: 3, + skipped: 0, + failed: 0, + }, + hits: { + hits: [], + }, + aggregations: { + id: { + buckets, + }, + }, + }; +} diff --git a/x-pack/plugins/synthetics/server/routes/status/current_status.ts b/x-pack/plugins/synthetics/server/routes/status/current_status.ts new file mode 100644 index 0000000000000..da8b4a7eb3911 --- /dev/null +++ b/x-pack/plugins/synthetics/server/routes/status/current_status.ts @@ -0,0 +1,199 @@ +/* + * 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 { schema } from '@kbn/config-schema'; +import datemath, { Unit } from '@kbn/datemath'; +import { IKibanaResponse, SavedObjectsClientContract } from '@kbn/core/server'; +import { SYNTHETICS_API_URLS } from '../../../common/constants'; +import { UMServerLibs } from '../../legacy_uptime/uptime_server'; +import { SyntheticsRestApiRouteFactory } from '../../legacy_uptime/routes'; +import { getMonitors } from '../common'; +import { UptimeEsClient } from '../../legacy_uptime/lib/lib'; +import { SyntheticsMonitorClient } from '../../synthetics_service/synthetics_monitor/synthetics_monitor_client'; +import { ConfigKey, OverviewStatus } from '../../../common/runtime_types'; + +/** + * Helper function that converts a monitor's schedule to a value to use to generate + * an appropriate look-back window for snapshot count. + * @param schedule a number/unit pair that represents how often a configured monitor runs + * @returns schedule interval in ms + */ +export function periodToMs(schedule: { number: string; unit: Unit }) { + if (Object.keys(datemath.unitsMap).indexOf(schedule.unit) === -1) return 0; + + return parseInt(schedule.number, 10) * datemath.unitsMap[schedule.unit].base; +} + +const DEFAULT_MAX_ES_BUCKET_SIZE = 10000; + +export async function queryMonitorStatus( + esClient: UptimeEsClient, + maxLocations: number, + maxPeriod: number, + ids: Array +): Promise> { + const idSize = Math.trunc(DEFAULT_MAX_ES_BUCKET_SIZE / maxLocations); + const pageCount = Math.ceil(ids.length / idSize); + const promises: Array> = []; + for (let i = 0; i < pageCount; i++) { + const params = { + size: 0, + query: { + bool: { + filter: [ + { + range: { + '@timestamp': { + gte: maxPeriod, + lte: 'now', + }, + }, + }, + { + terms: { + 'monitor.id': ids.slice(i * idSize, i * idSize + idSize), + }, + }, + { + exists: { + field: 'summary', + }, + }, + ], + }, + }, + aggs: { + id: { + terms: { + field: 'monitor.id', + size: idSize, + }, + aggs: { + location: { + terms: { + field: 'observer.geo.name', + size: maxLocations, + }, + aggs: { + status: { + top_hits: { + size: 1, + sort: [ + { + '@timestamp': { + order: 'desc', + }, + }, + ], + _source: { + includes: ['@timestamp', 'summary'], + }, + }, + }, + }, + }, + }, + }, + }, + }; + promises.push(esClient.baseESClient.search(params)); + } + let up = 0; + let down = 0; + for await (const response of promises) { + response.aggregations?.id.buckets.forEach(({ location }: { key: string; location: any }) => { + location.buckets.forEach(({ status }: { key: string; status: any }) => { + const downCount = status.hits.hits[0]._source.summary.down; + const upCount = status.hits.hits[0]._source.summary.up; + if (upCount > 0) { + up += 1; + } else if (downCount > 0) { + down += 1; + } + }); + }); + } + return { up, down }; +} + +/** + * Multi-stage function that first queries all the user's saved object monitor configs. + * + * Subsequently, fetch the status for each monitor per location in the data streams. + * @returns The counts of up/down/disabled monitor by location, and a map of each monitor:location status. + */ +export async function getStatus( + uptimeEsClient: UptimeEsClient, + savedObjectsClient: SavedObjectsClientContract, + syntheticsMonitorClient: SyntheticsMonitorClient +) { + let monitors; + const enabledIds: Array = []; + let disabledCount = 0; + let page = 1; + let maxPeriod = 0; + let maxLocations = 1; + /** + * Walk through all monitor saved objects, bucket IDs by disabled/enabled status. + * + * Track max period to make sure the snapshot query should reach back far enough to catch + * latest ping for all enabled monitors. + */ + do { + monitors = await getMonitors( + { + perPage: 500, + page, + sortField: 'name.keyword', + sortOrder: 'asc', + }, + syntheticsMonitorClient.syntheticsService, + savedObjectsClient + ); + page++; + monitors.saved_objects.forEach((monitor) => { + if (monitor.attributes[ConfigKey.ENABLED] === false) { + disabledCount += monitor.attributes[ConfigKey.LOCATIONS].length; + } else { + enabledIds.push(monitor.attributes[ConfigKey.CUSTOM_HEARTBEAT_ID] || monitor.id); + maxLocations = Math.max(maxLocations, monitor.attributes.locations.length); + maxPeriod = Math.max(maxPeriod, periodToMs(monitor.attributes.schedule)); + } + }); + } while (monitors.saved_objects.length === monitors.per_page); + + const { up, down } = await queryMonitorStatus( + uptimeEsClient, + maxLocations, + maxPeriod, + enabledIds + ); + + return { + disabledCount, + up, + down, + }; +} + +export const createGetCurrentStatusRoute: SyntheticsRestApiRouteFactory = (libs: UMServerLibs) => ({ + method: 'GET', + path: SYNTHETICS_API_URLS.OVERVIEW_STATUS, + validate: { + query: schema.object({}), + }, + handler: async ({ + uptimeEsClient, + savedObjectsClient, + syntheticsMonitorClient, + response, + }): Promise> => { + return response.ok({ + body: await getStatus(uptimeEsClient, savedObjectsClient, syntheticsMonitorClient), + }); + }, +}); 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 394567f45b600..5bbc8c27e3ebe 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/routes/telemetry/monitor_upgrade_sender.ts b/x-pack/plugins/synthetics/server/routes/telemetry/monitor_upgrade_sender.ts index 5d0d29a4c8ac5..1cb4659359f5e 100644 --- a/x-pack/plugins/synthetics/server/routes/telemetry/monitor_upgrade_sender.ts +++ b/x-pack/plugins/synthetics/server/routes/telemetry/monitor_upgrade_sender.ts @@ -22,11 +22,8 @@ import { MONITOR_UPDATE_CHANNEL, MONITOR_CURRENT_CHANNEL, MONITOR_ERROR_EVENTS_CHANNEL, - MONITOR_SYNC_STATE_CHANNEL, - MONITOR_SYNC_EVENTS_CHANNEL, } from '../../legacy_uptime/lib/telemetry/constants'; import { MonitorErrorEvent } from '../../legacy_uptime/lib/telemetry/types'; -import { MonitorSyncEvent } from '../../legacy_uptime/lib/telemetry/types'; export interface UpgradeError { key?: string; @@ -50,23 +47,6 @@ export function sendTelemetryEvents( } } -export function sendSyncTelemetryEvents( - logger: Logger, - eventsTelemetry: TelemetryEventsSender | undefined, - updateEvent: MonitorSyncEvent -) { - if (eventsTelemetry === undefined) { - return; - } - - try { - eventsTelemetry.queueTelemetryEvents(MONITOR_SYNC_STATE_CHANNEL, [updateEvent]); - eventsTelemetry.queueTelemetryEvents(MONITOR_SYNC_EVENTS_CHANNEL, [updateEvent]); - } catch (exc) { - logger.error(`queuing telemetry events failed ${exc}`); - } -} - export function sendErrorTelemetryEvents( logger: Logger, eventsTelemetry: TelemetryEventsSender | undefined, @@ -180,8 +160,6 @@ export function formatTelemetryDeleteEvent( }); } -export function formatTelemetrySyncEvent() {} - function getScriptType( attributes: Partial, isInlineScript: boolean 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 9c9d24a3f58f4..d9ee08ace167c 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,11 +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.CUSTOM_HEARTBEAT_ID]: null, - [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 16a0829cbb710..a2427357e3682 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/formatters/common.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/formatters/common.ts @@ -31,6 +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 b8652e0813a0e..83545eb198ba7 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 c295a17ed8964..25ba5c08e9b3c 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/browser_monitor.test.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/browser_monitor.test.ts index ed02f1037e32b..9b32b61a59b35 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/browser_monitor.test.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/browser_monitor.test.ts @@ -67,9 +67,7 @@ describe('browser normalizers', () => { locations: ['us_central'], tags: ['tag1', 'tag2'], ignoreHTTPSErrors: true, - apmServiceName: 'cart-service', - type: DataStream.BROWSER, - }, + } as ProjectMonitor, // test that normalizers defaults to browser when type is omitted { id: 'test-id-2', screenshot: ScreenshotOption.ON, @@ -86,7 +84,6 @@ describe('browser normalizers', () => { locations: ['us_central', 'us_east'], tags: ['tag3', 'tag4'], ignoreHTTPSErrors: false, - apmServiceName: 'bean-service', type: DataStream.BROWSER, }, { @@ -106,7 +103,6 @@ describe('browser normalizers', () => { privateLocations: ['Germany'], tags: ['tag3', 'tag4'], ignoreHTTPSErrors: false, - apmServiceName: 'bean-service', type: DataStream.BROWSER, }, ]; @@ -118,6 +114,7 @@ describe('browser normalizers', () => { monitors, projectId, namespace: 'test-space', + version: '8.5.0', }); expect(actual).toEqual([ { @@ -145,7 +142,7 @@ describe('browser normalizers', () => { unit: 'm', }, screenshots: 'off', - 'service.name': 'cart-service', + 'service.name': '', 'source.project.content': 'test content 1', tags: ['tag1', 'tag2'], 'throttling.config': '5d/10u/20l', @@ -162,6 +159,7 @@ describe('browser normalizers', () => { timeout: null, }, unsupportedKeys: [], + errors: [], }, { normalizedFields: { @@ -201,7 +199,7 @@ describe('browser normalizers', () => { unit: 'm', }, screenshots: 'on', - 'service.name': 'bean-service', + 'service.name': '', 'source.project.content': 'test content 2', tags: ['tag3', 'tag4'], 'throttling.config': '10d/15u/18l', @@ -217,6 +215,7 @@ describe('browser normalizers', () => { timeout: null, }, unsupportedKeys: [], + errors: [], }, { normalizedFields: { @@ -263,7 +262,7 @@ describe('browser normalizers', () => { unit: 'm', }, screenshots: 'on', - 'service.name': 'bean-service', + 'service.name': '', 'source.project.content': 'test content 3', tags: ['tag3', 'tag4'], 'throttling.config': '10d/15u/18l', @@ -279,6 +278,7 @@ describe('browser normalizers', () => { timeout: null, }, unsupportedKeys: [], + errors: [], }, ]); }); diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/browser_monitor.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/browser_monitor.ts index aae7031435c74..8eba2cd2651db 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/browser_monitor.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/browser_monitor.ts @@ -10,20 +10,14 @@ import { ConfigKey, DataStream, FormMonitorType, - Locations, - PrivateLocation, - ProjectMonitor, } from '../../../../common/runtime_types'; -import { getNormalizeCommonFields, getValueInSeconds } from './common_fields'; import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; - -export interface NormalizedProjectProps { - locations: Locations; - privateLocations: PrivateLocation[]; - monitor: ProjectMonitor; - projectId: string; - namespace: string; -} +import { + NormalizedProjectProps, + NormalizerResult, + getNormalizeCommonFields, + getValueInSeconds, +} from './common_fields'; export const getNormalizeBrowserFields = ({ locations = [], @@ -31,7 +25,8 @@ export const getNormalizeBrowserFields = ({ monitor, projectId, namespace, -}: NormalizedProjectProps): { normalizedFields: BrowserFields; unsupportedKeys: string[] } => { + version, +}: NormalizedProjectProps): NormalizerResult => { const defaultFields = DEFAULT_FIELDS[DataStream.BROWSER]; const commonFields = getNormalizeCommonFields({ @@ -40,6 +35,7 @@ export const getNormalizeBrowserFields = ({ monitor, projectId, namespace, + version, }); const normalizedFields = { @@ -81,5 +77,6 @@ export const getNormalizeBrowserFields = ({ ...normalizedFields, }, unsupportedKeys: [], + errors: [], }; }; diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/common_fields.test.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/common_fields.test.ts new file mode 100644 index 0000000000000..fee6f0ca2637c --- /dev/null +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/common_fields.test.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 { flattenAndFormatObject } from './common_fields'; + +describe('normalizeYamlConfig', () => { + it('does not continue flattening when encountering an array', () => { + const array = ['value1', 'value2']; + const supportedKeys: string[] = []; + const nestedObject = { + a: { + nested: { + key: array, + }, + }, + }; + expect(flattenAndFormatObject(nestedObject, '', supportedKeys)).toEqual({ + 'a.nested.key': array, + }); + }); + + it('does not continue flattening when encountering a supported key', () => { + const supportedKeys: string[] = ['a.supported.key']; + const object = { + with: { + further: { + nesting: '', + }, + }, + }; + const nestedObject = { + a: { + supported: { + key: object, + }, + }, + }; + expect(flattenAndFormatObject(nestedObject, '', supportedKeys)).toEqual({ + 'a.supported.key': object, + }); + }); + + it('flattens objects', () => { + const supportedKeys: string[] = []; + const nestedObject = { + a: { + nested: { + key: 'value1', + }, + }, + b: { + nested: { + key: 'value2', + }, + }, + }; + expect(flattenAndFormatObject(nestedObject, '', supportedKeys)).toEqual({ + 'a.nested.key': 'value1', + 'b.nested.key': 'value2', + }); + }); +}); diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/common_fields.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/common_fields.ts index 31aebd0e8586e..56045712606a1 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/common_fields.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/common_fields.ts @@ -20,7 +20,27 @@ import { } from '../../../../common/runtime_types'; import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; import { DEFAULT_COMMON_FIELDS } from '../../../../common/constants/monitor_defaults'; -import { NormalizedProjectProps } from '.'; + +export interface NormalizedProjectProps { + locations: Locations; + privateLocations: PrivateLocation[]; + monitor: ProjectMonitor; + projectId: string; + namespace: string; + version: string; +} + +export interface Error { + id: string; + reason: string; + details: string; +} + +export interface NormalizerResult { + normalizedFields: MonitorTypeFields; + unsupportedKeys: string[]; + errors: Error[]; +} export const getNormalizeCommonFields = ({ locations = [], @@ -28,7 +48,7 @@ export const getNormalizeCommonFields = ({ monitor, projectId, namespace, -}: NormalizedProjectProps): CommonFields => { +}: NormalizedProjectProps): Partial => { const defaultFields = DEFAULT_COMMON_FIELDS; const normalizedFields = { @@ -45,18 +65,16 @@ export const getNormalizeCommonFields = ({ privateLocations, publicLocations: locations, }), - [ConfigKey.APM_SERVICE_NAME]: - monitor.apmServiceName || defaultFields[ConfigKey.APM_SERVICE_NAME], [ConfigKey.TAGS]: getOptionalListField(monitor.tags) || defaultFields[ConfigKey.TAGS], [ConfigKey.NAMESPACE]: formatKibanaNamespace(namespace) || defaultFields[ConfigKey.NAMESPACE], [ConfigKey.ORIGINAL_SPACE]: namespace || defaultFields[ConfigKey.NAMESPACE], [ConfigKey.CUSTOM_HEARTBEAT_ID]: getCustomHeartbeatId(monitor, projectId, namespace), [ConfigKey.ENABLED]: monitor.enabled ?? defaultFields[ConfigKey.ENABLED], + [ConfigKey.TIMEOUT]: monitor.timeout + ? getValueInSeconds(monitor.timeout) + : defaultFields[ConfigKey.TIMEOUT], }; - return { - ...defaultFields, - ...normalizedFields, - }; + return normalizedFields; }; export const getCustomHeartbeatId = ( @@ -94,6 +112,35 @@ export const getMonitorLocations = ({ ) as BrowserFields[ConfigKey.LOCATIONS]; }; +export const getUnsupportedKeysError = ( + monitor: ProjectMonitor, + unsupportedKeys: string[], + version: string +) => ({ + id: monitor.id, + reason: 'Unsupported Heartbeat option', + details: `The following Heartbeat options are not supported for ${ + monitor.type + } project monitors in ${version}: ${unsupportedKeys.join( + '|' + )}. You monitor was not created or updated.`, +}); + +export const getMultipleUrlsOrHostsError = ( + monitor: ProjectMonitor, + key: 'hosts' | 'urls', + version: string +) => ({ + id: monitor.id, + reason: 'Unsupported Heartbeat option', + details: `Multiple ${key} are not supported for ${ + monitor.type + } project monitors in ${version}. Please set only 1 ${key.slice( + 0, + -1 + )} per monitor. You monitor was not created or updated.`, +}); + export const getValueInSeconds = (value: string) => { const keyMap = { h: 60 * 60, @@ -136,7 +183,7 @@ export const getOptionalArrayField = (value: string[] | string = '') => { * @param {Object} [monitor] * @returns {Object} Returns an object containing synthetics-compatible configuration keys */ -const flattenAndFormatObject = (obj: Record, prefix = '', keys: string[]) => +export const flattenAndFormatObject = (obj: Record, prefix = '', keys: string[]) => Object.keys(obj).reduce>((acc, k) => { const pre = prefix.length ? prefix + '.' : ''; const key = pre + k; 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 new file mode 100644 index 0000000000000..cea5aa8b50de8 --- /dev/null +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/http_monitor.test.ts @@ -0,0 +1,244 @@ +/* + * 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 { Locations, LocationStatus, PrivateLocation } from '../../../../common/runtime_types'; +import { normalizeProjectMonitors } from '.'; + +describe('http normalizers', () => { + describe('normalize push monitors', () => { + const projectId = 'test-project-id'; + const locations: Locations = [ + { + id: 'us_central', + label: 'Test Location', + geo: { lat: 33.333, lon: 73.333 }, + url: 'test-url', + isServiceManaged: true, + status: LocationStatus.GA, + }, + { + id: 'us_east', + label: 'Test Location', + geo: { lat: 33.333, lon: 73.333 }, + url: 'test-url', + isServiceManaged: true, + status: LocationStatus.GA, + }, + ]; + const privateLocations: PrivateLocation[] = [ + { + id: 'germany', + label: 'Germany', + isServiceManaged: false, + concurrentMonitors: 1, + agentPolicyId: 'germany', + }, + ]; + const monitors = [ + { + locations: ['localhost'], + type: 'http', + enabled: false, + id: 'my-monitor-2', + name: 'My Monitor 2', + urls: ['http://localhost:9200', 'http://anotherurl:9200'], + schedule: 60, + timeout: '80s', + 'check.request': { + method: 'POST', + body: { + json: 'body', + }, + headers: { + 'a-header': 'a-header-value', + }, + }, + response: { + include_body: 'always', + }, + 'response.include_headers': false, + 'check.response': { + status: [200], + body: ['Saved', 'saved'], + }, + unsupportedKey: { + nestedUnsupportedKey: 'unsupportedValue', + }, + service: { + name: 'test service', + }, + ssl: { + supported_protocols: ['TLSv1.2', 'TLSv1.3'], + }, + }, + { + locations: ['localhost'], + type: 'http', + enabled: false, + id: 'my-monitor-3', + name: 'My Monitor 3', + urls: ['http://localhost:9200'], + schedule: 60, + timeout: '80s', + 'check.request': { + method: 'POST', + body: 'sometextbody', + headers: { + 'a-header': 'a-header-value', + }, + }, + response: { + include_body: 'always', + }, + tags: 'tag2,tag2', + 'response.include_headers': false, + 'check.response': { + status: [200], + body: { + positive: ['Saved', 'saved'], + }, + }, + 'service.name': 'test service', + 'ssl.supported_protocols': 'TLSv1.2,TLSv1.3', + }, + ]; + + it('properly normalizes http monitors', () => { + const actual = normalizeProjectMonitors({ + locations, + privateLocations, + monitors, + projectId, + namespace: 'test-space', + version: '8.5.0', + }); + expect(actual).toEqual([ + { + errors: [ + { + details: + 'Multiple urls are not supported for http project monitors in 8.5.0. Please set only 1 url per monitor. You monitor was not created or updated.', + id: 'my-monitor-2', + reason: 'Unsupported Heartbeat option', + }, + { + details: + 'The following Heartbeat options are not supported for http project monitors in 8.5.0: check.response.body|unsupportedKey.nestedUnsupportedKey. You monitor was not created or updated.', + id: 'my-monitor-2', + reason: 'Unsupported Heartbeat option', + }, + ], + normalizedFields: { + __ui: { + is_tls_enabled: false, + }, + 'check.request.body': { + type: 'json', + value: '{"json":"body"}', + }, + 'check.request.headers': { + 'a-header': 'a-header-value', + }, + 'check.request.method': 'POST', + 'check.response.body.negative': [], + 'check.response.body.positive': [], + 'check.response.headers': {}, + 'check.response.status': ['200'], + config_id: '', + custom_heartbeat_id: 'my-monitor-2-test-project-id-test-space', + enabled: false, + form_monitor_type: 'http', + journey_id: 'my-monitor-2', + locations: [], + max_redirects: '0', + name: 'My Monitor 2', + namespace: 'test_space', + origin: 'project', + original_space: 'test-space', + password: '', + project_id: 'test-project-id', + proxy_url: '', + 'response.include_body': 'always', + 'response.include_headers': false, + schedule: { + number: '60', + unit: 'm', + }, + 'service.name': 'test service', + 'ssl.certificate': '', + 'ssl.certificate_authorities': '', + 'ssl.key': '', + 'ssl.key_passphrase': '', + 'ssl.supported_protocols': ['TLSv1.2', 'TLSv1.3'], + 'ssl.verification_mode': 'full', + tags: [], + timeout: '80', + type: 'http', + urls: 'http://localhost:9200', + 'url.port': null, + username: '', + }, + unsupportedKeys: ['check.response.body', 'unsupportedKey.nestedUnsupportedKey'], + }, + { + errors: [], + normalizedFields: { + __ui: { + is_tls_enabled: false, + }, + 'check.request.body': { + type: 'text', + value: 'sometextbody', + }, + 'check.request.headers': { + 'a-header': 'a-header-value', + }, + 'check.request.method': 'POST', + 'check.response.body.negative': [], + 'check.response.body.positive': ['Saved', 'saved'], + 'check.response.headers': {}, + 'check.response.status': ['200'], + config_id: '', + custom_heartbeat_id: 'my-monitor-3-test-project-id-test-space', + enabled: false, + form_monitor_type: 'http', + journey_id: 'my-monitor-3', + locations: [], + max_redirects: '0', + name: 'My Monitor 3', + namespace: 'test_space', + origin: 'project', + original_space: 'test-space', + password: '', + project_id: 'test-project-id', + proxy_url: '', + 'response.include_body': 'always', + 'response.include_headers': false, + schedule: { + number: '60', + unit: 'm', + }, + 'service.name': 'test service', + 'ssl.certificate': '', + 'ssl.certificate_authorities': '', + 'ssl.key': '', + 'ssl.key_passphrase': '', + 'ssl.supported_protocols': ['TLSv1.2', 'TLSv1.3'], + 'ssl.verification_mode': 'full', + tags: ['tag2', 'tag2'], + 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/http_monitor.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/http_monitor.ts index 6f637d818667a..d994e61517822 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/http_monitor.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/http_monitor.ts @@ -4,16 +4,26 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { getNormalizeCommonFields } from './common_fields'; -import { NormalizedProjectProps } from './browser_monitor'; +import { get } from 'lodash'; import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; import { ConfigKey, DataStream, FormMonitorType, HTTPFields, + Mode, + TLSVersion, } from '../../../../common/runtime_types/monitor_management'; -import { normalizeYamlConfig, getValueInSeconds, getOptionalArrayField } from './common_fields'; +import { + NormalizedProjectProps, + NormalizerResult, + getNormalizeCommonFields, + normalizeYamlConfig, + getOptionalListField, + getOptionalArrayField, + getUnsupportedKeysError, + getMultipleUrlsOrHostsError, +} from './common_fields'; export const getNormalizeHTTPFields = ({ locations = [], @@ -21,18 +31,30 @@ export const getNormalizeHTTPFields = ({ monitor, projectId, namespace, -}: NormalizedProjectProps): { normalizedFields: HTTPFields; unsupportedKeys: string[] } => { + version, +}: NormalizedProjectProps): NormalizerResult => { const defaultFields = DEFAULT_FIELDS[DataStream.HTTP]; + const errors = []; const { yamlConfig, unsupportedKeys } = normalizeYamlConfig(monitor); - const commonFields = getNormalizeCommonFields({ locations, privateLocations, monitor, projectId, namespace, + version, }); + /* Check if monitor has multiple urls */ + const urls = getOptionalListField(monitor.urls); + if (urls.length > 1) { + errors.push(getMultipleUrlsOrHostsError(monitor, 'urls', version)); + } + + if (unsupportedKeys.length) { + errors.push(getUnsupportedKeysError(monitor, unsupportedKeys, version)); + } + const normalizedFields = { ...yamlConfig, ...commonFields, @@ -41,9 +63,13 @@ export const getNormalizeHTTPFields = ({ [ConfigKey.URLS]: getOptionalArrayField(monitor.urls) || defaultFields[ConfigKey.URLS], [ConfigKey.MAX_REDIRECTS]: monitor[ConfigKey.MAX_REDIRECTS] || defaultFields[ConfigKey.MAX_REDIRECTS], - [ConfigKey.TIMEOUT]: monitor.timeout - ? getValueInSeconds(monitor.timeout) - : defaultFields[ConfigKey.TIMEOUT], + [ConfigKey.REQUEST_BODY_CHECK]: getRequestBodyField( + (yamlConfig as Record)[ConfigKey.REQUEST_BODY_CHECK] as string, + defaultFields[ConfigKey.REQUEST_BODY_CHECK] + ), + [ConfigKey.TLS_VERSION]: get(monitor, ConfigKey.TLS_VERSION) + ? (getOptionalListField(get(monitor, ConfigKey.TLS_VERSION)) as TLSVersion[]) + : defaultFields[ConfigKey.TLS_VERSION], }; return { normalizedFields: { @@ -51,5 +77,26 @@ export const getNormalizeHTTPFields = ({ ...normalizedFields, }, unsupportedKeys, + errors, + }; +}; + +export const getRequestBodyField = ( + value: string, + defaultValue: HTTPFields[ConfigKey.REQUEST_BODY_CHECK] +): HTTPFields[ConfigKey.REQUEST_BODY_CHECK] => { + let parsedValue: string; + let type: Mode; + + if (typeof value === 'object') { + parsedValue = JSON.stringify(value); + type = Mode.JSON; + } else { + parsedValue = value; + type = Mode.PLAINTEXT; + } + return { + type, + value: parsedValue || defaultValue.value, }; }; 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 new file mode 100644 index 0000000000000..74ac2cb2bfaf3 --- /dev/null +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/icmp_monitor.test.ts @@ -0,0 +1,227 @@ +/* + * 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 { Locations, LocationStatus, PrivateLocation } from '../../../../common/runtime_types'; +import { normalizeProjectMonitors } from '.'; + +describe('icmp normalizers', () => { + describe('normalize push monitors', () => { + const projectId = 'test-project-id'; + const locations: Locations = [ + { + id: 'us_central', + label: 'Test Location', + geo: { lat: 33.333, lon: 73.333 }, + url: 'test-url', + isServiceManaged: true, + status: LocationStatus.GA, + }, + { + id: 'us_east', + label: 'Test Location', + geo: { lat: 33.333, lon: 73.333 }, + url: 'test-url', + isServiceManaged: true, + status: LocationStatus.GA, + }, + ]; + const privateLocations: PrivateLocation[] = [ + { + id: 'germany', + label: 'Germany', + isServiceManaged: false, + concurrentMonitors: 1, + agentPolicyId: 'germany', + }, + ]; + const monitors = [ + { + locations: ['us_central'], + type: 'icmp', + id: 'Cloudflare-DNS', + name: 'Cloudflare DNS', + hosts: ['1.1.1.1'], + schedule: 1, + tags: ['service:smtp', 'org:google'], + privateLocations: ['Test private location 0'], + timeout: '1m', + wait: '30s', + 'service.name': 'test service', + }, + { + locations: ['us_central'], + type: 'icmp', + id: 'Cloudflare-DNS-2', + name: 'Cloudflare DNS 2', + hosts: '1.1.1.1', + schedule: 1, + tags: 'tag1,tag2', + privateLocations: ['Test private location 0'], + wait: '1m', + service: { + name: 'test service', + }, + }, + { + locations: ['us_central'], + type: 'icmp', + id: 'Cloudflare-DNS-3', + name: 'Cloudflare DNS 3', + hosts: '1.1.1.1,2.2.2.2', + schedule: 1, + tags: 'tag1,tag2', + privateLocations: ['Test private location 0'], + unsupportedKey: { + nestedUnsupportedKey: 'unnsuportedValue', + }, + }, + ]; + + it('properly normalizes icmp monitors', () => { + const actual = normalizeProjectMonitors({ + locations, + privateLocations, + monitors, + projectId, + namespace: 'test-space', + version: '8.5.0', + }); + expect(actual).toEqual([ + { + errors: [], + normalizedFields: { + config_id: '', + custom_heartbeat_id: 'Cloudflare-DNS-test-project-id-test-space', + enabled: true, + form_monitor_type: 'icmp', + hosts: '1.1.1.1', + journey_id: 'Cloudflare-DNS', + locations: [ + { + geo: { + lat: 33.333, + lon: 73.333, + }, + id: 'us_central', + isServiceManaged: true, + label: 'Test Location', + status: 'ga', + url: 'test-url', + }, + ], + name: 'Cloudflare DNS', + namespace: 'test_space', + origin: 'project', + original_space: 'test-space', + project_id: 'test-project-id', + schedule: { + number: '1', + unit: 'm', + }, + 'service.name': 'test service', + tags: ['service:smtp', 'org:google'], + timeout: '60', + type: 'icmp', + wait: '30', + }, + unsupportedKeys: [], + }, + { + errors: [], + normalizedFields: { + config_id: '', + custom_heartbeat_id: 'Cloudflare-DNS-2-test-project-id-test-space', + enabled: true, + form_monitor_type: 'icmp', + hosts: '1.1.1.1', + journey_id: 'Cloudflare-DNS-2', + locations: [ + { + geo: { + lat: 33.333, + lon: 73.333, + }, + id: 'us_central', + isServiceManaged: true, + label: 'Test Location', + status: 'ga', + url: 'test-url', + }, + ], + name: 'Cloudflare DNS 2', + namespace: 'test_space', + origin: 'project', + original_space: 'test-space', + project_id: 'test-project-id', + schedule: { + number: '1', + unit: 'm', + }, + 'service.name': 'test service', + tags: ['tag1', 'tag2'], + timeout: '16', + type: 'icmp', + wait: '60', + }, + unsupportedKeys: [], + }, + { + errors: [ + { + details: + 'Multiple hosts are not supported for icmp project monitors in 8.5.0. Please set only 1 host per monitor. You monitor was not created or updated.', + id: 'Cloudflare-DNS-3', + reason: 'Unsupported Heartbeat option', + }, + { + details: + 'The following Heartbeat options are not supported for icmp project monitors in 8.5.0: unsupportedKey.nestedUnsupportedKey. You monitor was not created or updated.', + id: 'Cloudflare-DNS-3', + reason: 'Unsupported Heartbeat option', + }, + ], + normalizedFields: { + config_id: '', + custom_heartbeat_id: 'Cloudflare-DNS-3-test-project-id-test-space', + enabled: true, + form_monitor_type: 'icmp', + hosts: '1.1.1.1', + journey_id: 'Cloudflare-DNS-3', + locations: [ + { + geo: { + lat: 33.333, + lon: 73.333, + }, + id: 'us_central', + isServiceManaged: true, + label: 'Test Location', + status: 'ga', + url: 'test-url', + }, + ], + name: 'Cloudflare DNS 3', + namespace: 'test_space', + origin: 'project', + original_space: 'test-space', + project_id: 'test-project-id', + schedule: { + number: '1', + unit: 'm', + }, + 'service.name': '', + tags: ['tag1', 'tag2'], + timeout: '16', + type: 'icmp', + wait: '1', + }, + unsupportedKeys: ['unsupportedKey.nestedUnsupportedKey'], + }, + ]); + }); + }); +}); diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/icmp_monitor.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/icmp_monitor.ts index 282475f94d7cd..ea4eb7dbdba84 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/icmp_monitor.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/icmp_monitor.ts @@ -5,8 +5,6 @@ * 2.0. */ -import { getNormalizeCommonFields } from './common_fields'; -import { NormalizedProjectProps } from './browser_monitor'; import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; import { ConfigKey, @@ -14,7 +12,17 @@ import { FormMonitorType, ICMPFields, } from '../../../../common/runtime_types/monitor_management'; -import { normalizeYamlConfig, getValueInSeconds, getOptionalArrayField } from './common_fields'; +import { + NormalizerResult, + NormalizedProjectProps, + normalizeYamlConfig, + getNormalizeCommonFields, + getValueInSeconds, + getOptionalArrayField, + getOptionalListField, + getMultipleUrlsOrHostsError, + getUnsupportedKeysError, +} from './common_fields'; export const getNormalizeICMPFields = ({ locations = [], @@ -22,8 +30,10 @@ export const getNormalizeICMPFields = ({ monitor, projectId, namespace, -}: NormalizedProjectProps): { normalizedFields: ICMPFields; unsupportedKeys: string[] } => { + version, +}: NormalizedProjectProps): NormalizerResult => { const defaultFields = DEFAULT_FIELDS[DataStream.ICMP]; + const errors = []; const { yamlConfig, unsupportedKeys } = normalizeYamlConfig(monitor); const commonFields = getNormalizeCommonFields({ @@ -32,8 +42,19 @@ export const getNormalizeICMPFields = ({ monitor, projectId, namespace, + version, }); + /* Check if monitor has multiple hosts */ + const hosts = getOptionalListField(monitor.hosts); + if (hosts.length > 1) { + errors.push(getMultipleUrlsOrHostsError(monitor, 'hosts', version)); + } + + if (unsupportedKeys.length) { + errors.push(getUnsupportedKeysError(monitor, unsupportedKeys, version)); + } + const normalizedFields = { ...yamlConfig, ...commonFields, @@ -41,9 +62,6 @@ export const getNormalizeICMPFields = ({ [ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.ICMP, [ConfigKey.HOSTS]: getOptionalArrayField(monitor[ConfigKey.HOSTS]) || defaultFields[ConfigKey.HOSTS], - [ConfigKey.TIMEOUT]: monitor.timeout - ? getValueInSeconds(monitor.timeout) - : defaultFields[ConfigKey.TIMEOUT], [ConfigKey.WAIT]: monitor.wait ? getValueInSeconds(monitor.wait) || defaultFields[ConfigKey.WAIT] : defaultFields[ConfigKey.WAIT], @@ -54,5 +72,6 @@ export const getNormalizeICMPFields = ({ ...normalizedFields, }, unsupportedKeys, + errors, }; }; diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/index.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/index.ts index 82b2acfacbf5b..6bac17c0fb542 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/index.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/index.ts @@ -14,14 +14,7 @@ import { getNormalizeBrowserFields } from './browser_monitor'; import { getNormalizeICMPFields } from './icmp_monitor'; import { getNormalizeTCPFields } from './tcp_monitor'; import { getNormalizeHTTPFields } from './http_monitor'; - -export interface NormalizedProjectProps { - locations: Locations; - privateLocations: PrivateLocation[]; - monitor: ProjectMonitor; - projectId: string; - namespace: string; -} +import { NormalizedProjectProps } from './common_fields'; export const normalizeProjectMonitor = (props: NormalizedProjectProps) => { const { monitor } = props; @@ -50,14 +43,23 @@ export const normalizeProjectMonitors = ({ monitors = [], projectId, namespace, + version, }: { locations: Locations; privateLocations: PrivateLocation[]; monitors: ProjectMonitor[]; projectId: string; namespace: string; + version: string; }) => { return monitors.map((monitor) => { - return normalizeProjectMonitor({ monitor, locations, privateLocations, projectId, namespace }); + return normalizeProjectMonitor({ + monitor, + locations, + privateLocations, + projectId, + namespace, + version, + }); }); }; 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 new file mode 100644 index 0000000000000..a479bbc09d47b --- /dev/null +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/tcp_monitor.test.ts @@ -0,0 +1,268 @@ +/* + * 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 { Locations, LocationStatus, PrivateLocation } from '../../../../common/runtime_types'; +import { normalizeProjectMonitors } from '.'; + +describe('tcp normalizers', () => { + describe('normalize push monitors', () => { + const projectId = 'test-project-id'; + const locations: Locations = [ + { + id: 'us_central', + label: 'Test Location', + geo: { lat: 33.333, lon: 73.333 }, + url: 'test-url', + isServiceManaged: true, + status: LocationStatus.GA, + }, + { + id: 'us_east', + label: 'Test Location', + geo: { lat: 33.333, lon: 73.333 }, + url: 'test-url', + isServiceManaged: true, + status: LocationStatus.GA, + }, + ]; + const privateLocations: PrivateLocation[] = [ + { + id: 'germany', + label: 'Germany', + isServiceManaged: false, + concurrentMonitors: 1, + agentPolicyId: 'germany', + }, + ]; + const monitors = [ + { + locations: ['us_central'], + type: 'tcp', + id: 'gmail-smtp', + name: 'GMail SMTP', + hosts: ['smtp.gmail.com:587'], + schedule: 1, + tags: ['service:smtp', 'org:google'], + privateLocations: ['BEEP'], + 'service.name': 'test service', + 'ssl.supported_protocols': ['TLSv1.2', 'TLSv1.3'], + }, + { + locations: ['us_central'], + type: 'tcp', + id: 'always-down', + name: 'Always Down', + hosts: 'localhost:18278', + schedule: 1, + tags: 'tag1,tag2', + privateLocations: ['BEEP'], + service: { + name: 'test service', + }, + ssl: { + supported_protocols: 'TLSv1.2,TLSv1.3', + }, + }, + { + locations: ['us_central'], + type: 'tcp', + id: 'always-down', + name: 'Always Down', + hosts: ['localhost', 'anotherhost'], + ports: ['5698'], + schedule: 1, + tags: 'tag1,tag2', + privateLocations: ['BEEP'], + unsupportedKey: { + nestedUnsupportedKey: 'unnsuportedValue', + }, + }, + ]; + + it('properly normalizes tcp monitors', () => { + const actual = normalizeProjectMonitors({ + locations, + privateLocations, + monitors, + projectId, + namespace: 'test-space', + version: '8.5.0', + }); + expect(actual).toEqual([ + { + errors: [], + normalizedFields: { + __ui: { + is_tls_enabled: false, + }, + 'check.receive': '', + 'check.send': '', + config_id: '', + custom_heartbeat_id: 'gmail-smtp-test-project-id-test-space', + enabled: true, + form_monitor_type: 'tcp', + hosts: 'smtp.gmail.com:587', + 'url.port': null, + journey_id: 'gmail-smtp', + locations: [ + { + geo: { + lat: 33.333, + lon: 73.333, + }, + id: 'us_central', + isServiceManaged: true, + label: 'Test Location', + status: 'ga', + url: 'test-url', + }, + ], + name: 'GMail SMTP', + namespace: 'test_space', + origin: 'project', + original_space: 'test-space', + project_id: 'test-project-id', + proxy_url: '', + proxy_use_local_resolver: false, + schedule: { + number: '1', + unit: 'm', + }, + 'service.name': 'test service', + 'ssl.certificate': '', + 'ssl.certificate_authorities': '', + 'ssl.key': '', + 'ssl.key_passphrase': '', + 'ssl.supported_protocols': ['TLSv1.2', 'TLSv1.3'], + 'ssl.verification_mode': 'full', + tags: ['service:smtp', 'org:google'], + timeout: '16', + type: 'tcp', + }, + unsupportedKeys: [], + }, + { + errors: [], + normalizedFields: { + __ui: { + is_tls_enabled: false, + }, + 'check.receive': '', + 'check.send': '', + config_id: '', + custom_heartbeat_id: 'always-down-test-project-id-test-space', + enabled: true, + form_monitor_type: 'tcp', + hosts: 'localhost:18278', + 'url.port': null, + journey_id: 'always-down', + locations: [ + { + geo: { + lat: 33.333, + lon: 73.333, + }, + id: 'us_central', + isServiceManaged: true, + label: 'Test Location', + status: 'ga', + url: 'test-url', + }, + ], + name: 'Always Down', + namespace: 'test_space', + origin: 'project', + original_space: 'test-space', + project_id: 'test-project-id', + proxy_url: '', + proxy_use_local_resolver: false, + schedule: { + number: '1', + unit: 'm', + }, + 'service.name': 'test service', + 'ssl.certificate': '', + 'ssl.certificate_authorities': '', + 'ssl.key': '', + 'ssl.key_passphrase': '', + 'ssl.supported_protocols': ['TLSv1.2', 'TLSv1.3'], + 'ssl.verification_mode': 'full', + tags: ['tag1', 'tag2'], + timeout: '16', + type: 'tcp', + }, + unsupportedKeys: [], + }, + { + errors: [ + { + details: + 'Multiple hosts are not supported for tcp project monitors in 8.5.0. Please set only 1 host per monitor. You monitor was not created or updated.', + id: 'always-down', + reason: 'Unsupported Heartbeat option', + }, + { + details: + 'The following Heartbeat options are not supported for tcp project monitors in 8.5.0: ports|unsupportedKey.nestedUnsupportedKey. You monitor was not created or updated.', + id: 'always-down', + reason: 'Unsupported Heartbeat option', + }, + ], + normalizedFields: { + __ui: { + is_tls_enabled: false, + }, + 'check.receive': '', + 'check.send': '', + config_id: '', + custom_heartbeat_id: 'always-down-test-project-id-test-space', + enabled: true, + form_monitor_type: 'tcp', + hosts: 'localhost', + 'url.port': null, + journey_id: 'always-down', + locations: [ + { + geo: { + lat: 33.333, + lon: 73.333, + }, + id: 'us_central', + isServiceManaged: true, + label: 'Test Location', + status: 'ga', + url: 'test-url', + }, + ], + name: 'Always Down', + namespace: 'test_space', + origin: 'project', + original_space: 'test-space', + project_id: 'test-project-id', + proxy_url: '', + proxy_use_local_resolver: false, + schedule: { + number: '1', + unit: 'm', + }, + 'service.name': '', + 'ssl.certificate': '', + 'ssl.certificate_authorities': '', + 'ssl.key': '', + 'ssl.key_passphrase': '', + 'ssl.supported_protocols': ['TLSv1.1', 'TLSv1.2', 'TLSv1.3'], + 'ssl.verification_mode': 'full', + tags: ['tag1', 'tag2'], + timeout: '16', + type: 'tcp', + }, + unsupportedKeys: ['ports', 'unsupportedKey.nestedUnsupportedKey'], + }, + ]); + }); + }); +}); diff --git a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/tcp_monitor.ts b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/tcp_monitor.ts index 8a85b2959d804..1045bc5ebff72 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/tcp_monitor.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/project_monitor/normalizers/tcp_monitor.ts @@ -4,18 +4,25 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - -import { NormalizedProjectProps } from './browser_monitor'; +import { get } from 'lodash'; import { DEFAULT_FIELDS } from '../../../../common/constants/monitor_defaults'; -import { normalizeYamlConfig, getValueInSeconds } from './common_fields'; - import { ConfigKey, DataStream, FormMonitorType, TCPFields, + TLSVersion, } from '../../../../common/runtime_types/monitor_management'; -import { getNormalizeCommonFields, getOptionalArrayField } from './common_fields'; +import { + NormalizedProjectProps, + NormalizerResult, + normalizeYamlConfig, + getNormalizeCommonFields, + getOptionalArrayField, + getOptionalListField, + getMultipleUrlsOrHostsError, + getUnsupportedKeysError, +} from './common_fields'; export const getNormalizeTCPFields = ({ locations = [], @@ -23,8 +30,10 @@ export const getNormalizeTCPFields = ({ monitor, projectId, namespace, -}: NormalizedProjectProps): { normalizedFields: TCPFields; unsupportedKeys: string[] } => { + version, +}: NormalizedProjectProps): NormalizerResult => { const defaultFields = DEFAULT_FIELDS[DataStream.TCP]; + const errors = []; const { yamlConfig, unsupportedKeys } = normalizeYamlConfig(monitor); const commonFields = getNormalizeCommonFields({ @@ -33,8 +42,19 @@ export const getNormalizeTCPFields = ({ monitor, projectId, namespace, + version, }); + /* Check if monitor has multiple hosts */ + const hosts = getOptionalListField(monitor.hosts); + if (hosts.length > 1) { + errors.push(getMultipleUrlsOrHostsError(monitor, 'hosts', version)); + } + + if (unsupportedKeys.length) { + errors.push(getUnsupportedKeysError(monitor, unsupportedKeys, version)); + } + const normalizedFields = { ...yamlConfig, ...commonFields, @@ -42,9 +62,9 @@ export const getNormalizeTCPFields = ({ [ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.TCP, [ConfigKey.HOSTS]: getOptionalArrayField(monitor[ConfigKey.HOSTS]) || defaultFields[ConfigKey.HOSTS], - [ConfigKey.TIMEOUT]: monitor.timeout - ? getValueInSeconds(monitor.timeout) - : defaultFields[ConfigKey.TIMEOUT], + [ConfigKey.TLS_VERSION]: get(monitor, ConfigKey.TLS_VERSION) + ? (getOptionalListField(get(monitor, ConfigKey.TLS_VERSION)) as TLSVersion[]) + : defaultFields[ConfigKey.TLS_VERSION], }; return { normalizedFields: { @@ -52,5 +72,6 @@ export const getNormalizeTCPFields = ({ ...normalizedFields, }, unsupportedKeys, + errors, }; }; 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 aa0be87f0e818..16cbf3f33a8aa 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 = ''; @@ -197,22 +196,17 @@ export class ProjectMonitorFormatter { try { await this.validatePermissions({ monitor }); - const { normalizedFields: normalizedMonitor, unsupportedKeys } = normalizeProjectMonitor({ + const { normalizedFields: normalizedMonitor, errors } = normalizeProjectMonitor({ monitor, locations: this.locations, privateLocations: this.privateLocations, projectId: this.projectId, namespace: this.spaceId, + version: this.server.kibanaVersion, }); - if (unsupportedKeys.length) { - this.failedMonitors.push({ - id: monitor.id, - reason: 'Unsupported Heartbeat option', - details: `The following Heartbeat options are not supported for ${ - monitor.type - } project monitors in ${this.server.kibanaVersion}: ${unsupportedKeys.join('|')}`, - }); + if (errors.length) { + this.failedMonitors.push(...errors); this.handleStreamingMessage({ message: `${monitor.id}: failed to create or update monitor`, }); @@ -233,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({ @@ -264,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, @@ -296,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({ @@ -357,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/synthetics/server/synthetics_service/synthetics_service.ts b/x-pack/plugins/synthetics/server/synthetics_service/synthetics_service.ts index d0211800dc6c0..c0f977758f6da 100644 --- a/x-pack/plugins/synthetics/server/synthetics_service/synthetics_service.ts +++ b/x-pack/plugins/synthetics/server/synthetics_service/synthetics_service.ts @@ -16,8 +16,6 @@ import { TaskInstance, } from '@kbn/task-manager-plugin/server'; import { sendErrorTelemetryEvents } from '../routes/telemetry/monitor_upgrade_sender'; -import { MonitorSyncEvent } from '../legacy_uptime/lib/telemetry/types'; -import { sendSyncTelemetryEvents } from '../routes/telemetry/monitor_upgrade_sender'; import { UptimeServerSetup } from '../legacy_uptime/lib/adapters'; import { installSyntheticsIndexTemplates } from '../routes/synthetics_service/install_index_templates'; import { SyntheticsServiceApiKey } from '../../common/runtime_types/synthetics_service_api_key'; @@ -317,11 +315,6 @@ export class SyntheticsService { return null; } - if (!configs && monitorConfigs.length > 0) { - const telemetry = this.getSyncTelemetry(monitorConfigs); - sendSyncTelemetryEvents(this.logger, this.server.telemetry, telemetry); - } - this.apiKey = await this.getApiKey(); if (!this.apiKey) { @@ -490,70 +483,6 @@ export class SyntheticsService { formatMonitorConfig(Object.keys(config) as ConfigKey[], config as Partial) ); } - - getSyncTelemetry(monitors: SyntheticsMonitorWithId[]): MonitorSyncEvent { - let totalRuns = 0; - let browserTestRuns = 0; - let httpTestRuns = 0; - let icmpTestRuns = 0; - let tcpTestRuns = 0; - - const locationRuns: Record = {}; - const locationMonitors: Record = {}; - - const testRunsInDay = (schedule: string) => { - return (24 * 60) / Number(schedule); - }; - - const monitorsByType: Record = { - browser: 0, - http: 0, - tcp: 0, - icmp: 0, - }; - - monitors.forEach((monitor) => { - if (monitor.schedule.number) { - totalRuns += testRunsInDay(monitor.schedule.number); - } - switch (monitor.type) { - case 'browser': - browserTestRuns += testRunsInDay(monitor.schedule.number); - break; - case 'http': - httpTestRuns += testRunsInDay(monitor.schedule.number); - break; - case 'icmp': - icmpTestRuns += testRunsInDay(monitor.schedule.number); - break; - case 'tcp': - tcpTestRuns += testRunsInDay(monitor.schedule.number); - break; - default: - break; - } - - monitorsByType[monitor.type] = (monitorsByType[monitor.type] ?? 0) + 1; - - monitor.locations.forEach(({ id }) => { - locationRuns[id + 'Tests'] = - (locationRuns[id + 'Tests'] ?? 0) + testRunsInDay(monitor.schedule.number); - locationMonitors[id + 'Monitors'] = (locationMonitors[id + 'Monitors'] ?? 0) + 1; - }); - }); - - return { - total: monitors.length, - totalTests: totalRuns, - browserTests24h: browserTestRuns, - httpTests24h: httpTestRuns, - icmpTests24h: icmpTestRuns, - tcpTests24h: tcpTestRuns, - ...locationRuns, - ...locationMonitors, - ...monitorsByType, - }; - } } class IndexTemplateInstallationError extends Error { diff --git a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json index 0c389000f6c80..9a47ad9de093e 100644 --- a/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json +++ b/x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @@ -4644,6 +4644,18 @@ "properties": { "all": { "properties": { + "total": { + "type": "long" + }, + "monthly": { + "type": "long" + }, + "weekly": { + "type": "long" + }, + "daily": { + "type": "long" + }, "assignees": { "properties": { "total": { @@ -4657,18 +4669,6 @@ } } }, - "total": { - "type": "long" - }, - "monthly": { - "type": "long" - }, - "weekly": { - "type": "long" - }, - "daily": { - "type": "long" - }, "status": { "properties": { "open": { @@ -4720,6 +4720,18 @@ }, "sec": { "properties": { + "total": { + "type": "long" + }, + "monthly": { + "type": "long" + }, + "weekly": { + "type": "long" + }, + "daily": { + "type": "long" + }, "assignees": { "properties": { "total": { @@ -4732,7 +4744,11 @@ "type": "long" } } - }, + } + } + }, + "obs": { + "properties": { "total": { "type": "long" }, @@ -4744,11 +4760,7 @@ }, "daily": { "type": "long" - } - } - }, - "obs": { - "properties": { + }, "assignees": { "properties": { "total": { @@ -4761,7 +4773,11 @@ "type": "long" } } - }, + } + } + }, + "main": { + "properties": { "total": { "type": "long" }, @@ -4773,11 +4789,7 @@ }, "daily": { "type": "long" - } - } - }, - "main": { - "properties": { + }, "assignees": { "properties": { "total": { @@ -4790,18 +4802,6 @@ "type": "long" } } - }, - "total": { - "type": "long" - }, - "monthly": { - "type": "long" - }, - "weekly": { - "type": "long" - }, - "daily": { - "type": "long" } } } @@ -10029,6 +10029,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -10161,6 +10183,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -10293,6 +10337,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -10425,6 +10491,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -10557,6 +10645,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -10689,6 +10799,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -10847,6 +10979,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -10979,6 +11133,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -11111,6 +11287,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -11243,6 +11441,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -11375,6 +11595,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -11507,6 +11749,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -11665,6 +11929,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -11797,6 +12083,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -11929,6 +12237,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -12061,6 +12391,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -12193,6 +12545,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { @@ -12325,6 +12699,28 @@ } } }, + "enrichment_duration": { + "properties": { + "max": { + "type": "float", + "_meta": { + "description": "The max duration" + } + }, + "avg": { + "type": "float", + "_meta": { + "description": "The avg duration" + } + }, + "min": { + "type": "float", + "_meta": { + "description": "The min duration" + } + } + } + }, "gap_duration": { "properties": { "max": { diff --git a/x-pack/plugins/threat_intelligence/FAQ.md b/x-pack/plugins/threat_intelligence/FAQ.md deleted file mode 100644 index d3f1287713840..0000000000000 --- a/x-pack/plugins/threat_intelligence/FAQ.md +++ /dev/null @@ -1,15 +0,0 @@ -# FAQ - -### Where can I find the UI for the Threat Intelligence plugin? - -Kibana recommends working on a fork of the [elastic/kibana repository](https://github.com/elastic/kibana) (see [here](https://docs.github.com/en/get-started/quickstart/fork-a-repo) to learn about forks). - -### How is the Threat Intelligence code loaded in Kibana? - -The Threat Intelligence plugin is loaded within the [security_solution](https://github.com/elastic/kibana/tree/main/x-pack/plugins/security_solution) plugin. - -### I'm not seeing any data in the Indicators' table - -See this [documentation here](https://github.com/elastic/security-team/blob/main/docs/protections-team/threat-intelligence-services/protections-experience/development-setup.mdx) to get Threat Intelligence feed in Kibana. - -Once you have the feed running, go to `Management > Advanced Settings > Threat indices` and add `filebeat-*` to the list (comma separated). \ No newline at end of file diff --git a/x-pack/plugins/threat_intelligence/README.md b/x-pack/plugins/threat_intelligence/README.md index 945ab9b85a4f1..7395ca0df8a70 100755 --- a/x-pack/plugins/threat_intelligence/README.md +++ b/x-pack/plugins/threat_intelligence/README.md @@ -6,28 +6,55 @@ Elastic Threat Intelligence makes it easy to analyze and investigate potential s The Threat Intelligence UI is displayed in Kibana Security, under the Explore section. -## Quick Start +## Development setup -See the [kibana contributing guide](https://github.com/elastic/kibana/blob/main/CONTRIBUTING.md) for instructions setting up your development environment. +### Kibana development in general -Verify your node version [here](https://github.com/elastic/kibana/blob/main/.node-version). +Best source - [internal Kibana docs](https://docs.elastic.dev/kibana-dev-docs/getting-started/welcome). If you have any issues with setting up your Kibana dev environment [#kibana](https://elastic.slack.com/archives/C0D8P2XK5) Slack channel is a good way to get help. -**Run ES:** +### Essential `kibana.yml` settings -`yarn es snapshot --license trial` +You can make a copy of `kibana.yml` file into `kibana.dev.yml` and make adjustments to the settings. External documentation on the flags available is [here](https://www.elastic.co/guide/en/kibana/current/settings.html) -**Run Kibana:** +It is recommended to set `server.basePath: "/kbn"` to make you local instance persist the base Kibana path. If you don't do it, the base path will be a random string every time you start Kibana. Any other value than `/kbn` will also work. -> **Important:** -> -> See here to get your `kibana.yaml` to enable the Threat Intelligence plugin. +### Getting Threat Intelligence feeds data into Kibana -``` -yarn kbn reset && yarn kbn bootstrap -yarn start --no-base-path -``` +There are many ways to get data for you local development. We first focus on getting Threat Intelligence data specifically. + +### Setting up filebeat threatintel integrations locally + +1. install [mage](https://github.com/magefile/mage). It is a Go build tool used to build `beats`. Installation from the sources requires Go lang set up. A simpler option might be to install it from a package manager available in your system (eg. `brew` on MacOs) or use their [binary distribution](https://github.com/magefile/mage/releases) +1. start Elasticsearch and Kibana +1. clone [beats](https://github.com/elastic/beats) repository +1. inside beats repository, update `x-pack/filebeat/filebeat.yml` with your local Elasticsearch and Kibana connection configs + + ``` + output.elasticsearch: + hosts: ["localhost:9200"] + username: "elastic" + password: "changeme" + + setup.kibana: + host: "localhost:5601" // make sure to run Kibana with --no-base-path option or specify server.basePath in Kibana config and use it here as a path, eg. localhost:5601/kbn + ``` + +1. go into `x-pack/filebeat` (that's where security related modules live) +1. build filebeat `mage build` +1. enable `threatintel` module by running `./filebeat modules enable threatintel` +1. enable specific Threat Intelligence integrations by updating `modules.d/threatintel.yml`. Update `enable` to `true` in every integration you want to enable and configs specific for these integrations. The bare minimum is to enable Abuse.CH feeds `abuseurl`, `abusemalware` and `malwarebazaar`. +1. run `./filebeat setup -E setup.dashboards.directory=build/kibana` to set up predefined dashboards +1. run `./filebeat -e` to start filebeat +1. to validate that the set up works, wait for some Threat Intel data to be ingested and then go in Analytics > Discover in your local Kibana to search `event.category : threat and event.type : indicator`. You should see some documents returned by this search. Abuse.CH feeds are up to date so you should see the results from the last 7 days. + +### More ways to get data -### Performance +There are many more tools available for getting the data for testing or local development, depending on the data type and usecase. + +- Kibana development docs > [Add data](https://docs.elastic.dev/kibana-dev-docs/getting-started/sample-data) +- [Dev/Design/Testing Environments and Frameworks](https://docs.google.com/document/d/1DGCcLMnVKQ_STlkbS4E0m4kbPivNtR8iMlg_IoCuCEw/edit#) gathered by Security Engineering Productivity team + +### Generate fixtures for local testing You can generate large volumes of threat indicators on demand with the following script: @@ -37,17 +64,29 @@ node scripts/generate_indicators.js see the file in order to adjust the amount of indicators generated. The default is one million. -### Useful hints +## Data for E2E tests -Export local instance data to es_archives (will be loaded in cypress tests). +Use es_archives to export data for e2e testing purposes, like so: ``` TEST_ES_PORT=9200 node scripts/es_archiver save x-pack/test/threat_intelligence_cypress/es_archives/threat_intelligence "logs-ti*" ``` +These can be loaded at will with `x-pack/plugins/threat_intelligence/cypress/tasks/es_archiver.ts` task. + +You can use this approach to load separate data dumps for every test case, to cover all critical scenarios. + ## FAQ -See [FAQ.md](https://github.com/elastic/kibana/blob/main/x-pack/plugins/threat_intelligence/FAQ.md) for questions you may have. +### How is the Threat Intelligence code loaded in Kibana? + +The Threat Intelligence plugin is loaded lazily within the [security_solution](https://github.com/elastic/kibana/tree/main/x-pack/plugins/security_solution) plugin, +from `x-pack/plugins/security_solution/public/threat_intelligence` owned by the Protections Experience Team. + +## QA and demo for implemented features + +One way to QA and demo the feature merged into `main` branch is to run the latest `main` locally. +Another option is to deploy a Staging instance. For Staging environment snapshots are being build every night with the latest state of the `main` branch. More documentation can be found [here](https://cloud.elastic.dev/environments/Staging/#automatic-termination-of-staging-deployments) ## Contributing diff --git a/x-pack/plugins/threat_intelligence/kibana.json b/x-pack/plugins/threat_intelligence/kibana.json index f55191e68a875..c640782b90f3c 100644 --- a/x-pack/plugins/threat_intelligence/kibana.json +++ b/x-pack/plugins/threat_intelligence/kibana.json @@ -12,17 +12,11 @@ "requiredPlugins": [ "data", "dataViews", - "unifiedSearch", "kibanaUtils", "navigation", "kibanaReact", "triggersActionsUi", "inspector" ], - "requiredBundles": [ - "data", - "unifiedSearch", - "kibanaUtils", - "kibanaReact" - ] + "requiredBundles": ["data", "kibanaUtils", "kibanaReact"] } 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 6e9c0b373a0fe..0be85bea8ccf1 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 @@ -6,11 +6,19 @@ */ import { FilterManager } from '@kbn/data-plugin/public'; -import { IndicatorsFiltersContextValue } from '../../modules/indicators/context'; +import { IndicatorsFiltersContextValue } from '../../modules/indicators/containers/indicators_filters/context'; + +export const mockTimeRange = { from: '2022-10-03T07:48:31.498Z', to: '2022-10-03T07:48:31.498Z' }; export const mockIndicatorsFiltersContext: IndicatorsFiltersContextValue = { filterManager: { getFilters: () => [], - setFilters: () => {}, + setFilters: () => window.alert('setFilters'), } as unknown as FilterManager, + filters: [], + filterQuery: { + language: 'kuery', + query: '', + }, + timeRange: mockTimeRange, }; diff --git a/x-pack/plugins/threat_intelligence/public/common/mocks/mock_security_context.tsx b/x-pack/plugins/threat_intelligence/public/common/mocks/mock_security_context.tsx index cef2598510da0..8a0bb088e064d 100644 --- a/x-pack/plugins/threat_intelligence/public/common/mocks/mock_security_context.tsx +++ b/x-pack/plugins/threat_intelligence/public/common/mocks/mock_security_context.tsx @@ -36,4 +36,12 @@ export const getSecuritySolutionContextMock = (): SecuritySolutionPluginContext ({ dataProviders, from, to }) => () => new Promise((resolve) => window.alert('investigate in timeline')), + + SiemSearchBar: () =>
mock siem search
, + + useFilters: () => [], + + useGlobalTime: () => ({ from: '', to: '' }), + + useQuery: () => ({ language: 'kuery', query: '' }), }); diff --git a/x-pack/plugins/threat_intelligence/public/common/mocks/story_providers.tsx b/x-pack/plugins/threat_intelligence/public/common/mocks/story_providers.tsx index eea2596327fb7..7cea653c45e5f 100644 --- a/x-pack/plugins/threat_intelligence/public/common/mocks/story_providers.tsx +++ b/x-pack/plugins/threat_intelligence/public/common/mocks/story_providers.tsx @@ -16,7 +16,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { mockIndicatorsFiltersContext } from './mock_indicators_filters_context'; import { SecuritySolutionContext } from '../../containers/security_solution_context'; import { getSecuritySolutionContextMock } from './mock_security_context'; -import { IndicatorsFiltersContext } from '../../modules/indicators/context'; +import { IndicatorsFiltersContext } from '../../modules/indicators/containers/indicators_filters/context'; import { FieldTypesContext } from '../../containers/field_types_provider'; import { generateFieldTypeMap } from './mock_field_type_map'; import { mockUiSettingsService } from './mock_kibana_ui_settings_service'; diff --git a/x-pack/plugins/threat_intelligence/public/common/mocks/test_providers.tsx b/x-pack/plugins/threat_intelligence/public/common/mocks/test_providers.tsx index a93b6bfe30469..c41f8972fd605 100644 --- a/x-pack/plugins/threat_intelligence/public/common/mocks/test_providers.tsx +++ b/x-pack/plugins/threat_intelligence/public/common/mocks/test_providers.tsx @@ -18,12 +18,13 @@ import { createTGridMocks } from '@kbn/timelines-plugin/public/mock'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import { RequestAdapter } from '@kbn/inspector-plugin/common'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; +import { MemoryRouter } from 'react-router-dom'; import { KibanaContext } from '../../hooks/use_kibana'; import { SecuritySolutionPluginContext } from '../../types'; import { getSecuritySolutionContextMock } from './mock_security_context'; import { mockUiSetting } from './mock_kibana_ui_settings_service'; import { SecuritySolutionContext } from '../../containers/security_solution_context'; -import { IndicatorsFiltersContext } from '../../modules/indicators/context'; +import { IndicatorsFiltersContext } from '../../modules/indicators/containers/indicators_filters/context'; import { mockIndicatorsFiltersContext } from './mock_indicators_filters_context'; import { FieldTypesContext } from '../../containers/field_types_provider'; import { generateFieldTypeMap } from './mock_field_type_map'; @@ -128,23 +129,25 @@ export const mockedServices = { }; export const TestProvidersComponent: FC = ({ children }) => ( - - - - - - - - - {children} - - - - - - - - + + + + + + + + + + {children} + + + + + + + + + ); export type MockedSearch = jest.Mocked; 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 004071059a739..0000000000000 --- 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 c994e7e9f3a3f..0000000000000 --- 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 0000000000000..f7ae645c3b1d9 --- /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 bb0a1b1205b52..0a8831cfc6ff8 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 19542bdf200a5..4a95c0ec890fe 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 d5535f53a862f..f15a1f2e4cd3a 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 0000000000000..472bc7934bab2 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.stories.tsx @@ -0,0 +1,205 @@ +/* + * 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 { IndicatorsBarChartWrapper } from '.'; +import { Aggregation, AGGREGATION_NAME, ChartSeries } from '../../services'; + +export default { + component: IndicatorsBarChartWrapper, + title: 'IndicatorsBarChartWrapper', +}; + +const mockTimeRange: TimeRange = { from: '', to: '' }; + +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 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 0000000000000..2c1244445e6bb --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/barchart/wrapper.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 { 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 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 = { from: '', to: '' }; + +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 53% 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 fab1cfc5473d1..57ec76d17bd41 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,26 +6,50 @@ */ 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 { useAggregatedIndicators } from '../../hooks/use_aggregated_indicators'; -import { IndicatorsFieldSelector } from '../indicators_field_selector/indicators_field_selector'; -import { IndicatorsBarChart } from '../indicators_barchart/indicators_barchart'; +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; + + series: ChartSeries[]; + + dateRange: TimeRangeBounds; + + field: string; + + onFieldChange: (value: string) => void; + + /** Is initial load in progress? */ + isLoading?: boolean; + + /** Is data update in progress? */ + isFetching?: boolean; } /** @@ -33,13 +57,21 @@ export interface IndicatorsBarChartWrapperProps { * and handles retrieving aggregated indicator data. */ export const IndicatorsBarChartWrapper = memo( - ({ timeRange, indexPattern }) => { - const { dateRange, indicators, selectedField, onFieldChange } = useAggregatedIndicators({ - timeRange, - }); + ({ timeRange, indexPattern, isLoading, isFetching, series, dateRange, field, onFieldChange }) => { + if (isLoading) { + return ( + + + + + + + + ); + } return ( - <> +
@@ -59,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.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/fields_table/fields_table.stories.tsx index 8d3f13ae01af2..eb0ed8fb045ed 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/fields_table/fields_table.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/fields_table/fields_table.stories.tsx @@ -10,7 +10,7 @@ import { mockIndicatorsFiltersContext } from '../../../../../common/mocks/mock_i import { IndicatorFieldsTable } from '.'; import { generateMockIndicator } from '../../../../../../common/types/indicator'; import { StoryProvidersComponent } from '../../../../../common/mocks/story_providers'; -import { IndicatorsFiltersContext } from '../../../context'; +import { IndicatorsFiltersContext } from '../../../containers/indicators_filters'; export default { component: IndicatorFieldsTable, 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 e670d6b90e02a..eb5b2d0ca2589 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.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.stories.tsx index 12345056c7a9d..69236e778178b 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.stories.tsx @@ -14,7 +14,7 @@ import { mockUiSettingsService } from '../../../../common/mocks/mock_kibana_ui_s import { mockKibanaTimelinesService } from '../../../../common/mocks/mock_kibana_timelines_service'; import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator'; import { IndicatorsFlyout } from '.'; -import { IndicatorsFiltersContext } from '../../context'; +import { IndicatorsFiltersContext } from '../../containers/indicators_filters'; export default { component: IndicatorsFlyout, 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 24fe1cc0082ec..11102df797017 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 919b39da28c31..0ee9ae050aa98 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.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/block/block.stories.tsx index 1049518f4620f..e30d352c2644f 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/block/block.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/block/block.stories.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { IndicatorsFiltersContext } from '../../../../context'; +import { IndicatorsFiltersContext } from '../../../../containers/indicators_filters'; import { StoryProvidersComponent } from '../../../../../../common/mocks/story_providers'; import { generateMockIndicator } from '../../../../../../../common/types/indicator'; import { IndicatorBlock } from '.'; 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 dd8d4335feca1..0866edde505bf 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 6ce9c332d6323..7ccbbdf2f1c99 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/flyout/overview_tab/overview_tab.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/overview_tab.stories.tsx index d543b6b6d1125..005edd9c4201d 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/overview_tab.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/overview_tab/overview_tab.stories.tsx @@ -10,7 +10,7 @@ import { Story } from '@storybook/react'; import { StoryProvidersComponent } from '../../../../../common/mocks/story_providers'; import { generateMockIndicator, Indicator } from '../../../../../../common/types/indicator'; import { IndicatorsFlyoutOverview } from '.'; -import { IndicatorsFiltersContext } from '../../../context'; +import { IndicatorsFiltersContext } from '../../../containers/indicators_filters'; export default { component: IndicatorsFlyoutOverview, diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/table_tab/table_tab.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/table_tab/table_tab.stories.tsx index 014d57b8ec113..60808a46356a8 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/table_tab/table_tab.stories.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/table_tab/table_tab.stories.tsx @@ -14,7 +14,7 @@ import { mockUiSettingsService } from '../../../../../common/mocks/mock_kibana_u import { mockKibanaTimelinesService } from '../../../../../common/mocks/mock_kibana_timelines_service'; import { generateMockIndicator, Indicator } from '../../../../../../common/types/indicator'; import { IndicatorsFlyoutTable } from '.'; -import { IndicatorsFiltersContext } from '../../../context'; +import { IndicatorsFiltersContext } from '../../../containers/indicators_filters'; export default { component: IndicatorsFlyoutTable, 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 bc2b71303138b..0000000000000 --- 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 213c750c5d1ed..0000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.stories.tsx +++ /dev/null @@ -1,127 +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 997cfc7922b9d..0000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/indicators_barchart_wrapper/indicators_barchart_wrapper.test.tsx +++ /dev/null @@ -1,56 +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'; - -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 1744bf8ac06ce..2f84b14db0c30 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 d10ba709bfa2f..9cca631ac3b5f 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 034fc13630433..95217171cb9e5 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 @@ -11,7 +11,7 @@ import { mockIndicatorsFiltersContext } from '../../../../common/mocks/mock_indi import { StoryProvidersComponent } from '../../../../common/mocks/story_providers'; import { generateMockIndicator, Indicator } from '../../../../../common/types/indicator'; import { IndicatorsTable } from './indicators_table'; -import { IndicatorsFiltersContext } from '../../context'; +import { IndicatorsFiltersContext } from '../../containers/indicators_filters/context'; import { DEFAULT_COLUMNS } from './hooks/use_column_settings'; export default { @@ -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 027033ae47710..eb1d4c3411c1f 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 d1888431f7d82..7391003471870 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/context.ts b/x-pack/plugins/threat_intelligence/public/modules/indicators/containers/indicators_filters/context.ts similarity index 81% rename from x-pack/plugins/threat_intelligence/public/modules/indicators/context.ts rename to x-pack/plugins/threat_intelligence/public/modules/indicators/containers/indicators_filters/context.ts index b6a4d17754f17..d579b5f519fba 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/context.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/containers/indicators_filters/context.ts @@ -6,12 +6,13 @@ */ import { createContext } from 'react'; +import { Filter, Query, TimeRange } from '@kbn/es-query'; import { FilterManager } from '@kbn/data-plugin/public'; export interface IndicatorsFiltersContextValue { - /** - * FilterManager is used to interact with KQL bar. - */ + timeRange: TimeRange; + filters: Filter[]; + filterQuery: Query; filterManager: FilterManager; } 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/containers/indicators_filters/index.ts similarity index 79% 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/containers/indicators_filters/index.ts index 6ed30045b29b4..4ef23e3e95001 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/containers/indicators_filters/index.ts @@ -5,4 +5,6 @@ * 2.0. */ -export * from './investigate_in_timeline_button_icon'; +export * from './indicators_filters'; + +export * from './context'; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/containers/indicators_filters/indicators_filters.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/containers/indicators_filters/indicators_filters.tsx index 0fdd5c60ce5ce..2253b1c548968 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/containers/indicators_filters/indicators_filters.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/containers/indicators_filters/indicators_filters.tsx @@ -5,26 +5,38 @@ * 2.0. */ -import React, { ReactNode, VFC } from 'react'; -import { FilterManager } from '@kbn/data-plugin/public'; -import { IndicatorsFiltersContext, IndicatorsFiltersContextValue } from '../../context'; - -export interface IndicatorsFiltersProps { - /** - * Get {@link FilterManager} from the useFilters hook and save it in context to use within the indicators table. - */ - filterManager: FilterManager; - /** - * Component(s) to be displayed inside - */ - children: ReactNode; -} +import React, { FC, useMemo } from 'react'; +import { useKibana } from '../../../../hooks/use_kibana'; +import { useSecurityContext } from '../../../../hooks/use_security_context'; +import { IndicatorsFiltersContext, IndicatorsFiltersContextValue } from './context'; /** * Container used to wrap components and share the {@link FilterManager} through React context. */ -export const IndicatorsFilters: VFC = ({ filterManager, children }) => { - const contextValue: IndicatorsFiltersContextValue = { filterManager }; +export const IndicatorsFilters: FC = ({ children }) => { + const securityContext = useSecurityContext(); + + const { + services: { + data: { + query: { filterManager }, + }, + }, + } = useKibana(); + + const globalFilters = securityContext.useFilters(); + const globalQuery = securityContext.useQuery(); + const globalTimeRange = securityContext.useGlobalTime(); + + const contextValue: IndicatorsFiltersContextValue = useMemo( + () => ({ + timeRange: globalTimeRange, + filters: globalFilters, + filterQuery: globalQuery, + filterManager, + }), + [globalFilters, globalQuery, globalTimeRange, filterManager] + ); return ( 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 0000000000000..23461fc809957 --- /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 6b3feb7406906..04ca3311955f0 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 @@ -7,38 +7,27 @@ import { act, renderHook } from '@testing-library/react-hooks'; import { useAggregatedIndicators, UseAggregatedIndicatorsParam } from './use_aggregated_indicators'; -import { DEFAULT_TIME_RANGE } from '../../query_bar/hooks/use_filters/utils'; import { mockedTimefilterService, TestProvidersComponent, } from '../../../common/mocks/test_providers'; -import { useFilters } from '../../query_bar/hooks/use_filters'; -import { createFetchAggregatedIndicators } from '../services/fetch_aggregated_indicators'; +import { createFetchAggregatedIndicators } from '../services'; +import { mockTimeRange } from '../../../common/mocks/mock_indicators_filters_context'; jest.mock('../services/fetch_aggregated_indicators'); -jest.mock('../../query_bar/hooks/use_filters'); const useAggregatedIndicatorsParams: UseAggregatedIndicatorsParam = { - timeRange: DEFAULT_TIME_RANGE, + timeRange: mockTimeRange, + filters: [], + filterQuery: { language: 'kuery', query: '' }, }; -const stub = () => {}; - const renderUseAggregatedIndicators = () => - renderHook((props) => useAggregatedIndicators(props), { + renderHook((props: UseAggregatedIndicatorsParam) => useAggregatedIndicators(props), { initialProps: useAggregatedIndicatorsParams, wrapper: TestProvidersComponent, }); -const initialFiltersValue = { - filters: [], - filterQuery: { language: 'kuery', query: '' }, - filterManager: {} as any, - handleSavedQuery: stub, - handleSubmitQuery: stub, - handleSubmitTimeRange: stub, -}; - describe('useAggregatedIndicators()', () => { beforeEach(jest.clearAllMocks); @@ -56,14 +45,12 @@ describe('useAggregatedIndicators()', () => { (createFetchAggregatedIndicators as MockedCreateFetchAggregatedIndicators).mockReturnValue( aggregatedIndicatorsQuery ); - - (useFilters as jest.MockedFunction).mockReturnValue(initialFiltersValue); }); it('should create and call the aggregatedIndicatorsQuery correctly', async () => { aggregatedIndicatorsQuery.mockResolvedValue([]); - const { rerender } = renderUseAggregatedIndicators(); + const { result, rerender, waitFor } = renderUseAggregatedIndicators(); // indicators service and the query should be called just once expect( @@ -81,14 +68,13 @@ describe('useAggregatedIndicators()', () => { expect.any(AbortSignal) ); - // After filter values change, the hook will be re-rendered and should call the query function again, with - // updated values - (useFilters as jest.MockedFunction).mockReturnValue({ - ...initialFiltersValue, - filterQuery: { language: 'kuery', query: "threat.indicator.type: 'file'" }, - }); - - await act(async () => rerender()); + await act(async () => + rerender({ + filterQuery: { language: 'kuery', query: "threat.indicator.type: 'file'" }, + filters: [], + timeRange: mockTimeRange, + }) + ); expect(aggregatedIndicatorsQuery).toHaveBeenCalledTimes(2); expect(aggregatedIndicatorsQuery).toHaveBeenLastCalledWith( @@ -97,5 +83,21 @@ describe('useAggregatedIndicators()', () => { }), expect.any(AbortSignal) ); + + await waitFor(() => !result.current.isLoading); + + expect(result.current).toMatchInlineSnapshot(` + Object { + "dateRange": Object { + "max": "2022-01-02T00:00:00.000Z", + "min": "2022-01-01T00:00:00.000Z", + }, + "isFetching": false, + "isLoading": false, + "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 2609dbda5eb11..1b3dcd33fea9b 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 @@ -5,16 +5,14 @@ * 2.0. */ -import { TimeRange } from '@kbn/es-query'; +import { useQuery } from '@tanstack/react-query'; +import { Filter, Query, TimeRange } from '@kbn/es-query'; import { useMemo, useState } from 'react'; import { TimeRangeBounds } from '@kbn/data-plugin/common'; -import { useQuery } from '@tanstack/react-query'; import { useInspector } from '../../../hooks/use_inspector'; -import { useFilters } from '../../query_bar/hooks/use_filters'; 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, @@ -23,17 +21,22 @@ 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; + timeRange: TimeRange; + filters: Filter[]; + /** + * Query data passed to the {@link useAggregatedIndicators} hook to query indicators. + */ + filterQuery: Query; } export interface UseAggregatedIndicatorsValue { /** * Array of {@link ChartSeries}, ready to be used in the Indicators barchart. */ - indicators: ChartSeries[]; + series: ChartSeries[]; /** * Callback used by the IndicatorsFieldSelector component to query a new set of * aggregated indicators. @@ -48,12 +51,20 @@ 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; export const useAggregatedIndicators = ({ - timeRange = DEFAULT_TIME_RANGE, + timeRange, + filters, + filterQuery, }: UseAggregatedIndicatorsParam): UseAggregatedIndicatorsValue => { const { services: { @@ -66,7 +77,6 @@ export const useAggregatedIndicators = ({ const { inspectorAdapters } = useInspector(); const [field, setField] = useState(DEFAULT_FIELD); - const { filters, filterQuery } = useFilters(); const aggregatedIndicatorsQuery = useMemo( () => @@ -78,7 +88,7 @@ export const useAggregatedIndicators = ({ [inspectorAdapters, queryService, searchService] ); - const { data } = useQuery( + const { data, isLoading, isFetching } = useQuery( [ 'indicatorsBarchart', { @@ -95,7 +105,8 @@ export const useAggregatedIndicators = ({ }: { signal?: AbortSignal; queryKey: [string, FetchAggregatedIndicatorsParams]; - }) => aggregatedIndicatorsQuery(queryParams, signal) + }) => aggregatedIndicatorsQuery(queryParams, signal), + { keepPreviousData: true } ); const dateRange = useMemo( @@ -105,8 +116,10 @@ export const useAggregatedIndicators = ({ return { dateRange, - indicators: data || [], + series: data || [], onFieldChange: setField, selectedField: field, + isLoading, + isFetching, }; }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators.test.tsx index 0b06208130780..42f6a4eb1fdb7 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators.test.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators.test.tsx @@ -9,6 +9,7 @@ import { renderHook, act } from '@testing-library/react-hooks'; import { useIndicators, UseIndicatorsParams, UseIndicatorsValue } from './use_indicators'; import { TestProvidersComponent } from '../../../common/mocks/test_providers'; import { createFetchIndicators } from '../services/fetch_indicators'; +import { mockTimeRange } from '../../../common/mocks/mock_indicators_filters_context'; jest.mock('../services/fetch_indicators'); @@ -16,6 +17,7 @@ const useIndicatorsParams: UseIndicatorsParams = { filters: [], filterQuery: { query: '', language: 'kuery' }, sorting: [], + timeRange: mockTimeRange, }; const indicatorsQueryResult = { indicators: [], total: 0 }; @@ -98,6 +100,29 @@ describe('useIndicators()', () => { }), expect.any(AbortSignal) ); + + await hookResult.waitFor(() => !hookResult.result.current.isLoading); + + expect(hookResult.result.current).toMatchInlineSnapshot(` + Object { + "handleRefresh": [Function], + "indicatorCount": 0, + "indicators": Array [], + "isFetching": false, + "isLoading": false, + "onChangeItemsPerPage": [Function], + "onChangePage": [Function], + "pagination": Object { + "pageIndex": 0, + "pageSize": 50, + "pageSizeOptions": Array [ + 10, + 25, + 50, + ], + }, + } + `); }); }); }); diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators.ts b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators.ts index 5303b5dae06cb..2352f302a1d4d 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators.ts @@ -8,6 +8,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import { Filter, Query, TimeRange } from '@kbn/es-query'; import { useQuery } from '@tanstack/react-query'; +import { EuiDataGridSorting } from '@elastic/eui'; import { useInspector } from '../../../hooks/use_inspector'; import { Indicator } from '../../../../common/types/indicator'; import { useKibana } from '../../../hooks/use_kibana'; @@ -21,12 +22,16 @@ export const DEFAULT_PAGE_SIZE = PAGE_SIZES[1]; export interface UseIndicatorsParams { filterQuery: Query; filters: Filter[]; - timeRange?: TimeRange; - sorting: any[]; + timeRange: TimeRange; + sorting: EuiDataGridSorting['columns']; } export interface UseIndicatorsValue { handleRefresh: () => void; + + /** + * Array of {@link Indicator} ready to render inside the IndicatorTable component + */ indicators: Indicator[]; indicatorCount: number; pagination: Pagination; diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators_filters_context.ts b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators_filters_context.ts index e8cc4b18474bf..e4c7c48d03d1b 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators_filters_context.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/hooks/use_indicators_filters_context.ts @@ -6,7 +6,10 @@ */ import { useContext } from 'react'; -import { IndicatorsFiltersContext, IndicatorsFiltersContextValue } from '../context'; +import { + IndicatorsFiltersContext, + IndicatorsFiltersContextValue, +} from '../containers/indicators_filters/context'; /** * Hook to retrieve {@link IndicatorsFiltersContext} (contains FilterManager) diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/indicators_page.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/indicators_page.test.tsx index 11bdb8fc8e6ed..e46c605d1a90a 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/indicators_page.test.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/indicators_page.test.tsx @@ -14,6 +14,7 @@ import { useFilters } from '../query_bar/hooks/use_filters'; import moment from 'moment'; import { TestProvidersComponent } from '../../common/mocks/test_providers'; import { TABLE_TEST_ID } from './components/indicators_table'; +import { mockTimeRange } from '../../common/mocks/mock_indicators_filters_context'; jest.mock('../query_bar/hooks/use_filters'); jest.mock('./hooks/use_indicators'); @@ -27,7 +28,7 @@ describe('', () => { useAggregatedIndicators as jest.MockedFunction ).mockReturnValue({ dateRange: { min: moment(), max: moment() }, - indicators: [], + series: [], selectedField: '', onFieldChange: () => {}, }); @@ -47,9 +48,7 @@ describe('', () => { filters: [], filterQuery: { language: 'kuery', query: '' }, filterManager: {} as any, - handleSavedQuery: stub, - handleSubmitQuery: stub, - handleSubmitTimeRange: stub, + timeRange: mockTimeRange, }); }); @@ -59,9 +58,9 @@ describe('', () => { expect(queryByTestId(TABLE_TEST_ID)).toBeInTheDocument(); }); - it('should render the query input', () => { + it('should render SIEM Search Bar', () => { const { queryByTestId } = render(, { wrapper: TestProvidersComponent }); - expect(queryByTestId('iocListPageQueryInput')).toBeInTheDocument(); + expect(queryByTestId('SiemSearchBar')).toBeInTheDocument(); }); it('should render stack by selector', () => { 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 f51e062e1c3cb..511faaa73a7a0 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,26 +7,29 @@ import React, { FC, VFC } from 'react'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { IndicatorsFilters } from './containers/indicators_filters/indicators_filters'; -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'; import { useFilters } from '../query_bar/hooks/use_filters'; import { FiltersGlobal } from '../../containers/filters_global'; -import QueryBar from '../query_bar/components/query_bar'; import { useSourcererDataView } from './hooks/use_sourcerer_data_view'; import { FieldTypesProvider } from '../../containers/field_types_provider'; import { InspectorProvider } from '../../containers/inspector'; import { useColumnSettings } from './components/indicators_table/hooks/use_column_settings'; +import { useAggregatedIndicators } from './hooks/use_aggregated_indicators'; +import { IndicatorsFilters } from './containers/indicators_filters'; +import { useSecurityContext } from '../../hooks/use_security_context'; const queryClient = new QueryClient(); const IndicatorsPageProviders: FC = ({ children }) => ( - - {children} - + + + {children} + + ); @@ -35,54 +38,69 @@ const IndicatorsPageContent: VFC = () => { const columnSettings = useColumnSettings(); + const { timeRange, filters, filterQuery } = useFilters(); + const { - timeRange, + indicatorCount, + indicators, + onChangeItemsPerPage, + onChangePage, + pagination, + isLoading: isLoadingIndicators, + isFetching: isFetchingIndicators, + } = useIndicators({ filters, - filterManager, filterQuery, - handleSubmitQuery, - handleSubmitTimeRange, - handleSavedQuery, - savedQuery, - } = useFilters(); + timeRange, + sorting: columnSettings.sorting.columns, + }); - const { handleRefresh, ...indicators } = useIndicators({ + const { + dateRange, + series, + selectedField, + onFieldChange, + isLoading: isLoadingAggregatedIndicators, + isFetching: isFetchingAggregatedIndicators, + } = useAggregatedIndicators({ + timeRange, filters, filterQuery, - timeRange, - sorting: columnSettings.sorting.columns, }); + const { SiemSearchBar } = useSecurityContext(); + return ( - - - + + + + + - - - + - - + + ); }; 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 c5503f1b32a0c..007623943c531 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 6cf0fea18b2c3..0edc0cca34e5c 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/indicators/services/index.ts b/x-pack/plugins/threat_intelligence/public/modules/indicators/services/index.ts new file mode 100644 index 0000000000000..3215ff6621597 --- /dev/null +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/services/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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +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 34e37aaf1dd40..b9a31b09a40e8 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 1e6c7d0c2614e..d32adf70ee103 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 { IndicatorsFiltersContext } from '../../../indicators/context'; -import { FilterIn } from '.'; +import { FilterInButtonIcon, FilterInContextMenu, FilterInCellAction } from '.'; +import { IndicatorsFiltersContext } from '../../../indicators/containers/indicators_filters/context'; 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 788ac9b2e4427..0abfa06522301 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 d6d62b3e35380..af6b608c1fb9e 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 bfee4c6363ba7..686e543636d00 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 a2f0061d36a94..463b249998eb2 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 { IndicatorsFiltersContext } from '../../../indicators/context'; -import { FilterOut } from '.'; +import { FilterOutButtonIcon, FilterOutContextMenu, FilterOutCellAction } from '.'; +import { IndicatorsFiltersContext } from '../../../indicators/containers/indicators_filters/context'; 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 6a65ff5036921..fa25a095191d4 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 afa1bc02a6ba9..3f77c14285f97 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/components/query_bar/query_bar.stories.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/query_bar.stories.tsx deleted file mode 100644 index e97cbeb78d531..0000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/query_bar.stories.tsx +++ /dev/null @@ -1,49 +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 { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; -import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { ComponentStory } from '@storybook/react'; -import { KibanaContextProvider } from '../../../../hooks/use_kibana'; -import { QueryBar } from './query_bar'; - -export default { - component: QueryBar, - title: 'QueryBar', - argTypes: { - onSubmitQuery: { action: 'onSubmitQuery' }, - onChangedQuery: { action: 'onChangedQuery' }, - onChangedDateRange: { action: 'onChangedDateRange' }, - onSubmitDateRange: { action: 'onSubmitDateRange' }, - onSavedQuery: { action: 'onSavedQuery' }, - onRefresh: { action: 'onRefresh' }, - }, -}; - -const services = { - data: { query: {} }, - storage: new Storage(localStorage), - uiSettings: { get: () => {} }, -}; - -const Template: ComponentStory = (args) => ( - - - {' '} - - -); - -export const Basic = Template.bind({}); - -Basic.args = { - indexPattern: {} as any, - filterManager: {} as any, - filters: [], - filterQuery: { language: 'kuery', query: '' }, -}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/query_bar.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/query_bar.test.tsx deleted file mode 100644 index 2ab2795e138bd..0000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/query_bar.test.tsx +++ /dev/null @@ -1,83 +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, screen, act, waitFor } from '@testing-library/react'; -import { QueryBar } from './query_bar'; -import userEvent from '@testing-library/user-event'; - -import { FilterManager } from '@kbn/data-plugin/public'; - -import { coreMock } from '@kbn/core/public/mocks'; -import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; -import { getByTestSubj } from '../../../../../common/test/utils'; - -const mockUiSettingsForFilterManager = coreMock.createStart().uiSettings; - -const filterManager = new FilterManager(mockUiSettingsForFilterManager); - -describe('QueryBar ', () => { - const onSubmitQuery = jest.fn(); - const onSubmitDateRange = jest.fn(); - const onSavedQuery = jest.fn(); - const onChangedQuery = jest.fn(); - - beforeEach(async () => { - await act(async () => { - render( - - - - ); - }); - - // Some parts of this are lazy loaded, we need to wait for quert input to appear before tests can be done - await waitFor(() => screen.queryByRole('input')); - }); - - it('should call onSubmitDateRange when date range is changed', async () => { - expect(getByTestSubj('superDatePickerToggleQuickMenuButton')).toBeInTheDocument(); - - await act(async () => { - userEvent.click(getByTestSubj('superDatePickerToggleQuickMenuButton')); - }); - - await act(async () => { - screen.getByText('Apply').click(); - }); - - expect(onSubmitDateRange).toHaveBeenCalled(); - }); - - it('should call onSubmitQuery when query is changed', async () => { - const queryInput = getByTestSubj('queryInput'); - - await act(async () => { - userEvent.type(queryInput, 'one_serious_query'); - }); - - expect(onChangedQuery).toHaveBeenCalledWith( - expect.objectContaining({ language: 'kuery', query: expect.any(String) }) - ); - - await act(async () => { - screen.getByText('Refresh').click(); - }); - - expect(onSubmitQuery).toHaveBeenCalled(); - }); -}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/query_bar.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/query_bar.tsx deleted file mode 100644 index e564c898f894a..0000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/query_bar.tsx +++ /dev/null @@ -1,179 +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, { memo, useMemo, useCallback } from 'react'; -import deepEqual from 'fast-deep-equal'; - -import { DataView } from '@kbn/data-views-plugin/public'; -import type { AggregateQuery, Filter, Query, TimeRange } from '@kbn/es-query'; -import { - FilterManager, - TimeHistory, - SavedQuery, - SavedQueryTimeFilter, -} from '@kbn/data-plugin/public'; -import { SearchBar, SearchBarProps } from '@kbn/unified-search-plugin/public'; -import { Storage } from '@kbn/kibana-utils-plugin/public'; -import { SecuritySolutionDataViewBase } from '../../../../types'; - -interface QueryPayload { - dateRange: TimeRange; - query?: Query | AggregateQuery; -} - -/** - * User defined type guard to verify if we are dealing with Query param - * @param query query param to test - * @returns - */ -const isQuery = (query?: Query | AggregateQuery | null): query is Query => { - return !!query && Object.prototype.hasOwnProperty.call(query, 'query'); -}; - -export interface QueryBarComponentProps { - dataTestSubj?: string; - dateRangeFrom?: string; - dateRangeTo?: string; - hideSavedQuery?: boolean; - indexPattern: SecuritySolutionDataViewBase; - isLoading?: boolean; - isRefreshPaused?: boolean; - filterQuery: Query; - filterManager: FilterManager; - filters: Filter[]; - onRefresh: VoidFunction; - onChangedQuery?: (query: Query) => void; - onChangedDateRange?: (dateRange?: TimeRange) => void; - onSubmitQuery: (query: Query, timefilter?: SavedQueryTimeFilter) => void; - onSubmitDateRange: (dateRange?: TimeRange) => void; - refreshInterval?: number; - savedQuery?: SavedQuery; - onSavedQuery: (savedQuery: SavedQuery | undefined) => void; - displayStyle?: SearchBarProps['displayStyle']; -} - -export const INDICATOR_FILTER_DROP_AREA = 'indicator-filter-drop-area'; - -export const QueryBar = memo( - ({ - dateRangeFrom, - dateRangeTo, - hideSavedQuery = false, - indexPattern, - isLoading = false, - isRefreshPaused, - filterQuery, - filterManager, - filters, - refreshInterval, - savedQuery, - dataTestSubj, - displayStyle, - onChangedQuery, - onSubmitQuery, - onChangedDateRange, - onSubmitDateRange, - onSavedQuery, - onRefresh, - }) => { - const onQuerySubmit = useCallback( - ({ query, dateRange }: QueryPayload) => { - if (dateRange != null) { - onSubmitDateRange(dateRange); - } - - if (isQuery(query) && !deepEqual(query, filterQuery)) { - onSubmitQuery(query); - } else { - onRefresh(); - } - }, - [filterQuery, onRefresh, onSubmitDateRange, onSubmitQuery] - ); - - const onQueryChange = useCallback( - ({ query, dateRange }: QueryPayload) => { - if (!onChangedQuery) { - return; - } - - if (isQuery(query) && !deepEqual(query, filterQuery)) { - onChangedQuery(query); - } - - if (onChangedDateRange && dateRange != null) { - onChangedDateRange(dateRange); - } - }, - [filterQuery, onChangedDateRange, onChangedQuery] - ); - - const onSavedQueryUpdated = useCallback( - (savedQueryUpdated: SavedQuery) => { - const { query: newQuery, filters: newFilters, timefilter } = savedQueryUpdated.attributes; - onSubmitQuery(newQuery, timefilter); - filterManager.setFilters(newFilters || []); - onSavedQuery(savedQueryUpdated); - }, - [filterManager, onSubmitQuery, onSavedQuery] - ); - - const onClearSavedQuery = useCallback(() => { - if (savedQuery != null) { - onSubmitQuery({ - query: '', - language: savedQuery.attributes.query.language, - }); - filterManager.setFilters([]); - onSavedQuery(undefined); - } - }, [filterManager, onSubmitQuery, onSavedQuery, savedQuery]); - - const onFiltersUpdated = useCallback( - (newFilters: Filter[]) => { - return filterManager.setFilters(newFilters); - }, - [filterManager] - ); - - const timeHistory = useMemo(() => new TimeHistory(new Storage(localStorage)), []); - - const indexPatterns = useMemo(() => [indexPattern], [indexPattern]); - - return ( - - ); - } -); - -QueryBar.displayName = 'QueryBar'; 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 0000000000000..6099ed8486670 --- /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 0000000000000..d44bb8528afab --- /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/query_bar/hooks/use_filters/use_filters.test.tsx b/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/use_filters.test.tsx deleted file mode 100644 index b9c16240df4b0..0000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/use_filters.test.tsx +++ /dev/null @@ -1,160 +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 { mockUseKibanaForFilters } from '../../../../common/mocks/mock_use_kibana_for_filters'; -import { renderHook, act, RenderHookResult, Renderer } from '@testing-library/react-hooks'; -import { useFilters, UseFiltersValue } from './use_filters'; - -import { useHistory, useLocation } from 'react-router-dom'; -import { Filter } from '@kbn/es-query'; -import { TestProvidersComponent } from '../../../../common/mocks/test_providers'; - -jest.mock('react-router-dom', () => ({ - useLocation: jest.fn().mockReturnValue({ - search: '', - }), - useHistory: jest.fn().mockReturnValue({ replace: jest.fn() }), -})); - -describe('useFilters()', () => { - let hookResult: RenderHookResult<{}, UseFiltersValue, Renderer>; - let mockRef: ReturnType; - - describe('when mounted', () => { - beforeEach(async () => { - mockRef = mockUseKibanaForFilters(); - - hookResult = renderHook(() => useFilters(), { - wrapper: TestProvidersComponent, - }); - }); - - it('should have valid initial filterQuery value', () => { - expect(hookResult.result.current.filterQuery).toMatchObject({ language: 'kuery', query: '' }); - }); - - describe('when query string is populated', () => { - it('should try to compute the initial state based on query string', async () => { - (useLocation as jest.Mock).mockReturnValue({ - search: - '?indicators=(filterQuery:(language:kuery,query:%27threat.indicator.type%20:%20"file"%20%27),filters:!(),timeRange:(from:now/d,to:now/d))', - }); - - hookResult = renderHook(() => useFilters(), { - wrapper: TestProvidersComponent, - }); - - expect(hookResult.result.current.filterQuery).toMatchObject({ - language: 'kuery', - query: 'threat.indicator.type : "file" ', - }); - }); - }); - }); - - describe('when filter values change', () => { - const historyReplace = jest.fn(); - beforeEach(async () => { - mockRef = mockUseKibanaForFilters(); - - hookResult = renderHook(() => useFilters(), { - wrapper: TestProvidersComponent, - }); - - (useHistory as jest.Mock).mockReturnValue({ replace: historyReplace }); - - historyReplace.mockClear(); - }); - - describe('when filters change', () => { - it('should update history entry', async () => { - const newFilterEntry = { query: { filter: 'new_filter' }, meta: {} }; - - // Make sure new filter value is returned from filter manager before signalling an update - // to subscribers - mockRef.getFilters.mockReturnValue([newFilterEntry] as Filter[]); - - // Emit the filterManager update to see how it propagates to local component state - await act(async () => { - mockRef.$filterUpdates.next(void 0); - }); - - // Internally, filters should be loaded from filterManager - expect(mockRef.getFilters).toHaveBeenCalled(); - - // Serialized into browser query string - expect(historyReplace).toHaveBeenCalledWith( - expect.objectContaining({ search: expect.stringMatching(/new_filter/) }) - ); - - // And updated in local hook state - expect(hookResult.result.current.filters).toContain(newFilterEntry); - }); - }); - - describe('when time range changes', () => { - const newTimeRange = { from: 'dawnOfTime', to: 'endOfTime' }; - - const updateTime = async () => { - // After new time range is selected - await act(async () => { - hookResult.result.current.handleSubmitTimeRange(newTimeRange); - }); - }; - - it('should update its local state', async () => { - expect(hookResult.result.current.timeRange).toBeDefined(); - expect(hookResult.result.current.timeRange).not.toEqual(newTimeRange); - - // After new time range is selected - await updateTime(); - - // Local filter state should be updated - expect(hookResult.result.current.timeRange).toEqual(newTimeRange); - }); - - it('should update history entry', async () => { - expect(historyReplace).not.toHaveBeenCalledWith( - expect.objectContaining({ search: expect.stringMatching(/dawnOfTime/) }) - ); - - // After new time range is selected - await updateTime(); - - // Query string should be updated - expect(historyReplace).toHaveBeenCalledWith( - expect.objectContaining({ search: expect.stringMatching(/dawnOfTime/) }) - ); - }); - }); - - describe('when filterQuery changes', () => { - beforeEach(async () => { - // After new time range is selected - await act(async () => { - hookResult.result.current.handleSubmitQuery({ - query: 'threat.indicator.type : *', - language: 'kuery', - }); - }); - }); - - it('should update history entry', async () => { - expect(historyReplace).toHaveBeenCalledWith( - expect.objectContaining({ search: expect.stringMatching(/threat\.indicator\.type/) }) - ); - }); - - it('should update local state', () => { - expect(hookResult.result.current.filterQuery).toMatchObject({ - language: 'kuery', - query: 'threat.indicator.type : *', - }); - }); - }); - }); -}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/use_filters.ts b/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/use_filters.ts index 73ce49691d5a6..c50a10c17b709 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/use_filters.ts +++ b/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/use_filters.ts @@ -5,110 +5,24 @@ * 2.0. */ -import { Filter, Query, TimeRange } from '@kbn/es-query'; -import { useCallback, useEffect, useState } from 'react'; -import { useHistory, useLocation } from 'react-router-dom'; -import deepEqual from 'fast-deep-equal'; -import type { FilterManager, SavedQuery } from '@kbn/data-plugin/public'; -import { useKibana } from '../../../../hooks/use_kibana'; +import { useContext } from 'react'; import { - DEFAULT_QUERY, - DEFAULT_TIME_RANGE, - encodeState, - FILTERS_QUERYSTRING_NAMESPACE, - stateFromQueryParams, -} from './utils'; + IndicatorsFiltersContext, + IndicatorsFiltersContextValue, +} from '../../../indicators/containers/indicators_filters'; -export interface UseFiltersValue { - timeRange?: TimeRange; - filters: Filter[]; - filterQuery: Query; - handleSavedQuery: (savedQuery: SavedQuery | undefined) => void; - handleSubmitTimeRange: (timeRange?: TimeRange) => void; - handleSubmitQuery: (filterQuery: Query) => void; - filterManager: FilterManager; - savedQuery?: SavedQuery; -} +export type UseFiltersValue = IndicatorsFiltersContextValue; /** * Custom react hook housing logic for KQL bar * @returns Filters and TimeRange for use with KQL bar */ -export const useFilters = (): UseFiltersValue => { - const { pathname: browserPathName, search } = useLocation(); - const history = useHistory(); - const [savedQuery, setSavedQuery] = useState(undefined); +export const useFilters = () => { + const contextValue = useContext(IndicatorsFiltersContext); - const { - services: { - data: { - query: { filterManager }, - }, - }, - } = useKibana(); + if (!contextValue) { + throw new Error('Filters can only be used inside IndicatorFiltersContext'); + } - // Filters are picked using the UI widgets - const [filters, setFilters] = useState([]); - - // Time range is self explanatory - const [timeRange, setTimeRange] = useState(DEFAULT_TIME_RANGE); - - // filterQuery is raw kql query that user can type in to filter results - const [filterQuery, setFilterQuery] = useState(DEFAULT_QUERY); - - // Serialize filters into query string - useEffect(() => { - const filterStateAsString = encodeState({ filters, filterQuery, timeRange }); - if (!deepEqual(filterManager.getFilters(), filters)) { - filterManager.setFilters(filters); - } - - history.replace({ - pathname: browserPathName, - search: `${FILTERS_QUERYSTRING_NAMESPACE}=${filterStateAsString}`, - }); - }, [browserPathName, filterManager, filterQuery, filters, history, timeRange]); - - // Sync filterManager to local state (after they are changed from the ui) - useEffect(() => { - const subscription = filterManager.getUpdates$().subscribe(() => { - setFilters(filterManager.getFilters()); - }); - - return () => subscription.unsubscribe(); - }, [filterManager]); - - // Update local state with filter values from the url (on initial mount) - useEffect(() => { - const { - filters: filtersFromQuery, - timeRange: timeRangeFromQuery, - filterQuery: filterQueryFromQuery, - } = stateFromQueryParams(search); - - setTimeRange(timeRangeFromQuery); - setFilterQuery(filterQueryFromQuery); - setFilters(filtersFromQuery); - - // We only want to have it done on initial render with initial 'search' value; - // that is why 'search' is ommited from the deps array - - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [filterManager]); - - const onSavedQuery = useCallback( - (newSavedQuery: SavedQuery | undefined) => setSavedQuery(newSavedQuery), - [] - ); - - return { - timeRange, - filters, - filterQuery, - handleSavedQuery: onSavedQuery, - handleSubmitTimeRange: setTimeRange, - handleSubmitQuery: setFilterQuery, - filterManager, - savedQuery, - }; + return contextValue; }; diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/utils.test.ts b/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/utils.test.ts deleted file mode 100644 index df0bffa1c85f1..0000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/utils.test.ts +++ /dev/null @@ -1,68 +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 { stateFromQueryParams } from './utils'; - -describe('encodeState()', () => {}); - -describe('stateFromQueryParams()', () => { - it('should return valid state object from invalid query', () => { - expect(stateFromQueryParams('')).toMatchObject({ - filterQuery: expect.any(Object), - timeRange: expect.any(Object), - filters: expect.any(Array), - }); - }); - - it('should return valid state when indicators fields is invalid', () => { - expect(stateFromQueryParams('?indicators=')).toMatchObject({ - filterQuery: expect.any(Object), - timeRange: expect.any(Object), - filters: expect.any(Array), - }); - }); - - it('should deserialize valid query state', () => { - expect( - stateFromQueryParams( - '?indicators=(filterQuery:(language:kuery,query:%27threat.indicator.type%20:%20"file"%20or%20threat.indicator.type%20:%20"url"%20%27),filters:!((%27$state%27:(store:appState),meta:(alias:!n,disabled:!f,index:%27%27,key:_id,negate:!f,type:exists,value:exists),query:(exists:(field:_id)))),timeRange:(from:now-1y/d,to:now))' - ) - ).toMatchInlineSnapshot(` - Object { - "filterQuery": Object { - "language": "kuery", - "query": "threat.indicator.type : \\"file\\" or threat.indicator.type : \\"url\\" ", - }, - "filters": Array [ - Object { - "$state": Object { - "store": "appState", - }, - "meta": Object { - "alias": null, - "disabled": false, - "index": "", - "key": "_id", - "negate": false, - "type": "exists", - "value": "exists", - }, - "query": Object { - "exists": Object { - "field": "_id", - }, - }, - }, - ], - "timeRange": Object { - "from": "now-1y/d", - "to": "now", - }, - } - `); - }); -}); diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/utils.ts b/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/utils.ts deleted file mode 100644 index f020367ff3cb1..0000000000000 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/hooks/use_filters/utils.ts +++ /dev/null @@ -1,73 +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 { Filter, Query, TimeRange } from '@kbn/es-query'; -import { parse } from 'query-string'; -import { decode, encode } from 'rison-node'; - -export const FILTERS_QUERYSTRING_NAMESPACE = 'indicators'; - -export const DEFAULT_TIME_RANGE = { from: 'now/d', to: 'now/d' }; - -export const DEFAULT_QUERY: Readonly = { query: '', language: 'kuery' }; - -const INITIAL_FILTERS_STATE: Readonly = { - filters: [], - timeRange: DEFAULT_TIME_RANGE, - filterQuery: DEFAULT_QUERY, -}; - -interface SerializableFilterState { - timeRange?: TimeRange; - filterQuery: Query; - filters: Filter[]; -} - -/** - * Converts filter state to query string - * @param filterState Serializable filter state to convert into query string - * @returns - */ -export const encodeState = (filterState: SerializableFilterState): string => - encode(filterState as any); - -/** - * - * @param encodedFilterState Serialized filter state to decode - * @returns - */ -const decodeState = (encodedFilterState: string): SerializableFilterState | null => - decode(encodedFilterState) as unknown as SerializableFilterState; - -/** - * Find and convert filter state stored within query string into object literal - * @param searchString Brower query string containing encoded filter information, within single query field - * @returns SerializableFilterState with all the relevant fields ready to use - */ -export const stateFromQueryParams = (searchString: string): SerializableFilterState => { - const { [FILTERS_QUERYSTRING_NAMESPACE]: filtersSerialized } = parse(searchString); - - if (!filtersSerialized) { - return INITIAL_FILTERS_STATE; - } - - if (Array.isArray(filtersSerialized)) { - throw new Error('serialized filters should not be an array'); - } - - const deserializedFilters = decodeState(filtersSerialized); - - if (!deserializedFilters) { - return INITIAL_FILTERS_STATE; - } - - return { - ...INITIAL_FILTERS_STATE, - ...deserializedFilters, - timeRange: deserializedFilters.timeRange || DEFAULT_TIME_RANGE, - }; -}; 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 ee3f2d67ed91c..beefdafd9d59f 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 b8ca854613b08..85e581bc8dc17 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 5b33a3bfeaa35..44f9df4225ba2 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 0000000000000..0db32e3424f55 --- /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 0000000000000..34bd1d7d56277 --- /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 15c5bc0c23ed4..08fe4b782c2c0 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 0000000000000..cd7aba14fff5e --- /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 0000000000000..cd1f7ce2a2d97 --- /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 a01cfb51e66d4..0000000000000 --- 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 c3c8e65001a3a..0000000000000 --- 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 b064ead7e645e..0000000000000 --- 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 479f175275625..0000000000000 --- 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 263e893f3f8b6..0000000000000 --- 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 3cdaa0528ca5e..0000000000000 --- 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 888f420a3cac7..0000000000000 --- 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 b4e2c354c6df9..fa81297901292 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 0000000000000..a92c75227310e --- /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 0000000000000..ab69481d3b528 --- /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 cbc040a936dc3..30c42d7096f2f 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 4f79990d00c34..efae8b441a673 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/threat_intelligence/public/types.ts b/x-pack/plugins/threat_intelligence/public/types.ts index f803231e97587..33d49e2d68c15 100644 --- a/x-pack/plugins/threat_intelligence/public/types.ts +++ b/x-pack/plugins/threat_intelligence/public/types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { ComponentType, ReactElement, ReactNode } from 'react'; +import { ComponentType, ReactElement, ReactNode, VFC } from 'react'; import { CoreStart } from '@kbn/core/public'; import { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { @@ -16,7 +16,7 @@ import { import { Storage } from '@kbn/kibana-utils-plugin/public'; import { TimelinesUIStart } from '@kbn/timelines-plugin/public'; import type { TriggersAndActionsUIPublicPluginStart as TriggersActionsStart } from '@kbn/triggers-actions-ui-plugin/public'; -import { DataViewBase } from '@kbn/es-query'; +import { DataViewBase, Filter, Query, TimeRange } from '@kbn/es-query'; import { BrowserField } from '@kbn/rule-registry-plugin/common'; import { Store } from 'redux'; import { DataProvider } from '@kbn/timelines-plugin/common'; @@ -102,4 +102,10 @@ export interface SecuritySolutionPluginContext { from, to, }: UseInvestigateInTimelineProps) => () => Promise; + + useQuery: () => Query; + useFilters: () => Filter[]; + useGlobalTime: () => TimeRange; + + SiemSearchBar: VFC; } 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 5f74967ff423c..966b3487ebfb2 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 56eeea8a242c0..0585d4553a99c 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 56922e26edc21..da2072ab3d605 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -988,7 +988,6 @@ "dashboard.panel.copyToDashboard.goToDashboard": "Copier et accéder au tableau de bord", "dashboard.panel.copyToDashboard.newDashboardOptionLabel": "Nouveau tableau de bord", "dashboard.panel.copyToDashboard.title": "Copier dans le tableau de bord", - "dashboard.panel.invalidData": "Données non valides dans l'url", "dashboard.panel.LibraryNotification": "Notification de la bibliothèque Visualize", "dashboard.panel.libraryNotification.ariaLabel": "Afficher les informations de la bibliothèque et dissocier ce panneau", "dashboard.panel.libraryNotification.toolTip": "La modification de ce panneau pourrait affecter d’autres tableaux de bord. Pour modifier ce panneau uniquement, dissociez-le de la bibliothèque.", @@ -3721,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", @@ -3755,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", @@ -3764,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.", @@ -5488,7 +5487,6 @@ "visTypeTimeseries.annotationsEditor.ignorePanelFiltersLabel": "Ignorer les filtres de panneau ?", "visTypeTimeseries.annotationsEditor.queryStringLabel": "Chaîne de requête", "visTypeTimeseries.annotationsEditor.rowTemplateLabel": "Modèle de ligne (requis)", - "visTypeTimeseries.annotationsEditor.timeFieldLabel": "Champ temporel (requis)", "visTypeTimeseries.calculateLabel.bucketScriptsLabel": "Script de compartiment", "visTypeTimeseries.calculateLabel.countLabel": "Décompte", "visTypeTimeseries.calculateLabel.filterRatioLabel": "Rapport de filtre", @@ -7543,7 +7541,6 @@ "xpack.apm.serviceGroups.selectServicesForm.preview": "Aperçu", "xpack.apm.serviceGroups.selectServicesForm.refresh": "Actualiser", "xpack.apm.serviceGroups.selectServicesForm.saveGroup": "Enregistrer le groupe", - "xpack.apm.serviceGroups.selectServicesForm.subtitle": "Utilisez une requête pour sélectionner les services pour ce groupe. Les services qui correspondent à cette requête dans les dernières 24 heures seront affectés au groupe.", "xpack.apm.serviceGroups.selectServicesForm.title": "Sélectionner des services", "xpack.apm.serviceGroups.selectServicesList.environmentColumnLabel": "Environnements", "xpack.apm.serviceGroups.selectServicesList.nameColumnLabel": "Nom", @@ -9286,7 +9283,6 @@ "xpack.cases.confirmDeleteCase.confirmQuestion": "Si vous supprimez {quantity, plural, =1 {ce cas} other {ces cas}}, toutes les données des cas connexes seront définitivement retirées et vous ne pourrez plus transmettre de données à un système de gestion des incidents externes. Voulez-vous vraiment continuer ?", "xpack.cases.confirmDeleteCase.deleteCase": "Supprimer {quantity, plural, =1 {le cas} other {les cas}}", "xpack.cases.confirmDeleteCase.deleteTitle": "Supprimer \"{caseTitle}\"", - "xpack.cases.confirmDeleteCase.selectedCases": "Supprimer \"{quantity, plural, =1 {{title}} other {{quantity} cas sélectionnés}}\"", "xpack.cases.connecors.get.missingCaseConnectorErrorMessage": "Le type d'objet \"{id}\" n'est pas enregistré.", "xpack.cases.connecors.register.duplicateCaseConnectorErrorMessage": "Le type d'objet \"{id}\" est déjà enregistré.", "xpack.cases.connectors.card.createCommentWarningDesc": "Configurez les champs Create Comment URL et Create Comment Objects pour que le connecteur {connectorName} puisse partager les commentaires.", @@ -9296,7 +9292,6 @@ "xpack.cases.connectors.cases.externalIncidentUpdated": "(mis à jour le {date} par {user})", "xpack.cases.connectors.jira.unableToGetIssueMessage": "Impossible d'obtenir le problème ayant l'ID {id}", "xpack.cases.containers.closedCases": "Fermeture de {totalCases, plural, =1 {\"{caseTitle}\"} other {{totalCases} cas}} effectuée", - "xpack.cases.containers.deletedCases": "Suppression de {totalCases, plural, =1 {\"{caseTitle}\"} other {{totalCases} cas}} effectuée", "xpack.cases.containers.markInProgressCases": "Marquage effectué de {totalCases, plural, =1 {\"{caseTitle}\"} other {{totalCases} cas}} comme étant en cours", "xpack.cases.containers.pushToExternalService": "Envoyé avec succès à { serviceName }", "xpack.cases.containers.reopenedCases": "Ouverture de {totalCases, plural, =1 {\"{caseTitle}\"} other {{totalCases} cas}} effectuée", @@ -9328,7 +9323,6 @@ "xpack.cases.caseTable.changeStatus": "Modifier le statut", "xpack.cases.caseTable.closed": "Fermé", "xpack.cases.caseTable.closedCases": "Cas fermés", - "xpack.cases.caseTable.delete": "Supprimer", "xpack.cases.caseTable.incidentSystem": "Système de gestion des incidents", "xpack.cases.caseTable.inProgressCases": "Cas en cours", "xpack.cases.caseTable.noCases.body": "Créer un cas ou modifiez vos filtres.", @@ -11548,7 +11542,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", @@ -13922,9 +13915,6 @@ "xpack.graph.icon.tachometer": "Tachymètre", "xpack.graph.icon.user": "Utilisateur", "xpack.graph.icon.users": "Utilisateurs", - "xpack.graph.inspect.requestTabTitle": "Requête", - "xpack.graph.inspect.responseTabTitle": "Réponse", - "xpack.graph.inspect.title": "Inspecter", "xpack.graph.leaveWorkspace.confirmButtonLabel": "Quitter", "xpack.graph.leaveWorkspace.confirmText": "Si vous quittez maintenant, vous perdez les modifications non enregistrées.", "xpack.graph.leaveWorkspace.modalTitle": "Modifications non enregistrées", @@ -15485,8 +15475,6 @@ "xpack.infra.deprecations.tiebreakerAdjustIndexing": "Ajustez votre indexation pour utiliser \"{field}\" comme moyen de départager.", "xpack.infra.deprecations.timestampAdjustIndexing": "Ajustez votre indexation pour utiliser \"{field}\" comme horodatage.", "xpack.infra.homePage.toolbar.showingLastOneMinuteDataText": "Dernières {duration} de données pour l'heure sélectionnée", - "xpack.infra.infrastructureMetricsExplorerPage.documentTitle": "{previousTitle} | Metrics Explorer", - "xpack.infra.infrastructureSnapshotPage.documentTitle": "{previousTitle} | Inventory", "xpack.infra.inventoryTimeline.header": "{metricLabel} moyen", "xpack.infra.kibanaMetrics.cloudIdMissingErrorMessage": "Le modèle de {metricId} nécessite un cloudId, mais aucun n'a été attribué à {nodeId}.", "xpack.infra.kibanaMetrics.invalidInfraMetricErrorMessage": "{id} n'est pas une valeur inframétrique valide", @@ -15526,7 +15514,6 @@ "xpack.infra.logs.searchResultTooltip": "{bucketCount, plural, one {# entrée mise en surbrillance} other {# entrées mises en surbrillance}}", "xpack.infra.logs.showingEntriesFromTimestamp": "Affichage des entrées à partir de {timestamp}", "xpack.infra.logs.showingEntriesUntilTimestamp": "Affichage des entrées jusqu'à {timestamp}", - "xpack.infra.logs.streamPage.documentTitle": "{previousTitle} | Flux", "xpack.infra.logs.viewInContext.logsFromContainerTitle": "Les logs affichés proviennent du conteneur {container}", "xpack.infra.logs.viewInContext.logsFromFileTitle": "Les logs affichés proviennent du fichier {file} et de l'hôte {host}", "xpack.infra.logSourceConfiguration.invalidMessageFieldTypeErrorMessage": "Le champ {messageField} doit être un champ textuel.", @@ -15535,8 +15522,7 @@ "xpack.infra.logSourceConfiguration.missingDataViewsLabel": "Vue de données {indexPatternId} manquante", "xpack.infra.logSourceConfiguration.missingMessageFieldErrorMessage": "La vue de données doit contenir un champ {messageField}.", "xpack.infra.logSourceErrorPage.savedObjectNotFoundErrorMessage": "Impossible de localiser ce {savedObjectType} : {savedObjectId}", - "xpack.infra.metricDetailPage.documentTitle": "Infrastructure | Indicateurs | {name}", - "xpack.infra.metricDetailPage.documentTitleError": "{previousTitle} | Oups", + "xpack.infra.metricDetailPage.documentTitleError": "Oups", "xpack.infra.metrics.alertFlyout.alertPerRedundantFilterError": "Il est possible que cette règle signale {matchedGroups} moins que prévu, car la requête de filtre comporte une correspondance pour {groupCount, plural, one {ce champ} other {ces champs}}. Pour en savoir plus, veuillez consulter {filteringAndGroupingLink}.", "xpack.infra.metrics.alertFlyout.ofExpression.helpTextDetail": "Vous ne trouvez pas d'indicateur ? {documentationLink}.", "xpack.infra.metrics.alerting.anomaly.summaryHigher": "{differential} x plus élevé", @@ -15690,7 +15676,6 @@ "xpack.infra.header.logsTitle": "Logs", "xpack.infra.header.observabilityTitle": "Observability", "xpack.infra.hideHistory": "Masquer l'historique", - "xpack.infra.homePage.documentTitle": "Indicateurs", "xpack.infra.homePage.inventoryTabTitle": "Inventory", "xpack.infra.homePage.metricsExplorerTabTitle": "Metrics Explorer", "xpack.infra.homePage.noMetricsIndicesInstructionsActionLabel": "Voir les instructions de configuration", @@ -17852,10 +17837,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", @@ -25876,7 +25858,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.", @@ -28314,7 +28295,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", @@ -32542,7 +32522,6 @@ "xpack.triggersActionsUI.sections.ruleDetails.alertsList.ruleTypeExcessDurationMessage": "La durée dépasse le temps d'exécution attendu de la règle.", "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.activeLabel": "Actif", "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.allAlertsLabel": "Toutes les alertes", - "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.recentAlertHistoryTitle": "Historique récent des alertes", "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.title": "Alertes", "xpack.triggersActionsUI.sections.ruleDetails.deleteRuleButtonLabel": "Supprimer la règle", "xpack.triggersActionsUI.sections.ruleDetails.disableRuleButtonLabel": "Désactiver", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 1441559ad00ab..0238b9e9add28 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -986,7 +986,6 @@ "dashboard.panel.copyToDashboard.goToDashboard": "コピーしてダッシュボードを開く", "dashboard.panel.copyToDashboard.newDashboardOptionLabel": "新規ダッシュボード", "dashboard.panel.copyToDashboard.title": "ダッシュボードにコピー", - "dashboard.panel.invalidData": "URL の無効なデータ", "dashboard.panel.LibraryNotification": "Visualize ライブラリ通知", "dashboard.panel.libraryNotification.ariaLabel": "ライブラリ情報を表示し、このパネルのリンクを解除します", "dashboard.panel.libraryNotification.toolTip": "このパネルを編集すると、他のダッシュボードに影響する場合があります。このパネルのみを変更するには、ライブラリからリンクを解除します。", @@ -3716,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": "確認", @@ -3750,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 つと一致している必要があります", @@ -3759,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": "データストリーム、インデックス、またはインデックスエイリアスがインデックスパターンと一致しません。", @@ -5482,7 +5481,6 @@ "visTypeTimeseries.annotationsEditor.ignorePanelFiltersLabel": "パネルフィルターを無視しますか?", "visTypeTimeseries.annotationsEditor.queryStringLabel": "クエリ文字列", "visTypeTimeseries.annotationsEditor.rowTemplateLabel": "行テンプレート(必須)", - "visTypeTimeseries.annotationsEditor.timeFieldLabel": "時間フィールド(必須)", "visTypeTimeseries.calculateLabel.bucketScriptsLabel": "バケットスクリプト", "visTypeTimeseries.calculateLabel.countLabel": "カウント", "visTypeTimeseries.calculateLabel.filterRatioLabel": "フィルターレート", @@ -7530,7 +7528,6 @@ "xpack.apm.serviceGroups.selectServicesForm.preview": "プレビュー", "xpack.apm.serviceGroups.selectServicesForm.refresh": "更新", "xpack.apm.serviceGroups.selectServicesForm.saveGroup": "グループを保存", - "xpack.apm.serviceGroups.selectServicesForm.subtitle": "クエリを使用してこのグループのサービスを選択します。過去24時間以内にこのクエリと一致したサービスはグループに割り当てられます。", "xpack.apm.serviceGroups.selectServicesForm.title": "サービスを選択", "xpack.apm.serviceGroups.selectServicesList.environmentColumnLabel": "環境", "xpack.apm.serviceGroups.selectServicesList.nameColumnLabel": "名前", @@ -9273,7 +9270,6 @@ "xpack.cases.confirmDeleteCase.confirmQuestion": "{quantity, plural, =1 {このケース} other {これらのケース}}を削除すると、関連するすべてのケースデータが完全に削除され、外部インシデント管理システムにデータをプッシュできなくなります。続行していいですか?", "xpack.cases.confirmDeleteCase.deleteCase": "{quantity, plural, other {ケース}}を削除", "xpack.cases.confirmDeleteCase.deleteTitle": "「{caseTitle}」を削除", - "xpack.cases.confirmDeleteCase.selectedCases": "\"{quantity, plural, =1 {{title}} other {選択した{quantity}個のケース}}\"を削除", "xpack.cases.connecors.get.missingCaseConnectorErrorMessage": "オブジェクトタイプ「{id}」は登録されていません。", "xpack.cases.connecors.register.duplicateCaseConnectorErrorMessage": "オブジェクトタイプ「{id}」はすでに登録されています。", "xpack.cases.connectors.card.createCommentWarningDesc": "コメントを外部で共有するには、{connectorName}コネクターの[コメントURLを作成]および[コメントオブジェクトを作成]フィールドを構成します。", @@ -9283,7 +9279,6 @@ "xpack.cases.connectors.cases.externalIncidentUpdated": "({date}に{user}が更新)", "xpack.cases.connectors.jira.unableToGetIssueMessage": "ID {id}の問題を取得できません", "xpack.cases.containers.closedCases": "{totalCases, plural, =1 {\"{caseTitle}\"} other {{totalCases}件のケース}}をクローズしました", - "xpack.cases.containers.deletedCases": "{totalCases, plural, =1 {\"{caseTitle}\"} other {{totalCases}件のケース}}を削除しました", "xpack.cases.containers.markInProgressCases": "{totalCases, plural, =1 {\"{caseTitle}\"} other {{totalCases}件のケース}}を進行中に設定しました", "xpack.cases.containers.pushToExternalService": "{ serviceName }への送信が正常に完了しました", "xpack.cases.containers.reopenedCases": "{totalCases, plural, =1 {\"{caseTitle}\"} other {{totalCases}件のケース}}をオープンしました", @@ -9315,7 +9310,6 @@ "xpack.cases.caseTable.changeStatus": "ステータスの変更", "xpack.cases.caseTable.closed": "終了", "xpack.cases.caseTable.closedCases": "終了したケース", - "xpack.cases.caseTable.delete": "削除", "xpack.cases.caseTable.incidentSystem": "インシデント管理システム", "xpack.cases.caseTable.inProgressCases": "進行中のケース", "xpack.cases.caseTable.noCases.body": "ケースを作成するか、フィルターを編集します。", @@ -11534,7 +11528,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": "インデックス正常性", @@ -13908,9 +13901,6 @@ "xpack.graph.icon.tachometer": "タコメーター", "xpack.graph.icon.user": "ユーザー", "xpack.graph.icon.users": "ユーザー", - "xpack.graph.inspect.requestTabTitle": "リクエスト", - "xpack.graph.inspect.responseTabTitle": "応答", - "xpack.graph.inspect.title": "検査", "xpack.graph.leaveWorkspace.confirmButtonLabel": "それでも移動", "xpack.graph.leaveWorkspace.confirmText": "今移動すると、保存されていない変更が失われます。", "xpack.graph.leaveWorkspace.modalTitle": "保存されていない変更", @@ -15471,8 +15461,6 @@ "xpack.infra.deprecations.tiebreakerAdjustIndexing": "インデックスを調整し、\"{field}\"をタイブレーカーとして使用します。", "xpack.infra.deprecations.timestampAdjustIndexing": "インデックスを調整し、\"{field}\"をタイムスタンプとして使用します。", "xpack.infra.homePage.toolbar.showingLastOneMinuteDataText": "指定期間のデータの最後の{duration}", - "xpack.infra.infrastructureMetricsExplorerPage.documentTitle": "{previousTitle} | メトリックエクスプローラー", - "xpack.infra.infrastructureSnapshotPage.documentTitle": "{previousTitle} | インベントリ", "xpack.infra.inventoryTimeline.header": "平均{metricLabel}", "xpack.infra.kibanaMetrics.cloudIdMissingErrorMessage": "{metricId} のモデルには cloudId が必要ですが、{nodeId} に cloudId が指定されていません。", "xpack.infra.kibanaMetrics.invalidInfraMetricErrorMessage": "{id} は有効な InfraMetric ではありません", @@ -15512,7 +15500,6 @@ "xpack.infra.logs.searchResultTooltip": "{bucketCount, plural, other {# 件のハイライトされたエントリー}}", "xpack.infra.logs.showingEntriesFromTimestamp": "{timestamp} 以降のエントリーを表示中", "xpack.infra.logs.showingEntriesUntilTimestamp": "{timestamp} までのエントリーを表示中", - "xpack.infra.logs.streamPage.documentTitle": "{previousTitle} | Stream", "xpack.infra.logs.viewInContext.logsFromContainerTitle": "表示されたログはコンテナー{container}から取得されました", "xpack.infra.logs.viewInContext.logsFromFileTitle": "表示されたログは、ファイル{file}およびホスト{host}から取得されました", "xpack.infra.logSourceConfiguration.invalidMessageFieldTypeErrorMessage": "{messageField}フィールドはテキストフィールドでなければなりません。", @@ -15520,8 +15507,7 @@ "xpack.infra.logSourceConfiguration.missingDataViewsLabel": "データビュー{indexPatternId}が見つかりません", "xpack.infra.logSourceConfiguration.missingMessageFieldErrorMessage": "データビューには{messageField}フィールドが必要です。", "xpack.infra.logSourceErrorPage.savedObjectNotFoundErrorMessage": "{savedObjectType}:{savedObjectId}が見つかりませんでした", - "xpack.infra.metricDetailPage.documentTitle": "インフラストラクチャ | メトリック | {name}", - "xpack.infra.metricDetailPage.documentTitleError": "{previousTitle} | おっと", + "xpack.infra.metricDetailPage.documentTitleError": "おっと", "xpack.infra.metrics.alertFlyout.alertPerRedundantFilterError": "このルールは想定未満の{matchedGroups}に対してアラートを通知できます。フィルタークエリには{groupCount, plural, one {このフィールド} other {これらのフィールド}}の完全一致が含まれるためです。詳細については、{filteringAndGroupingLink}を参照してください。", "xpack.infra.metrics.alertFlyout.ofExpression.helpTextDetail": "メトリックが見つからない場合は、{documentationLink}。", "xpack.infra.metrics.alerting.anomaly.summaryHigher": "{differential}x高い", @@ -15675,7 +15661,6 @@ "xpack.infra.header.logsTitle": "ログ", "xpack.infra.header.observabilityTitle": "Observability", "xpack.infra.hideHistory": "履歴を表示しない", - "xpack.infra.homePage.documentTitle": "メトリック", "xpack.infra.homePage.inventoryTabTitle": "インベントリ", "xpack.infra.homePage.metricsExplorerTabTitle": "メトリックエクスプローラー", "xpack.infra.homePage.noMetricsIndicesInstructionsActionLabel": "セットアップの手順を表示", @@ -17835,10 +17820,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": "値をフィルターするには正規表現を入力します", @@ -25851,7 +25833,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": "アラートを取得できませんでした。", @@ -28289,7 +28270,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": "ルール例外の追加", @@ -32516,7 +32496,6 @@ "xpack.triggersActionsUI.sections.ruleDetails.alertsList.ruleTypeExcessDurationMessage": "期間がルールの想定実行時間を超えています。", "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.activeLabel": "アクティブ", "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.allAlertsLabel": "すべてのアラート", - "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.recentAlertHistoryTitle": "最近のアラート履歴", "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.title": "アラート", "xpack.triggersActionsUI.sections.ruleDetails.deleteRuleButtonLabel": "ルールの削除", "xpack.triggersActionsUI.sections.ruleDetails.disableRuleButtonLabel": "無効にする", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index d1651dddce021..d555235d7ad76 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -988,7 +988,6 @@ "dashboard.panel.copyToDashboard.goToDashboard": "复制并前往仪表板", "dashboard.panel.copyToDashboard.newDashboardOptionLabel": "新仪表板", "dashboard.panel.copyToDashboard.title": "复制到仪表板", - "dashboard.panel.invalidData": "url 中的数据无效", "dashboard.panel.LibraryNotification": "可视化库通知", "dashboard.panel.libraryNotification.ariaLabel": "查看库信息并取消链接此面板", "dashboard.panel.libraryNotification.toolTip": "编辑此面板可能会影响其他仪表板。要仅更改此面板,请取消其与库的链接。", @@ -3721,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": "确认", @@ -3755,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": "汇总/打包数据视图错误:必须匹配一个汇总/打包索引", @@ -3764,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": "没有数据流、索引或索引别名匹配您的索引模式。", @@ -5489,7 +5488,6 @@ "visTypeTimeseries.annotationsEditor.ignorePanelFiltersLabel": "忽略面板筛选?", "visTypeTimeseries.annotationsEditor.queryStringLabel": "查询字符串", "visTypeTimeseries.annotationsEditor.rowTemplateLabel": "行模板(必需)", - "visTypeTimeseries.annotationsEditor.timeFieldLabel": "时间字段(必需)", "visTypeTimeseries.calculateLabel.bucketScriptsLabel": "存储桶脚本", "visTypeTimeseries.calculateLabel.countLabel": "计数", "visTypeTimeseries.calculateLabel.filterRatioLabel": "筛选比", @@ -7547,7 +7545,6 @@ "xpack.apm.serviceGroups.selectServicesForm.preview": "预览", "xpack.apm.serviceGroups.selectServicesForm.refresh": "刷新", "xpack.apm.serviceGroups.selectServicesForm.saveGroup": "保存组", - "xpack.apm.serviceGroups.selectServicesForm.subtitle": "使用查询为该组选择服务。过去 24 小时内与此查询匹配的服务将分配给该组。", "xpack.apm.serviceGroups.selectServicesForm.title": "选择服务", "xpack.apm.serviceGroups.selectServicesList.environmentColumnLabel": "环境", "xpack.apm.serviceGroups.selectServicesList.nameColumnLabel": "名称", @@ -9291,7 +9288,6 @@ "xpack.cases.confirmDeleteCase.confirmQuestion": "删除{quantity, plural, =1 {此案例} other {这些案例}}即会永久移除所有相关案例数据,而且您将无法再将数据推送到外部事件管理系统。是否确定要继续?", "xpack.cases.confirmDeleteCase.deleteCase": "删除{quantity, plural, other {案例}}", "xpack.cases.confirmDeleteCase.deleteTitle": "删除“{caseTitle}”", - "xpack.cases.confirmDeleteCase.selectedCases": "删除“{quantity, plural, =1 {{title}} other {选定的 {quantity} 个案例}}”", "xpack.cases.connecors.get.missingCaseConnectorErrorMessage": "对象类型“{id}”未注册。", "xpack.cases.connecors.register.duplicateCaseConnectorErrorMessage": "已注册对象类型“{id}”。", "xpack.cases.connectors.card.createCommentWarningDesc": "为 {connectorName} 连接器配置“创建注释 URL”和“创建注释对象”字段以在外部共享注释。", @@ -9301,7 +9297,6 @@ "xpack.cases.connectors.cases.externalIncidentUpdated": "(由 {user} 于 {date}更新)", "xpack.cases.connectors.jira.unableToGetIssueMessage": "无法获取 ID 为 {id} 的问题", "xpack.cases.containers.closedCases": "已关闭{totalCases, plural, =1 {“{caseTitle}”} other { {totalCases} 个案例}}", - "xpack.cases.containers.deletedCases": "已删除{totalCases, plural, =1 {“{caseTitle}”} other { {totalCases} 个案例}}", "xpack.cases.containers.markInProgressCases": "已将{totalCases, plural, =1 {“{caseTitle}”} other { {totalCases} 个案例}}标记为进行中", "xpack.cases.containers.pushToExternalService": "已成功发送到 { serviceName }", "xpack.cases.containers.reopenedCases": "已打开{totalCases, plural, =1 {“{caseTitle}”} other { {totalCases} 个案例}}", @@ -9333,7 +9328,6 @@ "xpack.cases.caseTable.changeStatus": "更改状态", "xpack.cases.caseTable.closed": "已关闭", "xpack.cases.caseTable.closedCases": "已关闭案例", - "xpack.cases.caseTable.delete": "删除", "xpack.cases.caseTable.incidentSystem": "事件管理系统", "xpack.cases.caseTable.inProgressCases": "进行中的案例", "xpack.cases.caseTable.noCases.body": "创建案例或编辑筛选。", @@ -11553,7 +11547,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": "索引运行状况", @@ -13928,9 +13921,6 @@ "xpack.graph.icon.tachometer": "转速表", "xpack.graph.icon.user": "用户", "xpack.graph.icon.users": "用户", - "xpack.graph.inspect.requestTabTitle": "请求", - "xpack.graph.inspect.responseTabTitle": "响应", - "xpack.graph.inspect.title": "检查", "xpack.graph.leaveWorkspace.confirmButtonLabel": "离开", "xpack.graph.leaveWorkspace.confirmText": "如果现在离开,将丢失未保存的更改。", "xpack.graph.leaveWorkspace.modalTitle": "未保存的更改", @@ -15491,8 +15481,6 @@ "xpack.infra.deprecations.tiebreakerAdjustIndexing": "调整索引以将“{field}”用作决胜属性。", "xpack.infra.deprecations.timestampAdjustIndexing": "调整索引以将“{field}”用作时间戳。", "xpack.infra.homePage.toolbar.showingLastOneMinuteDataText": "选定时间过去 {duration}的数据", - "xpack.infra.infrastructureMetricsExplorerPage.documentTitle": "{previousTitle} | 指标浏览器", - "xpack.infra.infrastructureSnapshotPage.documentTitle": "{previousTitle} | 库存", "xpack.infra.inventoryTimeline.header": "平均值 {metricLabel}", "xpack.infra.kibanaMetrics.cloudIdMissingErrorMessage": "{metricId} 的模型需要云 ID,但没有为 {nodeId} 提供。", "xpack.infra.kibanaMetrics.invalidInfraMetricErrorMessage": "{id} 不是有效的 InfraMetric", @@ -15532,7 +15520,6 @@ "xpack.infra.logs.searchResultTooltip": "{bucketCount, plural, other {# 个高亮条目}}", "xpack.infra.logs.showingEntriesFromTimestamp": "正在显示自 {timestamp} 起的条目", "xpack.infra.logs.showingEntriesUntilTimestamp": "正在显示截止于 {timestamp} 的条目", - "xpack.infra.logs.streamPage.documentTitle": "{previousTitle} | 流式传输", "xpack.infra.logs.viewInContext.logsFromContainerTitle": "显示的日志来自容器 {container}", "xpack.infra.logs.viewInContext.logsFromFileTitle": "显示的日志来自文件 {file} 和主机 {host}", "xpack.infra.logSourceConfiguration.invalidMessageFieldTypeErrorMessage": "{messageField} 字段必须是文本字段。", @@ -15541,8 +15528,7 @@ "xpack.infra.logSourceConfiguration.missingDataViewsLabel": "缺少数据视图 {indexPatternId}", "xpack.infra.logSourceConfiguration.missingMessageFieldErrorMessage": "数据视图必须包含 {messageField} 字段。", "xpack.infra.logSourceErrorPage.savedObjectNotFoundErrorMessage": "无法找到该{savedObjectType}:{savedObjectId}", - "xpack.infra.metricDetailPage.documentTitle": "Infrastructure | 指标 | {name}", - "xpack.infra.metricDetailPage.documentTitleError": "{previousTitle} | 啊哦", + "xpack.infra.metricDetailPage.documentTitleError": "啊哦", "xpack.infra.metrics.alertFlyout.alertPerRedundantFilterError": "此规则可能针对低于预期的 {matchedGroups} 告警,因为筛选查询包含{groupCount, plural, one {此字段} other {这些字段}}的匹配项。有关更多信息,请参阅 {filteringAndGroupingLink}。", "xpack.infra.metrics.alertFlyout.ofExpression.helpTextDetail": "找不到指标?{documentationLink}。", "xpack.infra.metrics.alerting.anomaly.summaryHigher": "高 {differential} 倍", @@ -15696,7 +15682,6 @@ "xpack.infra.header.logsTitle": "日志", "xpack.infra.header.observabilityTitle": "Observability", "xpack.infra.hideHistory": "隐藏历史记录", - "xpack.infra.homePage.documentTitle": "指标", "xpack.infra.homePage.inventoryTabTitle": "库存", "xpack.infra.homePage.metricsExplorerTabTitle": "指标浏览器", "xpack.infra.homePage.noMetricsIndicesInstructionsActionLabel": "查看设置说明", @@ -17860,10 +17845,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": "输入正则表达式以筛选值", @@ -25885,7 +25867,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": "无法获取告警。", @@ -28323,7 +28304,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": "添加规则例外", @@ -32553,7 +32533,6 @@ "xpack.triggersActionsUI.sections.ruleDetails.alertsList.ruleTypeExcessDurationMessage": "持续时间超出了规则的预期运行时间。", "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.activeLabel": "活动", "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.allAlertsLabel": "所有告警", - "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.recentAlertHistoryTitle": "最近告警历史记录", "xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.title": "告警", "xpack.triggersActionsUI.sections.ruleDetails.deleteRuleButtonLabel": "删除规则", "xpack.triggersActionsUI.sections.ruleDetails.disableRuleButtonLabel": "禁用", diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/context/action_type_registry.tsx b/x-pack/plugins/triggers_actions_ui/.storybook/context/action_type_registry.tsx new file mode 100644 index 0000000000000..73a28b53d0a8b --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/.storybook/context/action_type_registry.tsx @@ -0,0 +1,15 @@ +/* + * 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 getActionTypeRegistry = () => { + return { + has: () => true, + register: () => {}, + get: () => {}, + list: () => [], + }; +}; diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/context/http.ts b/x-pack/plugins/triggers_actions_ui/.storybook/context/http.ts new file mode 100644 index 0000000000000..dc260578641f8 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/.storybook/context/http.ts @@ -0,0 +1,305 @@ +/* + * 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 uuid from 'uuid'; +import { DecoratorFn } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; +import type { HttpStart, HttpFetchOptions, HttpHandler } from '@kbn/core/public'; +import { + mockLogResponse, + getMockLogResponse, +} from '../../public/application/sections/rule_details/components/test_helpers'; + +const getMockRule = () => { + const id = uuid.v4(); + return { + id, + name: `test rule - ${id}`, + tags: ['tag1', 'tag2', 'tag3'], + enabled: true, + ruleTypeId: 'test_rule_type', + schedule: { interval: '1s' }, + actions: [], + consumer: 'alerts', + params: { name: 'test rule type name' }, + scheduledTaskId: null, + createdBy: null, + updatedBy: null, + apiKeyOwner: null, + throttle: '1m', + muteAll: false, + mutedInstanceIds: [], + executionStatus: { + status: 'active', + lastDuration: 500, + lastExecutionDate: new Date('2020-08-20T19:23:38Z'), + error: null, + }, + monitoring: { + execution: { + history: [ + { + success: true, + duration: 1000000, + }, + { + success: true, + duration: 200000, + }, + { + success: false, + duration: 300000, + }, + ], + calculated_metrics: { + success_ratio: 0.66, + p50: 200000, + p95: 300000, + p99: 300000, + }, + }, + }, + }; +}; + +const mockRuleTypes = [ + { + id: 'test_rule_type', + name: 'some rule type', + action_groups: [{ id: 'default', name: 'Default' }], + recovery_action_group: { id: 'recovered', name: 'Recovered' }, + action_variables: { context: [], state: [] }, + default_action_group_id: 'default', + producer: 'alerts', + minimum_license_required: 'basic', + enabled_in_license: true, + authorized_consumers: { + alerts: { read: true, all: true }, + }, + rule_task_timeout: '1m', + }, +]; + +const mockConfig = { + minimumScheduleInterval: { + value: '1m', + enforce: false, + }, + isUsingSecurity: true, +}; + +const mockConnectorTypes = [ + { + id: 'test', + name: 'Test', + }, + { + id: 'test2', + name: 'Test2', + }, +]; + +const mockHealth = { + isAlertsAvailable: true, +}; + +const mockAggregation = { + rule_execution_status: { ok: 0, active: 0, error: 0, pending: 0, unknown: 0, warning: 0 }, + rule_enabled_status: { enabled: 0, disabled: 0 }, + rule_muted_status: { muted: 0, unmuted: 0 }, + rule_snoozed_status: { snoozed: 0 }, + rule_tags: ['a', 'b'], +}; + +const mockConnectors: any[] = []; + +const mockRuleSummary = { + id: 'rule-id', + name: 'rule-name', + tags: ['tag-1', 'tag-2'], + rule_type_id: 'test-rule-type-id', + consumer: 'rule-consumer', + status: 'OK', + mute_all: false, + throttle: '', + enabled: true, + error_messages: [], + status_start_date: '2022-03-21T07:40:46-07:00', + status_end_date: '2022-03-25T07:40:46-07:00', + alerts: { + foo: { + status: 'OK', + muted: false, + actionGroupId: 'testActionGroup', + }, + }, + execution_duration: { + average: 100, + valuesWithTimestamp: {}, + }, +}; + +const getMockErrorLog = () => { + return { + id: '66b9c04a-d5d3-4ed4-aa7c-94ddaca3ac1d', + timestamp: '2022-03-31T18:03:33.133Z', + type: 'alerting', + message: + "rule execution failure: .es-query:d87fcbd0-b11b-11ec-88f6-293354dba871: 'Mine' - x_content_parse_exception: [parsing_exception] Reason: unknown query [match_allxxxx] did you mean [match_all]?", + }; +}; + +const baseRulesListGetResponse = (path: string) => { + if (path === '/internal/triggers_actions_ui/_config') { + return mockConfig; + } + if (path === '/internal/triggers_actions_ui/_health') { + return mockHealth; + } + if (path === '/api/actions/connectors') { + return mockConnectors; + } + if (path === '/api/alerting/rule_types') { + return mockRuleTypes; + } + if (path === '/api/actions/connector_types') { + return mockConnectorTypes; + } + if (path === '/internal/alerting/rules/_aggregate') { + return mockAggregation; + } +}; + +const emptyRulesListGetResponse = (path: string) => { + if (path === '/internal/alerting/rules/_find') { + return { + data: [], + page: 1, + per_page: 10, + total: 0, + }; + } + return baseRulesListGetResponse(path); +}; + +const rulesListGetResponse = (path: string) => { + if (path === '/internal/alerting/rules/_find') { + return { + data: [getMockRule(), getMockRule(), getMockRule(), getMockRule()], + page: 1, + per_page: 10, + total: 4, + }; + } + return baseRulesListGetResponse(path); +}; + +const rulesListGetPaginatedResponse = (path: string) => { + if (path === '/internal/alerting/rules/_find') { + return { + data: Array.from(Array(10), () => getMockRule()), + page: 1, + per_page: 10, + total: 50, + }; + } + return baseRulesListGetResponse(path); +}; + +const baseEventLogListGetResponse = (path: string) => { + if (path.endsWith('/_alert_summary')) { + return { + ...mockRuleSummary, + execution_duration: { + ...mockRuleSummary.execution_duration, + valuesWithTimestamp: { + '2022-08-18T23:07:28.662Z': 68, + '2022-08-18T23:07:29.662Z': 59, + '2022-08-18T23:07:30.662Z': 20, + '2022-08-18T23:07:31.662Z': 140, + }, + }, + }; + } + if (path.endsWith('/_action_error_log')) { + return { + errors: Array.from(Array(4), () => getMockErrorLog()), + totalErrors: 4, + }; + } + if (path.endsWith('/_execution_kpi')) { + return { + activeAlerts: 49, + erroredActions: 36, + failure: 30, + newAlerts: 1, + recoveredAlerts: 20, + success: 49, + triggeredActions: 49, + unknown: 10, + }; + } +}; + +const emptyEventLogListGetResponse = (path: string) => { + if (path.endsWith('/_alert_summary')) { + return mockRuleSummary; + } + if (path.endsWith('/_execution_log')) { + return { + data: [], + total: 0, + }; + } + return baseEventLogListGetResponse(path); +}; + +const eventLogListGetResponse = (path: string) => { + if (path.endsWith('/_execution_log')) { + return mockLogResponse; + } + return baseEventLogListGetResponse(path); +}; + +const paginatedEventLogListGetResponse = (path: string) => { + if (path.endsWith('/_execution_log')) { + return { + data: Array.from(Array(10), () => getMockLogResponse()), + total: 500, + }; + } + return baseEventLogListGetResponse(path); +}; + +export const getHttp = (context: Parameters[1]) => { + return { + get: (async (path: string, options: HttpFetchOptions) => { + const { id } = context; + if (id === 'app-ruleslist--empty') { + return emptyRulesListGetResponse(path); + } + if (id === 'app-ruleslist--with-rules') { + return rulesListGetResponse(path); + } + if (id === 'app-ruleslist--with-paginated-rules') { + return rulesListGetPaginatedResponse(path); + } + if (id === 'app-ruleeventloglist--empty') { + return emptyEventLogListGetResponse(path); + } + if (id === 'app-ruleeventloglist--with-events') { + return eventLogListGetResponse(path); + } + if (id === 'app-ruleeventloglist--with-paginated-events') { + return paginatedEventLogListGetResponse(path); + } + }) as HttpHandler, + post: (async (path: string, options: HttpFetchOptions) => { + action('POST')(path, options); + }) as HttpHandler, + } as unknown as HttpStart; +}; diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/context/rule_type_registry.ts b/x-pack/plugins/triggers_actions_ui/.storybook/context/rule_type_registry.ts new file mode 100644 index 0000000000000..f8ddcf6f8def4 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/.storybook/context/rule_type_registry.ts @@ -0,0 +1,31 @@ +/* + * 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. + */ + +const mockRuleType = { + id: 'test_rule_type', + iconClass: 'test', + description: 'Rule when testing', + documentationUrl: 'https://localhost.local/docs', + validate: () => { + return { errors: {} }; + }, + ruleParamsExpression: () => null, + requiresAppContext: false, +}; + +export const getRuleTypeRegistry = () => { + return { + has: () => true, + register: () => {}, + get: () => { + return mockRuleType; + }, + list: () => { + return [mockRuleType]; + }, + }; +}; diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx b/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx new file mode 100644 index 0000000000000..ed2a1d7b17e14 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx @@ -0,0 +1,124 @@ +/* + * 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 uuid from 'uuid'; +import { action } from '@storybook/addon-actions'; +import { DecoratorFn } from '@storybook/react'; +import { EMPTY, of } from 'rxjs'; +import { I18nProvider } from '@kbn/i18n-react'; +import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public'; +import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; +import type { NotificationsStart, ApplicationStart } from '@kbn/core/public'; +import { KibanaContextProvider } from '../public/common/lib/kibana'; +import { ExperimentalFeaturesService } from '../public/common/experimental_features_service'; +import { getHttp } from './context/http'; +import { getRuleTypeRegistry } from './context/rule_type_registry'; +import { getActionTypeRegistry } from './context/action_type_registry'; + +interface StorybookContextDecoratorProps { + context: Parameters[1]; +} + +const handler = (type: string, ...rest: any[]) => { + action(`${type} Toast`)(rest); + return { id: uuid() }; +}; + +const notifications: NotificationsStart = { + toasts: { + add: (params) => handler('add', params), + addDanger: (params) => handler('danger', params), + addError: (params) => handler('error', params), + addWarning: (params) => handler('warning', params), + addSuccess: (params) => handler('success', params), + addInfo: (params) => handler('info', params), + remove: () => {}, + get$: () => of([]), + }, +}; + +const applications = new Map(); + +const application: ApplicationStart = { + currentAppId$: of('fleet'), + navigateToUrl: async (url: string) => { + action(`Navigate to: ${url}`); + }, + navigateToApp: async (app: string) => { + action(`Navigate to: ${app}`); + }, + getUrlForApp: (url: string) => url, + capabilities: { + actions: { + show: true, + save: true, + execute: true, + delete: true, + }, + catalogue: {}, + management: {}, + navLinks: {}, + fleet: { + read: true, + all: true, + }, + fleetv2: { + read: true, + all: true, + }, + }, + applications$: of(applications), +}; + +export const StorybookContextDecorator: React.FC = (props) => { + const { children, context } = props; + const { globals } = context; + const { euiTheme } = globals; + + const darkMode = ['v8.dark', 'v7.dark'].includes(euiTheme); + ExperimentalFeaturesService.init({ + experimentalFeatures: { + rulesListDatagrid: true, + internalAlertsTable: true, + ruleTagFilter: true, + ruleStatusFilter: true, + rulesDetailLogs: true, + }, + }); + return ( + + + + { + if (context.componentId === 'app-ruleslist') { + return 'format:number:defaultPattern'; + } + }, + get$: () => { + if (context.componentId === 'app-ruleslist') { + return of('format:number:defaultPattern'); + } + }, + }, + application, + http: getHttp(context), + actionTypeRegistry: getActionTypeRegistry(), + ruleTypeRegistry: getRuleTypeRegistry(), + }} + > + {children} + + + + + ); +}; diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/main.ts b/x-pack/plugins/triggers_actions_ui/.storybook/main.ts new file mode 100644 index 0000000000000..bf63e08d64c32 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/.storybook/main.ts @@ -0,0 +1,10 @@ +/* + * 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 { defaultConfig } from '@kbn/storybook'; + +module.exports = defaultConfig; diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/manager.ts b/x-pack/plugins/triggers_actions_ui/.storybook/manager.ts new file mode 100644 index 0000000000000..17fb8fc042000 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/.storybook/manager.ts @@ -0,0 +1,20 @@ +/* + * 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 { addons } from '@storybook/addons'; +import { create } from '@storybook/theming'; +import { PANEL_ID } from '@storybook/addon-actions'; + +addons.setConfig({ + theme: create({ + base: 'light', + brandTitle: 'Triggers Actions UI Storybook', + brandUrl: 'https://github.com/elastic/kibana/tree/main/x-pack/plugins/triggers_actions_ui', + }), + showPanel: true, + selectedPanel: PANEL_ID, +}); diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/preview.tsx b/x-pack/plugins/triggers_actions_ui/.storybook/preview.tsx new file mode 100644 index 0000000000000..8f334c0dc921c --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/.storybook/preview.tsx @@ -0,0 +1,31 @@ +/* + * 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 { addDecorator, DecoratorFn } from '@storybook/react'; +import { Title, Subtitle, Description, Primary, Stories } from '@storybook/addon-docs'; +import { StorybookContextDecorator } from './decorator'; + +const decorator: DecoratorFn = (story, context) => { + return {story()}; +}; + +addDecorator(decorator); + +export const parameters = { + docs: { + page: () => { + <> + + <Subtitle /> + <Description /> + <Primary /> + <Stories /> + </>; + }, + }, +}; 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 135d4783da822..643e1b69a513d 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<Props> = ({ return ( <EuiFormRow + data-test-subj="actionJsonEditor" fullWidth error={errors} isInvalid={errors && errors.length > 0 && inputTargetValue !== undefined} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_load_rule_alerts_aggregations.test.ts b/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_load_rule_alerts_aggregations.test.ts index 293c1e992ac18..03be9f6b9bd5a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_load_rule_alerts_aggregations.test.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_load_rule_alerts_aggregations.test.ts @@ -8,7 +8,7 @@ import { ALERTS_FEATURE_ID } from '@kbn/alerting-plugin/common'; import { renderHook } from '@testing-library/react-hooks'; import { useKibana } from '../../common/lib/kibana'; -import { mockAggsResponse, mockChartData } from '../mock/rule_details/alert_summary'; +import { mockAggsResponse } from '../mock/rule_details/alert_summary'; import { useLoadRuleAlertsAggs } from './use_load_rule_alerts_aggregations'; jest.mock('../../common/lib/kibana'); @@ -21,7 +21,7 @@ describe('useLoadRuleAlertsAggs', () => { useKibanaMock().services.http.get = jest.fn().mockResolvedValue({ index_name: ['mock_index'] }); }); - it('should return the expected chart data from the Elasticsearch Aggs. query', async () => { + it('should return the expected data from the Elasticsearch Aggs. query', async () => { const { result, waitForNextUpdate } = renderHook(() => useLoadRuleAlertsAggs({ features: ALERTS_FEATURE_ID, @@ -31,18 +31,15 @@ describe('useLoadRuleAlertsAggs', () => { expect(result.current).toEqual({ isLoadingRuleAlertsAggs: true, ruleAlertsAggs: { active: 0, recovered: 0 }, - alertsChartData: [], }); await waitForNextUpdate(); - const { ruleAlertsAggs, errorRuleAlertsAggs, alertsChartData } = result.current; + const { ruleAlertsAggs, errorRuleAlertsAggs } = result.current; expect(ruleAlertsAggs).toEqual({ active: 1, recovered: 7, }); - expect(alertsChartData).toEqual(mockChartData()); expect(errorRuleAlertsAggs).toBeFalsy(); - expect(alertsChartData.length).toEqual(33); }); it('should have the correct query body sent to Elasticsearch', async () => { @@ -55,7 +52,7 @@ describe('useLoadRuleAlertsAggs', () => { ); await waitForNextUpdate(); - const body = `{"index":"mock_index","size":0,"query":{"bool":{"must":[{"term":{"kibana.alert.rule.uuid":"${ruleId}"}},{"range":{"@timestamp":{"gte":"now-30d","lt":"now"}}},{"bool":{"should":[{"term":{"kibana.alert.status":"active"}},{"term":{"kibana.alert.status":"recovered"}}]}}]}},"aggs":{"total":{"filters":{"filters":{"totalActiveAlerts":{"term":{"kibana.alert.status":"active"}},"totalRecoveredAlerts":{"term":{"kibana.alert.status":"recovered"}}}}},"statusPerDay":{"date_histogram":{"field":"@timestamp","fixed_interval":"1d","extended_bounds":{"min":"now-30d","max":"now"}},"aggs":{"alertStatus":{"terms":{"field":"kibana.alert.status"}}}}}}`; + const body = `{"index":"mock_index","size":0,"query":{"bool":{"must":[{"term":{"kibana.alert.rule.uuid":"${ruleId}"}},{"range":{"@timestamp":{"gte":"now-30d","lt":"now"}}},{"bool":{"should":[{"term":{"kibana.alert.status":"active"}},{"term":{"kibana.alert.status":"recovered"}}]}}]}},"aggs":{"total":{"filters":{"filters":{"totalActiveAlerts":{"term":{"kibana.alert.status":"active"}},"totalRecoveredAlerts":{"term":{"kibana.alert.status":"recovered"}}}}}}}`; expect(useKibanaMock().services.http.post).toHaveBeenCalledWith( '/internal/rac/alerts/find', diff --git a/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_load_rule_alerts_aggregations.ts b/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_load_rule_alerts_aggregations.ts index c938b0b2cc13f..3df1722abc006 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_load_rule_alerts_aggregations.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_load_rule_alerts_aggregations.ts @@ -10,7 +10,6 @@ import { AsApiContract } from '@kbn/actions-plugin/common'; import { HttpSetup } from '@kbn/core/public'; import { BASE_RAC_ALERTS_API_PATH } from '@kbn/rule-registry-plugin/common/constants'; import { useKibana } from '../../common/lib/kibana'; -import { AlertChartData } from '../sections/rule_details/components/alert_summary'; interface UseLoadRuleAlertsAggs { features: string; @@ -29,7 +28,6 @@ interface LoadRuleAlertsAggs { recovered: number; }; errorRuleAlertsAggs?: string; - alertsChartData: AlertChartData[]; } interface IndexName { index: string; @@ -40,7 +38,6 @@ export function useLoadRuleAlertsAggs({ features, ruleId }: UseLoadRuleAlertsAgg const [ruleAlertsAggs, setRuleAlertsAggs] = useState<LoadRuleAlertsAggs>({ isLoadingRuleAlertsAggs: true, ruleAlertsAggs: { active: 0, recovered: 0 }, - alertsChartData: [], }); const isCancelledRef = useRef(false); const abortCtrlRef = useRef(new AbortController()); @@ -54,7 +51,7 @@ export function useLoadRuleAlertsAggs({ features, ruleId }: UseLoadRuleAlertsAgg http, features, }); - const { active, recovered, error, alertsChartData } = await fetchRuleAlertsAggByTimeRange({ + const { active, recovered, error } = await fetchRuleAlertsAggByTimeRange({ http, index, ruleId, @@ -68,7 +65,6 @@ export function useLoadRuleAlertsAggs({ features, ruleId }: UseLoadRuleAlertsAgg active, recovered, }, - alertsChartData, isLoadingRuleAlertsAggs: false, })); } @@ -79,7 +75,6 @@ export function useLoadRuleAlertsAggs({ features, ruleId }: UseLoadRuleAlertsAgg ...oldState, isLoadingRuleAlertsAggs: false, errorRuleAlertsAggs: error, - alertsChartData: [], })); } } @@ -92,7 +87,7 @@ export function useLoadRuleAlertsAggs({ features, ruleId }: UseLoadRuleAlertsAgg return ruleAlertsAggs; } -export async function fetchIndexNameAPI({ +async function fetchIndexNameAPI({ http, features, }: { @@ -107,14 +102,7 @@ export async function fetchIndexNameAPI({ }; } -interface RuleAlertsAggs { - active: number; - recovered: number; - error?: string; - alertsChartData: AlertChartData[]; -} - -export async function fetchRuleAlertsAggByTimeRange({ +async function fetchRuleAlertsAggByTimeRange({ http, index, ruleId, @@ -183,109 +171,22 @@ export async function fetchRuleAlertsAggByTimeRange({ }, }, }, - statusPerDay: { - date_histogram: { - field: '@timestamp', - fixed_interval: '1d', - extended_bounds: { - min: 'now-30d', - max: 'now', - }, - }, - aggs: { - alertStatus: { - terms: { - field: 'kibana.alert.status', - }, - }, - }, - }, }, }), }); const active = res?.aggregations?.total.buckets.totalActiveAlerts?.doc_count ?? 0; const recovered = res?.aggregations?.total.buckets.totalRecoveredAlerts?.doc_count ?? 0; - let maxTotalAlertPerDay = 0; - res?.aggregations?.statusPerDay.buckets.forEach( - (dayAlerts: { - key: number; - doc_count: number; - alertStatus: { - buckets: Array<{ - key: 'active' | 'recovered'; - doc_count: number; - }>; - }; - }) => { - if (dayAlerts.doc_count > maxTotalAlertPerDay) { - maxTotalAlertPerDay = dayAlerts.doc_count; - } - } - ); - const alertsChartData = [ - ...res?.aggregations?.statusPerDay.buckets.reduce( - ( - acc: AlertChartData[], - dayAlerts: { - key: number; - doc_count: number; - alertStatus: { - buckets: Array<{ - key: 'active' | 'recovered'; - doc_count: number; - }>; - }; - } - ) => { - // We are adding this to each day to construct the 30 days bars (background bar) when there is no data for a given day or to show the delta today alerts/total alerts. - const totalDayAlerts = { - date: dayAlerts.key, - count: maxTotalAlertPerDay === 0 ? 1 : maxTotalAlertPerDay, - status: 'total', - }; - - if (dayAlerts.doc_count > 0) { - const localAlertChartData = acc; - // If there are alerts in this day, we construct the chart data - dayAlerts.alertStatus.buckets.forEach((alert) => { - localAlertChartData.push({ - date: dayAlerts.key, - count: alert.doc_count, - status: alert.key, - }); - }); - const deltaAlertsCount = maxTotalAlertPerDay - dayAlerts.doc_count; - if (deltaAlertsCount > 0) { - localAlertChartData.push({ - date: dayAlerts.key, - count: deltaAlertsCount, - status: 'total', - }); - } - return localAlertChartData; - } - return [...acc, totalDayAlerts]; - }, - [] - ), - ]; return { active, recovered, - alertsChartData: [ - ...alertsChartData.filter((acd) => acd.status === 'recovered'), - ...alertsChartData.filter((acd) => acd.status === 'active'), - ...alertsChartData.filter((acd) => acd.status === 'total'), - ], }; } catch (error) { return { error, active: 0, recovered: 0, - alertsChartData: [], } as RuleAlertsAggs; } } diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.test.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.test.ts index 26a69093ae48d..cbe226ce68aa8 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.test.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.test.ts @@ -5,40 +5,47 @@ * 2.0. */ -import { getAlertingSectionBreadcrumb, getRuleDetailsBreadcrumb } from './breadcrumb'; +import { getAlertingSectionBreadcrumb } from './breadcrumb'; import { i18n } from '@kbn/i18n'; import { routeToConnectors, routeToRules, routeToHome } from '../constants'; describe('getAlertingSectionBreadcrumb', () => { test('if change calls return proper breadcrumb title ', async () => { - expect(getAlertingSectionBreadcrumb('connectors')).toMatchObject({ + expect(getAlertingSectionBreadcrumb('connectors', true)).toMatchObject({ text: i18n.translate('xpack.triggersActionsUI.connectors.breadcrumbTitle', { defaultMessage: 'Connectors', }), href: `${routeToConnectors}`, }); - expect(getAlertingSectionBreadcrumb('rules')).toMatchObject({ + expect(getAlertingSectionBreadcrumb('rules', true)).toMatchObject({ text: i18n.translate('xpack.triggersActionsUI.rules.breadcrumbTitle', { defaultMessage: 'Rules', }), href: `${routeToRules}`, }); - expect(getAlertingSectionBreadcrumb('home')).toMatchObject({ + expect(getAlertingSectionBreadcrumb('home', true)).toMatchObject({ text: i18n.translate('xpack.triggersActionsUI.home.breadcrumbTitle', { defaultMessage: 'Rules and Connectors', }), href: `${routeToHome}`, }); }); -}); - -describe('getRuleDetailsBreadcrumb', () => { - test('if select an alert should return proper breadcrumb title with alert name ', async () => { - expect(getRuleDetailsBreadcrumb('testId', 'testName')).toMatchObject({ - text: i18n.translate('xpack.triggersActionsUI.alertDetails.breadcrumbTitle', { - defaultMessage: 'testName', + test('if boolean is passed in returns proper breadcrumb href ', async () => { + expect(getAlertingSectionBreadcrumb('connectors', true)).toMatchObject({ + text: i18n.translate('xpack.triggersActionsUI.connectors.breadcrumbTitle', { + defaultMessage: 'Connectors', + }), + href: `${routeToConnectors}`, + }); + expect(getAlertingSectionBreadcrumb('rules', false)).toMatchObject({ + text: i18n.translate('xpack.triggersActionsUI.rules.breadcrumbTitle', { + defaultMessage: 'Rules', + }), + }); + expect(getAlertingSectionBreadcrumb('home', false)).toMatchObject({ + text: i18n.translate('xpack.triggersActionsUI.home.breadcrumbTitle', { + defaultMessage: 'Rules and Connectors', }), - href: '/rule/testId', }); }); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts index d26cdbcb3d174..46a15b12bb733 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts @@ -6,9 +6,12 @@ */ import { i18n } from '@kbn/i18n'; -import { routeToHome, routeToConnectors, routeToRules, routeToRuleDetails } from '../constants'; +import { routeToHome, routeToConnectors, routeToRules } from '../constants'; -export const getAlertingSectionBreadcrumb = (type: string): { text: string; href: string } => { +export const getAlertingSectionBreadcrumb = ( + type: string, + returnHref: boolean = false +): { text: string; href?: string } => { // Home and sections switch (type) { case 'connectors': @@ -16,31 +19,33 @@ export const getAlertingSectionBreadcrumb = (type: string): { text: string; href text: i18n.translate('xpack.triggersActionsUI.connectors.breadcrumbTitle', { defaultMessage: 'Connectors', }), - href: `${routeToConnectors}`, + ...(returnHref + ? { + href: `${routeToConnectors}`, + } + : {}), }; case 'rules': return { text: i18n.translate('xpack.triggersActionsUI.rules.breadcrumbTitle', { defaultMessage: 'Rules', }), - href: `${routeToRules}`, + ...(returnHref + ? { + href: `${routeToRules}`, + } + : {}), }; default: return { text: i18n.translate('xpack.triggersActionsUI.home.breadcrumbTitle', { defaultMessage: 'Rules and Connectors', }), - href: `${routeToHome}`, + ...(returnHref + ? { + href: `${routeToHome}`, + } + : {}), }; } }; - -export const getRuleDetailsBreadcrumb = ( - id: string, - name: string -): { text: string; href: string } => { - return { - text: name, - href: `${routeToRuleDetails.replace(':ruleId', id)}`, - }; -}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/get_filter.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/get_filter.ts new file mode 100644 index 0000000000000..65ace4fa72c7b --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/get_filter.ts @@ -0,0 +1,34 @@ +/* + * 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. + */ + +// TODO (Jiawei): Use node builder instead of strings +export const getFilter = ({ + message, + outcomeFilter, + runId, +}: { + message?: string; + outcomeFilter?: string[]; + runId?: string; +}) => { + const filter: string[] = []; + + if (message) { + const escapedMessage = message.replace(/([\)\(\<\>\}\{\"\:\\])/gm, '\\$&'); + filter.push(`message: "${escapedMessage}" OR error.message: "${escapedMessage}"`); + } + + if (outcomeFilter && outcomeFilter.length) { + filter.push(`event.outcome: ${outcomeFilter.join(' or ')}`); + } + + if (runId) { + filter.push(`kibana.alert.rule.execution.uuid: ${runId}`); + } + + return filter; +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/index.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/index.ts index e841506595c04..e23fe787e87c2 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/index.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/index.ts @@ -28,6 +28,10 @@ export { loadExecutionLogAggregations, loadGlobalExecutionLogAggregations, } from './load_execution_log_aggregations'; +export type { LoadExecutionKPIAggregationsProps } from './load_execution_kpi_aggregations'; +export { loadExecutionKPIAggregations } from './load_execution_kpi_aggregations'; +export type { LoadGlobalExecutionKPIAggregationsProps } from './load_global_execution_kpi_aggregations'; +export { loadGlobalExecutionKPIAggregations } from './load_global_execution_kpi_aggregations'; export type { LoadActionErrorLogProps } from './load_action_error_log'; export { loadActionErrorLog } from './load_action_error_log'; export { unmuteAlertInstance } from './unmute_alert'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_action_error_log.test.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_action_error_log.test.ts index b4384713336f7..d06447be31fbc 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_action_error_log.test.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_action_error_log.test.ts @@ -117,7 +117,7 @@ describe('loadActionErrorLog', () => { "query": Object { "date_end": "2022-03-23T16:17:53.482Z", "date_start": "2022-03-23T16:17:53.482Z", - "filter": "kibana.alert.rule.execution.uuid: 123 and message: \\"test\\" OR error.message: \\"test\\"", + "filter": "message: \\"test\\" OR error.message: \\"test\\" and kibana.alert.rule.execution.uuid: 123", "page": 1, "per_page": 10, "sort": "[{\\"@timestamp\\":{\\"order\\":\\"asc\\"}}]", diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_action_error_log.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_action_error_log.ts index 4ec1a6949bfe5..10f2879085cd0 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_action_error_log.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_action_error_log.ts @@ -9,6 +9,7 @@ import { HttpSetup } from '@kbn/core/public'; import type { SortOrder } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { IExecutionErrorsResult, ActionErrorLogSortFields } from '@kbn/alerting-plugin/common'; import { INTERNAL_BASE_ALERTING_API_PATH } from '../../constants'; +import { getFilter } from './get_filter'; export type SortField = Record< ActionErrorLogSortFields, @@ -49,22 +50,6 @@ const getRenamedSort = (sort?: SortField[]) => { }); }; -// TODO (Jiawei): Use node builder instead of strings -const getFilter = ({ runId, message }: { runId?: string; message?: string }) => { - const filter: string[] = []; - - if (runId) { - filter.push(`kibana.alert.rule.execution.uuid: ${runId}`); - } - - if (message) { - const escapedMessage = message.replace(/([\)\(\<\>\}\{\"\:\\])/gm, '\\$&'); - filter.push(`message: "${escapedMessage}" OR error.message: "${escapedMessage}"`); - } - - return filter; -}; - export const loadActionErrorLog = ({ id, http, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_execution_kpi_aggregations.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_execution_kpi_aggregations.ts new file mode 100644 index 0000000000000..076e1167f444a --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_execution_kpi_aggregations.ts @@ -0,0 +1,41 @@ +/* + * 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 { HttpSetup } from '@kbn/core/public'; +import { IExecutionKPIResult } from '@kbn/alerting-plugin/common'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../constants'; +import { getFilter } from './get_filter'; + +export interface LoadExecutionKPIAggregationsProps { + id: string; + outcomeFilter?: string[]; + message?: string; + dateStart: string; + dateEnd?: string; +} + +export const loadExecutionKPIAggregations = ({ + id, + http, + outcomeFilter, + message, + dateStart, + dateEnd, +}: LoadExecutionKPIAggregationsProps & { http: HttpSetup }) => { + const filter = getFilter({ outcomeFilter, message }); + + return http.get<IExecutionKPIResult>( + `${INTERNAL_BASE_ALERTING_API_PATH}/rule/${id}/_execution_kpi`, + { + query: { + filter: filter.length ? filter.join(' and ') : undefined, + date_start: dateStart, + date_end: dateEnd, + }, + } + ); +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_execution_log_aggregations.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_execution_log_aggregations.ts index c1f8487d842c5..bf5e529499b42 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_execution_log_aggregations.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_execution_log_aggregations.ts @@ -16,6 +16,7 @@ import { } from '@kbn/alerting-plugin/common'; import { AsApiContract, RewriteRequestCase } from '@kbn/actions-plugin/common'; import { INTERNAL_BASE_ALERTING_API_PATH } from '../../constants'; +import { getFilter } from './get_filter'; const getRenamedLog = (data: IExecutionLog) => { const { @@ -40,22 +41,6 @@ const rewriteBodyRes: RewriteRequestCase<IExecutionLogResult> = ({ data, ...rest ...rest, }); -// TODO (Jiawei): Use node builder instead of strings -const getFilter = ({ outcomeFilter, message }: { outcomeFilter?: string[]; message?: string }) => { - const filter: string[] = []; - - if (outcomeFilter && outcomeFilter.length) { - filter.push(`event.outcome: ${outcomeFilter.join(' or ')}`); - } - - if (message) { - const escapedMessage = message.replace(/([\)\(\<\>\}\{\"\:\\])/gm, '\\$&'); - filter.push(`message: "${escapedMessage}" OR error.message: "${escapedMessage}"`); - } - - return filter; -}; - export type SortField = Record< ExecutionLogSortFields, { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_global_execution_kpi_aggregations.ts b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_global_execution_kpi_aggregations.ts new file mode 100644 index 0000000000000..332e14ad4383f --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/lib/rule_api/load_global_execution_kpi_aggregations.ts @@ -0,0 +1,38 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { HttpSetup } from '@kbn/core/public'; +import { IExecutionKPIResult } from '@kbn/alerting-plugin/common'; +import { INTERNAL_BASE_ALERTING_API_PATH } from '../../constants'; +import { getFilter } from './get_filter'; + +export interface LoadGlobalExecutionKPIAggregationsProps { + id: string; + outcomeFilter?: string[]; + message?: string; + dateStart: string; + dateEnd?: string; +} + +export const loadGlobalExecutionKPIAggregations = ({ + id, + http, + outcomeFilter, + message, + dateStart, + dateEnd, +}: LoadGlobalExecutionKPIAggregationsProps & { http: HttpSetup }) => { + const filter = getFilter({ outcomeFilter, message }); + + return http.get<IExecutionKPIResult>(`${INTERNAL_BASE_ALERTING_API_PATH}/_global_execution_kpi`, { + query: { + filter: filter.length ? filter.join(' and ') : undefined, + date_start: dateStart, + date_end: dateEnd, + }, + }); +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/mock/rule_details/alert_summary/index.ts b/x-pack/plugins/triggers_actions_ui/public/application/mock/rule_details/alert_summary/index.ts index b0e5416bbf63d..2d5af068ae55d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/mock/rule_details/alert_summary/index.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/mock/rule_details/alert_summary/index.ts @@ -6,7 +6,6 @@ */ import { Rule } from '../../../../types'; -import { AlertChartData } from '../../../sections/rule_details/components/alert_summary'; export const mockRule = (): Rule => { return { @@ -63,383 +62,12 @@ export const mockRule = (): Rule => { }; }; -export function mockChartData(): AlertChartData[] { - return [ - { - date: 1660608000000, - count: 6, - status: 'recovered', - }, - { - date: 1660694400000, - count: 1, - status: 'recovered', - }, - { - date: 1660694400000, - count: 1, - status: 'active', - }, - { - date: 1658102400000, - count: 6, - status: 'total', - }, - { - date: 1658188800000, - count: 6, - status: 'total', - }, - { - date: 1658275200000, - count: 6, - status: 'total', - }, - { - date: 1658361600000, - count: 6, - status: 'total', - }, - { - date: 1658448000000, - count: 6, - status: 'total', - }, - { - date: 1658534400000, - count: 6, - status: 'total', - }, - { - date: 1658620800000, - count: 6, - status: 'total', - }, - { - date: 1658707200000, - count: 6, - status: 'total', - }, - { - date: 1658793600000, - count: 6, - status: 'total', - }, - { - date: 1658880000000, - count: 6, - status: 'total', - }, - { - date: 1658966400000, - count: 6, - status: 'total', - }, - { - date: 1659052800000, - count: 6, - status: 'total', - }, - { - date: 1659139200000, - count: 6, - status: 'total', - }, - { - date: 1659225600000, - count: 6, - status: 'total', - }, - { - date: 1659312000000, - count: 6, - status: 'total', - }, - { - date: 1659398400000, - count: 6, - status: 'total', - }, - { - date: 1659484800000, - count: 6, - status: 'total', - }, - { - date: 1659571200000, - count: 6, - status: 'total', - }, - { - date: 1659657600000, - count: 6, - status: 'total', - }, - { - date: 1659744000000, - count: 6, - status: 'total', - }, - { - date: 1659830400000, - count: 6, - status: 'total', - }, - { - date: 1659916800000, - count: 6, - status: 'total', - }, - { - date: 1660003200000, - count: 6, - status: 'total', - }, - { - date: 1660089600000, - count: 6, - status: 'total', - }, - { - date: 1660176000000, - count: 6, - status: 'total', - }, - { - date: 1660262400000, - count: 6, - status: 'total', - }, - { - date: 1660348800000, - count: 6, - status: 'total', - }, - { - date: 1660435200000, - count: 6, - status: 'total', - }, - { - date: 1660521600000, - count: 6, - status: 'total', - }, - { - date: 1660694400000, - count: 4, - status: 'total', - }, - ]; -} - export const mockAggsResponse = () => { return { aggregations: { total: { buckets: { totalActiveAlerts: { doc_count: 1 }, totalRecoveredAlerts: { doc_count: 7 } }, }, - statusPerDay: { - buckets: [ - { - key_as_string: '2022-07-18T00:00:00.000Z', - key: 1658102400000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-19T00:00:00.000Z', - key: 1658188800000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-20T00:00:00.000Z', - key: 1658275200000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-21T00:00:00.000Z', - key: 1658361600000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-22T00:00:00.000Z', - key: 1658448000000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-23T00:00:00.000Z', - key: 1658534400000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-24T00:00:00.000Z', - key: 1658620800000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-25T00:00:00.000Z', - key: 1658707200000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-26T00:00:00.000Z', - key: 1658793600000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-27T00:00:00.000Z', - key: 1658880000000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-28T00:00:00.000Z', - key: 1658966400000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-29T00:00:00.000Z', - key: 1659052800000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-30T00:00:00.000Z', - key: 1659139200000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-07-31T00:00:00.000Z', - key: 1659225600000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-01T00:00:00.000Z', - key: 1659312000000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-02T00:00:00.000Z', - key: 1659398400000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-03T00:00:00.000Z', - key: 1659484800000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-04T00:00:00.000Z', - key: 1659571200000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-05T00:00:00.000Z', - key: 1659657600000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-06T00:00:00.000Z', - key: 1659744000000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-07T00:00:00.000Z', - key: 1659830400000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-08T00:00:00.000Z', - key: 1659916800000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-09T00:00:00.000Z', - key: 1660003200000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-10T00:00:00.000Z', - key: 1660089600000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-11T00:00:00.000Z', - key: 1660176000000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-12T00:00:00.000Z', - key: 1660262400000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-13T00:00:00.000Z', - key: 1660348800000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-14T00:00:00.000Z', - key: 1660435200000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-15T00:00:00.000Z', - key: 1660521600000, - doc_count: 0, - alertStatus: { doc_count_error_upper_bound: 0, sum_other_doc_count: 0, buckets: [] }, - }, - { - key_as_string: '2022-08-16T00:00:00.000Z', - key: 1660608000000, - doc_count: 6, - alertStatus: { - doc_count_error_upper_bound: 0, - sum_other_doc_count: 0, - buckets: [{ key: 'recovered', doc_count: 6 }], - }, - }, - { - key_as_string: '2022-08-17T00:00:00.000Z', - key: 1660694400000, - doc_count: 2, - alertStatus: { - doc_count_error_upper_bound: 0, - sum_other_doc_count: 0, - buckets: [ - { key: 'active', doc_count: 1 }, - { key: 'recovered', doc_count: 1 }, - ], - }, - }, - ], - }, }, }; }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_flyout/alerts_flyout.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_flyout/alerts_flyout.tsx index e57e8c9902069..3ddefe1c4cf68 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_flyout/alerts_flyout.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/alerts_table/alerts_flyout/alerts_flyout.tsx @@ -99,7 +99,7 @@ export const AlertsFlyout: React.FunctionComponent<AlertsFlyoutProps> = ({ ); return ( - <EuiFlyout onClose={onClose} size={flyoutSize} data-test-subj="alertsFlyout"> + <EuiFlyout onClose={onClose} size={flyoutSize} data-test-subj="alertsFlyout" ownFocus={false}> {isLoading && <EuiProgress size="xs" color="accent" data-test-subj="alertsFlyoutLoading" />} <EuiFlyoutHeader hasBorder> <Suspense fallback={null}> diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/with_bulk_rule_api_operations.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/with_bulk_rule_api_operations.tsx index 3150a4cdf407b..fa93ae18ec701 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/with_bulk_rule_api_operations.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/with_bulk_rule_api_operations.tsx @@ -7,7 +7,11 @@ import React from 'react'; -import { IExecutionLogResult, IExecutionErrorsResult } from '@kbn/alerting-plugin/common'; +import { + IExecutionLogResult, + IExecutionErrorsResult, + IExecutionKPIResult, +} from '@kbn/alerting-plugin/common'; import { Rule, RuleType, @@ -46,6 +50,10 @@ import { bulkSnoozeRules, BulkSnoozeRulesProps, unsnoozeRule, + loadExecutionKPIAggregations, + LoadExecutionKPIAggregationsProps, + loadGlobalExecutionKPIAggregations, + LoadGlobalExecutionKPIAggregationsProps, bulkUnsnoozeRules, BulkUnsnoozeRulesProps, } from '../../../lib/rule_api'; @@ -74,12 +82,18 @@ export interface ComponentOpts { loadRuleState: (id: Rule['id']) => Promise<RuleTaskState>; loadRuleSummary: (id: Rule['id'], numberOfExecutions?: number) => Promise<RuleSummary>; loadRuleTypes: () => Promise<RuleType[]>; + loadExecutionKPIAggregations: ( + props: LoadExecutionKPIAggregationsProps + ) => Promise<IExecutionKPIResult>; loadExecutionLogAggregations: ( props: LoadExecutionLogAggregationsProps ) => Promise<IExecutionLogResult>; loadGlobalExecutionLogAggregations: ( props: LoadGlobalExecutionLogAggregationsProps ) => Promise<IExecutionLogResult>; + loadGlobalExecutionKPIAggregations: ( + props: LoadGlobalExecutionKPIAggregationsProps + ) => Promise<IExecutionKPIResult>; loadActionErrorLog: (props: LoadActionErrorLogProps) => Promise<IExecutionErrorsResult>; getHealth: () => Promise<AlertingFrameworkHealth>; resolveRule: (id: Rule['id']) => Promise<ResolvedRule>; @@ -177,6 +191,22 @@ export function withBulkRuleOperations<T>( http, }) } + loadExecutionKPIAggregations={async ( + loadExecutionKPIAggregationProps: LoadExecutionKPIAggregationsProps + ) => + loadExecutionKPIAggregations({ + ...loadExecutionKPIAggregationProps, + http, + }) + } + loadGlobalExecutionKPIAggregations={async ( + loadGlobalExecutionKPIAggregationsProps: LoadGlobalExecutionKPIAggregationsProps + ) => + loadGlobalExecutionKPIAggregations({ + ...loadGlobalExecutionKPIAggregationsProps, + http, + }) + } resolveRule={async (ruleId: Rule['id']) => resolveRule({ http, ruleId })} getHealth={async () => alertingFrameworkHealth({ http })} snoozeRule={async (rule: Rule, snoozeSchedule: SnoozeSchedule) => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/index.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/index.tsx index f4ae5d399e6f9..2e476855926d4 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/index.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/index.tsx @@ -49,6 +49,9 @@ export const RulesList = suspendedComponentWithProps( export const RulesListNotifyBadge = suspendedComponentWithProps( lazy(() => import('./rules_list/components/rules_list_notify_badge')) ); +export const RuleSnoozeModal = suspendedComponentWithProps( + lazy(() => import('./rules_list/components/rule_snooze_modal')) +); export const RuleDefinition = suspendedComponentWithProps( lazy(() => import('./rule_details/components/rule_definition')) ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/alert_summary_widget_error.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/alert_summary_widget_error.tsx new file mode 100644 index 0000000000000..1ee04fe2f69d1 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/alert_summary_widget_error.tsx @@ -0,0 +1,39 @@ +/* + * 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 { EuiEmptyPrompt } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n-react'; + +export const AlertSummaryWidgetError = () => { + return ( + <EuiEmptyPrompt + data-test-subj="alertsRuleSummaryErrorPrompt" + iconType="alert" + color="danger" + title={ + <h5> + <FormattedMessage + id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.errorLoadingTitle" + defaultMessage="Unable to load the alerts summary" + /> + </h5> + } + body={ + <p> + { + <FormattedMessage + id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.errorLoadingBody" + defaultMessage="There was an error loading the alerts summary. Contact your + administrator for help." + /> + } + </p> + } + /> + ); +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/alert_summary_widget_ui.stories.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/alert_summary_widget_ui.stories.tsx new file mode 100644 index 0000000000000..ab064893ae6fe --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/alert_summary_widget_ui.stories.tsx @@ -0,0 +1,21 @@ +/* + * 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 { AlertsSummaryWidgetUI as Component } from './alert_summary_widget_ui'; + +export default { + component: Component, + title: 'app/AlertsSummaryWidgetUI', +}; + +export const Overview = { + args: { + active: 15, + recovered: 53, + timeRange: 'Last 30 days', + }, +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/alert_summary_widget_ui.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/alert_summary_widget_ui.tsx new file mode 100644 index 0000000000000..e4003e803032d --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/alert_summary_widget_ui.tsx @@ -0,0 +1,87 @@ +/* + * 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 { euiLightVars } from '@kbn/ui-theme'; +import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiSpacer, EuiText, EuiTitle } from '@elastic/eui'; +import React from 'react'; +import { FormattedMessage } from '@kbn/i18n-react'; +import { AlertsSummaryWidgetUIProps } from './types'; + +export const AlertsSummaryWidgetUI = ({ + active, + recovered, + timeRange, +}: AlertsSummaryWidgetUIProps) => { + return ( + <EuiPanel data-test-subj="ruleAlertsSummary" hasShadow={false} hasBorder> + <EuiFlexGroup direction="column"> + <EuiFlexItem grow={false}> + <EuiFlexGroup direction="column"> + <EuiFlexItem grow={false}> + <EuiTitle size="xxs"> + <h5> + <FormattedMessage + id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.title" + defaultMessage="Alerts" + /> + </h5> + </EuiTitle> + {!!timeRange && ( + <> + <EuiSpacer size="s" /> + <EuiText size="s" color="subdued"> + {timeRange} + </EuiText> + </> + )} + </EuiFlexItem> + + <EuiFlexItem> + <EuiFlexGroup gutterSize="s" alignItems="flexStart" responsive={false}> + <EuiFlexItem> + <EuiText> + <h3 data-test-subj="totalAlertsCount">{active + recovered}</h3> + </EuiText> + <EuiText size="xs" color="subdued"> + <FormattedMessage + id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.allAlertsLabel" + defaultMessage="All" + /> + </EuiText> + </EuiFlexItem> + <EuiFlexItem> + <EuiFlexItem> + <EuiText color={euiLightVars.euiColorSuccessText}> + <h3 data-test-subj="recoveredAlertsCount">{recovered}</h3> + </EuiText> + </EuiFlexItem> + <EuiText size="xs" color="subdued"> + <FormattedMessage + id="xpack.triggersActionsUI.sections.ruleDetails.rule.ruleSummary.recoveredLabel" + defaultMessage="Recovered" + /> + </EuiText> + </EuiFlexItem> + <EuiFlexItem> + <EuiText color={euiLightVars.euiColorDangerText}> + <h3 data-test-subj="activeAlertsCount">{active}</h3> + </EuiText> + <EuiText size="xs" color="subdued"> + <FormattedMessage + id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.activeLabel" + defaultMessage="Currently active" + /> + </EuiText> + </EuiFlexItem> + </EuiFlexGroup> + </EuiFlexItem> + </EuiFlexGroup> + </EuiFlexItem> + </EuiFlexGroup> + </EuiPanel> + ); +}; diff --git a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/index.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/index.ts similarity index 64% rename from x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/index.tsx rename to x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/index.ts index c3dfef48d27f6..e1f4ef4d231e7 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/query_bar/components/query_bar/index.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/index.ts @@ -5,7 +5,5 @@ * 2.0. */ -export * from './query_bar'; - -// eslint-disable-next-line import/no-default-export -export { QueryBar as default } from './query_bar'; +export { AlertsSummaryWidgetUI } from './alert_summary_widget_ui'; +export { AlertSummaryWidgetError } from './alert_summary_widget_error'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/types.ts b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/types.ts new file mode 100644 index 0000000000000..81437071fcea2 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/components/types.ts @@ -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. + */ + +export interface AlertsSummaryWidgetUIProps { + active: number; + recovered: number; + timeRange: JSX.Element | string; +} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/helpers.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/helpers.tsx deleted file mode 100644 index 167c98a678f52..0000000000000 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/helpers.tsx +++ /dev/null @@ -1,41 +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 { LIGHT_THEME, XYChartSeriesIdentifier } from '@elastic/charts'; -import { AlertChartData } from './types'; - -export const formatChartAlertData = ( - data: AlertChartData[] -): Array<{ x: number; y: number; g: string }> => - data.map((alert) => ({ - x: alert.date, - y: alert.count, - g: alert.status, - })); - -export const getColorSeries = ({ seriesKeys }: XYChartSeriesIdentifier) => { - switch (seriesKeys[0]) { - case 'active': - return LIGHT_THEME.colors.vizColors[2]; - case 'recovered': - return LIGHT_THEME.colors.vizColors[1]; - case 'total': - return '#f5f7fa'; - default: - return null; - } -}; - -/** - * This function may be passed to `Array.find()` to locate the `P1DT` - * configuration (sub) setting, a string array that contains two entries - * like the following example: `['P1DT', 'YYYY-MM-DD']`. - */ -export const isP1DTFormatterSetting = (formatNameFormatterPair?: string[]) => - Array.isArray(formatNameFormatterPair) && - formatNameFormatterPair[0] === 'P1DT' && - formatNameFormatterPair.length === 2; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/index.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/index.tsx index 80f221f436c49..ede15d4bac294 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/index.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/index.tsx @@ -6,5 +6,4 @@ */ export { RuleAlertsSummary } from './rule_alerts_summary'; -export type { RuleAlertsSummaryProps, AlertChartData, AlertsChartProps } from './types'; -export { formatChartAlertData, getColorSeries } from './helpers'; +export type { RuleAlertsSummaryProps } from './types'; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/rule_alerts_summary.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/rule_alerts_summary.test.tsx index 39264020f30a3..019d4f2ba549b 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/rule_alerts_summary.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/rule_alerts_summary.test.tsx @@ -12,7 +12,6 @@ import { mount, ReactWrapper } from 'enzyme'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; import { ALERTS_FEATURE_ID } from '@kbn/alerting-plugin/common'; import { mockRule } from '../../../../mock/rule_details/alert_summary'; -import { AlertChartData } from './types'; jest.mock('@kbn/kibana-react-plugin/public/ui_settings/use_ui_setting', () => ({ useUiSetting: jest.fn().mockImplementation(() => true), @@ -25,7 +24,6 @@ jest.mock('../../../../hooks/use_load_rule_types', () => ({ jest.mock('../../../../hooks/use_load_rule_alerts_aggregations', () => ({ useLoadRuleAlertsAggs: jest.fn().mockReturnValue({ ruleAlertsAggs: { active: 1, recovered: 7 }, - alertsChartData: mockChartData(), }), })); @@ -80,174 +78,3 @@ describe('Rule Alert Summary', () => { expect(wrapper.find('[data-test-subj="totalAlertsCount"]').text()).toBe('8'); }); }); - -// This function should stay in the same file as the test otherwise the test will fail. -function mockChartData(): AlertChartData[] { - return [ - { - date: 1660608000000, - count: 6, - status: 'recovered', - }, - { - date: 1660694400000, - count: 1, - status: 'recovered', - }, - { - date: 1660694400000, - count: 1, - status: 'active', - }, - { - date: 1658102400000, - count: 6, - status: 'total', - }, - { - date: 1658188800000, - count: 6, - status: 'total', - }, - { - date: 1658275200000, - count: 6, - status: 'total', - }, - { - date: 1658361600000, - count: 6, - status: 'total', - }, - { - date: 1658448000000, - count: 6, - status: 'total', - }, - { - date: 1658534400000, - count: 6, - status: 'total', - }, - { - date: 1658620800000, - count: 6, - status: 'total', - }, - { - date: 1658707200000, - count: 6, - status: 'total', - }, - { - date: 1658793600000, - count: 6, - status: 'total', - }, - { - date: 1658880000000, - count: 6, - status: 'total', - }, - { - date: 1658966400000, - count: 6, - status: 'total', - }, - { - date: 1659052800000, - count: 6, - status: 'total', - }, - { - date: 1659139200000, - count: 6, - status: 'total', - }, - { - date: 1659225600000, - count: 6, - status: 'total', - }, - { - date: 1659312000000, - count: 6, - status: 'total', - }, - { - date: 1659398400000, - count: 6, - status: 'total', - }, - { - date: 1659484800000, - count: 6, - status: 'total', - }, - { - date: 1659571200000, - count: 6, - status: 'total', - }, - { - date: 1659657600000, - count: 6, - status: 'total', - }, - { - date: 1659744000000, - count: 6, - status: 'total', - }, - { - date: 1659830400000, - count: 6, - status: 'total', - }, - { - date: 1659916800000, - count: 6, - status: 'total', - }, - { - date: 1660003200000, - count: 6, - status: 'total', - }, - { - date: 1660089600000, - count: 6, - status: 'total', - }, - { - date: 1660176000000, - count: 6, - status: 'total', - }, - { - date: 1660262400000, - count: 6, - status: 'total', - }, - { - date: 1660348800000, - count: 6, - status: 'total', - }, - { - date: 1660435200000, - count: 6, - status: 'total', - }, - { - date: 1660521600000, - count: 6, - status: 'total', - }, - { - date: 1660694400000, - count: 4, - status: 'total', - }, - ]; -} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/rule_alerts_summary.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/rule_alerts_summary.tsx index 708b12ceb7b4a..da43783568658 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/rule_alerts_summary.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/rule_alerts_summary.tsx @@ -5,65 +5,17 @@ * 2.0. */ -import { - BarSeries, - Chart, - FilterPredicate, - LIGHT_THEME, - ScaleType, - Settings, - TooltipType, -} from '@elastic/charts'; -import { - EuiEmptyPrompt, - EuiFlexGroup, - EuiFlexItem, - EuiLoadingSpinner, - EuiPanel, - EuiSpacer, - EuiText, - EuiTitle, -} from '@elastic/eui'; +import { EuiLoadingSpinner } from '@elastic/eui'; import { ALERTS_FEATURE_ID } from '@kbn/alerting-plugin/common'; import { FormattedMessage } from '@kbn/i18n-react'; -import React, { useEffect, useMemo, useState } from 'react'; -import { - EUI_CHARTS_THEME_DARK, - EUI_CHARTS_THEME_LIGHT, - EUI_SPARKLINE_THEME_PARTIAL, -} from '@elastic/eui/dist/eui_charts_theme'; -import { useUiSetting } from '@kbn/kibana-react-plugin/public'; -import moment from 'moment'; +import React, { useEffect, useState } from 'react'; import { useLoadRuleAlertsAggs } from '../../../../hooks/use_load_rule_alerts_aggregations'; import { useLoadRuleTypes } from '../../../../hooks/use_load_rule_types'; -import { formatChartAlertData, getColorSeries } from '.'; import { RuleAlertsSummaryProps } from '.'; -import { isP1DTFormatterSetting } from './helpers'; +import { AlertSummaryWidgetError, AlertsSummaryWidgetUI } from './components'; -const Y_ACCESSORS = ['y']; -const X_ACCESSORS = ['x']; -const G_ACCESSORS = ['g']; -const FALLBACK_DATE_FORMAT_SCALED_P1DT = 'YYYY-MM-DD'; export const RuleAlertsSummary = ({ rule, filteredRuleTypes }: RuleAlertsSummaryProps) => { const [features, setFeatures] = useState<string>(''); - const isDarkMode = useUiSetting<boolean>('theme:darkMode'); - - const scaledDateFormatPreference = useUiSetting<string[][]>('dateFormat:scaled'); - const maybeP1DTFormatter = Array.isArray(scaledDateFormatPreference) - ? scaledDateFormatPreference.find(isP1DTFormatterSetting) - : null; - const p1dtFormat = - Array.isArray(maybeP1DTFormatter) && maybeP1DTFormatter.length === 2 - ? maybeP1DTFormatter[1] - : FALLBACK_DATE_FORMAT_SCALED_P1DT; - - const theme = useMemo( - () => [ - EUI_SPARKLINE_THEME_PARTIAL, - isDarkMode ? EUI_CHARTS_THEME_DARK.theme : EUI_CHARTS_THEME_LIGHT.theme, - ], - [isDarkMode] - ); const { ruleTypes } = useLoadRuleTypes({ filteredRuleTypes, }); @@ -71,21 +23,10 @@ export const RuleAlertsSummary = ({ rule, filteredRuleTypes }: RuleAlertsSummary ruleAlertsAggs: { active, recovered }, isLoadingRuleAlertsAggs, errorRuleAlertsAggs, - alertsChartData, } = useLoadRuleAlertsAggs({ ruleId: rule.id, features, }); - const chartData = useMemo(() => formatChartAlertData(alertsChartData), [alertsChartData]); - const tooltipSettings = useMemo( - () => ({ - type: TooltipType.VerticalCursor, - headerFormatter: ({ value }: { value: number }) => { - return <>{moment(value).format(p1dtFormat)}</>; - }, - }), - [p1dtFormat] - ); useEffect(() => { const matchedRuleType = ruleTypes.find((type) => type.id === rule.ruleTypeId); @@ -95,133 +36,18 @@ export const RuleAlertsSummary = ({ rule, filteredRuleTypes }: RuleAlertsSummary }, [rule, ruleTypes]); if (isLoadingRuleAlertsAggs) return <EuiLoadingSpinner />; - if (errorRuleAlertsAggs) - return ( - <EuiEmptyPrompt - data-test-subj="alertsRuleSummaryErrorPrompt" - iconType="alert" - color="danger" - title={ - <h5> - <FormattedMessage - id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.errorLoadingTitle" - defaultMessage="Unable to load the alerts summary" - /> - </h5> - } - body={ - <p> - { - <FormattedMessage - id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.errorLoadingBody" - defaultMessage=" There was an error loading the alerts summary. Contact your - administrator for help." - /> - } - </p> - } - /> - ); - const isVisibleFunction: FilterPredicate = (series) => series.splitAccessors.get('g') !== 'total'; + if (errorRuleAlertsAggs) return <AlertSummaryWidgetError />; return ( - <EuiPanel data-test-subj="ruleAlertsSummary" hasShadow={false} hasBorder> - <EuiFlexGroup direction="column"> - <EuiFlexItem grow={false}> - <EuiFlexGroup direction="column"> - <EuiFlexItem grow={false}> - <EuiTitle size="xxs"> - <h5> - <FormattedMessage - id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.title" - defaultMessage="Alerts" - /> - </h5> - </EuiTitle> - <EuiSpacer size="s" /> - <EuiText size="s" color="subdued"> - <FormattedMessage - id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.last30days" - defaultMessage="Last 30 days" - /> - </EuiText> - </EuiFlexItem> - - <EuiPanel hasShadow={false}> - <EuiFlexGroup gutterSize="s" alignItems="center"> - <EuiFlexGroup direction="row"> - <EuiFlexItem> - <EuiText size="xs" color="subdued"> - <FormattedMessage - id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.allAlertsLabel" - defaultMessage="All alerts" - /> - </EuiText> - <EuiText> - <h4 data-test-subj="totalAlertsCount">{active + recovered}</h4> - </EuiText> - </EuiFlexItem> - </EuiFlexGroup> - <EuiFlexGroup direction="row"> - <EuiFlexItem> - <EuiText size="xs" color="subdued"> - <FormattedMessage - id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.activeLabel" - defaultMessage="Active" - /> - </EuiText> - <EuiText color={LIGHT_THEME.colors.vizColors[2]}> - <h4 data-test-subj="activeAlertsCount">{active}</h4> - </EuiText> - </EuiFlexItem> - </EuiFlexGroup> - <EuiFlexGroup direction="row"> - <EuiFlexItem> - <EuiText size="xs" color="subdued"> - <FormattedMessage - id="xpack.triggersActionsUI.sections.ruleDetails.rule.ruleSummary.recoveredLabel" - defaultMessage="Recovered" - /> - </EuiText> - <EuiFlexItem> - <EuiText color={LIGHT_THEME.colors.vizColors[1]}> - <h4 data-test-subj="recoveredAlertsCount">{recovered}</h4> - </EuiText> - </EuiFlexItem> - </EuiFlexItem> - </EuiFlexGroup> - </EuiFlexGroup> - </EuiPanel> - </EuiFlexGroup> - </EuiFlexItem> - - <EuiFlexItem grow={false}> - <EuiTitle size="xxs"> - <h5> - <FormattedMessage - id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.recentAlertHistoryTitle" - defaultMessage="Recent alert history" - /> - </h5> - </EuiTitle> - </EuiFlexItem> - </EuiFlexGroup> - <EuiSpacer size="m" /> - <Chart size={{ height: 50 }}> - <Settings tooltip={tooltipSettings} theme={theme} /> - <BarSeries - id="bars" - xScaleType={ScaleType.Time} - yScaleType={ScaleType.Linear} - xAccessor="x" - yAccessors={Y_ACCESSORS} - stackAccessors={X_ACCESSORS} - splitSeriesAccessors={G_ACCESSORS} - color={getColorSeries} - data={chartData} - filterSeriesInTooltip={isVisibleFunction} + <AlertsSummaryWidgetUI + active={active} + recovered={recovered} + timeRange={ + <FormattedMessage + id="xpack.triggersActionsUI.sections.ruleDetails.alertsSummary.last30days" + defaultMessage="Last 30 days" /> - </Chart> - </EuiPanel> + } + /> ); }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/types.ts b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/types.ts index ae4d8696572b0..7ae05d1eaa10e 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/types.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/alert_summary/types.ts @@ -11,12 +11,3 @@ export interface RuleAlertsSummaryProps { rule: Rule; filteredRuleTypes: string[]; } -export interface AlertChartData { - status: 'active' | 'recovered' | 'total'; - count: number; - date: number; -} - -export interface AlertsChartProps { - data: AlertChartData[]; -} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.test.tsx index bfe337a1fb880..5eac73c4e87ac 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.test.tsx @@ -419,8 +419,8 @@ describe('tabbed content', () => { tabbedContent.update(); }); - expect(tabbedContent.find('[aria-labelledby="rule_event_log_list"]').exists()).toBeTruthy(); - expect(tabbedContent.find('[aria-labelledby="rule_alert_list"]').exists()).toBeFalsy(); + expect(tabbedContent.find('[aria-labelledby="rule_event_log_list"]').exists()).toBeFalsy(); + expect(tabbedContent.find('[aria-labelledby="rule_alert_list"]').exists()).toBeTruthy(); tabbedContent.find('[data-test-subj="eventLogListTab"]').simulate('click'); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.tsx index 5c44b9161b2c2..db82f36cbc90c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.tsx @@ -97,6 +97,14 @@ export function RuleComponent({ }; const tabs = [ + { + id: ALERT_LIST_TAB, + name: i18n.translate('xpack.triggersActionsUI.sections.ruleDetails.rule.alertsTabText', { + defaultMessage: 'Alerts', + }), + 'data-test-subj': 'ruleAlertListTab', + content: renderRuleAlertList(), + }, { id: EVENT_LOG_LIST_TAB, name: i18n.translate('xpack.triggersActionsUI.sections.ruleDetails.rule.eventLogTabText', { @@ -118,14 +126,6 @@ export function RuleComponent({ requestRefresh, }), }, - { - id: ALERT_LIST_TAB, - name: i18n.translate('xpack.triggersActionsUI.sections.ruleDetails.rule.alertsTabText', { - defaultMessage: 'Alerts', - }), - 'data-test-subj': 'ruleAlertListTab', - content: renderRuleAlertList(), - }, ]; const renderTabs = () => { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_details.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_details.tsx index c17bc40086666..38357d7c56057 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_details.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_details.tsx @@ -36,7 +36,7 @@ import { hasExecuteActionsCapability, hasManageApiKeysCapability, } from '../../../lib/capabilities'; -import { getAlertingSectionBreadcrumb, getRuleDetailsBreadcrumb } from '../../../lib/breadcrumb'; +import { getAlertingSectionBreadcrumb } from '../../../lib/breadcrumb'; import { getCurrentDocTitle } from '../../../lib/doc_title'; import { Rule, @@ -117,10 +117,7 @@ export const RuleDetails: React.FunctionComponent<RuleDetailsProps> = ({ // Set breadcrumb and page title useEffect(() => { - setBreadcrumbs([ - getAlertingSectionBreadcrumb('rules'), - getRuleDetailsBreadcrumb(rule.id, rule.name), - ]); + setBreadcrumbs([getAlertingSectionBreadcrumb('rules', true), { text: rule.name }]); chrome.docTitle.change(getCurrentDocTitle('rules')); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.stories.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.stories.tsx new file mode 100644 index 0000000000000..8bf88bed72359 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.stories.tsx @@ -0,0 +1,82 @@ +/* + * 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, { ComponentProps } from 'react'; +import { Meta } from '@storybook/react'; +import { RuleEventLogList, RuleEventLogListProps } from './rule_event_log_list'; +import { mockRule, mockRuleType } from './test_helpers'; + +type Args = ComponentProps<typeof RuleEventLogList>; + +const rule = mockRule({ ruleTypeId: 'test-rule-type-id' }); +const ruleType = mockRuleType(); + +export default { + title: 'app/RuleEventLogList', + component: RuleEventLogList, + argTypes: { + rule: { + control: { + type: 'object', + }, + }, + ruleType: { + control: { + type: 'object', + }, + }, + localStorageKey: { + defaultValue: 'xpack.triggersActionsUI.ruleEventLogList.initialColumns', + control: { + type: 'text', + }, + }, + refreshToken: { + control: { + type: 'number', + }, + }, + requestRefresh: {}, + fetchRuleSummary: { + defaultValue: true, + control: { + type: 'boolean', + }, + }, + ruleSummary: { + control: { + type: 'object', + }, + }, + onChangeDuration: {}, + numberOfExecutions: { + control: { + type: 'number', + }, + }, + isLoadingRuleSummary: { + defaultValue: false, + control: { + type: 'boolean', + }, + }, + }, + args: { + rule, + ruleType, + }, +} as Meta<Args>; + +const Template = (args: RuleEventLogListProps) => { + return <RuleEventLogList {...args} />; +}; + +export const Empty = Template.bind({}); + +export const WithEvents = Template.bind({}); + +export const WithPaginatedEvents = Template.bind({}); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.test.tsx index 541cf94d1d539..96d9c0013fe4e 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list.test.tsx @@ -19,7 +19,7 @@ import { RULE_EXECUTION_DEFAULT_INITIAL_VISIBLE_COLUMNS, GLOBAL_EXECUTION_DEFAULT_INITIAL_VISIBLE_COLUMNS, } from '../../../constants'; -import { mockRule, mockRuleType, mockRuleSummary } from './test_helpers'; +import { mockRule, mockRuleType, mockRuleSummary, mockLogResponse } from './test_helpers'; import { RuleType } from '../../../../types'; import { loadActionErrorLog } from '../../../lib/rule_api/load_action_error_log'; @@ -33,84 +33,6 @@ const loadActionErrorLogMock = loadActionErrorLog as unknown as jest.MockedFunct typeof loadActionErrorLog >; -const mockLogResponse: any = { - data: [ - { - id: uuid.v4(), - timestamp: '2022-03-20T07:40:44-07:00', - duration: 5000000, - status: 'success', - message: 'rule execution #1', - version: '8.2.0', - num_active_alerts: 2, - num_new_alerts: 4, - num_recovered_alerts: 3, - num_triggered_actions: 10, - num_succeeded_actions: 0, - num_errored_actions: 4, - total_search_duration: 1000000, - es_search_duration: 1400000, - schedule_delay: 2000000, - timed_out: false, - }, - { - id: uuid.v4(), - timestamp: '2022-03-20T07:40:45-07:00', - duration: 6000000, - status: 'success', - message: 'rule execution #2', - version: '8.2.0', - num_active_alerts: 4, - num_new_alerts: 2, - num_recovered_alerts: 4, - num_triggered_actions: 5, - num_succeeded_actions: 3, - num_errored_actions: 0, - total_search_duration: 300000, - es_search_duration: 300000, - schedule_delay: 300000, - timed_out: false, - }, - { - id: uuid.v4(), - timestamp: '2022-03-20T07:40:46-07:00', - duration: 340000, - status: 'failure', - message: 'rule execution #3', - version: '8.2.0', - num_active_alerts: 8, - num_new_alerts: 5, - num_recovered_alerts: 0, - num_triggered_actions: 1, - num_succeeded_actions: 1, - num_errored_actions: 4, - total_search_duration: 2300000, - es_search_duration: 2300000, - schedule_delay: 2300000, - timed_out: false, - }, - { - id: uuid.v4(), - timestamp: '2022-03-21T07:40:46-07:00', - duration: 3000000, - status: 'unknown', - message: 'rule execution #4', - version: '8.2.0', - num_active_alerts: 4, - num_new_alerts: 4, - num_recovered_alerts: 4, - num_triggered_actions: 4, - num_succeeded_actions: 4, - num_errored_actions: 4, - total_search_duration: 400000, - es_search_duration: 400000, - schedule_delay: 400000, - timed_out: false, - }, - ], - total: 4, -}; - const loadExecutionLogAggregationsMock = jest.fn(); const onChangeDurationMock = jest.fn(); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.test.tsx new file mode 100644 index 0000000000000..f77494e4f3c12 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.test.tsx @@ -0,0 +1,183 @@ +/* + * 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 { act } from 'react-dom/test-utils'; +import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers'; +import { loadExecutionKPIAggregations } from '../../../lib/rule_api/load_execution_kpi_aggregations'; +import { loadGlobalExecutionKPIAggregations } from '../../../lib/rule_api/load_global_execution_kpi_aggregations'; +import { RuleEventLogListKPI } from './rule_event_log_list_kpi'; + +jest.mock('../../../../common/lib/kibana', () => ({ + useKibana: jest.fn().mockReturnValue({ + services: { + notifications: { toast: { addDanger: jest.fn() } }, + }, + }), +})); + +jest.mock('../../../lib/rule_api/load_execution_kpi_aggregations', () => ({ + loadExecutionKPIAggregations: jest.fn(), +})); + +jest.mock('../../../lib/rule_api/load_global_execution_kpi_aggregations', () => ({ + loadGlobalExecutionKPIAggregations: jest.fn(), +})); + +const mockKpiResponse = { + success: 4, + unknown: 10, + failure: 60, + activeAlerts: 100, + newAlerts: 40, + recoveredAlerts: 30, + erroredActions: 60, + triggeredActions: 140, +}; + +const loadExecutionKPIAggregationsMock = + loadExecutionKPIAggregations as unknown as jest.MockedFunction<any>; +const loadGlobalExecutionKPIAggregationsMock = + loadGlobalExecutionKPIAggregations as unknown as jest.MockedFunction<any>; + +describe('rule_event_log_list_kpi', () => { + beforeEach(() => { + jest.clearAllMocks(); + loadExecutionKPIAggregationsMock.mockResolvedValue(mockKpiResponse); + loadGlobalExecutionKPIAggregationsMock.mockResolvedValue(mockKpiResponse); + }); + + it('renders correctly', async () => { + const wrapper = mountWithIntl( + <RuleEventLogListKPI + ruleId="123" + dateStart="now-24h" + dateEnd="now" + loadExecutionKPIAggregations={loadExecutionKPIAggregationsMock} + loadGlobalExecutionKPIAggregations={loadGlobalExecutionKPIAggregationsMock} + /> + ); + + expect(wrapper.find('[data-test-subj="centerJustifiedSpinner"]').exists()).toBeTruthy(); + + // Let the load resolve + await act(async () => { + await nextTick(); + wrapper.update(); + }); + + expect(wrapper.find('[data-test-subj="centerJustifiedSpinner"]').exists()).toBeFalsy(); + + expect(loadExecutionKPIAggregationsMock).toHaveBeenCalledWith( + expect.objectContaining({ + id: '123', + message: undefined, + outcomeFilter: undefined, + }) + ); + + expect(loadGlobalExecutionKPIAggregations).not.toHaveBeenCalled(); + + expect( + wrapper + .find('[data-test-subj="ruleEventLogKpi-successOutcome"] .euiStat__title') + .first() + .text() + ).toEqual(`${mockKpiResponse.success}`); + expect( + wrapper + .find('[data-test-subj="ruleEventLogKpi-unknownOutcome"] .euiStat__title') + .first() + .text() + ).toEqual(`${mockKpiResponse.unknown}`); + expect( + wrapper + .find('[data-test-subj="ruleEventLogKpi-failureOutcome"] .euiStat__title') + .first() + .text() + ).toEqual(`${mockKpiResponse.failure}`); + expect( + wrapper.find('[data-test-subj="ruleEventLogKpi-activeAlerts"] .euiStat__title').first().text() + ).toEqual(`${mockKpiResponse.activeAlerts}`); + expect( + wrapper.find('[data-test-subj="ruleEventLogKpi-newAlerts"] .euiStat__title').first().text() + ).toEqual(`${mockKpiResponse.newAlerts}`); + expect( + wrapper + .find('[data-test-subj="ruleEventLogKpi-recoveredAlerts"] .euiStat__title') + .first() + .text() + ).toEqual(`${mockKpiResponse.recoveredAlerts}`); + expect( + wrapper + .find('[data-test-subj="ruleEventLogKpi-erroredActions"] .euiStat__title') + .first() + .text() + ).toEqual(`${mockKpiResponse.erroredActions}`); + expect( + wrapper + .find('[data-test-subj="ruleEventLogKpi-triggeredActions"] .euiStat__title') + .first() + .text() + ).toEqual(`${mockKpiResponse.triggeredActions}`); + }); + + it('calls global KPI API if provided global rule id', async () => { + const wrapper = mountWithIntl( + <RuleEventLogListKPI + ruleId="*" + dateStart="now-24h" + dateEnd="now" + loadExecutionKPIAggregations={loadExecutionKPIAggregationsMock} + loadGlobalExecutionKPIAggregations={loadGlobalExecutionKPIAggregationsMock} + /> + ); + // Let the load resolve + await act(async () => { + await nextTick(); + wrapper.update(); + }); + + expect(loadGlobalExecutionKPIAggregations).toHaveBeenCalledWith( + expect.objectContaining({ + id: '*', + message: undefined, + outcomeFilter: undefined, + }) + ); + + expect(loadExecutionKPIAggregationsMock).not.toHaveBeenCalled(); + }); + + it('calls KPI API with filters', async () => { + const wrapper = mountWithIntl( + <RuleEventLogListKPI + ruleId="123" + dateStart="now-24h" + dateEnd="now" + message="test" + outcomeFilter={['status: 123', 'test:456']} + loadExecutionKPIAggregations={loadExecutionKPIAggregationsMock} + loadGlobalExecutionKPIAggregations={loadGlobalExecutionKPIAggregationsMock} + /> + ); + + // Let the load resolve + await act(async () => { + await nextTick(); + wrapper.update(); + }); + + expect(loadExecutionKPIAggregationsMock).toHaveBeenCalledWith( + expect.objectContaining({ + id: '123', + message: 'test', + outcomeFilter: ['status: 123', 'test:456'], + }) + ); + }); +}); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.tsx new file mode 100644 index 0000000000000..7fe7dd8fdb029 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.tsx @@ -0,0 +1,251 @@ +/* + * 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, useState, useMemo, useRef } from 'react'; +import { i18n } from '@kbn/i18n'; +import datemath from '@kbn/datemath'; +import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiIconTip, EuiStat, EuiSpacer } from '@elastic/eui'; +import { IExecutionKPIResult } from '@kbn/alerting-plugin/common'; +import { + ComponentOpts as RuleApis, + withBulkRuleOperations, +} from '../../common/components/with_bulk_rule_api_operations'; +import { useKibana } from '../../../../common/lib/kibana'; +import { CenterJustifiedSpinner } from '../../../components/center_justified_spinner'; +import { RuleEventLogListStatus } from './rule_event_log_list_status'; + +const getParsedDate = (date: string) => { + if (date.includes('now')) { + return datemath.parse(date)?.format() || date; + } + return date; +}; + +const API_FAILED_MESSAGE = i18n.translate( + 'xpack.triggersActionsUI.sections.ruleDetails.ruleEventLogListKpi.apiError', + { + defaultMessage: 'Failed to fetch event log KPI.', + } +); + +const RESPONSE_TOOLTIP = i18n.translate( + 'xpack.triggersActionsUI.sections.ruleDetails.ruleEventLogListKpi.responseTooltip', + { + defaultMessage: 'The responses for the latest rule runs.', + } +); + +const ALERTS_TOOLTIP = i18n.translate( + 'xpack.triggersActionsUI.sections.ruleDetails.ruleEventLogListKpi.alertsTooltip', + { + defaultMessage: 'The alert statuses for the latest rule runs.', + } +); + +const ACTIONS_TOOLTIP = i18n.translate( + 'xpack.triggersActionsUI.sections.ruleDetails.ruleEventLogListKpi.actionsTooltip', + { + defaultMessage: 'The action statuses for the latest rule runs.', + } +); + +const Stat = ({ + title, + tooltip, + children, +}: { + title: string; + tooltip: string; + children?: JSX.Element; +}) => { + return ( + <EuiPanel color="subdued"> + <EuiFlexGroup justifyContent="spaceBetween"> + <EuiFlexItem grow={false}> + <b>{title}</b> + </EuiFlexItem> + <EuiFlexItem grow={false}> + <EuiIconTip content={tooltip} position="top" /> + </EuiFlexItem> + </EuiFlexGroup> + <EuiSpacer /> + {children} + </EuiPanel> + ); +}; + +export type RuleEventLogListKPIProps = { + ruleId: string; + dateStart: string; + dateEnd: string; + outcomeFilter?: string[]; + message?: string; + refreshToken?: number; +} & Pick<RuleApis, 'loadExecutionKPIAggregations' | 'loadGlobalExecutionKPIAggregations'>; + +export const RuleEventLogListKPI = (props: RuleEventLogListKPIProps) => { + const { + ruleId, + dateStart, + dateEnd, + outcomeFilter, + message, + refreshToken, + loadExecutionKPIAggregations, + loadGlobalExecutionKPIAggregations, + } = props; + const { + notifications: { toasts }, + } = useKibana().services; + + const isInitialized = useRef(false); + + const [isLoading, setIsLoading] = useState<boolean>(false); + const [kpi, setKpi] = useState<IExecutionKPIResult>(); + + const loadKPIFn = useMemo(() => { + if (ruleId === '*') { + return loadGlobalExecutionKPIAggregations; + } + return loadExecutionKPIAggregations; + }, [ruleId, loadExecutionKPIAggregations, loadGlobalExecutionKPIAggregations]); + + const loadKPIs = async () => { + setIsLoading(true); + try { + const newKpi = await loadKPIFn({ + id: ruleId, + dateStart: getParsedDate(dateStart), + dateEnd: getParsedDate(dateEnd), + outcomeFilter, + message, + }); + setKpi(newKpi); + } catch (e) { + toasts.addDanger({ + title: API_FAILED_MESSAGE, + text: e.body?.message ?? e, + }); + } + setIsLoading(false); + }; + + useEffect(() => { + loadKPIs(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [ruleId, dateStart, dateEnd, outcomeFilter, message]); + + useEffect(() => { + if (isInitialized.current) { + loadKPIs(); + } + isInitialized.current = true; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [refreshToken]); + + if (isLoading || !kpi) { + return <CenterJustifiedSpinner />; + } + + const getStatDescription = (element: React.ReactNode) => { + return ( + <> + {element} + <EuiSpacer size="s" /> + </> + ); + }; + + return ( + <EuiFlexGroup> + <EuiFlexItem grow={4}> + <Stat title="Response" tooltip={RESPONSE_TOOLTIP}> + <EuiFlexGroup> + <EuiFlexItem> + <EuiStat + data-test-subj="ruleEventLogKpi-successOutcome" + description={getStatDescription(<RuleEventLogListStatus status="success" />)} + titleSize="s" + title={kpi.success} + /> + </EuiFlexItem> + <EuiFlexItem> + <EuiStat + data-test-subj="ruleEventLogKpi-unknownOutcome" + description={getStatDescription(<RuleEventLogListStatus status="unknown" />)} + titleSize="s" + title={kpi.unknown} + /> + </EuiFlexItem> + <EuiFlexItem> + <EuiStat + data-test-subj="ruleEventLogKpi-failureOutcome" + description={getStatDescription(<RuleEventLogListStatus status="failure" />)} + titleSize="s" + title={kpi.failure} + /> + </EuiFlexItem> + </EuiFlexGroup> + </Stat> + </EuiFlexItem> + <EuiFlexItem grow={4}> + <Stat title="Alerts" tooltip={ALERTS_TOOLTIP}> + <EuiFlexGroup> + <EuiFlexItem> + <EuiStat + data-test-subj="ruleEventLogKpi-activeAlerts" + description={getStatDescription('Active')} + titleSize="s" + title={kpi.activeAlerts} + /> + </EuiFlexItem> + <EuiFlexItem> + <EuiStat + data-test-subj="ruleEventLogKpi-newAlerts" + description={getStatDescription('New')} + titleSize="s" + title={kpi.newAlerts} + /> + </EuiFlexItem> + <EuiFlexItem> + <EuiStat + data-test-subj="ruleEventLogKpi-recoveredAlerts" + description={getStatDescription('Recovered')} + titleSize="s" + title={kpi.recoveredAlerts} + /> + </EuiFlexItem> + </EuiFlexGroup> + </Stat> + </EuiFlexItem> + <EuiFlexItem grow={2}> + <Stat title="Actions" tooltip={ACTIONS_TOOLTIP}> + <EuiFlexGroup> + <EuiFlexItem> + <EuiStat + data-test-subj="ruleEventLogKpi-erroredActions" + description={getStatDescription('Errored')} + titleSize="s" + title={kpi.erroredActions} + /> + </EuiFlexItem> + <EuiFlexItem> + <EuiStat + data-test-subj="ruleEventLogKpi-triggeredActions" + description={getStatDescription('Triggered')} + titleSize="s" + title={kpi.triggeredActions} + /> + </EuiFlexItem> + </EuiFlexGroup> + </Stat> + </EuiFlexItem> + </EuiFlexGroup> + ); +}; + +export const RuleEventLogListKPIWithApi = withBulkRuleOperations(RuleEventLogListKPI); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_table.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_table.tsx index b647442a8eaf0..2c1d6df71fc3d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_table.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_table.tsx @@ -30,9 +30,9 @@ import { RuleEventLogListStatusFilter } from './rule_event_log_list_status_filte import { RuleEventLogDataGrid } from './rule_event_log_data_grid'; import { CenterJustifiedSpinner } from '../../../components/center_justified_spinner'; import { RuleActionErrorLogFlyout } from './rule_action_error_log_flyout'; - import { RefineSearchPrompt } from '../refine_search_prompt'; import { LoadExecutionLogAggregationsProps } from '../../../lib/rule_api'; +import { RuleEventLogListKPIWithApi as RuleEventLogListKPI } from './rule_event_log_list_kpi'; import { ComponentOpts as RuleApis, withBulkRuleOperations, @@ -114,6 +114,9 @@ export const RuleEventLogListTable = <T extends RuleEventLogListOptions>( const [search, setSearch] = useState<string>(''); const [isFlyoutOpen, setIsFlyoutOpen] = useState<boolean>(false); const [selectedRunLog, setSelectedRunLog] = useState<IExecutionLog | undefined>(); + const [internalRefreshToken, setInternalRefreshToken] = useState<number | undefined>( + refreshToken + ); // Data grid states const [logs, setLogs] = useState<IExecutionLog[]>(); @@ -243,6 +246,7 @@ export const RuleEventLogListTable = <T extends RuleEventLogListOptions>( ); const onRefresh = () => { + setInternalRefreshToken(Date.now()); loadEventLogs(); }; @@ -339,6 +343,10 @@ export const RuleEventLogListTable = <T extends RuleEventLogListOptions>( localStorage.setItem(localStorageKey, JSON.stringify(visibleColumns)); }, [localStorageKey, visibleColumns]); + useEffect(() => { + setInternalRefreshToken(refreshToken); + }, [refreshToken]); + return ( <> <EuiFlexGroup> @@ -371,6 +379,15 @@ export const RuleEventLogListTable = <T extends RuleEventLogListOptions>( </EuiFlexItem> </EuiFlexGroup> <EuiSpacer /> + <RuleEventLogListKPI + ruleId={ruleId} + dateStart={dateStart} + dateEnd={dateEnd} + outcomeFilter={filter} + message={searchText} + refreshToken={internalRefreshToken} + /> + <EuiSpacer /> {renderList()} {isOnLastPage && ( <RefineSearchPrompt diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/test_helpers.ts b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/test_helpers.ts index 704410f6265fd..9e96487b167a4 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/test_helpers.ts +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/test_helpers.ts @@ -8,6 +8,32 @@ import uuid from 'uuid'; import { Rule, RuleSummary, RuleType } from '../../../../types'; +export const getMockLogResponse = () => { + return { + id: uuid.v4(), + timestamp: '2022-03-20T07:40:44-07:00', + duration: 5000000, + status: 'success', + message: 'rule execution #1', + version: '8.2.0', + num_active_alerts: 2, + num_new_alerts: 4, + num_recovered_alerts: 3, + num_triggered_actions: 10, + num_succeeded_actions: 0, + num_errored_actions: 4, + total_search_duration: 1000000, + es_search_duration: 1400000, + schedule_delay: 2000000, + timed_out: false, + }; +}; + +export const mockLogResponse: any = { + data: [getMockLogResponse(), getMockLogResponse(), getMockLogResponse(), getMockLogResponse()], + total: 4, +}; + export function mockRule(overloads: Partial<Rule> = {}): Rule { return { id: uuid.v4(), diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_snooze_modal.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_snooze_modal.tsx new file mode 100644 index 0000000000000..c4624e7ea8e61 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_snooze_modal.tsx @@ -0,0 +1,104 @@ +/* + * 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, { useCallback, useMemo } from 'react'; +import { EuiModal, EuiModalBody, EuiSpacer } from '@elastic/eui'; + +import { useKibana } from '../../../../common/lib/kibana'; +import { snoozeRule, unsnoozeRule } from '../../../lib/rule_api'; +import { + SNOOZE_FAILED_MESSAGE, + SNOOZE_SUCCESS_MESSAGE, + UNSNOOZE_SUCCESS_MESSAGE, +} from './rules_list_notify_badge'; +import { SnoozePanel, futureTimeToInterval } from './rule_snooze'; +import { Rule, RuleTypeParams, SnoozeSchedule } from '../../../../types'; + +export interface RuleSnoozeModalProps { + rule: Rule<RuleTypeParams>; + onClose: () => void; + onLoading: (isLoading: boolean) => void; + onRuleChanged: () => void; +} + +const isRuleSnoozed = (rule: { isSnoozedUntil?: Date | null; muteAll: boolean }) => + Boolean( + (rule.isSnoozedUntil && new Date(rule.isSnoozedUntil).getTime() > Date.now()) || rule.muteAll + ); + +export const RuleSnoozeModal: React.FunctionComponent<RuleSnoozeModalProps> = ({ + rule, + onClose, + onLoading, + onRuleChanged, +}) => { + const { + http, + notifications: { toasts }, + } = useKibana().services; + + const isSnoozed = useMemo(() => { + return isRuleSnoozed(rule); + }, [rule]); + + const onApplySnooze = useCallback( + async (snoozeSchedule: SnoozeSchedule) => { + try { + onLoading(true); + onClose(); + + await snoozeRule({ http, id: rule.id, snoozeSchedule }); + + onRuleChanged(); + + toasts.addSuccess(SNOOZE_SUCCESS_MESSAGE); + } catch (e) { + toasts.addDanger(SNOOZE_FAILED_MESSAGE); + } finally { + onLoading(false); + } + }, + [onLoading, onClose, http, rule.id, onRuleChanged, toasts] + ); + + const onApplyUnsnooze = useCallback( + async (scheduleIds?: string[]) => { + try { + onLoading(true); + onClose(); + await unsnoozeRule({ http, id: rule.id, scheduleIds }); + onRuleChanged(); + toasts.addSuccess(UNSNOOZE_SUCCESS_MESSAGE); + } catch (e) { + toasts.addDanger(SNOOZE_FAILED_MESSAGE); + } finally { + onLoading(false); + } + }, + [onLoading, onClose, http, rule.id, onRuleChanged, toasts] + ); + + return ( + <EuiModal onClose={onClose} data-test-subj="ruleSnoozeModal"> + <EuiModalBody> + <EuiSpacer size="s" /> + <SnoozePanel + inPopover={false} + interval={futureTimeToInterval(rule.isSnoozedUntil)} + activeSnoozes={rule.activeSnoozes ?? []} + scheduledSnoozes={rule.snoozeSchedule ?? []} + showCancel={isSnoozed} + snoozeRule={onApplySnooze} + unsnoozeRule={onApplyUnsnooze} + /> + </EuiModalBody> + </EuiModal> + ); +}; + +// eslint-disable-next-line import/no-default-export +export { RuleSnoozeModal as default }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.stories.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.stories.tsx new file mode 100644 index 0000000000000..401fcaf749fb1 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_status_dropdown.stories.tsx @@ -0,0 +1,72 @@ +/* + * 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, { ComponentProps } from 'react'; +import { Story } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; +import { RuleStatusDropdown } from './rule_status_dropdown'; +import { mockRule } from '../../rule_details/components/test_helpers'; + +type Args = ComponentProps<typeof RuleStatusDropdown>; + +const rule = mockRule({ ruleTypeId: 'test-rule-type-id' }); + +export default { + title: 'app/RuleStatusDropdown', + component: RuleStatusDropdown, + argTypes: { + rule: { + defaultValue: rule, + control: { + type: 'object', + }, + }, + onRuleChanged: {}, + enableRule: {}, + disableRule: {}, + snoozeRule: {}, + unsnoozeRule: {}, + isEditable: { + defaultValue: true, + control: { + type: 'boolean', + }, + }, + direction: { + defaultValue: 'column', + control: { + type: 'text', + }, + }, + hideSnoozeOption: { + defaultValue: false, + control: { + type: 'boolean', + }, + }, + }, + args: { + rule, + onRuleChanged: (...args: any) => action('onRuleChanged')(args), + enableRule: (...args: any) => action('enableRule')(args), + disableRule: (...args: any) => action('disableRule')(args), + snoozeRule: (...args: any) => action('snoozeRule')(args), + unsnoozeRule: (...args: any) => action('unsnoozeRule')(args), + }, +}; + +const Template: Story<Args> = (args) => { + return <RuleStatusDropdown {...args} />; +}; + +export const EnabledRule = Template.bind({}); + +export const DisabledRule = Template.bind({}); + +DisabledRule.args = { + rule: mockRule({ enabled: false }), +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_tag_badge.stories.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_tag_badge.stories.tsx new file mode 100644 index 0000000000000..4e5abf410afa1 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_tag_badge.stories.tsx @@ -0,0 +1,70 @@ +/* + * 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, { ComponentProps } from 'react'; +import { Story } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; +import { RuleTagBadge } from './rule_tag_badge'; + +type Args = ComponentProps<typeof RuleTagBadge>; + +export default { + title: 'app/RuleTagBadge', + component: RuleTagBadge, + argTypes: { + isOpen: { + defaultValue: false, + control: { + type: 'boolean', + }, + }, + onClick: {}, + onClose: {}, + tagsOutPopover: { + defaultValue: false, + control: { + type: 'boolean', + }, + }, + tags: { + defaultValue: ['tag1', 'tag2', 'tag3'], + control: { + type: 'object', + }, + }, + badgeDataTestSubj: { + control: { + type: 'text', + }, + }, + titleDataTestSubj: { + control: { + type: 'text', + }, + }, + tagItemDataTestSubj: { + control: { + type: 'text', + }, + }, + }, + args: { + onClick: () => action('onClick')(), + onClose: () => action('onClose')(), + }, +}; + +const Template: Story<Args> = (args) => { + return <RuleTagBadge {...args} />; +}; + +export const Default = Template.bind({}); + +export const OutPopover = Template.bind({}); +OutPopover.args = { + tagsOutPopover: true, +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_tag_filter.stories.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_tag_filter.stories.tsx new file mode 100644 index 0000000000000..7e3f3f696969e --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rule_tag_filter.stories.tsx @@ -0,0 +1,100 @@ +/* + * 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, { ComponentProps } from 'react'; +import { Story } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; +import { RuleTagFilter } from './rule_tag_filter'; + +type Args = ComponentProps<typeof RuleTagFilter>; + +export default { + title: 'app/RuleTagFilter', + component: RuleTagFilter, + argTypes: { + tags: { + defaultValue: ['tag1', 'tag2', 'tag3'], + control: { + type: 'object', + }, + }, + selectedTags: { + defaultValue: [], + control: { + type: 'object', + }, + }, + isGrouped: { + defaultValue: false, + control: { + type: 'boolean', + }, + }, + isLoading: { + defaultValue: false, + control: { + type: 'boolean', + }, + }, + loadingMessage: { + control: { + type: 'text', + }, + }, + noMatchesMessage: { + control: { + type: 'text', + }, + }, + emptyMessage: { + control: { + type: 'text', + }, + }, + errorMessage: { + control: { + type: 'text', + }, + }, + dataTestSubj: { + control: { + type: 'text', + }, + }, + selectableDataTestSubj: { + control: { + type: 'text', + }, + }, + optionDataTestSubj: { + control: { + type: 'text', + }, + }, + buttonDataTestSubj: { + control: { + type: 'text', + }, + }, + onChange: {}, + }, + args: { + onChange: (...args: any) => action('onChange')(args), + }, +}; + +const Template: Story<Args> = (args) => { + return <RuleTagFilter {...args} />; +}; + +export const Default = Template.bind({}); + +export const Selected = Template.bind({}); + +Selected.args = { + selectedTags: ['tag1'], +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.stories.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.stories.tsx new file mode 100644 index 0000000000000..487da3e973653 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.stories.tsx @@ -0,0 +1,112 @@ +/* + * 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, { ComponentProps, useEffect } from 'react'; +import { Meta } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; +import { MemoryRouter, useLocation } from 'react-router-dom'; +import { RulesList, RulesListProps } from './rules_list'; + +type Args = ComponentProps<typeof RulesList>; + +export default { + title: 'app/RulesList', + component: RulesList, + decorators: [ + (StoryComponent) => { + return ( + <MemoryRouter> + <StoryComponent /> + </MemoryRouter> + ); + }, + ], + argTypes: { + filteredRuleTypes: { + defaultValue: [], + control: { + type: 'object', + }, + }, + showActionFilter: { + defaultValue: true, + control: { + type: 'boolean', + }, + }, + showCreateRuleButton: { + defaultValue: true, + control: { + type: 'boolean', + }, + }, + ruleDetailsRoute: { + control: { + type: 'text', + }, + }, + statusFilter: { + defaultValue: [], + control: { + type: 'object', + }, + }, + lastResponseFilter: { + defaultValue: [], + control: { + type: 'object', + }, + }, + onStatusFilterChange: { + action: 'onStatusFilterChange', + }, + onLastResponseFilterChange: { + action: 'onLastResponseFilterChange', + }, + refresh: { + control: { + type: 'date', + }, + }, + rulesListKey: { + control: { + type: 'text', + }, + }, + visibleColumns: { + defaultValue: [ + 'ruleName', + 'ruleTags', + 'ruleExecutionStatusLastDate', + 'ruleSnoozeNotify', + 'ruleScheduleInterval', + 'ruleExecutionStatusLastDuration', + 'ruleExecutionPercentile', + 'ruleExecutionSuccessRatio', + 'ruleExecutionStatus', + 'ruleExecutionState', + ], + control: { + type: 'object', + }, + }, + }, +} as Meta<Args>; + +const Template = (args: RulesListProps) => { + const location = useLocation(); + useEffect(() => { + action('location')(location); + }, [location]); + return <RulesList {...args} />; +}; + +export const Empty = Template.bind({}); + +export const WithRules = Template.bind({}); + +export const WithPaginatedRules = Template.bind({}); diff --git a/x-pack/plugins/triggers_actions_ui/public/common/get_rule_snooze_modal.tsx b/x-pack/plugins/triggers_actions_ui/public/common/get_rule_snooze_modal.tsx new file mode 100644 index 0000000000000..b22fe16f77312 --- /dev/null +++ b/x-pack/plugins/triggers_actions_ui/public/common/get_rule_snooze_modal.tsx @@ -0,0 +1,15 @@ +/* + * 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 { RuleSnoozeModal } from '../application/sections'; +import { RuleSnoozeModalProps } from '../application/sections/rules_list/components/rule_snooze_modal'; + +export const getRuleSnoozeModalLazy = (props: RuleSnoozeModalProps) => { + return <RuleSnoozeModal {...props} />; +}; diff --git a/x-pack/plugins/triggers_actions_ui/public/mocks.ts b/x-pack/plugins/triggers_actions_ui/public/mocks.ts index 02722bc0ee73b..7c18ea1b6fa2c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/mocks.ts +++ b/x-pack/plugins/triggers_actions_ui/public/mocks.ts @@ -43,6 +43,7 @@ import { getFieldBrowserLazy } from './common/get_field_browser'; import { getRuleAlertsSummaryLazy } from './common/get_rule_alerts_summary'; import { getRuleDefinitionLazy } from './common/get_rule_definition'; import { getRuleStatusPanelLazy } from './common/get_rule_status_panel'; +import { getRuleSnoozeModalLazy } from './common/get_rule_snooze_modal'; function createStartMock(): TriggersAndActionsUIPublicPluginStart { const actionTypeRegistry = new TypeRegistry<ActionTypeModel>(); @@ -124,6 +125,9 @@ function createStartMock(): TriggersAndActionsUIPublicPluginStart { getRuleStatusPanel: (props) => { return getRuleStatusPanelLazy(props); }, + getRuleSnoozeModal: (props) => { + return getRuleSnoozeModalLazy(props); + }, }; } diff --git a/x-pack/plugins/triggers_actions_ui/public/plugin.ts b/x-pack/plugins/triggers_actions_ui/public/plugin.ts index 10c5e5637f159..1374f10355e16 100644 --- a/x-pack/plugins/triggers_actions_ui/public/plugin.ts +++ b/x-pack/plugins/triggers_actions_ui/public/plugin.ts @@ -78,6 +78,8 @@ import { getRuleDefinitionLazy } from './common/get_rule_definition'; import { RuleStatusPanelProps } from './application/sections/rule_details/components/rule_status_panel'; import { RuleAlertsSummaryProps } from './application/sections/rule_details/components/alert_summary'; import { getRuleAlertsSummaryLazy } from './common/get_rule_alerts_summary'; +import { RuleSnoozeModalProps } from './application/sections/rules_list/components/rule_snooze_modal'; +import { getRuleSnoozeModalLazy } from './common/get_rule_snooze_modal'; export interface TriggersAndActionsUIPublicPluginSetup { actionTypeRegistry: TypeRegistry<ActionTypeModel>; @@ -123,6 +125,7 @@ export interface TriggersAndActionsUIPublicPluginStart { getRuleDefinition: (props: RuleDefinitionProps) => ReactElement<RuleDefinitionProps>; getRuleStatusPanel: (props: RuleStatusPanelProps) => ReactElement<RuleStatusPanelProps>; getRuleAlertsSummary: (props: RuleAlertsSummaryProps) => ReactElement<RuleAlertsSummaryProps>; + getRuleSnoozeModal: (props: RuleSnoozeModalProps) => ReactElement<RuleSnoozeModalProps>; } interface PluginsSetup { @@ -352,6 +355,9 @@ export class Plugin getRuleAlertsSummary: (props: RuleAlertsSummaryProps) => { return getRuleAlertsSummaryLazy(props); }, + getRuleSnoozeModal: (props: RuleSnoozeModalProps) => { + return getRuleSnoozeModalLazy(props); + }, }; } diff --git a/x-pack/plugins/triggers_actions_ui/tsconfig.json b/x-pack/plugins/triggers_actions_ui/tsconfig.json index 8618be6c9c285..c98e5f1dfd511 100644 --- a/x-pack/plugins/triggers_actions_ui/tsconfig.json +++ b/x-pack/plugins/triggers_actions_ui/tsconfig.json @@ -7,6 +7,7 @@ "declarationMap": true }, "include": [ + ".storybook/**/*", "server/**/*", "public/**/*", "common/**/*", diff --git a/x-pack/test/accessibility/apps/graph.ts b/x-pack/test/accessibility/apps/graph.ts index d13ed5a58f871..03ca3b2afbfe4 100644 --- a/x-pack/test/accessibility/apps/graph.ts +++ b/x-pack/test/accessibility/apps/graph.ts @@ -63,12 +63,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.click('saveCancelButton'); }); - it('Graph inspect panel', async function () { - await testSubjects.click('graphInspectButton'); - await a11y.testAppSnapshot(); - await testSubjects.click('graphInspectButton'); - }); - it('Graph settings - advanced settings tab', async function () { await testSubjects.click('graphSettingsButton'); await a11y.testAppSnapshot(); @@ -85,12 +79,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await browser.pressKeys(browser.keys.ESCAPE); }); - // https://github.com/elastic/kibana/issues/134693 - it.skip('Graph settings drilldown tab - add new drilldown', async function () { + it('Graph settings drilldown tab - add new drilldown', async function () { + await testSubjects.click('graphSettingsButton'); + await testSubjects.click('drillDowns'); await testSubjects.click('graphAddNewTemplate'); await a11y.testAppSnapshot(); - await testSubjects.click('graphRemoveUrlTemplate'); - await testSubjects.click('euiFlyoutCloseButton'); await browser.pressKeys(browser.keys.ESCAPE); }); diff --git a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/alert_types.ts b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/alert_types.ts index 3d68c420e4442..068c516618616 100644 --- a/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/alert_types.ts +++ b/x-pack/test/alerting_api_integration/common/fixtures/plugins/alerts/server/alert_types.ts @@ -109,31 +109,21 @@ async function alwaysFiringExecutor(alertExecutorOptions: any) { rule, } = alertExecutorOptions; let group: string | null = 'default'; - let subgroup: string | null = null; const alertInfo = { alertId, spaceId, namespace, name, tags, createdBy, updatedBy, ...rule }; if (params.groupsToScheduleActionsInSeries) { const index = state.groupInSeriesIndex || 0; - const [scheduledGroup, scheduledSubgroup] = ( - params.groupsToScheduleActionsInSeries[index] ?? '' - ).split(':'); + const [scheduledGroup] = (params.groupsToScheduleActionsInSeries[index] ?? '').split(':'); group = scheduledGroup; - subgroup = scheduledSubgroup; } if (group) { const instance = services.alertFactory.create('1').replaceState({ instanceStateValue: true }); - if (subgroup) { - instance.scheduleActionsWithSubGroup(group, subgroup, { - instanceContextValue: true, - }); - } else { - instance.scheduleActions(group, { - instanceContextValue: true, - }); - } + instance.scheduleActions(group, { + instanceContextValue: true, + }); } await services.scopedClusterClient.asCurrentUser.index({ @@ -506,9 +496,7 @@ function getPatternFiringAlertType() { deep: DeepContextVariables, }); } else if (typeof scheduleByPattern === 'string') { - services.alertFactory - .create(instanceId) - .scheduleActionsWithSubGroup('default', scheduleByPattern); + services.alertFactory.create(instanceId).scheduleActions('default', scheduleByPattern); } } diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/alerts.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/alerts.ts index 63c70e93ea194..8f1b8047e4331 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/alerts.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/alerts.ts @@ -953,82 +953,6 @@ instanceStateValue: true } }); - it('should not throttle when changing subgroups', async () => { - const testStart = new Date(); - const reference = alertUtils.generateReference(); - const response = await alertUtils.createAlwaysFiringAction({ - reference, - overwrites: { - schedule: { interval: '1s' }, - params: { - index: ES_TEST_INDEX_NAME, - reference, - groupsToScheduleActionsInSeries: ['default:prev', 'default:next'], - }, - actions: [ - { - group: 'default', - id: indexRecordActionId, - params: { - index: ES_TEST_INDEX_NAME, - reference, - message: 'from:{{alertActionGroup}}:{{alertActionSubgroup}}', - }, - }, - ], - }, - }); - - switch (scenario.id) { - case 'no_kibana_privileges at space1': - case 'space_1_all at space2': - case 'global_read at space1': - expect(response.statusCode).to.eql(403); - expect(response.body).to.eql({ - error: 'Forbidden', - message: getConsumerUnauthorizedErrorMessage( - 'create', - 'test.always-firing', - 'alertsFixture' - ), - statusCode: 403, - }); - break; - case 'space_1_all_alerts_none_actions at space1': - expect(response.statusCode).to.eql(403); - expect(response.body).to.eql({ - error: 'Forbidden', - message: `Unauthorized to get actions`, - statusCode: 403, - }); - break; - case 'space_1_all at space1': - case 'space_1_all_with_restricted_fixture at space1': - case 'superuser at space1': - expect(response.statusCode).to.eql(200); - // Wait for actions to execute twice before disabling the alert and waiting for tasks to finish - await esTestIndexTool.waitForDocs('action:test.index-record', reference, 2); - await alertUtils.disable(response.body.id); - await taskManagerUtils.waitForDisabled(response.body.id, testStart); - - // Ensure only 2 actions with proper params exists - const searchResult = await esTestIndexTool.search( - 'action:test.index-record', - reference - ); - // @ts-expect-error doesnt handle total: number - expect(searchResult.body.hits.total.value).to.eql(2); - const messages: string[] = searchResult.body.hits.hits.map( - // @ts-expect-error _source: unknown - (hit: { _source: { params: { message: string } } }) => hit._source.params.message - ); - expect(messages.sort()).to.eql(['from:default:next', 'from:default:prev']); - break; - default: - throw new Error(`Scenario untested: ${JSON.stringify(scenario)}`); - } - }); - it('should reset throttle window when not firing', async () => { const testStart = new Date(); const reference = alertUtils.generateReference(); diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_global_execution_kpi.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_global_execution_kpi.ts new file mode 100644 index 0000000000000..133cca59f9472 --- /dev/null +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_global_execution_kpi.ts @@ -0,0 +1,162 @@ +/* + * 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 { UserAtSpaceScenarios } from '../../../scenarios'; +import { getUrlPrefix, getTestRuleData, ObjectRemover, getEventLog } from '../../../../common/lib'; +import { FtrProviderContext } from '../../../../common/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function getGlobalExecutionKpiTests({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const supertestWithoutAuth = getService('supertestWithoutAuth'); + + const retry = getService('retry'); + + describe('getGlobalExecutionKpi', () => { + const objectRemover = new ObjectRemover(supertest); + + after(() => objectRemover.removeAll()); + + it('should return KPI only from the current space', async () => { + const startTime = new Date().toISOString(); + + const spaceId = UserAtSpaceScenarios[1].space.id; + const user = UserAtSpaceScenarios[1].user; + const response = await supertest + .post(`${getUrlPrefix(spaceId)}/api/alerting/rule`) + .set('kbn-xsrf', 'foo') + .send( + getTestRuleData({ + rule_type_id: 'test.noop', + schedule: { interval: '1s' }, + throttle: null, + }) + ); + + expect(response.status).to.eql(200); + const ruleId = response.body.id; + objectRemover.add(spaceId, ruleId, 'rule', 'alerting'); + + const response2 = await supertest + .post(`${getUrlPrefix(spaceId)}/api/alerting/rule`) + .set('kbn-xsrf', 'foo') + .send( + getTestRuleData({ + rule_type_id: 'test.noop', + schedule: { interval: '1s' }, + throttle: null, + }) + ); + + expect(response2.status).to.eql(200); + const ruleId2 = response2.body.id; + objectRemover.add(spaceId, ruleId2, 'rule', 'alerting'); + + await retry.try(async () => { + // break AAD + await supertest + .put(`${getUrlPrefix(spaceId)}/api/alerts_fixture/saved_object/alert/${ruleId2}`) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); + + await retry.try(async () => { + // there can be a successful execute before the error one + const someEvents = await getEventLog({ + getService, + spaceId, + type: 'alert', + id: ruleId2, + provider: 'alerting', + actions: new Map([['execute', { gte: 1 }]]), + }); + const errorEvents = someEvents.filter( + (event) => event?.kibana?.alerting?.status === 'error' + ); + expect(errorEvents.length).to.be.above(0); + }); + + await retry.try(async () => { + // there can be a successful execute before the error one + const logResponse = await supertestWithoutAuth + .get( + `${getUrlPrefix( + spaceId + )}/internal/alerting/_global_execution_logs?date_start=${startTime}&date_end=9999-12-31T23:59:59Z&per_page=50&page=1` + ) + .set('kbn-xsrf', 'foo') + .auth(user.username, user.password); + expect(logResponse.statusCode).to.be(200); + expect(logResponse.body.data.length).to.be.above(1); + }); + + await retry.try(async () => { + // break AAD + await supertest + .put(`${getUrlPrefix(spaceId)}/api/alerts_fixture/saved_object/alert/${ruleId}`) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); + + await retry.try(async () => { + // there can be a successful execute before the error one + const someEvents = await getEventLog({ + getService, + spaceId, + type: 'alert', + id: ruleId, + provider: 'alerting', + actions: new Map([['execute', { gte: 1 }]]), + }); + const errorEvents = someEvents.filter( + (event) => event?.kibana?.alerting?.status === 'error' + ); + expect(errorEvents.length).to.be.above(0); + }); + + const kpiLogs = await retry.try(async () => { + // there can be a successful execute before the error one + const logResponse = await supertestWithoutAuth + .get( + `${getUrlPrefix( + spaceId + )}/internal/alerting/_global_execution_kpi?date_start=${startTime}&date_end=9999-12-31T23:59:59Z` + ) + .set('kbn-xsrf', 'foo') + .auth(user.username, user.password); + expect(logResponse.statusCode).to.be(200); + + return logResponse.body; + }); + + expect(Object.keys(kpiLogs)).to.eql([ + 'success', + 'unknown', + 'failure', + 'activeAlerts', + 'newAlerts', + 'recoveredAlerts', + 'erroredActions', + 'triggeredActions', + ]); + // it should be above 1 since we have two rule running + expect(kpiLogs.success).to.be.above(1); + expect(kpiLogs.failure).to.be.above(0); + }); + }); +} diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_rule_execution_kpi.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_rule_execution_kpi.ts new file mode 100644 index 0000000000000..2303fc616d8dc --- /dev/null +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_rule_execution_kpi.ts @@ -0,0 +1,133 @@ +/* + * 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 { UserAtSpaceScenarios } from '../../../scenarios'; +import { getUrlPrefix, getTestRuleData, ObjectRemover, getEventLog } from '../../../../common/lib'; +import { FtrProviderContext } from '../../../../common/ftr_provider_context'; + +// eslint-disable-next-line import/no-default-export +export default function getRuleExecutionKpiTests({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const supertestWithoutAuth = getService('supertestWithoutAuth'); + + const retry = getService('retry'); + + describe('getRuleExecutionKpi', () => { + const objectRemover = new ObjectRemover(supertest); + + after(() => objectRemover.removeAll()); + + it('should return KPI only from the current space', async () => { + const startTime = new Date().toISOString(); + + const spaceId = UserAtSpaceScenarios[1].space.id; + const user = UserAtSpaceScenarios[1].user; + const response = await supertest + .post(`${getUrlPrefix(spaceId)}/api/alerting/rule`) + .set('kbn-xsrf', 'foo') + .send( + getTestRuleData({ + rule_type_id: 'test.noop', + schedule: { interval: '1s' }, + throttle: null, + }) + ); + + expect(response.status).to.eql(200); + const ruleId = response.body.id; + objectRemover.add(spaceId, ruleId, 'rule', 'alerting'); + + const spaceId2 = UserAtSpaceScenarios[4].space.id; + const response2 = await supertest + .post(`${getUrlPrefix(spaceId2)}/api/alerting/rule`) + .set('kbn-xsrf', 'foo') + .send( + getTestRuleData({ + rule_type_id: 'test.noop', + schedule: { interval: '1s' }, + throttle: null, + }) + ); + + expect(response2.status).to.eql(200); + const ruleId2 = response2.body.id; + objectRemover.add(spaceId2, ruleId2, 'rule', 'alerting'); + + await retry.try(async () => { + // there can be a successful execute before the error one + const someEvents = await getEventLog({ + getService, + spaceId, + type: 'alert', + id: ruleId, + provider: 'alerting', + actions: new Map([['execute', { gte: 1 }]]), + }); + + expect(someEvents.length).to.be.above(0); + }); + + await retry.try(async () => { + // break AAD + await supertest + .put(`${getUrlPrefix(spaceId)}/api/alerts_fixture/saved_object/alert/${ruleId}`) + .set('kbn-xsrf', 'foo') + .send({ + attributes: { + name: 'bar', + }, + }) + .expect(200); + }); + + await retry.try(async () => { + // there can be a successful execute before the error one + const someEvents = await getEventLog({ + getService, + spaceId, + type: 'alert', + id: ruleId, + provider: 'alerting', + actions: new Map([['execute', { gte: 1 }]]), + }); + const errorEvents = someEvents.filter( + (event) => event?.kibana?.alerting?.status === 'error' + ); + expect(errorEvents.length).to.be.above(0); + }); + + const kpiLogs = await retry.try(async () => { + // there can be a successful execute before the error one + const logResponse = await supertestWithoutAuth + .get( + `${getUrlPrefix( + spaceId + )}/internal/alerting/rule/${ruleId}/_execution_kpi?date_start=${startTime}&date_end=9999-12-31T23:59:59Z` + ) + .set('kbn-xsrf', 'foo') + .auth(user.username, user.password); + expect(logResponse.statusCode).to.be(200); + + return logResponse.body; + }); + + expect(Object.keys(kpiLogs)).to.eql([ + 'success', + 'unknown', + 'failure', + 'activeAlerts', + 'newAlerts', + 'recoveredAlerts', + 'erroredActions', + 'triggeredActions', + ]); + expect(kpiLogs.success).to.be.above(0); + expect(kpiLogs.failure).to.be.above(0); + }); + }); +} diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/event_log.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/event_log.ts index 206036ef7fcac..2e63bed197864 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/event_log.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/event_log.ts @@ -6,7 +6,6 @@ */ import expect from '@kbn/expect'; -import uuid from 'uuid'; import { IValidatedEvent, nanosToMillis } from '@kbn/event-log-plugin/server'; import { Spaces } from '../../scenarios'; import { @@ -447,237 +446,6 @@ export default function eventLogTests({ getService }: FtrProviderContext) { } }); - it('should generate expected events for normal operation with subgroups', async () => { - const { body: createdAction } = await supertest - .post(`${getUrlPrefix(space.id)}/api/actions/connector`) - .set('kbn-xsrf', 'foo') - .send({ - name: 'MY action', - connector_type_id: 'test.noop', - config: {}, - secrets: {}, - }) - .expect(200); - - // pattern of when the alert should fire - const [firstSubgroup, secondSubgroup] = [uuid.v4(), uuid.v4()]; - const pattern = { - instance: [false, firstSubgroup, secondSubgroup], - }; - - const response = await supertest - .post(`${getUrlPrefix(space.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send( - getTestRuleData({ - rule_type_id: 'test.patternFiring', - schedule: { interval: '1s' }, - throttle: null, - params: { - pattern, - }, - actions: [ - { - id: createdAction.id, - group: 'default', - params: {}, - }, - ], - }) - ); - - expect(response.status).to.eql(200); - const alertId = response.body.id; - objectRemover.add(space.id, alertId, 'rule', 'alerting'); - - // get the events we're expecting - const events = await retry.try(async () => { - return await getEventLog({ - getService, - spaceId: space.id, - type: 'alert', - id: alertId, - provider: 'alerting', - actions: new Map([ - // make sure the counts of the # of events per type are as expected - ['execute-start', { gte: 4 }], - ['execute', { gte: 4 }], - ['execute-action', { equal: 2 }], - ['new-instance', { equal: 1 }], - ['active-instance', { gte: 2 }], - ['recovered-instance', { equal: 1 }], - ]), - }); - }); - - const executeEvents = getEventsByAction(events, 'execute'); - const executeStartEvents = getEventsByAction(events, 'execute-start'); - const newInstanceEvents = getEventsByAction(events, 'new-instance'); - const recoveredInstanceEvents = getEventsByAction(events, 'recovered-instance'); - - // make sure the events are in the right temporal order - const executeTimes = getTimestamps(executeEvents); - const executeStartTimes = getTimestamps(executeStartEvents); - const newInstanceTimes = getTimestamps(newInstanceEvents); - const recoveredInstanceTimes = getTimestamps(recoveredInstanceEvents); - - expect(executeTimes[0] < newInstanceTimes[0]).to.be(true); - expect(executeTimes[1] >= newInstanceTimes[0]).to.be(true); - expect(executeTimes[2] > newInstanceTimes[0]).to.be(true); - expect(executeStartTimes.length === executeTimes.length).to.be(true); - expect(recoveredInstanceTimes[0] > newInstanceTimes[0]).to.be(true); - - // validate each event - let executeCount = 0; - let numActiveAlerts = 0; - let numNewAlerts = 0; - let numRecoveredAlerts = 0; - let currentExecutionId; - const executeStatuses = ['ok', 'active', 'active']; - for (const event of events) { - switch (event?.event?.action) { - case 'execute-start': - currentExecutionId = event?.kibana?.alert?.rule?.execution?.uuid; - validateEvent(event, { - spaceId: space.id, - savedObjects: [ - { type: 'alert', id: alertId, rel: 'primary', type_id: 'test.patternFiring' }, - ], - message: `rule execution start: "${alertId}"`, - shouldHaveTask: true, - executionId: currentExecutionId, - ruleTypeId: response.body.rule_type_id, - rule: { - id: alertId, - category: response.body.rule_type_id, - license: 'basic', - ruleset: 'alertsFixture', - }, - consumer: 'alertsFixture', - }); - break; - case 'execute-action': - expect( - [firstSubgroup, secondSubgroup].includes( - event?.kibana?.alerting?.action_subgroup! - ) - ).to.be(true); - validateEvent(event, { - spaceId: space.id, - savedObjects: [ - { type: 'alert', id: alertId, rel: 'primary', type_id: 'test.patternFiring' }, - { type: 'action', id: createdAction.id, type_id: 'test.noop' }, - ], - message: `alert: test.patternFiring:${alertId}: 'abc' instanceId: 'instance' scheduled actionGroup(subgroup): 'default(${event?.kibana?.alerting?.action_subgroup})' action: test.noop:${createdAction.id}`, - instanceId: 'instance', - actionGroupId: 'default', - executionId: currentExecutionId, - ruleTypeId: response.body.rule_type_id, - rule: { - id: alertId, - category: response.body.rule_type_id, - license: 'basic', - ruleset: 'alertsFixture', - name: response.body.name, - }, - consumer: 'alertsFixture', - }); - break; - case 'new-instance': - numNewAlerts++; - validateInstanceEvent( - event, - `created new alert: 'instance'`, - false, - currentExecutionId - ); - break; - case 'recovered-instance': - numRecoveredAlerts++; - validateInstanceEvent( - event, - `alert 'instance' has recovered`, - true, - currentExecutionId - ); - break; - case 'active-instance': - numActiveAlerts++; - expect( - [firstSubgroup, secondSubgroup].includes( - event?.kibana?.alerting?.action_subgroup! - ) - ).to.be(true); - validateInstanceEvent( - event, - `active alert: 'instance' in actionGroup(subgroup): 'default(${event?.kibana?.alerting?.action_subgroup})'`, - false, - currentExecutionId - ); - break; - case 'execute': - validateEvent(event, { - spaceId: space.id, - savedObjects: [ - { type: 'alert', id: alertId, rel: 'primary', type_id: 'test.patternFiring' }, - ], - outcome: 'success', - message: `rule executed: test.patternFiring:${alertId}: 'abc'`, - status: executeStatuses[executeCount++], - shouldHaveTask: true, - executionId: currentExecutionId, - ruleTypeId: response.body.rule_type_id, - rule: { - id: alertId, - category: response.body.rule_type_id, - license: 'basic', - ruleset: 'alertsFixture', - name: response.body.name, - }, - consumer: 'alertsFixture', - numActiveAlerts, - numNewAlerts, - numRecoveredAlerts, - }); - numActiveAlerts = 0; - numNewAlerts = 0; - numRecoveredAlerts = 0; - break; - // this will get triggered as we add new event actions - default: - throw new Error(`unexpected event action "${event?.event?.action}"`); - } - } - - function validateInstanceEvent( - event: IValidatedEvent, - subMessage: string, - shouldHaveEventEnd: boolean, - executionId?: string - ) { - validateEvent(event, { - spaceId: space.id, - savedObjects: [ - { type: 'alert', id: alertId, rel: 'primary', type_id: 'test.patternFiring' }, - ], - message: `test.patternFiring:${alertId}: 'abc' ${subMessage}`, - instanceId: 'instance', - actionGroupId: 'default', - shouldHaveEventEnd, - executionId, - ruleTypeId: response.body.rule_type_id, - rule: { - id: alertId, - category: response.body.rule_type_id, - license: 'basic', - ruleset: 'alertsFixture', - name: response.body.name, - }, - consumer: 'alertsFixture', - }); - } - }); - it('should generate events for execution errors', async () => { const response = await supertest .post(`${getUrlPrefix(space.id)}/api/alerting/rule`) diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts index 49e652d9a9a4e..e09cf3121adec 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/index.ts @@ -49,6 +49,7 @@ export default function alertingTests({ loadTestFile, getService }: FtrProviderC loadTestFile(require.resolve('./bulk_edit')); loadTestFile(require.resolve('./capped_action_type')); loadTestFile(require.resolve('./scheduled_task_id')); + loadTestFile(require.resolve('./run_soon')); // Do not place test files here, due to https://github.com/elastic/kibana/issues/123059 // note that this test will destroy existing spaces diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/notify_when.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/notify_when.ts index 5024a1489f4c8..a7996f19554e8 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/notify_when.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/notify_when.ts @@ -174,97 +174,6 @@ export default function createNotifyWhenTests({ getService }: FtrProviderContext ); expect(executeActionEventsActionGroup).to.eql(expectedActionGroupBasedOnPattern); }); - - it(`alert with notifyWhen=onActionGroupChange should only execute actions when action subgroup changes`, async () => { - const { body: defaultAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/connector`) - .set('kbn-xsrf', 'foo') - .send({ - name: 'My Default Action', - connector_type_id: 'test.noop', - config: {}, - secrets: {}, - }) - .expect(200); - - const { body: recoveredAction } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/connector`) - .set('kbn-xsrf', 'foo') - .send({ - name: 'My Recovered Action', - connector_type_id: 'test.noop', - config: {}, - secrets: {}, - }) - .expect(200); - - const pattern = { - instance: [ - 'subgroup1', - 'subgroup1', - false, - false, - 'subgroup1', - 'subgroup2', - 'subgroup2', - false, - ], - }; - const expectedActionGroupBasedOnPattern = [ - 'default', - 'recovered', - 'default', - 'default', - 'recovered', - ]; - - const { body: createdAlert } = await supertest - .post(`${getUrlPrefix(Spaces.space1.id)}/api/alerting/rule`) - .set('kbn-xsrf', 'foo') - .send( - getTestRuleData({ - rule_type_id: 'test.patternFiring', - params: { pattern }, - schedule: { interval: '1s' }, - throttle: null, - notify_when: 'onActionGroupChange', - actions: [ - { - id: defaultAction.id, - group: 'default', - params: {}, - }, - { - id: recoveredAction.id, - group: 'recovered', - params: {}, - }, - ], - }) - ) - .expect(200); - objectRemover.add(Spaces.space1.id, createdAlert.id, 'rule', 'alerting'); - - const events = await retry.try(async () => { - return await getEventLog({ - getService, - spaceId: Spaces.space1.id, - type: 'alert', - id: createdAlert.id, - provider: 'alerting', - actions: new Map([ - ['execute-action', { gte: 5 }], - ['new-instance', { equal: 2 }], - ]), - }); - }); - - const executeActionEvents = getEventsByAction(events, 'execute-action'); - const executeActionEventsActionGroup = executeActionEvents.map( - (event) => event?.kibana?.alerting?.action_group_id - ); - expect(executeActionEventsActionGroup).to.eql(expectedActionGroupBasedOnPattern); - }); }); } diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/run_soon.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/run_soon.ts new file mode 100644 index 0000000000000..050c220ab1b0f --- /dev/null +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/run_soon.ts @@ -0,0 +1,104 @@ +/* + * 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 { getUrlPrefix, getTestRuleData, ObjectRemover } from '../../../common/lib'; +import { FtrProviderContext } from '../../../common/ftr_provider_context'; + +const LOADED_RULE_ID = '74f3e6d7-b7bb-477d-ac28-92ee22728e6e'; + +// eslint-disable-next-line import/no-default-export +export default function createRunSoonTests({ getService }: FtrProviderContext) { + const supertest = getService('supertest'); + const retry = getService('retry'); + const es = getService('es'); + const esArchiver = getService('esArchiver'); + + describe('runSoon', () => { + const objectRemover = new ObjectRemover(supertest); + + before(async () => { + await esArchiver.load('x-pack/test/functional/es_archives/rules_scheduled_task_id'); + }); + + afterEach(async () => { + await objectRemover.removeAll(); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/rules_scheduled_task_id'); + }); + + it('should successfully run rule where scheduled task id is different than rule id', async () => { + await retry.try(async () => { + // Sometimes the rule may already be running. Try until it isn't + const response = await supertest + .post(`${getUrlPrefix(``)}/internal/alerting/rule/${LOADED_RULE_ID}/_run_soon`) + .set('kbn-xsrf', 'foo'); + expect(response.status).to.eql(204); + }); + }); + + it('should successfully run rule where scheduled task id is same as rule id', async () => { + const response = await supertest + .post(`${getUrlPrefix(``)}/api/alerting/rule`) + .set('kbn-xsrf', 'foo') + .send(getTestRuleData()); + + expect(response.status).to.eql(200); + objectRemover.add('default', response.body.id, 'rule', 'alerting'); + + const runSoonResponse = await supertest + .post(`${getUrlPrefix(``)}/internal/alerting/rule/${response.body.id}/_run_soon`) + .set('kbn-xsrf', 'foo'); + expect(runSoonResponse.status).to.eql(204); + }); + + it('should return message when task does not exist for rule', async () => { + const response = await supertest + .post(`${getUrlPrefix(``)}/api/alerting/rule`) + .set('kbn-xsrf', 'foo') + .send(getTestRuleData()); + + expect(response.status).to.eql(200); + objectRemover.add('default', response.body.id, 'rule', 'alerting'); + + await es.delete({ + id: `task:${response.body.id}`, + index: '.kibana_task_manager', + }); + + const runSoonResponse = await supertest + .post(`${getUrlPrefix(``)}/internal/alerting/rule/${response.body.id}/_run_soon`) + .set('kbn-xsrf', 'foo'); + expect(runSoonResponse.status).to.eql(200); + expect(runSoonResponse.text).to.eql( + `Error running rule: Saved object [task/${response.body.id}] not found` + ); + }); + + it('should return message when rule is disabled', async () => { + const response = await supertest + .post(`${getUrlPrefix(``)}/api/alerting/rule`) + .set('kbn-xsrf', 'foo') + .send(getTestRuleData()); + + expect(response.status).to.eql(200); + objectRemover.add('default', response.body.id, 'rule', 'alerting'); + + await supertest + .post(`${getUrlPrefix(``)}/api/alerting/rule/${response.body.id}/_disable`) + .set('kbn-xsrf', 'foo'); + + const runSoonResponse = await supertest + .post(`${getUrlPrefix(``)}/internal/alerting/rule/${response.body.id}/_run_soon`) + .set('kbn-xsrf', 'foo'); + expect(runSoonResponse.status).to.eql(200); + expect(runSoonResponse.text).to.eql(`Error running rule: rule is disabled`); + }); + }); +} diff --git a/x-pack/test/api_integration/apis/ml/index.ts b/x-pack/test/api_integration/apis/ml/index.ts index 915d755ca97c0..e76eef8cb82bf 100644 --- a/x-pack/test/api_integration/apis/ml/index.ts +++ b/x-pack/test/api_integration/apis/ml/index.ts @@ -67,5 +67,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./saved_objects')); loadTestFile(require.resolve('./system')); loadTestFile(require.resolve('./trained_models')); + loadTestFile(require.resolve('./notifications')); }); } 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 e530b6bfb3622..8152f3e760b60 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 0000000000000..c843aab29dc48 --- /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<CombinedJobWithStats[]> { + 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 de8919976fd33..d28263b487701 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 0000000000000..3e5cd0aa996d6 --- /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/notifications/count_notifications.ts b/x-pack/test/api_integration/apis/ml/notifications/count_notifications.ts new file mode 100644 index 0000000000000..58932ea199b5d --- /dev/null +++ b/x-pack/test/api_integration/apis/ml/notifications/count_notifications.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. + */ + +import expect from '@kbn/expect'; +import moment from 'moment'; +import type { 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 supertest = getService('supertestWithoutAuth'); + const ml = getService('ml'); + + describe('GET notifications count', () => { + before(async () => { + await ml.api.initSavedObjects(); + await ml.testResources.setKibanaTimeZoneToUTC(); + + const adJobConfig = ml.commonConfig.getADFqSingleMetricJobConfig('fq_job'); + await ml.api.createAnomalyDetectionJob(adJobConfig); + + await ml.api.waitForJobNotificationsToIndex('fq_job'); + }); + + after(async () => { + await ml.api.cleanMlIndices(); + await ml.testResources.cleanMLSavedObjects(); + }); + + it('return notifications count by level', async () => { + const { body, status } = await supertest + .get(`/api/ml/notifications/count`) + .query({ lastCheckedAt: moment().subtract(7, 'd').valueOf() }) + .auth(USER.ML_POWERUSER, ml.securityCommon.getPasswordForUser(USER.ML_POWERUSER)) + .set(COMMON_REQUEST_HEADERS); + ml.api.assertResponseStatusCode(200, status, body); + + expect(body.info).to.eql(1); + expect(body.warning).to.eql(0); + expect(body.error).to.eql(0); + }); + + it('returns an error for unauthorized user', async () => { + const { body, status } = await supertest + .get(`/api/ml/notifications/count`) + .auth(USER.ML_UNAUTHORIZED, ml.securityCommon.getPasswordForUser(USER.ML_UNAUTHORIZED)) + .set(COMMON_REQUEST_HEADERS); + ml.api.assertResponseStatusCode(403, status, body); + }); + }); +}; diff --git a/x-pack/test/api_integration/apis/ml/notifications/get_notifications.ts b/x-pack/test/api_integration/apis/ml/notifications/get_notifications.ts new file mode 100644 index 0000000000000..992065cdae67d --- /dev/null +++ b/x-pack/test/api_integration/apis/ml/notifications/get_notifications.ts @@ -0,0 +1,102 @@ +/* + * 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 { + NotificationItem, + NotificationsSearchResponse, +} from '@kbn/ml-plugin/common/types/notifications'; +import type { 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 supertest = getService('supertestWithoutAuth'); + const esArchiver = getService('esArchiver'); + const ml = getService('ml'); + + describe('GET notifications', () => { + before(async () => { + await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/bm_classification'); + await ml.api.initSavedObjects(); + await ml.testResources.setKibanaTimeZoneToUTC(); + + const adJobConfig = ml.commonConfig.getADFqSingleMetricJobConfig('fq_job'); + await ml.api.createAnomalyDetectionJob(adJobConfig); + + const dfaJobConfig = ml.commonConfig.getDFABmClassificationJobConfig('df_job'); + await ml.api.createDataFrameAnalyticsJob(dfaJobConfig); + + // wait for notification to index + + await ml.api.waitForJobNotificationsToIndex('fq_job'); + await ml.api.waitForJobNotificationsToIndex('df_job'); + }); + + after(async () => { + await ml.api.cleanMlIndices(); + await ml.testResources.cleanMLSavedObjects(); + }); + + it('return all notifications ', async () => { + const { body, status } = await supertest + .get(`/api/ml/notifications`) + .query({ earliest: 'now-1d', latest: 'now' }) + .auth(USER.ML_POWERUSER, ml.securityCommon.getPasswordForUser(USER.ML_POWERUSER)) + .set(COMMON_REQUEST_HEADERS); + ml.api.assertResponseStatusCode(200, status, body); + + expect((body as NotificationsSearchResponse).total).to.eql(2); + }); + + it('return notifications based on the query string', async () => { + const { body, status } = await supertest + .get(`/api/ml/notifications`) + .query({ earliest: 'now-1d', latest: 'now', queryString: 'job_type:anomaly_detector' }) + .auth(USER.ML_VIEWER, ml.securityCommon.getPasswordForUser(USER.ML_VIEWER)) + .set(COMMON_REQUEST_HEADERS); + ml.api.assertResponseStatusCode(200, status, body); + + expect((body as NotificationsSearchResponse).total).to.eql(1); + expect( + (body as NotificationsSearchResponse).results.filter( + (result: NotificationItem) => result.job_type === 'anomaly_detector' + ) + ).to.length(body.total); + }); + + it('supports sorting asc sorting by field', async () => { + const { body, status } = await supertest + .get(`/api/ml/notifications`) + .query({ earliest: 'now-1d', latest: 'now', sortField: 'job_id', sortDirection: 'asc' }) + .auth(USER.ML_POWERUSER, ml.securityCommon.getPasswordForUser(USER.ML_POWERUSER)) + .set(COMMON_REQUEST_HEADERS); + ml.api.assertResponseStatusCode(200, status, body); + + expect(body.results[0].job_id).to.eql('df_job'); + }); + + it('supports sorting desc sorting by field', async () => { + const { body, status } = await supertest + .get(`/api/ml/notifications`) + .query({ earliest: 'now-1h', latest: 'now', sortField: 'job_id', sortDirection: 'desc' }) + .auth(USER.ML_POWERUSER, ml.securityCommon.getPasswordForUser(USER.ML_POWERUSER)) + .set(COMMON_REQUEST_HEADERS); + ml.api.assertResponseStatusCode(200, status, body); + + expect(body.results[0].job_id).to.eql('fq_job'); + }); + + it('returns an error for unauthorized user', async () => { + const { body, status } = await supertest + .get(`/api/ml/notifications`) + .auth(USER.ML_UNAUTHORIZED, ml.securityCommon.getPasswordForUser(USER.ML_UNAUTHORIZED)) + .set(COMMON_REQUEST_HEADERS); + ml.api.assertResponseStatusCode(403, status, body); + }); + }); +}; diff --git a/x-pack/test/api_integration/apis/ml/notifications/index.ts b/x-pack/test/api_integration/apis/ml/notifications/index.ts new file mode 100644 index 0000000000000..4a09fce5ee51e --- /dev/null +++ b/x-pack/test/api_integration/apis/ml/notifications/index.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../../../ftr_provider_context'; + +export default function ({ loadTestFile }: FtrProviderContext) { + describe('Notifications', function () { + loadTestFile(require.resolve('./get_notifications')); + loadTestFile(require.resolve('./count_notifications')); + }); +} diff --git a/x-pack/test/api_integration/apis/ml/results/get_anomaly_search.ts b/x-pack/test/api_integration/apis/ml/results/get_anomaly_search.ts new file mode 100644 index 0000000000000..ce4b5b600e579 --- /dev/null +++ b/x-pack/test/api_integration/apis/ml/results/get_anomaly_search.ts @@ -0,0 +1,106 @@ +/* + * 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 ml = getService('ml'); + const spacesService = getService('spaces'); + const supertest = getService('supertestWithoutAuth'); + + const adJobId = 'fq_single'; + const idSpace1 = 'space1'; + const idSpace2 = 'space2'; + + const jobQuery = { + size: 1, + body: { + query: { + bool: { + filter: [{ term: { job_id: adJobId } }], + }, + }, + }, + }; + + async function runRequest( + requestBody: { + jobIds: string[]; + query: any; + }, + space: string, + expectedStatusCode: number, + user: USER + ) { + const { body, status } = await supertest + .post(`/s/${space}/api/ml/results/anomaly_search`) + .auth(user, ml.securityCommon.getPasswordForUser(user)) + .set(COMMON_REQUEST_HEADERS) + .send(requestBody); + ml.api.assertResponseStatusCode(expectedStatusCode, status, body); + + return body; + } + + describe('POST results/anomaly_search', () => { + before(async () => { + await ml.testResources.setKibanaTimeZoneToUTC(); + await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); + + // create spaces + await spacesService.create({ id: idSpace1, name: 'space_one', disabledFeatures: [] }); + await spacesService.create({ id: idSpace2, name: 'space_two', disabledFeatures: [] }); + + await ml.api.createAndRunAnomalyDetectionLookbackJob( + ml.commonConfig.getADFqSingleMetricJobConfig(adJobId), + ml.commonConfig.getADFqDatafeedConfig(adJobId), + idSpace1 + ); + await ml.api.assertJobSpaces(adJobId, 'anomaly-detector', [idSpace1]); + }); + + after(async () => { + await ml.api.cleanMlIndices(); + await ml.testResources.cleanMLSavedObjects(); + await spacesService.delete(idSpace1); + await spacesService.delete(idSpace2); + }); + + it('should see results in current space', async () => { + const body = await runRequest( + { + jobIds: [adJobId], + query: jobQuery, + }, + idSpace1, + 200, + USER.ML_POWERUSER + ); + expect(body.hits.hits[0]._source.job_id).to.eql( + adJobId, + `Expected job_id to equal ${adJobId}` + ); + }); + + it('should not see results in different space', async () => { + const body = await runRequest( + { + jobIds: [adJobId], + query: jobQuery, + }, + idSpace2, + 404, + USER.ML_POWERUSER + ); + expect(body.message).to.eql(`${adJobId} missing`); + }); + }); +}; diff --git a/x-pack/test/api_integration/apis/ml/results/index.ts b/x-pack/test/api_integration/apis/ml/results/index.ts index 1580055df6d0e..e9accf88eadab 100644 --- a/x-pack/test/api_integration/apis/ml/results/index.ts +++ b/x-pack/test/api_integration/apis/ml/results/index.ts @@ -16,5 +16,6 @@ export default function ({ loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./get_category_examples')); loadTestFile(require.resolve('./max_anomaly_score')); loadTestFile(require.resolve('./get_partition_fields_values')); + loadTestFile(require.resolve('./get_anomaly_search')); }); } 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 f1464095edffe..5139a121e07d1 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 0000000000000..3e98c51ea047e --- /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/osquery/packs.ts b/x-pack/test/api_integration/apis/osquery/packs.ts index 9d00249a4e1b0..de490a489cec7 100644 --- a/x-pack/test/api_integration/apis/osquery/packs.ts +++ b/x-pack/test/api_integration/apis/osquery/packs.ts @@ -45,7 +45,8 @@ limit 1000;`; export default function ({ getService }: FtrProviderContext) { const supertest = getService('supertest'); - describe('Packs', () => { + // FLAKY: https://github.com/elastic/kibana/issues/133259 + describe.skip('Packs', () => { let packId: string = ''; let hostedPolicy: Record<string, any>; let packagePolicyId: string; diff --git a/x-pack/test/api_integration/apis/security/basic_login.js b/x-pack/test/api_integration/apis/security/basic_login.js index c81034b6fb824..6402945af74a6 100644 --- a/x-pack/test/api_integration/apis/security/basic_login.js +++ b/x-pack/test/api_integration/apis/security/basic_login.js @@ -135,7 +135,7 @@ export default function ({ getService }) { ) .expect(200); - expect(apiResponse.body).to.only.have.keys([ + expect(apiResponse.body).to.have.keys([ 'username', 'full_name', 'email', @@ -182,7 +182,7 @@ export default function ({ getService }) { .set('Cookie', sessionCookie.cookieString()) .expect(200); - expect(apiResponse.body).to.only.have.keys([ + expect(apiResponse.body).to.have.keys([ 'username', 'full_name', 'email', 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 4e65bf1c4dbe3..f96479a50bc6f 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 1110bbb875c73..9dce7e7d8fdaa 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]]; @@ -112,7 +220,12 @@ export default function ({ getService }: FtrProviderContext) { expect(messages[2].failedMonitors).eql([ { id: httpProjectMonitors.monitors[0].id, - details: `The following Heartbeat options are not supported for ${httpProjectMonitors.monitors[0].type} project monitors in ${kibanaVersion}: check.response.body|unsupportedKey.nestedUnsupportedKey`, + details: `Multiple urls are not supported for http project monitors in ${kibanaVersion}. Please set only 1 url per monitor. You monitor was not created or updated.`, + reason: 'Unsupported Heartbeat option', + }, + { + id: httpProjectMonitors.monitors[0].id, + details: `The following Heartbeat options are not supported for ${httpProjectMonitors.monitors[0].type} project monitors in ${kibanaVersion}: check.response.body|unsupportedKey.nestedUnsupportedKey. You monitor was not created or updated.`, reason: 'Unsupported Heartbeat option', }, ]); @@ -125,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, }, @@ -133,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, @@ -156,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, @@ -169,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 { @@ -200,7 +333,12 @@ export default function ({ getService }: FtrProviderContext) { expect(messages[2].failedMonitors).eql([ { id: tcpProjectMonitors.monitors[2].id, - details: `The following Heartbeat options are not supported for ${tcpProjectMonitors.monitors[0].type} project monitors in ${kibanaVersion}: ports|unsupportedKey.nestedUnsupportedKey`, + details: `Multiple hosts are not supported for tcp project monitors in ${kibanaVersion}. Please set only 1 host per monitor. You monitor was not created or updated.`, + reason: 'Unsupported Heartbeat option', + }, + { + id: tcpProjectMonitors.monitors[2].id, + details: `The following Heartbeat options are not supported for ${tcpProjectMonitors.monitors[0].type} project monitors in ${kibanaVersion}: ports|unsupportedKey.nestedUnsupportedKey. You monitor was not created or updated.`, reason: 'Unsupported Heartbeat option', }, ]); @@ -213,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, @@ -253,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 { @@ -284,7 +432,12 @@ export default function ({ getService }: FtrProviderContext) { expect(messages[2].failedMonitors).eql([ { id: icmpProjectMonitors.monitors[2].id, - details: `The following Heartbeat options are not supported for ${icmpProjectMonitors.monitors[0].type} project monitors in ${kibanaVersion}: unsupportedKey.nestedUnsupportedKey`, + details: `Multiple hosts are not supported for icmp project monitors in ${kibanaVersion}. Please set only 1 host per monitor. You monitor was not created or updated.`, + reason: 'Unsupported Heartbeat option', + }, + { + id: icmpProjectMonitors.monitors[2].id, + details: `The following Heartbeat options are not supported for ${icmpProjectMonitors.monitors[0].type} project monitors in ${kibanaVersion}: unsupportedKey.nestedUnsupportedKey. You monitor was not created or updated.`, reason: 'Unsupported Heartbeat option', }, ]); @@ -297,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 480d07e7144f3..eb44aa36a76c8 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<HTTPFields> = { + [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<HTTPFields>; + + 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 76478fd7aee1a..45a2e11e9f306 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 d9df06d1c7c32..052c811461ae7 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/project_http_monitor.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_http_monitor.json index fc754cbdcd038..42044c8ba9cf3 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_http_monitor.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_http_monitor.json @@ -9,7 +9,8 @@ "id": "my-monitor-2", "name": "My Monitor 2", "urls": [ - "http://localhost:9200" + "http://localhost:9200", + "http://anotherurl:9200" ], "schedule": 60, "timeout": "80s", @@ -32,7 +33,6 @@ "saved" ] }, - "content": "", "unsupportedKey": { "nestedUnsupportedKey": "unsupportedValue" } @@ -69,8 +69,7 @@ "saved" ] } - }, - "content": "" + } } ] } \ No newline at end of file diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_icmp_monitor.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_icmp_monitor.json index 8dec1b28d50c4..b19e910882582 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_icmp_monitor.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_icmp_monitor.json @@ -14,7 +14,6 @@ "schedule": 1, "tags": [ "service:smtp", "org:google" ], "privateLocations": [ "Test private location 0" ], - "content": "", "wait": "30s" }, { @@ -26,7 +25,6 @@ "schedule": 1, "tags": "tag1,tag2", "privateLocations": [ "Test private location 0" ], - "content": "", "wait": "1m" }, { @@ -34,11 +32,10 @@ "type": "icmp", "id": "Cloudflare-DNS-3", "name": "Cloudflare DNS 3", - "hosts": "1.1.1.1", + "hosts": "1.1.1.1,2.2.2.2", "schedule": 1, "tags": "tag1,tag2", "privateLocations": [ "Test private location 0" ], - "content": "", "unsupportedKey": { "nestedUnsupportedKey": "unnsuportedValue" } diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_tcp_monitor.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_tcp_monitor.json index 30061673079d3..82d6c8c557e77 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_tcp_monitor.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/project_tcp_monitor.json @@ -10,8 +10,7 @@ "hosts": [ "smtp.gmail.com:587" ], "schedule": 1, "tags": [ "service:smtp", "org:google" ], - "privateLocations": [ "BEEP" ], - "content": "" + "privateLocations": [ "BEEP" ] }, { "locations": [ "localhost" ], @@ -21,20 +20,18 @@ "hosts": "localhost:18278", "schedule": 1, "tags": "tag1,tag2", - "privateLocations": [ "BEEP" ], - "content": "" + "privateLocations": [ "BEEP" ] }, { "locations": [ "localhost" ], "type": "tcp", "id": "always-down", "name": "Always Down", - "hosts": "localhost", + "hosts": ["localhost", "anotherhost"], "ports": ["5698"], "schedule": 1, "tags": "tag1,tag2", "privateLocations": [ "BEEP" ], - "content": "", "unsupportedKey": { "nestedUnsupportedKey": "unnsuportedValue" } 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 1c726c1bcc70e..e0b4ca03b1d8d 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/apm_api_integration/common/bootstrap_apm_synthtrace.ts b/x-pack/test/apm_api_integration/common/bootstrap_apm_synthtrace.ts index 96d0cbf3f8e7b..0a790d261ef49 100644 --- a/x-pack/test/apm_api_integration/common/bootstrap_apm_synthtrace.ts +++ b/x-pack/test/apm_api_integration/common/bootstrap_apm_synthtrace.ts @@ -7,7 +7,7 @@ import { apm, createLogger, LogLevel } from '@kbn/apm-synthtrace'; import { esTestConfig } from '@kbn/test'; -import { APM_TEST_PASSWORD } from './authentication'; +import { APM_TEST_PASSWORD } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/authentication'; import { InheritedFtrProviderContext } from './ftr_provider_context'; export async function bootstrapApmSynthtrace( diff --git a/x-pack/test/apm_api_integration/common/config.ts b/x-pack/test/apm_api_integration/common/config.ts index e01c5fbf40541..8400cccd64d4f 100644 --- a/x-pack/test/apm_api_integration/common/config.ts +++ b/x-pack/test/apm_api_integration/common/config.ts @@ -8,11 +8,12 @@ import { FtrConfigProviderContext } from '@kbn/test'; import supertest from 'supertest'; import { format, UrlObject } from 'url'; -import { Client } from '@elastic/elasticsearch'; -import { ToolingLog } from '@kbn/tooling-log'; -import { SecurityServiceProvider } from '../../../../test/common/services/security'; +import { + ApmUsername, + APM_TEST_PASSWORD, +} from '@kbn/apm-plugin/server/test_helpers/create_apm_users/authentication'; +import { createApmUsers } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/create_apm_users'; import { InheritedFtrProviderContext, InheritedServices } from './ftr_provider_context'; -import { createApmUser, APM_TEST_PASSWORD, ApmUsername } from './authentication'; import { APMFtrConfigName } from '../configs'; import { createApmApiClient } from './apm_api_supertest'; import { RegistryProvider } from './registry'; @@ -25,17 +26,8 @@ export interface ApmFtrConfig { kibanaConfig?: Record<string, string | string[]>; } -type SecurityService = Awaited<ReturnType<typeof SecurityServiceProvider>>; - function getLegacySupertestClient(kibanaServer: UrlObject, username: ApmUsername) { return async (context: InheritedFtrProviderContext) => { - const security = context.getService('security'); - const es = context.getService('es'); - const logger = context.getService('log'); - await security.init(); - - await createApmUser({ security, username, es, logger }); - const url = format({ ...kibanaServer, auth: `${username}:${APM_TEST_PASSWORD}`, @@ -47,19 +39,11 @@ function getLegacySupertestClient(kibanaServer: UrlObject, username: ApmUsername async function getApmApiClient({ kibanaServer, - security, username, - es, - logger, }: { kibanaServer: UrlObject; - security: SecurityService; username: ApmUsername; - es: Client; - logger: ToolingLog; }) { - await createApmUser({ security, username, es, logger }); - const url = format({ ...kibanaServer, auth: `${username}:${APM_TEST_PASSWORD}`, @@ -81,6 +65,8 @@ export function createTestConfig(config: ApmFtrConfig) { const services = xPackAPITestsConfig.get('services') as InheritedServices; const servers = xPackAPITestsConfig.get('servers'); const kibanaServer = servers.kibana as UrlObject; + const kibanaServerUrl = format(kibanaServer); + const esServer = servers.elasticsearch as UrlObject; return { testFiles: [require.resolve('../tests')], @@ -91,93 +77,59 @@ export function createTestConfig(config: ApmFtrConfig) { apmFtrConfig: () => config, registry: RegistryProvider, synthtraceEsClient: (context: InheritedFtrProviderContext) => { - const kibanaServerUrl = format(kibanaServer); return bootstrapApmSynthtrace(context, kibanaServerUrl); }, apmApiClient: async (context: InheritedFtrProviderContext) => { - const security = context.getService('security'); - const es = context.getService('es'); - const logger = context.getService('log'); + const { username, password } = servers.kibana; + const esUrl = format(esServer); - await security.init(); + // Creates APM users + await createApmUsers({ + elasticsearch: { node: esUrl, username, password }, + kibana: { hostname: kibanaServerUrl }, + }); return { noAccessUser: await getApmApiClient({ kibanaServer, - security, username: ApmUsername.noAccessUser, - es, - logger, }), readUser: await getApmApiClient({ kibanaServer, - security, username: ApmUsername.viewerUser, - es, - logger, }), writeUser: await getApmApiClient({ kibanaServer, - security, username: ApmUsername.editorUser, - es, - logger, }), annotationWriterUser: await getApmApiClient({ kibanaServer, - security, username: ApmUsername.apmAnnotationsWriteUser, - es, - logger, }), noMlAccessUser: await getApmApiClient({ kibanaServer, - security, username: ApmUsername.apmReadUserWithoutMlAccess, - es, - logger, }), manageOwnAgentKeysUser: await getApmApiClient({ kibanaServer, - security, username: ApmUsername.apmManageOwnAgentKeys, - es, - logger, }), createAndAllAgentKeysUser: await getApmApiClient({ kibanaServer, - security, username: ApmUsername.apmManageOwnAndCreateAgentKeys, - es, - logger, }), monitorIndicesUser: await getApmApiClient({ kibanaServer, - security, username: ApmUsername.apmMonitorIndices, - es, - logger, }), }; }, ml: MachineLearningAPIProvider, // legacy clients - legacySupertestAsNoAccessUser: getLegacySupertestClient( - kibanaServer, - ApmUsername.noAccessUser - ), - legacySupertestAsApmReadUser: getLegacySupertestClient( - kibanaServer, - ApmUsername.viewerUser - ), legacySupertestAsApmWriteUser: getLegacySupertestClient( kibanaServer, ApmUsername.editorUser ), - legacySupertestAsApmAnnotationsWriteUser: getLegacySupertestClient( - kibanaServer, - ApmUsername.apmAnnotationsWriteUser - ), legacySupertestAsApmReadUserWithoutMlAccess: getLegacySupertestClient( kibanaServer, ApmUsername.apmReadUserWithoutMlAccess diff --git a/x-pack/test/apm_api_integration/common/utils/expect_to_reject.ts b/x-pack/test/apm_api_integration/common/utils/expect_to_reject.ts new file mode 100644 index 0000000000000..e40422f2723cd --- /dev/null +++ b/x-pack/test/apm_api_integration/common/utils/expect_to_reject.ts @@ -0,0 +1,15 @@ +/* + * 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 async function expectToReject<T extends Error>(fn: () => Promise<any>): Promise<T> { + try { + await fn(); + } catch (e) { + return e; + } + throw new Error(`Expected fn to throw`); +} diff --git a/x-pack/test/apm_api_integration/tests/services/annotations.spec.ts b/x-pack/test/apm_api_integration/tests/services/annotations.spec.ts index deb1b675ee764..aea26243f779e 100644 --- a/x-pack/test/apm_api_integration/tests/services/annotations.spec.ts +++ b/x-pack/test/apm_api_integration/tests/services/annotations.spec.ts @@ -5,20 +5,33 @@ * 2.0. */ +import { + ENVIRONMENT_ALL, + ENVIRONMENT_NOT_DEFINED, +} from '@kbn/apm-plugin/common/environment_filter_values'; +import { + APIClientRequestParamsOf, + APIReturnType, +} from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; +import { RecursivePartial } from '@kbn/apm-plugin/typings/common'; import expect from '@kbn/expect'; -import { merge, cloneDeep, isPlainObject } from 'lodash'; import { JsonObject } from '@kbn/utility-types'; +import { cloneDeep, isPlainObject, merge } from 'lodash'; +import { ApmApiError } from '../../common/apm_api_supertest'; import { FtrProviderContext } from '../../common/ftr_provider_context'; +import { expectToReject } from '../../common/utils/expect_to_reject'; const DEFAULT_INDEX_NAME = 'observability-annotations'; export default function annotationApiTests({ getService }: FtrProviderContext) { const registry = getService('registry'); - const supertestRead = getService('legacySupertestAsApmReadUser'); - const supertestWrite = getService('legacySupertestAsApmAnnotationsWriteUser'); + const apmApiClient = getService('apmApiClient'); const es = getService('es'); - function expectContainsObj(source: JsonObject, expected: JsonObject) { + function expectContainsObj( + source: APIReturnType<'POST /api/apm/services/{serviceName}/annotation'>, + expected: JsonObject + ) { expect(source).to.eql( merge(cloneDeep(source), expected, (a: any, b: any) => { if (isPlainObject(a) && isPlainObject(b)) { @@ -29,26 +42,46 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { ); } - function request({ method, url, data }: { method: string; url: string; data?: JsonObject }) { - switch (method.toLowerCase()) { - case 'get': - return supertestRead.get(url).set('kbn-xsrf', 'foo'); - - case 'post': - return supertestWrite.post(url).send(data).set('kbn-xsrf', 'foo'); + function createAnnotation( + body: APIClientRequestParamsOf<'POST /api/apm/services/{serviceName}/annotation'>['params']['body'] + ) { + return apmApiClient.annotationWriterUser({ + endpoint: 'POST /api/apm/services/{serviceName}/annotation', + params: { + path: { + serviceName: 'opbeans-java', + }, + body, + }, + }); + } - default: - throw new Error(`Unsupported method ${method}`); - } + function getAnnotation( + query: RecursivePartial< + APIClientRequestParamsOf<'GET /api/apm/services/{serviceName}/annotation/search'>['params']['query'] + > + ) { + return apmApiClient.readUser({ + endpoint: 'GET /api/apm/services/{serviceName}/annotation/search', + params: { + path: { + serviceName: 'opbeans-java', + }, + query: { + environment: ENVIRONMENT_ALL.value, + start: new Date().toISOString(), + end: new Date().toISOString(), + ...query, + }, + }, + }); } registry.when('Annotations with a basic license', { config: 'basic', archives: [] }, () => { describe('when creating an annotation', () => { it('fails with a 403 forbidden', async () => { - const response = await request({ - url: '/api/apm/services/opbeans-java/annotation', - method: 'POST', - data: { + const err = await expectToReject<ApmApiError>(() => + createAnnotation({ '@timestamp': new Date().toISOString(), message: 'New deployment', tags: ['foo'], @@ -56,11 +89,11 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { version: '1.1', environment: 'production', }, - }, - }); + }) + ); - expect(response.status).to.be(403); - expect(response.body.message).to.be( + expect(err.res.status).to.be(403); + expect(err.res.body.message).eql( 'Annotations require at least a gold license or a trial license.' ); }); @@ -79,52 +112,48 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { }); it('fails with a 400 bad request if data is missing', async () => { - const response = await request({ - url: '/api/apm/services/opbeans-java/annotation', - method: 'POST', - }); + const err = await expectToReject<ApmApiError>(() => + // @ts-expect-error + createAnnotation() + ); - expect(response.status).to.be(400); + expect(err.res.status).to.be(400); }); - it('fails with a 400 bad request if data is invalid', async () => { - const invalidTimestampResponse = await request({ - url: '/api/apm/services/opbeans-java/annotation', - method: 'POST', - data: { + it('fails with a 400 bad request if timestamp is invalid', async () => { + const invalidTimestampErr = await expectToReject<ApmApiError>(() => + // @ts-expect-error + createAnnotation({ '@timestamp': 'foo', message: 'foo', - }, - }); + }) + ); - expect(invalidTimestampResponse.status).to.be(400); + expect(invalidTimestampErr.res.status).to.be(400); + }); - const missingServiceVersionResponse = await request({ - url: '/api/apm/services/opbeans-java/annotation', - method: 'POST', - data: { + it('fails with a 400 bad request if data is invalid', async () => { + const err = await expectToReject<ApmApiError>(() => + // @ts-expect-error + createAnnotation({ '@timestamp': new Date().toISOString(), message: 'New deployment', - }, - }); + }) + ); - expect(missingServiceVersionResponse.status).to.be(400); + expect(err.res.status).to.be(400); }); it('completes with a 200 and the created annotation if data is complete and valid', async () => { const timestamp = new Date().toISOString(); - const response = await request({ - url: '/api/apm/services/opbeans-java/annotation', - method: 'POST', - data: { - '@timestamp': timestamp, - message: 'New deployment', - tags: ['foo'], - service: { - version: '1.1', - environment: 'production', - }, + const response = await createAnnotation({ + '@timestamp': timestamp, + message: 'New deployment', + tags: ['foo'], + service: { + version: '1.1', + environment: 'production', }, }); @@ -150,14 +179,10 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { it('prefills `message` and `tags`', async () => { const timestamp = new Date().toISOString(); - const response = await request({ - url: '/api/apm/services/opbeans-java/annotation', - method: 'POST', - data: { - '@timestamp': timestamp, - service: { - version: '1.1', - }, + const response = await createAnnotation({ + '@timestamp': timestamp, + service: { + version: '1.1', }, }); @@ -263,9 +288,10 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { end: new Date(2020, 4, 2, 20).toISOString(), }; - const response = await request({ - url: `/api/apm/services/${serviceName}/annotation/search?start=${range.start}&end=${range.end}&environment=ENVIRONMENT_ALL`, - method: 'GET', + const response = await getAnnotation({ + start: range.start, + end: range.end, + environment: ENVIRONMENT_ALL.value, }); expect(response.status).to.be(200); @@ -283,22 +309,19 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { expect( ( - await request({ - url: `/api/apm/services/${serviceName}/annotation`, - method: 'POST', - data: { - service: { - version: '1.3', - }, - '@timestamp': new Date(2020, 4, 2, 21, 30).toISOString(), + await createAnnotation({ + service: { + version: '1.3', }, + '@timestamp': new Date(2020, 4, 2, 21, 30).toISOString(), }) ).status ).to.be(200); - const response = await request({ - url: `/api/apm/services/${serviceName}/annotation/search?start=${range.start}&end=${range.end}&environment=ENVIRONMENT_ALL`, - method: 'GET', + const response = await getAnnotation({ + start: range.start, + end: range.end, + environment: ENVIRONMENT_ALL.value, }); expect(response.body.annotations.length).to.be(1); @@ -311,22 +334,19 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { expect( ( - await request({ - url: `/api/apm/services/${serviceName}/annotation`, - method: 'POST', - data: { - service: { - version: '1.3', - }, - '@timestamp': new Date(2020, 4, 2, 21, 30).toISOString(), + await createAnnotation({ + service: { + version: '1.3', }, + '@timestamp': new Date(2020, 4, 2, 21, 30).toISOString(), }) ).status ).to.be(200); - const responseFromEarlierRange = await request({ - url: `/api/apm/services/${serviceName}/annotation/search?start=${earlierRange.start}&end=${earlierRange.end}&environment=ENVIRONMENT_ALL`, - method: 'GET', + const responseFromEarlierRange = await getAnnotation({ + start: earlierRange.start, + end: earlierRange.end, + environment: ENVIRONMENT_ALL.value, }); expect(responseFromEarlierRange.body.annotations.length).to.be(2); @@ -337,31 +357,23 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { it('returns stored annotations for the given environment', async () => { expect( ( - await request({ - url: `/api/apm/services/${serviceName}/annotation`, - method: 'POST', - data: { - service: { - version: '1.3', - }, - '@timestamp': new Date(2020, 4, 2, 21, 30).toISOString(), + await createAnnotation({ + service: { + version: '1.3', }, + '@timestamp': new Date(2020, 4, 2, 21, 30).toISOString(), }) ).status ).to.be(200); expect( ( - await request({ - url: `/api/apm/services/${serviceName}/annotation`, - method: 'POST', - data: { - service: { - version: '1.4', - environment: 'production', - }, - '@timestamp': new Date(2020, 4, 2, 21, 31).toISOString(), + await createAnnotation({ + service: { + version: '1.4', + environment: 'production', }, + '@timestamp': new Date(2020, 4, 2, 21, 31).toISOString(), }) ).status ).to.be(200); @@ -371,24 +383,27 @@ export default function annotationApiTests({ getService }: FtrProviderContext) { end: new Date(2020, 4, 2, 23).toISOString(), }; - const allEnvironmentsResponse = await request({ - url: `/api/apm/services/${serviceName}/annotation/search?start=${range.start}&end=${range.end}&environment=ENVIRONMENT_ALL`, - method: 'GET', + const allEnvironmentsResponse = await getAnnotation({ + start: range.start, + end: range.end, + environment: ENVIRONMENT_ALL.value, }); expect(allEnvironmentsResponse.body.annotations.length).to.be(2); - const productionEnvironmentResponse = await request({ - url: `/api/apm/services/${serviceName}/annotation/search?start=${range.start}&end=${range.end}&environment=production`, - method: 'GET', + const productionEnvironmentResponse = await getAnnotation({ + start: range.start, + end: range.end, + environment: 'production', }); expect(productionEnvironmentResponse.body.annotations.length).to.be(1); expect(productionEnvironmentResponse.body.annotations[0].text).to.be('1.4'); - const missingEnvironmentsResponse = await request({ - url: `/api/apm/services/${serviceName}/annotation/search?start=${range.start}&end=${range.end}&environment=ENVIRONMENT_NOT_DEFINED`, - method: 'GET', + const missingEnvironmentsResponse = await getAnnotation({ + start: range.start, + end: range.end, + environment: ENVIRONMENT_NOT_DEFINED.value, }); expect(missingEnvironmentsResponse.body.annotations.length).to.be(1); diff --git a/x-pack/test/apm_api_integration/tests/settings/agent_keys/agent_keys.spec.ts b/x-pack/test/apm_api_integration/tests/settings/agent_keys/agent_keys.spec.ts index c0d6500fd298c..ef3c328fe0203 100644 --- a/x-pack/test/apm_api_integration/tests/settings/agent_keys/agent_keys.spec.ts +++ b/x-pack/test/apm_api_integration/tests/settings/agent_keys/agent_keys.spec.ts @@ -7,9 +7,10 @@ import expect from '@kbn/expect'; import { first } from 'lodash'; import { PrivilegeType } from '@kbn/apm-plugin/common/privilege_type'; +import { ApmUsername } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/authentication'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; import { ApmApiError, ApmApiSupertest } from '../../../common/apm_api_supertest'; -import { ApmUsername } from '../../../common/authentication'; +import { expectToReject } from '../../../common/utils/expect_to_reject'; export default function ApiTest({ getService }: FtrProviderContext) { const registry = getService('registry'); @@ -50,20 +51,24 @@ export default function ApiTest({ getService }: FtrProviderContext) { () => { describe('When the user does not have the required cluster privileges', () => { it('should return an error when creating an agent key', async () => { - const error = await expectToReject(() => createAgentKey(apmApiClient.writeUser)); + const error = await expectToReject<ApmApiError>(() => + createAgentKey(apmApiClient.writeUser) + ); expect(error.res.status).to.be(500); expect(error.res.body.message).contain('is missing the following requested privilege'); }); it('should return an error when invalidating an agent key', async () => { - const error = await expectToReject(() => + const error = await expectToReject<ApmApiError>(() => invalidateAgentKey(apmApiClient.writeUser, agentKeyName) ); expect(error.res.status).to.be(500); }); it('should return an error when getting a list of agent keys', async () => { - const error = await expectToReject(() => getAgentKeys(apmApiClient.writeUser)); + const error = await expectToReject<ApmApiError>(() => + getAgentKeys(apmApiClient.writeUser) + ); expect(error.res.status).to.be(500); }); }); @@ -71,7 +76,7 @@ export default function ApiTest({ getService }: FtrProviderContext) { describe('When the user does not have the required application privileges', () => { allApplicationPrivileges.map((privilege) => { it(`should return an error when creating an agent key with ${privilege} privilege`, async () => { - const error = await expectToReject(() => + const error = await expectToReject<ApmApiError>(() => createAgentKey(apmApiClient.manageOwnAgentKeysUser, [privilege]) ); expect(error.res.status).to.be(500); @@ -159,13 +164,4 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); } ); - - async function expectToReject(fn: () => Promise<any>): Promise<ApmApiError> { - try { - await fn(); - } catch (e) { - return e; - } - throw new Error(`Expected fn to throw`); - } } diff --git a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/no_access_user.spec.ts b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/no_access_user.spec.ts index eefd5226ee7d0..06be441facd25 100644 --- a/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/no_access_user.spec.ts +++ b/x-pack/test/apm_api_integration/tests/settings/anomaly_detection/no_access_user.spec.ts @@ -6,38 +6,50 @@ */ import expect from '@kbn/expect'; +import { ApmApiError } from '../../../common/apm_api_supertest'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; +import { expectToReject } from '../../../common/utils/expect_to_reject'; export default function apiTest({ getService }: FtrProviderContext) { const registry = getService('registry'); - const noAccessUser = getService('legacySupertestAsNoAccessUser'); + const apmApiClient = getService('apmApiClient'); function getJobs() { - return noAccessUser.get(`/internal/apm/settings/anomaly-detection/jobs`).set('kbn-xsrf', 'foo'); + return apmApiClient.noAccessUser({ + endpoint: 'GET /internal/apm/settings/anomaly-detection/jobs', + }); } function createJobs(environments: string[]) { - return noAccessUser - .post(`/internal/apm/settings/anomaly-detection/jobs`) - .send({ environments }) - .set('kbn-xsrf', 'foo'); + return apmApiClient.noAccessUser({ + endpoint: 'POST /internal/apm/settings/anomaly-detection/jobs', + params: { + body: { + environments, + }, + }, + }); } registry.when('ML jobs', { config: 'trial', archives: [] }, () => { describe('when user does not have read access to ML', () => { describe('when calling the endpoint for listing jobs', () => { it('returns an error because the user does not have access', async () => { - const { body } = await getJobs(); - expect(body.statusCode).to.be(403); - expect(body.error).to.be('Forbidden'); + const err = await expectToReject<ApmApiError>(() => getJobs()); + + expect(err.res.status).to.be(403); + expect(err.res.body.message).eql('Forbidden'); }); }); describe('when calling create endpoint', () => { it('returns an error because the user does not have access', async () => { - const { body } = await createJobs(['production', 'staging']); - expect(body.statusCode).to.be(403); - expect(body.error).to.be('Forbidden'); + const err = await expectToReject<ApmApiError>(() => + createJobs(['production', 'staging']) + ); + + expect(err.res.status).to.be(403); + expect(err.res.body.message).eql('Forbidden'); }); }); }); diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.spec.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.spec.snap deleted file mode 100644 index c4dfaf346d015..0000000000000 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/error_rate.spec.snap +++ /dev/null @@ -1,268 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`APM API tests basic apm_8.0.0 Error rate when data is loaded returns the transaction error rate has the correct error rate 1`] = ` -Array [ - Object { - "x": 1627973400000, - "y": 0, - }, - Object { - "x": 1627973460000, - "y": 0, - }, - Object { - "x": 1627973520000, - "y": 0.333333333333333, - }, - Object { - "x": 1627973580000, - "y": 0.181818181818182, - }, - Object { - "x": 1627973640000, - "y": 0, - }, - Object { - "x": 1627973700000, - "y": 0, - }, - Object { - "x": 1627973760000, - "y": 0.166666666666667, - }, - Object { - "x": 1627973820000, - "y": 0.181818181818182, - }, - Object { - "x": 1627973880000, - "y": 0, - }, - Object { - "x": 1627973940000, - "y": 0, - }, - Object { - "x": 1627974000000, - "y": 0.0833333333333333, - }, - Object { - "x": 1627974060000, - "y": 0.0769230769230769, - }, - Object { - "x": 1627974120000, - "y": 0, - }, - Object { - "x": 1627974180000, - "y": 0.1, - }, - Object { - "x": 1627974240000, - "y": 0.153846153846154, - }, - Object { - "x": 1627974300000, - "y": 0, - }, - Object { - "x": 1627974360000, - "y": null, - }, - Object { - "x": 1627974420000, - "y": 0, - }, - Object { - "x": 1627974480000, - "y": 0, - }, - Object { - "x": 1627974540000, - "y": 0, - }, - Object { - "x": 1627974600000, - "y": 0.125, - }, - Object { - "x": 1627974660000, - "y": 0.6, - }, - Object { - "x": 1627974720000, - "y": 0.2, - }, - Object { - "x": 1627974780000, - "y": 0, - }, - Object { - "x": 1627974840000, - "y": 0, - }, - Object { - "x": 1627974900000, - "y": 0.0666666666666667, - }, - Object { - "x": 1627974960000, - "y": 0, - }, - Object { - "x": 1627975020000, - "y": 0, - }, - Object { - "x": 1627975080000, - "y": 0, - }, - Object { - "x": 1627975140000, - "y": 0.181818181818182, - }, - Object { - "x": 1627975200000, - "y": null, - }, -] -`; - -exports[`APM API tests basic apm_8.0.0 Error rate when data is loaded returns the transaction error rate with comparison data has the correct error rate 1`] = ` -Array [ - Object { - "x": 1627974300000, - "y": 0, - }, - Object { - "x": 1627974360000, - "y": null, - }, - Object { - "x": 1627974420000, - "y": 0, - }, - Object { - "x": 1627974480000, - "y": 0, - }, - Object { - "x": 1627974540000, - "y": 0, - }, - Object { - "x": 1627974600000, - "y": 0.125, - }, - Object { - "x": 1627974660000, - "y": 0.6, - }, - Object { - "x": 1627974720000, - "y": 0.2, - }, - Object { - "x": 1627974780000, - "y": 0, - }, - Object { - "x": 1627974840000, - "y": 0, - }, - Object { - "x": 1627974900000, - "y": 0.0666666666666667, - }, - Object { - "x": 1627974960000, - "y": 0, - }, - Object { - "x": 1627975020000, - "y": 0, - }, - Object { - "x": 1627975080000, - "y": 0, - }, - Object { - "x": 1627975140000, - "y": 0.181818181818182, - }, - Object { - "x": 1627975200000, - "y": null, - }, -] -`; - -exports[`APM API tests basic apm_8.0.0 Error rate when data is loaded returns the transaction error rate with comparison data has the correct error rate 2`] = ` -Array [ - Object { - "x": 1627974300000, - "y": 0, - }, - Object { - "x": 1627974360000, - "y": 0, - }, - Object { - "x": 1627974420000, - "y": 0.333333333333333, - }, - Object { - "x": 1627974480000, - "y": 0.181818181818182, - }, - Object { - "x": 1627974540000, - "y": 0, - }, - Object { - "x": 1627974600000, - "y": 0, - }, - Object { - "x": 1627974660000, - "y": 0.166666666666667, - }, - Object { - "x": 1627974720000, - "y": 0.181818181818182, - }, - Object { - "x": 1627974780000, - "y": 0, - }, - Object { - "x": 1627974840000, - "y": 0, - }, - Object { - "x": 1627974900000, - "y": 0.0833333333333333, - }, - Object { - "x": 1627974960000, - "y": 0.0769230769230769, - }, - Object { - "x": 1627975020000, - "y": 0, - }, - Object { - "x": 1627975080000, - "y": 0.1, - }, - Object { - "x": 1627975140000, - "y": 0.153846153846154, - }, - Object { - "x": 1627975200000, - "y": null, - }, -] -`; diff --git a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.spec.snap b/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.spec.snap deleted file mode 100644 index dec67450bdbda..0000000000000 --- a/x-pack/test/apm_api_integration/tests/transactions/__snapshots__/latency.spec.snap +++ /dev/null @@ -1,131 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`APM API tests basic apm_8.0.0 Latency with a basic license when data is loaded time comparison returns some data 1`] = ` -Array [ - Object { - "x": 1627974300000, - "y": 22799, - }, - Object { - "x": 1627974360000, - "y": 3227391, - }, - Object { - "x": 1627974420000, - "y": 15565.2222222222, - }, - Object { - "x": 1627974480000, - "y": 54307.5714285714, - }, - Object { - "x": 1627974540000, - "y": 16655, - }, - Object { - "x": 1627974600000, - "y": 9453, - }, - Object { - "x": 1627974660000, - "y": 31119, - }, - Object { - "x": 1627974720000, - "y": 15282.2, - }, - Object { - "x": 1627974780000, - "y": 18709, - }, - Object { - "x": 1627974840000, - "y": 12095, - }, - Object { - "x": 1627974900000, - "y": 16291, - }, - Object { - "x": 1627974960000, - "y": 13444.3333333333, - }, - Object { - "x": 1627975020000, - "y": 13241.6666666667, - }, - Object { - "x": 1627975080000, - "y": 25535, - }, - Object { - "x": 1627975140000, - "y": 11024.6, - }, -] -`; - -exports[`APM API tests basic apm_8.0.0 Latency with a basic license when data is loaded time comparison returns some data 2`] = ` -Array [ - Object { - "x": 1627974300000, - "y": 34866.2, - }, - Object { - "x": 1627974360000, - "y": 104799, - }, - Object { - "x": 1627974420000, - "y": 36247, - }, - Object { - "x": 1627974480000, - "y": 22207, - }, - Object { - "x": 1627974540000, - "y": 80191, - }, - Object { - "x": 1627974600000, - "y": 11520.4545454545, - }, - Object { - "x": 1627974660000, - "y": 47031.8888888889, - }, - Object { - "x": 1627974720000, - "y": 30249.6666666667, - }, - Object { - "x": 1627974780000, - "y": 14868.3333333333, - }, - Object { - "x": 1627974840000, - "y": 17199, - }, - Object { - "x": 1627974900000, - "y": 19837.2222222222, - }, - Object { - "x": 1627974960000, - "y": 19397.6666666667, - }, - Object { - "x": 1627975020000, - "y": 22473.6666666667, - }, - Object { - "x": 1627975080000, - "y": 11362.2, - }, - Object { - "x": 1627975140000, - "y": 26319, - }, -] -`; diff --git a/x-pack/test/apm_api_integration/tests/transactions/error_rate.spec.ts b/x-pack/test/apm_api_integration/tests/transactions/error_rate.spec.ts index ee834a8936496..8df3f9e17558f 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/error_rate.spec.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/error_rate.spec.ts @@ -4,12 +4,15 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { apm, timerange } from '@kbn/apm-synthtrace'; import expect from '@kbn/expect'; import { first, last } from 'lodash'; import moment from 'moment'; -import { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; -import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; +import { + APIClientRequestParamsOf, + APIReturnType, +} from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; +import { RecursivePartial } from '@kbn/apm-plugin/typings/common'; import { FtrProviderContext } from '../../common/ftr_provider_context'; type ErrorRate = @@ -18,48 +21,36 @@ type ErrorRate = export default function ApiTest({ getService }: FtrProviderContext) { const registry = getService('registry'); const apmApiClient = getService('apmApiClient'); - - const archiveName = 'apm_8.0.0'; + const synthtraceEsClient = getService('synthtraceEsClient'); // url parameters - const { start, end } = archives_metadata[archiveName]; - const transactionType = 'request'; - - async function fetchErrorCharts({ - serviceName, - query, - }: { - serviceName: string; - query: { - start: string; - end: string; - transactionType: string; - environment: string; - kuery: string; - offset?: string; - }; - }) { + const start = new Date('2021-01-01T00:00:00.000Z').getTime(); + const end = new Date('2021-01-01T00:15:00.000Z').getTime() - 1; + + async function fetchErrorCharts( + overrides?: RecursivePartial< + APIClientRequestParamsOf<'GET /internal/apm/services/{serviceName}/transactions/charts/error_rate'>['params'] + > + ) { return await apmApiClient.readUser({ endpoint: `GET /internal/apm/services/{serviceName}/transactions/charts/error_rate`, params: { - path: { serviceName }, - query, + path: { serviceName: overrides?.path?.serviceName || 'opbeans-go' }, + query: { + start: new Date(start).toISOString(), + end: new Date(end).toISOString(), + transactionType: 'request', + environment: 'ENVIRONMENT_ALL', + kuery: '', + ...overrides?.query, + }, }, }); } registry.when('Error rate when data is not loaded', { config: 'basic', archives: [] }, () => { it('handles the empty state', async () => { - const response = await fetchErrorCharts({ - serviceName: 'opbeans-java', - query: { - start, - end, - transactionType, - environment: 'ENVIRONMENT_ALL', - kuery: '', - }, - }); + const response = await fetchErrorCharts(); expect(response.status).to.be(200); const body = response.body as ErrorRate; @@ -71,14 +62,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { it('handles the empty state with comparison data', async () => { const response = await fetchErrorCharts({ - serviceName: 'opbeans-java', query: { - transactionType, - start: moment(end).subtract(15, 'minutes').toISOString(), - end, - offset: '15m', - environment: 'ENVIRONMENT_ALL', - kuery: '', + start: moment(end).subtract(7, 'minutes').toISOString(), + offset: '7m', }, }); expect(response.status).to.be(200); @@ -91,149 +77,174 @@ export default function ApiTest({ getService }: FtrProviderContext) { }); }); - registry.when( - 'Error rate when data is loaded', - { config: 'basic', archives: [archiveName] }, - () => { - describe('returns the transaction error rate', () => { - let errorRateResponse: ErrorRate; - - before(async () => { - const response = await fetchErrorCharts({ - serviceName: 'opbeans-java', - query: { - start, - end, - transactionType, - environment: 'ENVIRONMENT_ALL', - kuery: '', - }, - }); - - errorRateResponse = response.body; - }); - - it('returns some data', () => { - expect(errorRateResponse.currentPeriod.average).to.be.greaterThan(0); - expect(errorRateResponse.previousPeriod.average).to.be(null); + registry.when('Error rate when data is loaded', { config: 'basic', archives: [] }, () => { + const config = { + firstTransaction: { + name: 'GET /apple 🍎 ', + successRate: 50, + failureRate: 50, + }, + }; + before(async () => { + const serviceGoProdInstance = apm + .service({ name: 'opbeans-go', environment: 'production', agentName: 'go' }) + .instance('instance-a'); + + const { firstTransaction } = config; + + const documents = timerange(start, end) + .ratePerMinute(firstTransaction.successRate) + .generator((timestamp) => + serviceGoProdInstance + .transaction({ transactionName: firstTransaction.name }) + .timestamp(timestamp) + .duration(1000) + .success() + ) + .merge( + timerange(start, end) + .ratePerMinute(firstTransaction.failureRate) + .generator((timestamp) => + serviceGoProdInstance + .transaction({ transactionName: firstTransaction.name }) + .errors( + serviceGoProdInstance + .error({ + message: 'Error 1', + type: firstTransaction.name, + groupingName: 'Error test', + }) + .timestamp(timestamp) + ) + .duration(1000) + .timestamp(timestamp) + .failure() + ) + ); + + await synthtraceEsClient.index(documents); + }); - expect(errorRateResponse.currentPeriod.timeseries.length).to.be.greaterThan(0); - expect(errorRateResponse.previousPeriod.timeseries).to.empty(); + after(() => synthtraceEsClient.clean()); - const nonNullDataPoints = errorRateResponse.currentPeriod.timeseries.filter( - ({ y }) => y !== null - ); + describe('returns the transaction error rate', () => { + let errorRateResponse: ErrorRate; - expect(nonNullDataPoints.length).to.be.greaterThan(0); + before(async () => { + const response = await fetchErrorCharts({ + query: { transactionName: config.firstTransaction.name }, }); + errorRateResponse = response.body; + }); - it('has the correct start date', () => { - expectSnapshot( - new Date(first(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T06:50:00.000Z"`); - }); + it('returns some data', () => { + expect(errorRateResponse.currentPeriod.average).to.be.greaterThan(0); + expect(errorRateResponse.previousPeriod.average).to.be(null); - it('has the correct end date', () => { - expectSnapshot( - new Date(last(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); - }); + expect(errorRateResponse.currentPeriod.timeseries).not.to.be.empty(); + expect(errorRateResponse.previousPeriod.timeseries).to.empty(); - it('has the correct number of buckets', () => { - expectSnapshot(errorRateResponse.currentPeriod.timeseries.length).toMatchInline(`31`); - }); + const nonNullDataPoints = errorRateResponse.currentPeriod.timeseries.filter( + ({ y }) => y !== null + ); - it('has the correct calculation for average', () => { - expectSnapshot(errorRateResponse.currentPeriod.average).toMatchInline( - `0.0848214285714286` - ); - }); + expect(nonNullDataPoints).not.to.be.empty(); + }); - it('has the correct error rate', () => { - expectSnapshot(errorRateResponse.currentPeriod.timeseries).toMatch(); - }); + it('has the correct start date', () => { + expect( + new Date(first(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() + ).to.eql('2021-01-01T00:00:00.000Z'); + }); + + it('has the correct end date', () => { + expect( + new Date(last(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() + ).to.eql('2021-01-01T00:14:00.000Z'); + }); + + it('has the correct number of buckets', () => { + expect(errorRateResponse.currentPeriod.timeseries.length).to.be.eql(15); }); - describe('returns the transaction error rate with comparison data', () => { - let errorRateResponse: ErrorRate; + it('has the correct calculation for average', () => { + expect(errorRateResponse.currentPeriod.average).to.eql( + config.firstTransaction.failureRate / 100 + ); + }); + }); - before(async () => { - const response = await fetchErrorCharts({ - serviceName: 'opbeans-java', - query: { - transactionType, - start: moment(end).subtract(15, 'minutes').toISOString(), - end, - offset: '15m', - environment: 'ENVIRONMENT_ALL', - kuery: '', - }, - }); + describe('returns the transaction error rate with comparison data', () => { + let errorRateResponse: ErrorRate; - errorRateResponse = response.body; + before(async () => { + const response = await fetchErrorCharts({ + query: { + transactionName: config.firstTransaction.name, + start: moment(end).subtract(7, 'minutes').toISOString(), + offset: '7m', + }, }); - it('returns some data', () => { - expect(errorRateResponse.currentPeriod.average).to.be.greaterThan(0); - expect(errorRateResponse.previousPeriod.average).to.be.greaterThan(0); + errorRateResponse = response.body; + }); - expect(errorRateResponse.currentPeriod.timeseries.length).to.be.greaterThan(0); - expect(errorRateResponse.previousPeriod.timeseries.length).to.be.greaterThan(0); + it('returns some data', () => { + expect(errorRateResponse.currentPeriod.average).to.be.greaterThan(0); + expect(errorRateResponse.previousPeriod.average).to.be.greaterThan(0); - const currentPeriodNonNullDataPoints = errorRateResponse.currentPeriod.timeseries.filter( - ({ y }) => y !== null - ); + expect(errorRateResponse.currentPeriod.timeseries).not.to.be.empty(); + expect(errorRateResponse.previousPeriod.timeseries).not.to.be.empty(); - const previousPeriodNonNullDataPoints = - errorRateResponse.previousPeriod.timeseries.filter(({ y }) => y !== null); + const currentPeriodNonNullDataPoints = errorRateResponse.currentPeriod.timeseries.filter( + ({ y }) => y !== null + ); - expect(currentPeriodNonNullDataPoints.length).to.be.greaterThan(0); - expect(previousPeriodNonNullDataPoints.length).to.be.greaterThan(0); - }); + const previousPeriodNonNullDataPoints = errorRateResponse.previousPeriod.timeseries.filter( + ({ y }) => y !== null + ); - it('has the correct start date', () => { - expectSnapshot( - new Date(first(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T07:05:00.000Z"`); - expectSnapshot( - new Date(first(errorRateResponse.previousPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T07:05:00.000Z"`); - }); + expect(currentPeriodNonNullDataPoints).not.to.be.empty(); + expect(previousPeriodNonNullDataPoints).not.to.be.empty(); + }); - it('has the correct end date', () => { - expectSnapshot( - new Date(last(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); - expectSnapshot( - new Date(last(errorRateResponse.previousPeriod.timeseries)?.x ?? NaN).toISOString() - ).toMatchInline(`"2021-08-03T07:20:00.000Z"`); - }); + it('has the correct start date', () => { + expect( + new Date(first(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() + ).to.eql('2021-01-01T00:07:00.000Z'); + expect( + new Date(first(errorRateResponse.previousPeriod.timeseries)?.x ?? NaN).toISOString() + ).to.eql('2021-01-01T00:07:00.000Z'); + }); - it('has the correct number of buckets', () => { - expectSnapshot(errorRateResponse.currentPeriod.timeseries.length).toMatchInline(`16`); - expectSnapshot(errorRateResponse.previousPeriod.timeseries.length).toMatchInline(`16`); - }); + it('has the correct end date', () => { + expect( + new Date(last(errorRateResponse.currentPeriod.timeseries)?.x ?? NaN).toISOString() + ).to.eql('2021-01-01T00:14:00.000Z'); + expect( + new Date(last(errorRateResponse.previousPeriod.timeseries)?.x ?? NaN).toISOString() + ).to.eql('2021-01-01T00:14:00.000Z'); + }); - it('has the correct calculation for average', () => { - expectSnapshot(errorRateResponse.currentPeriod.average).toMatchInline( - `0.0792079207920792` - ); - expectSnapshot(errorRateResponse.previousPeriod.average).toMatchInline( - `0.0894308943089431` - ); - }); + it('has the correct number of buckets', () => { + expect(errorRateResponse.currentPeriod.timeseries.length).to.eql(8); + expect(errorRateResponse.previousPeriod.timeseries.length).to.eql(8); + }); - it('has the correct error rate', () => { - expectSnapshot(errorRateResponse.currentPeriod.timeseries).toMatch(); - expectSnapshot(errorRateResponse.previousPeriod.timeseries).toMatch(); - }); + it('has the correct calculation for average', () => { + expect(errorRateResponse.currentPeriod.average).to.eql( + config.firstTransaction.failureRate / 100 + ); + expect(errorRateResponse.previousPeriod.average).to.eql( + config.firstTransaction.failureRate / 100 + ); + }); - it('matches x-axis on current period and previous period', () => { - expect(errorRateResponse.currentPeriod.timeseries.map(({ x }) => x)).to.be.eql( - errorRateResponse.previousPeriod.timeseries.map(({ x }) => x) - ); - }); + it('matches x-axis on current period and previous period', () => { + expect(errorRateResponse.currentPeriod.timeseries.map(({ x }) => x)).to.be.eql( + errorRateResponse.previousPeriod.timeseries.map(({ x }) => x) + ); }); - } - ); + }); + }); } diff --git a/x-pack/test/apm_api_integration/tests/transactions/latency.spec.ts b/x-pack/test/apm_api_integration/tests/transactions/latency.spec.ts index bcd59423ce3cb..50bae6074a9b1 100644 --- a/x-pack/test/apm_api_integration/tests/transactions/latency.spec.ts +++ b/x-pack/test/apm_api_integration/tests/transactions/latency.spec.ts @@ -4,13 +4,17 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - +import { apm, timerange } from '@kbn/apm-synthtrace'; import expect from '@kbn/expect'; import moment from 'moment'; -import { APIReturnType } from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; +import { + APIClientRequestParamsOf, + APIReturnType, +} from '@kbn/apm-plugin/public/services/rest/create_call_apm_api'; import { LatencyAggregationType } from '@kbn/apm-plugin/common/latency_aggregation_types'; +import { RecursivePartial } from '@kbn/apm-plugin/typings/common'; +import { meanBy } from 'lodash'; import { FtrProviderContext } from '../../common/ftr_provider_context'; -import archives_metadata from '../../common/fixtures/es_archiver/archives_metadata'; type LatencyChartReturnType = APIReturnType<'GET /internal/apm/services/{serviceName}/transactions/charts/latency'>; @@ -18,31 +22,30 @@ type LatencyChartReturnType = export default function ApiTest({ getService }: FtrProviderContext) { const registry = getService('registry'); const apmApiClient = getService('apmApiClient'); + const synthtraceEsClient = getService('synthtraceEsClient'); - const archiveName = 'apm_8.0.0'; - - const { start, end } = archives_metadata[archiveName]; + const serviceName = 'synth-go'; + const start = new Date('2021-01-01T00:00:00.000Z').getTime(); + const end = new Date('2021-01-01T00:15:00.000Z').getTime() - 1; - async function fetchLatencyCharts({ - serviceName, - query, - }: { - serviceName: string; - query: { - start: string; - end: string; - latencyAggregationType: LatencyAggregationType; - transactionType: string; - environment: string; - kuery: string; - offset?: string; - }; - }) { + async function fetchLatencyCharts( + overrides?: RecursivePartial< + APIClientRequestParamsOf<'GET /internal/apm/services/{serviceName}/transactions/charts/latency'>['params'] + > + ) { return await apmApiClient.readUser({ endpoint: `GET /internal/apm/services/{serviceName}/transactions/charts/latency`, params: { - path: { serviceName }, - query, + path: { serviceName: overrides?.path?.serviceName || serviceName }, + query: { + start: new Date(start).toISOString(), + end: new Date(end).toISOString(), + latencyAggregationType: LatencyAggregationType.avg, + transactionType: 'request', + environment: 'ENVIRONMENT_ALL', + kuery: '', + ...overrides?.query, + }, }, }); } @@ -52,20 +55,8 @@ export default function ApiTest({ getService }: FtrProviderContext) { { config: 'basic', archives: [] }, () => { it('handles the empty state', async () => { - const response = await fetchLatencyCharts({ - serviceName: 'opbeans-node', - query: { - start, - end, - latencyAggregationType: LatencyAggregationType.avg, - transactionType: 'request', - environment: 'testing', - kuery: '', - }, - }); - + const response = await fetchLatencyCharts(); expect(response.status).to.be(200); - const latencyChartReturn = response.body as LatencyChartReturnType; expect(latencyChartReturn.currentPeriod.overallAvgDuration).to.be(null); @@ -77,73 +68,90 @@ export default function ApiTest({ getService }: FtrProviderContext) { registry.when( 'Latency with a basic license when data is loaded', - { config: 'basic', archives: [archiveName] }, + { config: 'basic', archives: [] }, () => { + const GO_PROD_RATE = 80; + const GO_DEV_RATE = 20; + const GO_PROD_DURATION = 1000; + const GO_DEV_DURATION = 500; + before(async () => { + const serviceGoProdInstance = apm + .service({ name: serviceName, environment: 'production', agentName: 'go' }) + .instance('instance-a'); + const serviceGoDevInstance = apm + .service({ name: serviceName, environment: 'development', agentName: 'go' }) + .instance('instance-b'); + + await synthtraceEsClient.index([ + timerange(start, end) + .ratePerMinute(GO_PROD_RATE) + .generator((timestamp) => + serviceGoProdInstance + .transaction({ transactionName: 'GET /api/product/list' }) + .duration(GO_PROD_DURATION) + .timestamp(timestamp) + ), + timerange(start, end) + .ratePerMinute(GO_DEV_RATE) + .generator((timestamp) => + serviceGoDevInstance + .transaction({ transactionName: 'GET /api/product/:id' }) + .duration(GO_DEV_DURATION) + .timestamp(timestamp) + ), + ]); + }); + + after(() => synthtraceEsClient.clean()); + + const expectedLatencyAvgValueMs = + ((GO_PROD_RATE * GO_PROD_DURATION + GO_DEV_RATE * GO_DEV_DURATION) / + (GO_PROD_RATE + GO_DEV_RATE)) * + 1000; + describe('average latency type', () => { it('returns average duration and timeseries', async () => { - const response = await fetchLatencyCharts({ - serviceName: 'opbeans-node', - query: { - start, - end, - latencyAggregationType: LatencyAggregationType.avg, - transactionType: 'request', - environment: 'testing', - kuery: '', - }, - }); + const response = await fetchLatencyCharts(); expect(response.status).to.be(200); const latencyChartReturn = response.body as LatencyChartReturnType; - expect(latencyChartReturn.currentPeriod.overallAvgDuration).not.to.be(null); - expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(31); + expect(latencyChartReturn.currentPeriod.overallAvgDuration).to.be( + expectedLatencyAvgValueMs + ); + expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(15); }); }); describe('95th percentile latency type', () => { it('returns average duration and timeseries', async () => { const response = await fetchLatencyCharts({ - serviceName: 'opbeans-node', - query: { - start, - end, - latencyAggregationType: LatencyAggregationType.p95, - transactionType: 'request', - environment: 'testing', - kuery: '', - }, + query: { latencyAggregationType: LatencyAggregationType.p95 }, }); expect(response.status).to.be(200); const latencyChartReturn = response.body as LatencyChartReturnType; - expect(latencyChartReturn.currentPeriod.overallAvgDuration).not.to.be(null); - expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(31); + expect(latencyChartReturn.currentPeriod.overallAvgDuration).to.be( + expectedLatencyAvgValueMs + ); + expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(15); }); }); describe('99th percentile latency type', () => { it('returns average duration and timeseries', async () => { const response = await fetchLatencyCharts({ - serviceName: 'opbeans-node', query: { - start, - end, latencyAggregationType: LatencyAggregationType.p99, - transactionType: 'request', - environment: 'testing', - kuery: '', }, }); expect(response.status).to.be(200); const latencyChartReturn = response.body as LatencyChartReturnType; - expect(latencyChartReturn.currentPeriod.overallAvgDuration).not.to.be(null); - expectSnapshot(latencyChartReturn.currentPeriod.overallAvgDuration).toMatchInline( - `53906.6603773585` + expect(latencyChartReturn.currentPeriod.overallAvgDuration).to.be( + expectedLatencyAvgValueMs ); - - expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(31); + expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(15); }); }); @@ -152,14 +160,9 @@ export default function ApiTest({ getService }: FtrProviderContext) { before(async () => { response = await fetchLatencyCharts({ - serviceName: 'opbeans-node', query: { - latencyAggregationType: LatencyAggregationType.avg, - transactionType: 'request', - start: moment(end).subtract(15, 'minutes').toISOString(), - end, - offset: '15m', - environment: 'ENVIRONMENT_ALL', + start: moment(end).subtract(7, 'minutes').toISOString(), + offset: '7m', kuery: '', }, }); @@ -175,8 +178,8 @@ export default function ApiTest({ getService }: FtrProviderContext) { latencyChartReturn.previousPeriod.latencyTimeseries.filter(({ y }) => y !== null); expect(previousPeriodNonNullDataPoints.length).to.be.greaterThan(0); - expectSnapshot(currentPeriodNonNullDataPoints).toMatch(); - expectSnapshot(previousPeriodNonNullDataPoints).toMatch(); + expect(meanBy(currentPeriodNonNullDataPoints, 'y')).to.eql(expectedLatencyAvgValueMs); + expect(meanBy(previousPeriodNonNullDataPoints, 'y')).to.eql(expectedLatencyAvgValueMs); }); it('matches x-axis on current period and previous period', () => { @@ -192,14 +195,8 @@ export default function ApiTest({ getService }: FtrProviderContext) { before(async () => { response = await fetchLatencyCharts({ - serviceName: 'opbeans-node', query: { - start, - end, - latencyAggregationType: LatencyAggregationType.avg, - transactionType: 'request', environment: 'does-not-exist', - kuery: '', }, }); }); @@ -216,74 +213,24 @@ export default function ApiTest({ getService }: FtrProviderContext) { expect(currentPeriodNonNullDataPoints).to.be.empty(); }); }); - } - ); - - registry.when( - 'Transaction latency with a trial license when data is loaded', - { config: 'trial', archives: [archiveName] }, - () => { - let response: Awaited<ReturnType<typeof fetchLatencyCharts>>; - const transactionType = 'request'; - - describe('without an environment', () => { - before(async () => { - response = await fetchLatencyCharts({ - serviceName: 'opbeans-node', - query: { - start, - end, - latencyAggregationType: LatencyAggregationType.avg, - transactionType, - environment: 'ENVIRONMENT_ALL', - kuery: '', - }, - }); - }); - - it('returns an ok response', () => { - expect(response.status).to.eql(200); - }); - }); + describe('with production environment', () => { + let response: Awaited<ReturnType<typeof fetchLatencyCharts>>; - describe('with environment selected', () => { before(async () => { response = await fetchLatencyCharts({ - serviceName: 'opbeans-node', query: { - start, - end, - latencyAggregationType: LatencyAggregationType.avg, - transactionType, environment: 'production', - kuery: '', }, }); }); - it('should have a successful response', () => { - expect(response.status).to.eql(200); - }); - }); - - describe('with all environments selected', () => { - before(async () => { - response = await fetchLatencyCharts({ - serviceName: 'opbeans-node', - query: { - start, - end, - latencyAggregationType: LatencyAggregationType.avg, - transactionType, - environment: 'ENVIRONMENT_ALL', - kuery: '', - }, - }); - }); - - it('should have a successful response', () => { - expect(response.status).to.eql(200); + it('returns average duration and timeseries', async () => { + const latencyChartReturn = response.body as LatencyChartReturnType; + expect(latencyChartReturn.currentPeriod.overallAvgDuration).to.be( + GO_PROD_DURATION * 1000 + ); + expect(latencyChartReturn.currentPeriod.latencyTimeseries.length).to.be.eql(15); }); }); } diff --git a/x-pack/test/detection_engine_api_integration/security_and_spaces/group10/perform_bulk_action.ts b/x-pack/test/detection_engine_api_integration/security_and_spaces/group10/perform_bulk_action.ts index c17e679b6be31..8f06bc93820a4 100644 --- a/x-pack/test/detection_engine_api_integration/security_and_spaces/group10/perform_bulk_action.ts +++ b/x-pack/test/detection_engine_api_integration/security_and_spaces/group10/perform_bulk_action.ts @@ -1829,6 +1829,42 @@ export default ({ getService }: FtrProviderContext): void => { expect(setIndexRule.data_view_id).to.eql(undefined); }); + it('should return error when set an empty index pattern to a rule and overwrite the data view when overwrite_data_views is true', async () => { + const dataViewId = 'index1-*'; + const simpleRule = { + ...getSimpleRule(), + index: undefined, + data_view_id: dataViewId, + }; + const rule = await createRule(supertest, log, simpleRule); + + const { body } = await postBulkAction() + .send({ + query: '', + action: BulkAction.edit, + [BulkAction.edit]: [ + { + type: BulkActionEditType.set_index_patterns, + value: [], + overwrite_data_views: true, + }, + ], + }) + .expect(500); + + expect(body.attributes.summary).to.eql({ failed: 1, succeeded: 0, total: 1 }); + expect(body.attributes.errors[0]).to.eql({ + message: "Mutated params invalid: Index patterns can't be empty", + status_code: 500, + rules: [ + { + id: rule.id, + name: rule.name, + }, + ], + }); + }); + it('should NOT set an index pattern to a rule and overwrite the data view when overwrite_data_views is false', async () => { const ruleId = 'ruleId'; const dataViewId = 'index1-*'; diff --git a/x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_security.ts b/x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_security.ts index 8f7fc4fe73062..3a33f14d682a6 100644 --- a/x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_security.ts +++ b/x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_security.ts @@ -6,10 +6,6 @@ */ import expect from '@kbn/expect'; -import { - createDashboardEditUrl, - DashboardConstants, -} from '@kbn/dashboard-plugin/public/dashboard_constants'; import { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ getPageObjects, getService }: FtrProviderContext) { @@ -32,6 +28,11 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const savedQueryManagementComponent = getService('savedQueryManagementComponent'); const kbnServer = getService('kibanaServer'); + const navigationArgs = { + ensureCurrentUrl: false, + shouldLoginIfPrompted: false, + }; + describe('dashboard feature controls security', () => { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); @@ -97,14 +98,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`landing page shows "Create new Dashboard" button`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.LANDING_PAGE_PATH, - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardListingURL({ + args: navigationArgs, + }); await testSubjects.existOrFail('dashboardLandingPage', { timeout: config.get('timeouts.waitFor'), }); @@ -116,28 +112,17 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`create new dashboard shows addNew button`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.CREATE_NEW_DASHBOARD_URL, - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardURL({ args: navigationArgs }); await testSubjects.existOrFail('emptyDashboardWidget', { timeout: config.get('timeouts.waitFor'), }); }); it(`can view existing Dashboard`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - createDashboardEditUrl('i-exist'), - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardURL({ + id: 'i-exist', + args: navigationArgs, + }); await testSubjects.existOrFail('embeddablePanelHeading-APie', { timeout: config.get('timeouts.waitFor'), }); @@ -307,14 +292,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`landing page doesn't show "Create new Dashboard" button`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.LANDING_PAGE_PATH, - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardListingURL({ + args: navigationArgs, + }); await testSubjects.existOrFail('dashboardLandingPage', { timeout: config.get('timeouts.waitFor'), }); @@ -322,38 +302,24 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`shows read-only badge`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.LANDING_PAGE_PATH, - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardListingURL({ + args: navigationArgs, + }); await globalNav.badgeExistsOrFail('Read only'); }); it(`create new dashboard shows the read only warning`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.CREATE_NEW_DASHBOARD_URL, - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardURL({ + args: navigationArgs, + }); await testSubjects.existOrFail('dashboardEmptyReadOnly', { timeout: 20000 }); }); it(`can view existing Dashboard`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - createDashboardEditUrl('i-exist'), - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardURL({ + id: 'i-exist', + args: navigationArgs, + }); await testSubjects.existOrFail('embeddablePanelHeading-APie', { timeout: config.get('timeouts.waitFor'), }); @@ -438,14 +404,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`landing page doesn't show "Create new Dashboard" button`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.LANDING_PAGE_PATH, - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardListingURL({ + args: navigationArgs, + }); await testSubjects.existOrFail('dashboardLandingPage', { timeout: 10000 }); await testSubjects.missingOrFail('newItemButton'); }); @@ -455,26 +416,14 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`create new dashboard shows the read only warning`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.CREATE_NEW_DASHBOARD_URL, - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardURL({ + args: navigationArgs, + }); await testSubjects.existOrFail('dashboardEmptyReadOnly', { timeout: 20000 }); }); it(`can view existing Dashboard`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - createDashboardEditUrl('i-exist'), - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardURL({ id: 'i-exist', args: navigationArgs }); await testSubjects.existOrFail('embeddablePanelHeading-APie', { timeout: 10000 }); }); @@ -552,50 +501,24 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`landing page shows 403`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.LANDING_PAGE_PATH, - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardListingURL({ + args: navigationArgs, + }); await PageObjects.error.expectForbidden(); }); it(`create new dashboard shows 403`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.CREATE_NEW_DASHBOARD_URL, - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardURL({ args: navigationArgs }); await PageObjects.error.expectForbidden(); }); it(`edit dashboard for object which doesn't exist shows 403`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - createDashboardEditUrl('i-dont-exist'), - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardURL({ id: 'i-dont-exist', args: navigationArgs }); await PageObjects.error.expectForbidden(); }); it(`edit dashboard for object which exists shows 403`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - createDashboardEditUrl('i-exist'), - { - ensureCurrentUrl: false, - shouldLoginIfPrompted: false, - } - ); + await PageObjects.dashboard.gotoDashboardURL({ id: 'i-exist', args: navigationArgs }); await PageObjects.error.expectForbidden(); }); }); diff --git a/x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_spaces.ts b/x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_spaces.ts index a702b7a716a15..ef8c83ec667ba 100644 --- a/x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_spaces.ts +++ b/x-pack/test/functional/apps/dashboard/group1/feature_controls/dashboard_spaces.ts @@ -6,10 +6,6 @@ */ import expect from '@kbn/expect'; -import { - createDashboardEditUrl, - DashboardConstants, -} from '@kbn/dashboard-plugin/public/dashboard_constants'; import { FtrProviderContext } from '../../../../ftr_provider_context'; export default function ({ getPageObjects, getService }: FtrProviderContext) { @@ -53,15 +49,13 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`landing page shows "Create new Dashboard" button`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.LANDING_PAGE_PATH, - { + await PageObjects.dashboard.gotoDashboardListingURL({ + args: { basePath: '/s/custom_space', ensureCurrentUrl: false, shouldLoginIfPrompted: false, - } - ); + }, + }); await testSubjects.existOrFail('dashboardLandingPage', { timeout: config.get('timeouts.waitFor'), }); @@ -69,30 +63,27 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`create new dashboard shows addNew button`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.CREATE_NEW_DASHBOARD_URL, - { + await PageObjects.dashboard.gotoDashboardURL({ + args: { basePath: '/s/custom_space', ensureCurrentUrl: false, shouldLoginIfPrompted: false, - } - ); + }, + }); await testSubjects.existOrFail('emptyDashboardWidget', { timeout: config.get('timeouts.waitFor'), }); }); it(`can view existing Dashboard`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - createDashboardEditUrl('8fba09d8-df3f-5aa1-83cc-65f7fbcbc0d9'), - { + await PageObjects.dashboard.gotoDashboardURL({ + id: '8fba09d8-df3f-5aa1-83cc-65f7fbcbc0d9', + args: { basePath: '/s/custom_space', ensureCurrentUrl: false, shouldLoginIfPrompted: false, - } - ); + }, + }); await testSubjects.existOrFail('embeddablePanelHeading-APie', { timeout: config.get('timeouts.waitFor'), }); @@ -125,41 +116,37 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { }); it(`create new dashboard shows 404`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - DashboardConstants.CREATE_NEW_DASHBOARD_URL, - { + await PageObjects.dashboard.gotoDashboardURL({ + args: { basePath: '/s/custom_space', ensureCurrentUrl: false, shouldLoginIfPrompted: false, - } - ); + }, + }); await PageObjects.error.expectNotFound(); }); it(`edit dashboard for object which doesn't exist shows 404`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - createDashboardEditUrl('i-dont-exist'), - { + await PageObjects.dashboard.gotoDashboardURL({ + id: 'i-dont-exist', + args: { basePath: '/s/custom_space', ensureCurrentUrl: false, shouldLoginIfPrompted: false, - } - ); + }, + }); await PageObjects.error.expectNotFound(); }); it(`edit dashboard for object which exists shows 404`, async () => { - await PageObjects.common.navigateToActualUrl( - 'dashboard', - createDashboardEditUrl('i-exist'), - { + await PageObjects.dashboard.gotoDashboardURL({ + id: 'i-exist', + args: { basePath: '/s/custom_space', ensureCurrentUrl: false, shouldLoginIfPrompted: false, - } - ); + }, + }); await PageObjects.error.expectNotFound(); }); }); diff --git a/x-pack/test/functional/apps/dashboard/group2/_async_dashboard.ts b/x-pack/test/functional/apps/dashboard/group2/_async_dashboard.ts index 09d353e631fed..80354eda9eefd 100644 --- a/x-pack/test/functional/apps/dashboard/group2/_async_dashboard.ts +++ b/x-pack/test/functional/apps/dashboard/group2/_async_dashboard.ts @@ -179,7 +179,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('Checking saved searches rendered'); await dashboardExpect.savedSearchRowCount(10); log.debug('Checking input controls rendered'); - await dashboardExpect.inputControlItemCount(3); + await dashboardExpect.controlCount(3); log.debug('Checking tag cloud rendered'); await dashboardExpect.tagCloudWithValuesFound(['Sunny', 'Rain', 'Clear', 'Cloudy', 'Hail']); log.debug('Checking vega chart rendered'); diff --git a/x-pack/test/functional/apps/discover/visualize_field.ts b/x-pack/test/functional/apps/discover/visualize_field.ts index 0a7f075d50bd4..be1f223110503 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/infra/home_page.ts b/x-pack/test/functional/apps/infra/home_page.ts index 6acaabcd5d207..1c0323808270d 100644 --- a/x-pack/test/functional/apps/infra/home_page.ts +++ b/x-pack/test/functional/apps/infra/home_page.ts @@ -14,8 +14,9 @@ const DATE_WITHOUT_DATA = DATES.metricsAndLogs.hosts.withoutData; export default ({ getPageObjects, getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); + const browser = getService('browser'); const retry = getService('retry'); - const pageObjects = getPageObjects(['common', 'infraHome', 'infraSavedViews']); + const pageObjects = getPageObjects(['common', 'header', 'infraHome', 'infraSavedViews']); const kibanaServer = getService('kibanaServer'); describe('Home page', function () { @@ -34,6 +35,22 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await pageObjects.common.navigateToApp('infraOps'); await pageObjects.infraHome.getNoMetricsIndicesPrompt(); }); + + it('renders the correct error page title', async () => { + await pageObjects.common.navigateToUrlWithBrowserHistory( + 'infraOps', + '/detail/host/test', + '', + { + ensureCurrentUrl: false, + } + ); + await pageObjects.infraHome.waitForLoading(); + await pageObjects.header.waitUntilLoadingHasFinished(); + + const documentTitle = await browser.getTitle(); + expect(documentTitle).to.contain('Uh oh - Observability - Elastic'); + }); }); describe('with metrics present', () => { @@ -47,6 +64,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs') ); + it('renders the correct page title', async () => { + await pageObjects.header.waitUntilLoadingHasFinished(); + + const documentTitle = await browser.getTitle(); + expect(documentTitle).to.contain('Inventory - Infrastructure - Observability - Elastic'); + }); + it('renders an empty data prompt for dates with no data', async () => { await pageObjects.infraHome.goToTime(DATE_WITHOUT_DATA); await pageObjects.infraHome.getNoMetricsDataPrompt(); diff --git a/x-pack/test/functional/apps/infra/link_to.ts b/x-pack/test/functional/apps/infra/link_to.ts index ebfcb740961b1..05eccc8e57ebc 100644 --- a/x-pack/test/functional/apps/infra/link_to.ts +++ b/x-pack/test/functional/apps/infra/link_to.ts @@ -42,6 +42,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await retry.tryForTime(5000, async () => { const currentUrl = await browser.getCurrentUrl(); const parsedUrl = new URL(currentUrl); + const documentTitle = await browser.getTitle(); expect(parsedUrl.pathname).to.be('/app/logs/stream'); expect(parsedUrl.searchParams.get('logFilter')).to.be( @@ -51,6 +52,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { `(end:'${endDate}',position:(tiebreaker:0,time:${timestamp}),start:'${startDate}',streamLive:!f)` ); expect(parsedUrl.searchParams.get('sourceId')).to.be('default'); + expect(documentTitle).to.contain('Stream - Logs - Observability - Elastic'); }); }); }); diff --git a/x-pack/test/functional/apps/infra/logs_source_configuration.ts b/x-pack/test/functional/apps/infra/logs_source_configuration.ts index 56eed5ec4b635..38cc795034a22 100644 --- a/x-pack/test/functional/apps/infra/logs_source_configuration.ts +++ b/x-pack/test/functional/apps/infra/logs_source_configuration.ts @@ -16,6 +16,7 @@ const COMMON_REQUEST_HEADERS = { export default ({ getPageObjects, getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); + const browser = getService('browser'); const logsUi = getService('logsUi'); const infraSourceConfigurationForm = getService('infraSourceConfigurationForm'); const pageObjects = getPageObjects(['common', 'header', 'infraLogs']); @@ -49,6 +50,15 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs'); }); + it('renders the correct page title', async () => { + await pageObjects.infraLogs.navigateToTab('settings'); + + await pageObjects.header.waitUntilLoadingHasFinished(); + const documentTitle = await browser.getTitle(); + + expect(documentTitle).to.contain('Settings - Logs - Observability - Elastic'); + }); + it('can change the log indices to a pattern that matches nothing', async () => { await pageObjects.infraLogs.navigateToTab('settings'); diff --git a/x-pack/test/functional/apps/infra/metrics_explorer.ts b/x-pack/test/functional/apps/infra/metrics_explorer.ts index fc620d9ba5665..4d6859a4e99e7 100644 --- a/x-pack/test/functional/apps/infra/metrics_explorer.ts +++ b/x-pack/test/functional/apps/infra/metrics_explorer.ts @@ -16,6 +16,7 @@ const timepickerFormat = 'MMM D, YYYY @ HH:mm:ss.SSS'; export default ({ getPageObjects, getService }: FtrProviderContext) => { const esArchiver = getService('esArchiver'); const kibanaServer = getService('kibanaServer'); + const browser = getService('browser'); const pageObjects = getPageObjects([ 'common', 'infraHome', @@ -42,6 +43,13 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs')); + it('should render the correct page title', async () => { + const documentTitle = await browser.getTitle(); + expect(documentTitle).to.contain( + 'Metrics Explorer - Infrastructure - Observability - Elastic' + ); + }); + it('should have three metrics by default', async () => { const metrics = await pageObjects.infraMetricsExplorer.getMetrics(); expect(metrics.length).to.equal(3); diff --git a/x-pack/test/functional/apps/lens/group1/table.ts b/x-pack/test/functional/apps/lens/group1/table.ts index 7bf9b49c53d8d..724efbe6c6c82 100644 --- a/x-pack/test/functional/apps/lens/group1/table.ts +++ b/x-pack/test/functional/apps/lens/group1/table.ts @@ -9,7 +9,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { - const PageObjects = getPageObjects(['visualize', 'lens', 'common', 'header']); + const PageObjects = getPageObjects(['visualize', 'lens', 'common']); const listingTable = getService('listingTable'); const find = getService('find'); const retry = getService('retry'); @@ -91,14 +91,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should allow to sort by transposed columns', async () => { await PageObjects.lens.changeTableSortingBy(2, 'ascending'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); expect(await PageObjects.lens.getDatatableCellText(0, 2)).to.eql('17,246'); }); it('should show dynamic coloring feature for numeric columns', async () => { await PageObjects.lens.openDimensionEditor('lnsDatatable_metrics > lns-dimensionTrigger'); await PageObjects.lens.setTableDynamicColoring('text'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); const styleObj = await PageObjects.lens.getDatatableCellStyle(0, 2); expect(styleObj['background-color']).to.be(undefined); expect(styleObj.color).to.be('rgb(133, 189, 177)'); @@ -106,7 +106,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should allow to color cell background rather than text', async () => { await PageObjects.lens.setTableDynamicColoring('cell'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); const styleObj = await PageObjects.lens.getDatatableCellStyle(0, 2); expect(styleObj['background-color']).to.be('rgb(133, 189, 177)'); // should also set text color when in cell mode @@ -115,9 +115,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should open the palette panel to customize the palette look', async () => { await PageObjects.lens.openPalettePanel('lnsDatatable'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); await PageObjects.lens.changePaletteTo('temperature'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); const styleObj = await PageObjects.lens.getDatatableCellStyle(0, 2); expect(styleObj['background-color']).to.be('rgb(235, 239, 245)'); }); @@ -125,7 +125,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should keep the coloring consistent when changing mode', async () => { // Change mode from percent to number await testSubjects.click('lnsPalettePanel_dynamicColoring_rangeType_groups_number'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); // check that all remained the same const styleObj = await PageObjects.lens.getDatatableCellStyle(0, 2); expect(styleObj['background-color']).to.be('rgb(235, 239, 245)'); @@ -133,7 +133,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should keep the coloring consistent when moving to custom palette from default', async () => { await PageObjects.lens.changePaletteTo('custom'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); // check that all remained the same const styleObj = await PageObjects.lens.getDatatableCellStyle(0, 2); expect(styleObj['background-color']).to.be('rgb(235, 239, 245)'); @@ -149,7 +149,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); // when clicking on another row will trigger a sorting + update await testSubjects.click('lnsPalettePanel_dynamicColoring_range_value_1'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); // pick a cell without color as is below the range const styleObj = await PageObjects.lens.getDatatableCellStyle(3, 3); expect(styleObj['background-color']).to.be(undefined); @@ -159,7 +159,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should allow the user to reverse the palette', async () => { await testSubjects.click('lnsPalettePanel_dynamicColoring_reverseColors'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); const styleObj = await PageObjects.lens.getDatatableCellStyle(1, 1); expect(styleObj['background-color']).to.be('rgb(168, 191, 218)'); // should also set text color when in cell mode @@ -169,7 +169,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should allow to show a summary table for metric columns', async () => { await PageObjects.lens.setTableSummaryRowFunction('sum'); - await PageObjects.header.waitUntilLoadingHasFinished(); + await PageObjects.lens.waitForVisualization(); await PageObjects.lens.assertExactText( '[data-test-subj="lnsDataTable-footer-169.228.188.120-›-Average-of-bytes"]', 'Sum: 18,994' diff --git a/x-pack/test/functional/apps/lens/group2/tsdb.ts b/x-pack/test/functional/apps/lens/group2/tsdb.ts index 7a43fc47471a5..d19ab9d19db7d 100644 --- a/x-pack/test/functional/apps/lens/group2/tsdb.ts +++ b/x-pack/test/functional/apps/lens/group2/tsdb.ts @@ -119,7 +119,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.click('lns-indexPatternDimension-median'); await PageObjects.lens.waitForVisualization('xyVisChart'); await PageObjects.lens.assertEditorWarning( - '"Median of kubernetes.container.memory.available.bytes" does not work for all indices in the selected data view because it\'s using a function which is not supported on rolled up data. Please edit the visualization to use another function or change the time range.' + 'Median of kubernetes.container.memory.available.bytes uses a function that is unsupported by rolled up data. Select a different function or change the time range.' ); }); it('shows warnings in dashboards as well', async () => { @@ -127,7 +127,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await PageObjects.dashboard.waitForRenderComplete(); await PageObjects.lens.assertInlineWarning( - '"Median of kubernetes.container.memory.available.bytes" does not work for all indices in the selected data view because it\'s using a function which is not supported on rolled up data. Please edit the visualization to use another function or change the time range.' + 'Median of kubernetes.container.memory.available.bytes uses a function that is unsupported by rolled up data. Select a different function or change the time range.' ); }); it('still shows other warnings as toast', async () => { diff --git a/x-pack/test/functional/apps/lens/group3/index.ts b/x-pack/test/functional/apps/lens/group3/index.ts index 44365d5333d16..627e9d560ca21 100644 --- a/x-pack/test/functional/apps/lens/group3/index.ts +++ b/x-pack/test/functional/apps/lens/group3/index.ts @@ -86,7 +86,7 @@ export default ({ getService, loadTestFile, getPageObjects }: FtrProviderContext loadTestFile(require.resolve('./error_handling')); loadTestFile(require.resolve('./lens_tagging')); loadTestFile(require.resolve('./lens_reporting')); - loadTestFile(require.resolve('./tsvb_open_in_lens')); + loadTestFile(require.resolve('./open_in_lens')); // keep these two last in the group in this order because they are messing with the default saved objects loadTestFile(require.resolve('./rollup')); loadTestFile(require.resolve('./no_data')); diff --git a/x-pack/test/functional/apps/lens/group3/open_in_lens/agg_based/index.ts b/x-pack/test/functional/apps/lens/group3/open_in_lens/agg_based/index.ts new file mode 100644 index 0000000000000..b279f0d8a93cd --- /dev/null +++ b/x-pack/test/functional/apps/lens/group3/open_in_lens/agg_based/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../../../../../ftr_provider_context'; + +export default function ({ loadTestFile }: FtrProviderContext) { + describe('Agg based Vis to Lens', function () { + loadTestFile(require.resolve('./pie')); + }); +} diff --git a/x-pack/test/functional/apps/lens/group3/open_in_lens/agg_based/pie.ts b/x-pack/test/functional/apps/lens/group3/open_in_lens/agg_based/pie.ts new file mode 100644 index 0000000000000..1640a6a14631d --- /dev/null +++ b/x-pack/test/functional/apps/lens/group3/open_in_lens/agg_based/pie.ts @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; 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'; + +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const { visualize, visEditor, lens, timePicker, header } = getPageObjects([ + 'visualize', + 'lens', + 'visEditor', + 'timePicker', + 'header', + ]); + + const testSubjects = getService('testSubjects'); + const pieChart = getService('pieChart'); + + describe('Pie', function describeIndexTests() { + const isNewChartsLibraryEnabled = true; + + before(async () => { + await visualize.initTests(isNewChartsLibraryEnabled); + }); + + beforeEach(async () => { + await visualize.navigateToNewAggBasedVisualization(); + await visualize.clickPieChart(); + await visualize.clickNewSearch(); + await timePicker.setDefaultAbsoluteRange(); + }); + + it('should hide the "Edit Visualization in Lens" menu item if no split slices were defined', async () => { + const button = await testSubjects.exists('visualizeEditInLensButton'); + expect(button).to.eql(false); + }); + + it('should show the "Edit Visualization in Lens" menu item', async () => { + await visEditor.clickBucket('Split slices'); + await visEditor.selectAggregation('Terms'); + await visEditor.selectField('machine.os.raw'); + await header.waitUntilLoadingHasFinished(); + await visEditor.clickGo(isNewChartsLibraryEnabled); + + const button = await testSubjects.exists('visualizeEditInLensButton'); + expect(button).to.eql(true); + }); + + it('should convert to Lens', async () => { + const expectedTableData = ['ios', 'osx', 'win 7', 'win 8', 'win xp']; + await visEditor.clickBucket('Split slices'); + await visEditor.selectAggregation('Terms'); + await visEditor.selectField('machine.os.raw'); + await header.waitUntilLoadingHasFinished(); + await visEditor.clickGo(isNewChartsLibraryEnabled); + + const button = await testSubjects.find('visualizeEditInLensButton'); + await button.click(); + await lens.waitForVisualization('partitionVisChart'); + + await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + }); + }); +} diff --git a/x-pack/test/functional/apps/lens/group3/open_in_lens/index.ts b/x-pack/test/functional/apps/lens/group3/open_in_lens/index.ts new file mode 100644 index 0000000000000..b1d5a1cbb3c52 --- /dev/null +++ b/x-pack/test/functional/apps/lens/group3/open_in_lens/index.ts @@ -0,0 +1,15 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../../../../ftr_provider_context'; + +export default function ({ loadTestFile }: FtrProviderContext) { + describe('Open in Lens', function () { + loadTestFile(require.resolve('./tsvb')); + loadTestFile(require.resolve('./agg_based')); + }); +} diff --git a/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/dashboard.ts b/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/dashboard.ts new file mode 100644 index 0000000000000..bd74e109326bf --- /dev/null +++ b/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/dashboard.ts @@ -0,0 +1,101 @@ +/* + * 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'; + +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const { visualize, visualBuilder, lens, timeToVisualize, dashboard, canvas } = getPageObjects([ + 'visualBuilder', + 'visualize', + 'lens', + 'timeToVisualize', + 'dashboard', + 'canvas', + ]); + + const testSubjects = getService('testSubjects'); + const retry = getService('retry'); + const panelActions = getService('dashboardPanelActions'); + const dashboardAddPanel = getService('dashboardAddPanel'); + + describe('Dashboard to TSVB to Lens', function describeIndexTests() { + before(async () => { + await visualize.initTests(); + }); + + it('should convert a by value TSVB viz to a Lens viz', async () => { + await visualize.navigateToNewVisualization(); + await visualize.clickVisualBuilder(); + await visualBuilder.checkVisualBuilderIsPresent(); + await visualBuilder.resetPage(); + await testSubjects.click('visualizeSaveButton'); + + await timeToVisualize.saveFromModal('My TSVB to Lens viz 1', { + addToDashboard: 'new', + saveToLibrary: false, + }); + + await dashboard.waitForRenderComplete(); + const originalEmbeddableCount = await canvas.getEmbeddableCount(); + await panelActions.openContextMenu(); + await panelActions.clickEdit(); + + const button = await testSubjects.find('visualizeEditInLensButton'); + await button.click(); + await lens.waitForVisualization('xyVisChart'); + await retry.try(async () => { + const dimensions = await testSubjects.findAll('lns-dimensionTrigger'); + expect(await dimensions[1].getVisibleText()).to.be('Count of records'); + }); + + await lens.saveAndReturn(); + await retry.try(async () => { + const embeddableCount = await canvas.getEmbeddableCount(); + expect(embeddableCount).to.eql(originalEmbeddableCount); + }); + await panelActions.removePanel(); + }); + + it('should convert a by reference TSVB viz to a Lens viz', async () => { + await dashboardAddPanel.clickEditorMenuButton(); + await dashboardAddPanel.clickVisType('metrics'); + await testSubjects.click('visualizesaveAndReturnButton'); + // save it to library + const originalPanel = await testSubjects.find('embeddablePanelHeading-'); + await panelActions.saveToLibrary('My TSVB to Lens viz 2', originalPanel); + + await dashboard.waitForRenderComplete(); + const originalEmbeddableCount = await canvas.getEmbeddableCount(); + await panelActions.openContextMenu(); + await panelActions.clickEdit(); + + const button = await testSubjects.find('visualizeEditInLensButton'); + await button.click(); + await lens.waitForVisualization('legacyMtrVis'); + await retry.try(async () => { + const dimensions = await testSubjects.findAll('lns-dimensionTrigger'); + expect(await dimensions[1].getVisibleText()).to.be('Count of records'); + }); + + await lens.saveAndReturn(); + await retry.try(async () => { + const embeddableCount = await canvas.getEmbeddableCount(); + expect(embeddableCount).to.eql(originalEmbeddableCount); + }); + + const panel = await testSubjects.find(`embeddablePanelHeading-`); + const descendants = await testSubjects.findAllDescendant( + 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', + panel + ); + expect(descendants.length).to.equal(0); + + await panelActions.removePanel(); + }); + }); +} diff --git a/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/index.ts b/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/index.ts new file mode 100644 index 0000000000000..c786ed22c6a1a --- /dev/null +++ b/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../../../../../ftr_provider_context'; + +export default function ({ loadTestFile }: FtrProviderContext) { + describe('TSVB to Lens', function () { + loadTestFile(require.resolve('./metric')); + loadTestFile(require.resolve('./timeseries')); + loadTestFile(require.resolve('./dashboard')); + }); +} diff --git a/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/metric.ts b/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/metric.ts new file mode 100644 index 0000000000000..273473b67a31e --- /dev/null +++ b/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/metric.ts @@ -0,0 +1,44 @@ +/* + * 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'; + +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const { visualize, visualBuilder, lens } = getPageObjects(['visualBuilder', 'visualize', 'lens']); + + const testSubjects = getService('testSubjects'); + + describe('Metric', function describeIndexTests() { + before(async () => { + await visualize.initTests(); + }); + + beforeEach(async () => { + await visualize.navigateToNewVisualization(); + await visualize.clickVisualBuilder(); + await visualBuilder.checkVisualBuilderIsPresent(); + await visualBuilder.resetPage(); + await visualBuilder.clickMetric(); + await visualBuilder.clickDataTab('metric'); + }); + + it('should show the "Edit Visualization in Lens" menu item', async () => { + const button = await testSubjects.exists('visualizeEditInLensButton'); + expect(button).to.eql(true); + }); + + it('should convert to Lens', async () => { + const button = await testSubjects.find('visualizeEditInLensButton'); + await button.click(); + await lens.waitForVisualization('mtrVis'); + + const metricData = await lens.getMetricVisualizationData(); + expect(metricData[0].title).to.eql('Count of records'); + }); + }); +} diff --git a/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/timeseries.ts b/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/timeseries.ts new file mode 100644 index 0000000000000..17e3a6b1bee8a --- /dev/null +++ b/x-pack/test/functional/apps/lens/group3/open_in_lens/tsvb/timeseries.ts @@ -0,0 +1,87 @@ +/* + * 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'; + +export default function ({ getPageObjects, getService }: FtrProviderContext) { + const { visualize, visualBuilder, lens, header } = getPageObjects([ + 'visualBuilder', + 'visualize', + 'header', + 'lens', + ]); + + const testSubjects = getService('testSubjects'); + const retry = getService('retry'); + const find = getService('find'); + const filterBar = getService('filterBar'); + const queryBar = getService('queryBar'); + + describe('Time Series', function describeIndexTests() { + before(async () => { + await visualize.initTests(); + }); + + it('should show the "Edit Visualization in Lens" menu item for a count aggregation', async () => { + await visualize.navigateToNewVisualization(); + await visualize.clickVisualBuilder(); + await visualBuilder.checkVisualBuilderIsPresent(); + await visualBuilder.resetPage(); + const isMenuItemVisible = await find.existsByCssSelector( + '[data-test-subj="visualizeEditInLensButton"]' + ); + expect(isMenuItemVisible).to.be(true); + }); + + it('visualizes field to Lens and loads fields to the dimesion editor', async () => { + const button = await testSubjects.find('visualizeEditInLensButton'); + await button.click(); + await lens.waitForVisualization('xyVisChart'); + await retry.try(async () => { + const dimensions = await testSubjects.findAll('lns-dimensionTrigger'); + expect(dimensions).to.have.length(2); + expect(await dimensions[0].getVisibleText()).to.be('@timestamp'); + expect(await dimensions[1].getVisibleText()).to.be('Count of records'); + }); + }); + + it('navigates back to TSVB when the Back button is clicked', async () => { + const goBackBtn = await testSubjects.find('lnsApp_goBackToAppButton'); + goBackBtn.click(); + await visualBuilder.checkVisualBuilderIsPresent(); + await retry.try(async () => { + const actualCount = await visualBuilder.getRhythmChartLegendValue(); + expect(actualCount).to.be('56'); + }); + }); + + it('should preserve app filters in lens', async () => { + await filterBar.addFilter('extension', 'is', 'css'); + await header.waitUntilLoadingHasFinished(); + const button = await testSubjects.find('visualizeEditInLensButton'); + await button.click(); + await lens.waitForVisualization('xyVisChart'); + + expect(await filterBar.hasFilter('extension', 'css')).to.be(true); + }); + + it('should preserve query in lens', async () => { + const goBackBtn = await testSubjects.find('lnsApp_goBackToAppButton'); + goBackBtn.click(); + await visualBuilder.checkVisualBuilderIsPresent(); + await queryBar.setQuery('machine.os : ios'); + await queryBar.submitQuery(); + await header.waitUntilLoadingHasFinished(); + const button = await testSubjects.find('visualizeEditInLensButton'); + await button.click(); + await lens.waitForVisualization('xyVisChart'); + + expect(await queryBar.getQueryString()).to.equal('machine.os : ios'); + }); + }); +} diff --git a/x-pack/test/functional/apps/lens/group3/tsvb_open_in_lens.ts b/x-pack/test/functional/apps/lens/group3/tsvb_open_in_lens.ts deleted file mode 100644 index 173ab1c4fdf04..0000000000000 --- a/x-pack/test/functional/apps/lens/group3/tsvb_open_in_lens.ts +++ /dev/null @@ -1,192 +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 expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../../ftr_provider_context'; - -export default function ({ getPageObjects, getService }: FtrProviderContext) { - const { visualize, visualBuilder, header, lens, timeToVisualize, dashboard, canvas } = - getPageObjects([ - 'visualBuilder', - 'visualize', - 'header', - 'lens', - 'timeToVisualize', - 'dashboard', - 'canvas', - ]); - const testSubjects = getService('testSubjects'); - const find = getService('find'); - const dashboardAddPanel = getService('dashboardAddPanel'); - const panelActions = getService('dashboardPanelActions'); - const retry = getService('retry'); - const filterBar = getService('filterBar'); - const queryBar = getService('queryBar'); - - describe('TSVB to Lens', function describeIndexTests() { - before(async () => { - await visualize.initTests(); - }); - - describe('Time Series', () => { - it('should show the "Edit Visualization in Lens" menu item for a count aggregation', async () => { - await visualize.navigateToNewVisualization(); - await visualize.clickVisualBuilder(); - await visualBuilder.checkVisualBuilderIsPresent(); - await visualBuilder.resetPage(); - const isMenuItemVisible = await find.existsByCssSelector( - '[data-test-subj="visualizeEditInLensButton"]' - ); - expect(isMenuItemVisible).to.be(true); - }); - - it('visualizes field to Lens and loads fields to the dimesion editor', async () => { - const button = await testSubjects.find('visualizeEditInLensButton'); - await button.click(); - await lens.waitForVisualization('xyVisChart'); - await retry.try(async () => { - const dimensions = await testSubjects.findAll('lns-dimensionTrigger'); - expect(dimensions).to.have.length(2); - expect(await dimensions[0].getVisibleText()).to.be('@timestamp'); - expect(await dimensions[1].getVisibleText()).to.be('Count of records'); - }); - }); - - it('navigates back to TSVB when the Back button is clicked', async () => { - const goBackBtn = await testSubjects.find('lnsApp_goBackToAppButton'); - goBackBtn.click(); - await visualBuilder.checkVisualBuilderIsPresent(); - await retry.try(async () => { - const actualCount = await visualBuilder.getRhythmChartLegendValue(); - expect(actualCount).to.be('56'); - }); - }); - - it('should preserve app filters in lens', async () => { - await filterBar.addFilter('extension', 'is', 'css'); - await header.waitUntilLoadingHasFinished(); - const button = await testSubjects.find('visualizeEditInLensButton'); - await button.click(); - await lens.waitForVisualization('xyVisChart'); - - expect(await filterBar.hasFilter('extension', 'css')).to.be(true); - }); - - it('should preserve query in lens', async () => { - const goBackBtn = await testSubjects.find('lnsApp_goBackToAppButton'); - goBackBtn.click(); - await visualBuilder.checkVisualBuilderIsPresent(); - await queryBar.setQuery('machine.os : ios'); - await queryBar.submitQuery(); - await header.waitUntilLoadingHasFinished(); - const button = await testSubjects.find('visualizeEditInLensButton'); - await button.click(); - await lens.waitForVisualization('xyVisChart'); - - expect(await queryBar.getQueryString()).to.equal('machine.os : ios'); - }); - }); - - describe('Metric', () => { - beforeEach(async () => { - await visualize.navigateToNewVisualization(); - await visualize.clickVisualBuilder(); - await visualBuilder.checkVisualBuilderIsPresent(); - await visualBuilder.resetPage(); - await visualBuilder.clickMetric(); - await visualBuilder.clickDataTab('metric'); - }); - - it('should show the "Edit Visualization in Lens" menu item', async () => { - const button = await testSubjects.exists('visualizeEditInLensButton'); - expect(button).to.eql(true); - }); - - it('should convert to Lens', async () => { - const button = await testSubjects.find('visualizeEditInLensButton'); - await button.click(); - await lens.waitForVisualization('mtrVis'); - - const metricData = await lens.getMetricVisualizationData(); - expect(metricData[0].title).to.eql('Count of records'); - }); - }); - - describe('Dashboard to TSVB to Lens', () => { - it('should convert a by value TSVB viz to a Lens viz', async () => { - await visualize.navigateToNewVisualization(); - await visualize.clickVisualBuilder(); - await visualBuilder.checkVisualBuilderIsPresent(); - await visualBuilder.resetPage(); - await testSubjects.click('visualizeSaveButton'); - - await timeToVisualize.saveFromModal('My TSVB to Lens viz 1', { - addToDashboard: 'new', - saveToLibrary: false, - }); - - await dashboard.waitForRenderComplete(); - const originalEmbeddableCount = await canvas.getEmbeddableCount(); - await panelActions.openContextMenu(); - await panelActions.clickEdit(); - - const button = await testSubjects.find('visualizeEditInLensButton'); - await button.click(); - await lens.waitForVisualization('xyVisChart'); - await retry.try(async () => { - const dimensions = await testSubjects.findAll('lns-dimensionTrigger'); - expect(await dimensions[1].getVisibleText()).to.be('Count of records'); - }); - - await lens.saveAndReturn(); - await retry.try(async () => { - const embeddableCount = await canvas.getEmbeddableCount(); - expect(embeddableCount).to.eql(originalEmbeddableCount); - }); - await panelActions.removePanel(); - }); - - it('should convert a by reference TSVB viz to a Lens viz', async () => { - await dashboardAddPanel.clickEditorMenuButton(); - await dashboardAddPanel.clickVisType('metrics'); - await testSubjects.click('visualizesaveAndReturnButton'); - // save it to library - const originalPanel = await testSubjects.find('embeddablePanelHeading-'); - await panelActions.saveToLibrary('My TSVB to Lens viz 2', originalPanel); - - await dashboard.waitForRenderComplete(); - const originalEmbeddableCount = await canvas.getEmbeddableCount(); - await panelActions.openContextMenu(); - await panelActions.clickEdit(); - - const button = await testSubjects.find('visualizeEditInLensButton'); - await button.click(); - await lens.waitForVisualization('legacyMtrVis'); - await retry.try(async () => { - const dimensions = await testSubjects.findAll('lns-dimensionTrigger'); - expect(await dimensions[1].getVisibleText()).to.be('Count of records'); - }); - - await lens.saveAndReturn(); - await retry.try(async () => { - const embeddableCount = await canvas.getEmbeddableCount(); - expect(embeddableCount).to.eql(originalEmbeddableCount); - }); - - const panel = await testSubjects.find(`embeddablePanelHeading-`); - const descendants = await testSubjects.findAllDescendant( - 'embeddablePanelNotification-ACTION_LIBRARY_NOTIFICATION', - panel - ); - expect(descendants.length).to.equal(0); - - await panelActions.removePanel(); - }); - }); - }); -} diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts index 2ba4ac6f08350..ea95525062700 100644 --- a/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/classification_creation.ts @@ -13,7 +13,8 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); const editedDescription = 'Edited description'; - describe('classification creation', function () { + // FLAKY: https://github.com/elastic/kibana/issues/142102 + describe.skip('classification creation', function () { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/bm_classification'); await ml.testResources.createIndexPatternIfNeeded('ft_bank_marketing', '@timestamp'); @@ -92,7 +93,8 @@ export default function ({ getService }: FtrProviderContext) { }, ]; for (const testData of testDataList) { - describe(`${testData.suiteTitle}`, function () { + // FLAKY: https://github.com/elastic/kibana/issues/142102 + describe.skip(`${testData.suiteTitle}`, function () { after(async () => { await ml.api.deleteIndices(testData.destinationIndex); await ml.testResources.deleteIndexPatternByTitle(testData.destinationIndex); 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 3a33c95edba42..a3314aabce725 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 @@ -15,7 +15,9 @@ export default function ({ getService }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const ml = getService('ml'); - describe('jobs cloning supported by UI form', function () { + // 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; archive: string; @@ -135,7 +137,8 @@ export default function ({ getService }: FtrProviderContext) { }); for (const testData of testDataList) { - describe(`${testData.suiteTitle}`, function () { + // FLAKY: https://github.com/elastic/kibana/issues/142118 + describe.skip(`${testData.suiteTitle}`, function () { const cloneJobId = `${testData.job.id}_clone`; const cloneDestIndex = `${testData.job!.dest!.index}_clone`; diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts index 947cd82cdd342..fb04cd793d9d8 100644 --- a/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/outlier_detection_creation.ts @@ -13,7 +13,8 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); const editedDescription = 'Edited description'; - describe('outlier detection creation', function () { + // FLAKY: https://github.com/elastic/kibana/issues/142083 + describe.skip('outlier detection creation', function () { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/ihp_outlier'); await ml.testResources.createIndexPatternIfNeeded('ft_ihp_outlier', '@timestamp'); @@ -108,7 +109,8 @@ export default function ({ getService }: FtrProviderContext) { ]; for (const testData of testDataList) { - describe(`${testData.suiteTitle}`, function () { + // FLAKY: https://github.com/elastic/kibana/issues/142083 + describe.skip(`${testData.suiteTitle}`, function () { after(async () => { await ml.api.deleteIndices(testData.destinationIndex); await ml.testResources.deleteIndexPatternByTitle(testData.destinationIndex); diff --git a/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts b/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts index 7a84c41aa4a66..744b61a2a06ca 100644 --- a/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts +++ b/x-pack/test/functional/apps/ml/data_frame_analytics/regression_creation.ts @@ -13,7 +13,8 @@ export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); const editedDescription = 'Edited description'; - describe('regression creation', function () { + // FLAKY: https://github.com/elastic/kibana/issues/142095 + describe.skip('regression creation', function () { before(async () => { await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/egs_regression'); await ml.testResources.createIndexPatternIfNeeded('ft_egs_regression', '@timestamp'); @@ -86,7 +87,8 @@ export default function ({ getService }: FtrProviderContext) { ]; for (const testData of testDataList) { - describe(`${testData.suiteTitle}`, function () { + // FLAKY: https://github.com/elastic/kibana/issues/142095 + describe.skip(`${testData.suiteTitle}`, function () { after(async () => { await ml.api.deleteIndices(testData.destinationIndex); await ml.testResources.deleteIndexPatternByTitle(testData.destinationIndex); 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 2bddf0a7d9512..af023ea52d9b3 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/apps/ml/short_tests/index.ts b/x-pack/test/functional/apps/ml/short_tests/index.ts index f96d2b91ee0ef..d446a35933474 100644 --- a/x-pack/test/functional/apps/ml/short_tests/index.ts +++ b/x-pack/test/functional/apps/ml/short_tests/index.ts @@ -33,5 +33,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./model_management')); loadTestFile(require.resolve('./feature_controls')); loadTestFile(require.resolve('./settings')); + loadTestFile(require.resolve('./notifications')); }); } diff --git a/x-pack/test/functional/apps/ml/short_tests/notifications/index.ts b/x-pack/test/functional/apps/ml/short_tests/notifications/index.ts new file mode 100644 index 0000000000000..e026d44a67af2 --- /dev/null +++ b/x-pack/test/functional/apps/ml/short_tests/notifications/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { FtrProviderContext } from '../../../../ftr_provider_context'; + +export default function ({ loadTestFile }: FtrProviderContext) { + describe('Notifcations', function () { + this.tags(['ml', 'skipFirefox']); + + loadTestFile(require.resolve('./notification_list')); + }); +} diff --git a/x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.ts b/x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.ts new file mode 100644 index 0000000000000..c9ad8d2423ef8 --- /dev/null +++ b/x-pack/test/functional/apps/ml/short_tests/notifications/notification_list.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 { FtrProviderContext } from '../../../../ftr_provider_context'; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const PageObjects = getPageObjects(['common']); + const esArchiver = getService('esArchiver'); + const ml = getService('ml'); + const browser = getService('browser'); + + describe('Notifications list', function () { + before(async () => { + await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/ml/farequote'); + await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp'); + await ml.testResources.setKibanaTimeZoneToUTC(); + + // Prepare jobs to generate notifications + await Promise.all( + [ + { jobId: 'fq_001', spaceId: undefined }, + { jobId: 'fq_002', spaceId: 'space1' }, + ].map(async (v) => { + const datafeedConfig = ml.commonConfig.getADFqDatafeedConfig(v.jobId); + + await ml.api.createAnomalyDetectionJob( + ml.commonConfig.getADFqSingleMetricJobConfig(v.jobId), + v.spaceId + ); + await ml.api.openAnomalyDetectionJob(v.jobId); + await ml.api.createDatafeed(datafeedConfig, v.spaceId); + await ml.api.startDatafeed(datafeedConfig.datafeed_id); + }) + ); + + await ml.securityUI.loginAsMlPowerUser(); + await PageObjects.common.navigateToApp('ml', { + basePath: '', + }); + }); + + after(async () => { + await ml.api.cleanMlIndices(); + await ml.testResources.cleanMLSavedObjects(); + await ml.testResources.deleteIndexPatternByTitle('ft_farequote'); + }); + + it('displays a generic notification indicator', async () => { + await ml.notifications.assertNotificationIndicatorExist(); + }); + + it('opens the Notifications page', async () => { + await ml.navigation.navigateToNotifications(); + + await ml.notifications.table.waitForTableToLoad(); + await ml.notifications.table.assertRowsNumberPerPage(25); + }); + + it('does not show notifications from another space', async () => { + await ml.notifications.table.filterWithSearchString('Job created', 1); + }); + + it('display a number of errors in the notification indicator', async () => { + await ml.navigation.navigateToOverview(); + + const jobConfig = ml.commonConfig.getADFqSingleMetricJobConfig('fq_fail'); + jobConfig.analysis_config = { + bucket_span: '15m', + influencers: ['airline'], + detectors: [ + { function: 'mean', field_name: 'responsetime', partition_field_name: 'airline' }, + { function: 'min', field_name: 'responsetime', partition_field_name: 'airline' }, + { function: 'max', field_name: 'responsetime', partition_field_name: 'airline' }, + ], + }; + // Set extremely low memory limit to trigger an error + jobConfig.analysis_limits!.model_memory_limit = '1024kb'; + + const datafeedConfig = ml.commonConfig.getADFqDatafeedConfig(jobConfig.job_id); + + await ml.api.createAnomalyDetectionJob(jobConfig); + await ml.api.openAnomalyDetectionJob(jobConfig.job_id); + await ml.api.createDatafeed(datafeedConfig); + await ml.api.startDatafeed(datafeedConfig.datafeed_id); + await ml.api.waitForJobMemoryStatus(jobConfig.job_id, 'hard_limit'); + + // refresh the page to avoid 1m wait + await browser.refresh(); + await ml.notifications.assertNotificationErrorsCount(0); + }); + }); +} diff --git a/x-pack/test/functional/apps/ml/short_tests/pages.ts b/x-pack/test/functional/apps/ml/short_tests/pages.ts index e17454d0fa222..87fb9d03ca0c9 100644 --- a/x-pack/test/functional/apps/ml/short_tests/pages.ts +++ b/x-pack/test/functional/apps/ml/short_tests/pages.ts @@ -10,7 +10,8 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { const ml = getService('ml'); - describe('page navigation', function () { + // FLAKY: https://github.com/elastic/kibana/issues/142397 + describe.skip('page navigation', function () { this.tags(['skipFirefox', 'ml']); before(async () => { await ml.api.cleanMlIndices(); diff --git a/x-pack/test/functional/services/ml/api.ts b/x-pack/test/functional/services/ml/api.ts index 07bd1f346cf25..d6802d2cb0f7d 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, @@ -273,6 +275,16 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { return state; }, + async getJobMemoryStatus(jobId: string): Promise<'hard_limit' | 'soft_limit' | 'ok'> { + const jobStats = await this.getADJobStats(jobId); + + expect(jobStats.jobs).to.have.length( + 1, + `Expected job stats to have exactly one job (got '${jobStats.length}')` + ); + return jobStats.jobs[0].model_size_stats.memory_status; + }, + async getADJobStats(jobId: string): Promise<any> { log.debug(`Fetching anomaly detection job stats for job ${jobId}...`); const { body: jobStats, status } = await esSupertest.get( @@ -299,6 +311,27 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { }); }, + async waitForJobMemoryStatus( + jobId: string, + expectedMemoryStatus: 'hard_limit' | 'soft_limit' | 'ok', + timeout: number = 2 * 60 * 1000 + ) { + await retry.waitForWithTimeout( + `job memory status to be ${expectedMemoryStatus}`, + timeout, + async () => { + const memoryStatus = await this.getJobMemoryStatus(jobId); + if (memoryStatus === expectedMemoryStatus) { + return true; + } else { + throw new Error( + `expected job memory status to be ${expectedMemoryStatus} but got ${memoryStatus}` + ); + } + } + ); + }, + async getDatafeedState(datafeedId: string): Promise<DATAFEED_STATE> { log.debug(`Fetching datafeed state for datafeed ${datafeedId}`); const { body: datafeedStats, status } = await esSupertest.get( @@ -576,6 +609,18 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { return response; }, + async hasNotifications(query: object) { + const body = await es.search({ + index: '.ml-notifications*', + body: { + size: 10000, + query, + }, + }); + + return body.hits.hits.length > 0; + }, + async adJobExist(jobId: string) { this.validateJobId(jobId); try { @@ -608,6 +653,24 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { }); }, + async waitForJobNotificationsToIndex(jobId: string, timeout: number = 60 * 1000) { + await retry.waitForWithTimeout(`Notifications for '${jobId}' to exist`, timeout, async () => { + if ( + await this.hasNotifications({ + term: { + job_id: { + value: jobId, + }, + }, + }) + ) { + return true; + } else { + throw new Error(`expected '${jobId}' notifications to exist`); + } + }); + }, + async createAnomalyDetectionJob(jobConfig: Job, space?: string) { const jobId = jobConfig.job_id; log.debug( @@ -1384,5 +1447,21 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) { log.debug('> Ingest pipeline deleted'); }, + + async setupModule( + moduleId: string, + body: TypeOf<typeof setupModuleBodySchema>, + 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/common_table_service.ts b/x-pack/test/functional/services/ml/common_table_service.ts new file mode 100644 index 0000000000000..50a40ab43f35a --- /dev/null +++ b/x-pack/test/functional/services/ml/common_table_service.ts @@ -0,0 +1,118 @@ +/* + * 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 { WebElementWrapper } from '../../../../../test/functional/services/lib/web_element_wrapper'; +import { FtrProviderContext } from '../../ftr_provider_context'; + +export type MlTableService = ReturnType<typeof MlTableServiceProvider>; + +export function MlTableServiceProvider({ getPageObject, getService }: FtrProviderContext) { + const testSubjects = getService('testSubjects'); + const commonPage = getPageObject('common'); + + const TableService = class { + constructor( + public readonly tableTestSubj: string, + public readonly tableRowSubj: string, + public readonly columns: Array<{ id: string; testSubj: string }>, + public readonly searchInputSubj: string + ) {} + + public async assertTableLoaded() { + await testSubjects.existOrFail(`~${this.tableTestSubj} loaded`); + } + + public async assertTableLoading() { + await testSubjects.existOrFail(`~${this.tableTestSubj} loading`); + } + + public async parseTable() { + const table = await testSubjects.find(`~${this.tableTestSubj}`); + const $ = await table.parseDomContent(); + const rows = []; + + for (const tr of $.findTestSubjects(`~${this.tableRowSubj}`).toArray()) { + const $tr = $(tr); + + const rowObject = this.columns.reduce((acc, curr) => { + acc[curr.id] = $tr + .findTestSubject(curr.testSubj) + .find('.euiTableCellContent') + .text() + .trim(); + return acc; + }, {} as Record<typeof this.columns[number]['id'], string>); + + rows.push(rowObject); + } + + return rows; + } + + public async assertRowsNumberPerPage(rowsNumber: 10 | 25 | 50 | 100) { + const textContent = await testSubjects.getVisibleText( + `~${this.tableTestSubj} > tablePaginationPopoverButton` + ); + expect(textContent).to.be(`Rows per page: ${rowsNumber}`); + } + + public async waitForTableToStartLoading() { + await testSubjects.existOrFail(`~${this.tableTestSubj}`, { timeout: 60 * 1000 }); + await testSubjects.existOrFail(`${this.tableTestSubj} loading`, { timeout: 30 * 1000 }); + } + + public async waitForTableToLoad() { + await testSubjects.existOrFail(`~${this.tableTestSubj}`, { timeout: 60 * 1000 }); + await testSubjects.existOrFail(`${this.tableTestSubj} loaded`, { timeout: 30 * 1000 }); + } + + async getSearchInput(): Promise<WebElementWrapper> { + return await testSubjects.find(this.searchInputSubj); + } + + public async assertSearchInputValue(expectedSearchValue: string) { + const searchBarInput = await this.getSearchInput(); + const actualSearchValue = await searchBarInput.getAttribute('value'); + expect(actualSearchValue).to.eql( + expectedSearchValue, + `Search input value should be '${expectedSearchValue}' (got '${actualSearchValue}')` + ); + } + + public async filterWithSearchString(queryString: string, expectedRowCount: number = 1) { + await this.waitForTableToLoad(); + const searchBarInput = await this.getSearchInput(); + await searchBarInput.clearValueWithKeyboard(); + await searchBarInput.type(queryString); + await commonPage.pressEnterKey(); + await this.assertSearchInputValue(queryString); + await this.waitForTableToStartLoading(); + await this.waitForTableToLoad(); + + const rows = await this.parseTable(); + + expect(rows).to.have.length( + expectedRowCount, + `Filtered table should have ${expectedRowCount} row(s) for filter '${queryString}' (got ${rows.length} matching items)` + ); + } + }; + + return { + getServiceInstance( + name: string, + tableTestSubj: string, + tableRowSubj: string, + columns: Array<{ id: string; testSubj: string }>, + searchInputSubj: string + ) { + Object.defineProperty(TableService, 'name', { value: name }); + return new TableService(tableTestSubj, tableRowSubj, columns, searchInputSubj); + }, + }; +} diff --git a/x-pack/test/functional/services/ml/custom_urls.ts b/x-pack/test/functional/services/ml/custom_urls.ts index 1695b575e1f05..46e145cda1c3c 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/index.ts b/x-pack/test/functional/services/ml/index.ts index d8c6924ec4cfd..9452baa324898 100644 --- a/x-pack/test/functional/services/ml/index.ts +++ b/x-pack/test/functional/services/ml/index.ts @@ -59,6 +59,8 @@ import { MachineLearningJobAnnotationsProvider } from './job_annotations_table'; import { MlNodesPanelProvider } from './ml_nodes_list'; import { MachineLearningCasesProvider } from './cases'; import { AnomalyChartsProvider } from './anomaly_charts'; +import { NotificationsProvider } from './notifications'; +import { MlTableServiceProvider } from './common_table_service'; export function MachineLearningProvider(context: FtrProviderContext) { const commonAPI = MachineLearningCommonAPIProvider(context); @@ -123,6 +125,7 @@ export function MachineLearningProvider(context: FtrProviderContext) { const settingsFilterList = MachineLearningSettingsFilterListProvider(context, commonUI); const singleMetricViewer = MachineLearningSingleMetricViewerProvider(context, commonUI); const stackManagementJobs = MachineLearningStackManagementJobsProvider(context); + const tableService = MlTableServiceProvider(context); const testExecution = MachineLearningTestExecutionProvider(context); const testResources = MachineLearningTestResourcesProvider(context, api); const alerting = MachineLearningAlertingProvider(context, api, commonUI); @@ -130,6 +133,7 @@ export function MachineLearningProvider(context: FtrProviderContext) { const trainedModels = TrainedModelsProvider(context, commonUI); const trainedModelsTable = TrainedModelsTableProvider(context, commonUI); const mlNodesPanel = MlNodesPanelProvider(context); + const notifications = NotificationsProvider(context, commonUI, tableService); const cases = MachineLearningCasesProvider(context, swimLane, anomalyCharts); @@ -171,7 +175,9 @@ export function MachineLearningProvider(context: FtrProviderContext) { jobWizardMultiMetric, jobWizardPopulation, lensVisualizations, + mlNodesPanel, navigation, + notifications, overviewPage, securityCommon, securityUI, @@ -181,10 +187,10 @@ export function MachineLearningProvider(context: FtrProviderContext) { singleMetricViewer, stackManagementJobs, swimLane, + tableService, testExecution, testResources, trainedModels, trainedModelsTable, - mlNodesPanel, }; } diff --git a/x-pack/test/functional/services/ml/notifications.ts b/x-pack/test/functional/services/ml/notifications.ts new file mode 100644 index 0000000000000..2365717d7226b --- /dev/null +++ b/x-pack/test/functional/services/ml/notifications.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 expect from '@kbn/expect'; +import { FtrProviderContext } from '../../ftr_provider_context'; +import { MlCommonUI } from './common_ui'; +import { MlTableService } from './common_table_service'; + +export function NotificationsProvider( + { getService }: FtrProviderContext, + mlCommonUI: MlCommonUI, + tableService: MlTableService +) { + const testSubjects = getService('testSubjects'); + + return { + async assertNotificationIndicatorExist(expectExist = true) { + if (expectExist) { + await testSubjects.existOrFail('mlNotificationsIndicator'); + } else { + await testSubjects.missingOrFail('mlNotificationsIndicator'); + } + }, + + async assertNotificationErrorsCount(expectedCount: number) { + const actualCount = await testSubjects.getVisibleText('mlNotificationErrorsIndicator'); + expect(actualCount).to.greaterThan(expectedCount); + }, + + table: tableService.getServiceInstance( + 'NotificationsTable', + 'mlNotificationsTable', + 'mlNotificationsTableRow', + [ + { id: 'timestamp', testSubj: 'mlNotificationTime' }, + { id: 'level', testSubj: 'mlNotificationLevel' }, + { id: 'job_type', testSubj: 'mlNotificationType' }, + { id: 'job_id', testSubj: 'mlNotificationEntity' }, + { id: 'message', testSubj: 'mlNotificationMessage' }, + ], + 'mlNotificationsSearchBarInput' + ), + }; +} diff --git a/x-pack/test/functional/services/ml/test_resources.ts b/x-pack/test/functional/services/ml/test_resources.ts index d1a7557caf2b1..56d01a4f1a867 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<boolean> { - const response = await supertest.get(`/api/saved_objects/${objectType}/${id}`); + async savedObjectExistsById( + id: string, + objectType: SavedObjectType, + space?: string + ): Promise<boolean> { + const response = await supertest.get( + `${space ? `/s/${space}` : ''}/api/saved_objects/${objectType}/${id}` + ); return response.status === 200; }, - async savedObjectExistsByTitle(title: string, objectType: SavedObjectType): Promise<boolean> { - const id = await this.getSavedObjectIdByTitle(title, objectType); + async savedObjectExistsByTitle( + title: string, + objectType: SavedObjectType, + space?: string + ): Promise<boolean> { + 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<string | undefined> { 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<string | undefined> { - return this.getSavedObjectIdByTitle(title, SavedObjectType.INDEX_PATTERN); + async getIndexPatternId(title: string, space?: string): Promise<string | undefined> { + return this.getSavedObjectIdByTitle(title, SavedObjectType.INDEX_PATTERN, space); }, async getSavedSearchId(title: string): Promise<string | undefined> { @@ -120,7 +133,11 @@ export function MachineLearningTestResourcesProvider( return this.getSavedObjectIdByTitle(title, SavedObjectType.DASHBOARD); }, - async createIndexPattern(title: string, timeFieldName?: string): Promise<string> { + async createIndexPattern( + title: string, + timeFieldName?: string, + space?: string + ): Promise<string> { 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<string> { - const indexPatternId = await this.getIndexPatternId(title); + async createIndexPatternIfNeeded( + title: string, + timeFieldName?: string, + space?: string + ): Promise<string> { + 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 56dfa17ef6268..d32c5bd58a94c 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/observability_functional/apps/observability/exploratory_view.ts b/x-pack/test/observability_functional/apps/observability/exploratory_view.ts index 8f27f20ce30e6..b3adaa556dac3 100644 --- a/x-pack/test/observability_functional/apps/observability/exploratory_view.ts +++ b/x-pack/test/observability_functional/apps/observability/exploratory_view.ts @@ -19,8 +19,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const rangeFrom = '2021-01-17T16%3A46%3A15.338Z'; const rangeTo = '2021-01-19T17%3A01%3A32.309Z'; - // Failing: See https://github.com/elastic/kibana/issues/106934 - describe.skip('ExploratoryView', () => { + describe('ExploratoryView', () => { before(async () => { await esArchiver.loadIfNeeded( Path.join('x-pack/test/apm_api_integration/common/fixtures/es_archiver', '8.0.0') @@ -33,11 +32,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await esArchiver.loadIfNeeded( Path.join('x-pack/test/apm_api_integration/common/fixtures/es_archiver', 'rum_test_data') ); - - await PageObjects.common.navigateToApp('ux', { - search: `?rangeFrom=${rangeFrom}&rangeTo=${rangeTo}`, - }); - await PageObjects.header.waitUntilLoadingHasFinished(); }); after(async () => { @@ -48,16 +42,28 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await esArchiver.unload( Path.join('x-pack/test/apm_api_integration/common/fixtures/es_archiver', 'rum_8.0.0') ); + await esArchiver.unload( + Path.join('x-pack/test/apm_api_integration/common/fixtures/es_archiver', 'rum_test_data') + ); + }); + + it('should go to ux app', async function () { + await PageObjects.common.navigateToApp('ux', { + search: `?rangeFrom=${rangeFrom}&rangeTo=${rangeTo}`, + }); + + await PageObjects.header.waitUntilLoadingHasFinished(); }); it('should able to open exploratory view from ux app', async () => { await testSubjects.exists('uxAnalyzeBtn'); await testSubjects.click('uxAnalyzeBtn'); - expect(await find.existsByCssSelector('.euiBasicTable')).to.eql(true); + + await PageObjects.header.waitUntilLoadingHasFinished(); }); it('renders lens visualization', async () => { - expect(await testSubjects.exists('lnsVisualizationContainer')).to.eql(true); + expect(await testSubjects.exists('xyVisChart')).to.eql(true); expect( await find.existsByCssSelector('div[data-title="Prefilled from exploratory view app"]') @@ -67,12 +73,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('can do a breakdown per series', async () => { + await testSubjects.click('editSeries0'); + await testSubjects.click('seriesBreakdown'); expect(await find.existsByCssSelector('[id="user_agent.name"]')).to.eql(true); await find.clickByCssSelector('[id="user_agent.name"]'); + await testSubjects.click('seriesChangesApplyButton'); + await PageObjects.header.waitUntilLoadingHasFinished(); expect(await find.existsByCssSelector('[title="Chrome Mobile iOS"]')).to.eql(true); diff --git a/x-pack/test/osquery_cypress/artifact_manager.ts b/x-pack/test/osquery_cypress/artifact_manager.ts index bef18d0177220..7ee2680e21f83 100644 --- a/x-pack/test/osquery_cypress/artifact_manager.ts +++ b/x-pack/test/osquery_cypress/artifact_manager.ts @@ -6,5 +6,5 @@ */ export async function getLatestVersion(): Promise<string> { - return '8.5.0-SNAPSHOT'; + return '8.6.0-SNAPSHOT'; } 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 123259cadf0c7..fd7e07dacb477 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 4e5059933dd74..34e18b76088f1 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/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/save_search_session_relative_time.ts b/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/save_search_session_relative_time.ts index 27b2914d3575b..86c36241b9ca7 100644 --- a/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/save_search_session_relative_time.ts +++ b/x-pack/test/search_sessions_integration/tests/apps/dashboard/async_search/save_search_session_relative_time.ts @@ -91,7 +91,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('Checking saved searches rendered'); await dashboardExpect.savedSearchRowCount(11); log.debug('Checking input controls rendered'); - await dashboardExpect.inputControlItemCount(3); + await dashboardExpect.controlCount(3); log.debug('Checking tag cloud rendered'); await dashboardExpect.tagCloudWithValuesFound(['Sunny', 'Rain', 'Clear', 'Cloudy', 'Hail']); log.debug('Checking vega chart rendered'); diff --git a/x-pack/test/security_api_integration/tests/kerberos/kerberos_login.ts b/x-pack/test/security_api_integration/tests/kerberos/kerberos_login.ts index f92f9d5a58b5b..10420d637afaf 100644 --- a/x-pack/test/security_api_integration/tests/kerberos/kerberos_login.ts +++ b/x-pack/test/security_api_integration/tests/kerberos/kerberos_login.ts @@ -6,6 +6,7 @@ */ import expect from '@kbn/expect'; +import jestExpect from 'expect'; import { parse as parseCookie, Cookie } from 'tough-cookie'; import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { adminTestUser } from '@kbn/test'; @@ -142,26 +143,29 @@ export default function ({ getService }: FtrProviderContext) { ? ['kibana_admin', 'superuser_anonymous'] : ['kibana_admin']; - await supertest + const spnegoResponse = await supertest .get('/internal/security/me') .set('kbn-xsrf', 'xxx') .set('Cookie', sessionCookie.cookieString()) - .expect(200, { - username: 'tester@TEST.ELASTIC.CO', - roles: expectedUserRoles, - full_name: null, - email: null, - metadata: { - kerberos_user_principal_name: 'tester@TEST.ELASTIC.CO', - kerberos_realm: 'TEST.ELASTIC.CO', - }, - enabled: true, - authentication_realm: { name: 'kerb1', type: 'kerberos' }, - lookup_realm: { name: 'kerb1', type: 'kerberos' }, - authentication_provider: { type: 'kerberos', name: 'kerberos' }, - authentication_type: 'token', - elastic_cloud_user: false, - }); + .expect(200); + + jestExpect(spnegoResponse.body).toEqual({ + username: 'tester@TEST.ELASTIC.CO', + roles: expectedUserRoles, + full_name: null, + email: null, + metadata: { + kerberos_user_principal_name: 'tester@TEST.ELASTIC.CO', + kerberos_realm: 'TEST.ELASTIC.CO', + }, + enabled: true, + authentication_realm: { name: 'kerb1', type: 'kerberos' }, + lookup_realm: { name: 'kerb1', type: 'kerberos' }, + authentication_provider: { type: 'kerberos', name: 'kerberos' }, + authentication_type: 'token', + elastic_cloud_user: false, + profile_uid: jestExpect.any(String), + }); }); it('should re-initiate SPNEGO handshake if token is rejected with 401', async () => { diff --git a/x-pack/test/security_api_integration/tests/login_selector/basic_functionality.ts b/x-pack/test/security_api_integration/tests/login_selector/basic_functionality.ts index df7d309261a38..b9f5aa96080e9 100644 --- a/x-pack/test/security_api_integration/tests/login_selector/basic_functionality.ts +++ b/x-pack/test/security_api_integration/tests/login_selector/basic_functionality.ts @@ -53,7 +53,7 @@ export default function ({ getService }: FtrProviderContext) { .set('Cookie', sessionCookie.cookieString()) .expect(200); - expect(apiResponse.body).to.only.have.keys([ + expect(apiResponse.body).to.have.keys([ 'username', 'full_name', 'email', diff --git a/x-pack/test/security_api_integration/tests/oidc/authorization_code_flow/oidc_auth.ts b/x-pack/test/security_api_integration/tests/oidc/authorization_code_flow/oidc_auth.ts index 9ea2e9b635522..4222f4f6a64f7 100644 --- a/x-pack/test/security_api_integration/tests/oidc/authorization_code_flow/oidc_auth.ts +++ b/x-pack/test/security_api_integration/tests/oidc/authorization_code_flow/oidc_auth.ts @@ -217,7 +217,7 @@ export default function ({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxx') .set('Cookie', sessionCookie.cookieString()) .expect(200); - expect(apiResponse.body).to.only.have.keys([ + expect(apiResponse.body).to.have.keys([ 'username', 'full_name', 'email', @@ -271,7 +271,7 @@ export default function ({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxx') .set('Cookie', sessionCookie.cookieString()) .expect(200); - expect(apiResponse.body).to.only.have.keys([ + expect(apiResponse.body).to.have.keys([ 'username', 'full_name', 'email', diff --git a/x-pack/test/security_api_integration/tests/oidc/implicit_flow/oidc_auth.ts b/x-pack/test/security_api_integration/tests/oidc/implicit_flow/oidc_auth.ts index 9a0483d5cebaa..8e7fe36fd689b 100644 --- a/x-pack/test/security_api_integration/tests/oidc/implicit_flow/oidc_auth.ts +++ b/x-pack/test/security_api_integration/tests/oidc/implicit_flow/oidc_auth.ts @@ -141,7 +141,7 @@ export default function ({ getService }: FtrProviderContext) { .set('kbn-xsrf', 'xxx') .set('Cookie', sessionCookie.cookieString()) .expect(200); - expect(apiResponse.body).to.only.have.keys([ + expect(apiResponse.body).to.have.keys([ 'username', 'full_name', 'email', diff --git a/x-pack/test/security_api_integration/tests/pki/pki_auth.ts b/x-pack/test/security_api_integration/tests/pki/pki_auth.ts index 6b8178ac938df..c286adcc7879b 100644 --- a/x-pack/test/security_api_integration/tests/pki/pki_auth.ts +++ b/x-pack/test/security_api_integration/tests/pki/pki_auth.ts @@ -6,6 +6,7 @@ */ import expect from '@kbn/expect'; +import jestExpect from 'expect'; import { parse as parseCookie, Cookie } from 'tough-cookie'; import { setTimeout as setTimeoutAsync } from 'timers/promises'; import { readFileSync } from 'fs'; @@ -123,7 +124,7 @@ export default function ({ getService }: FtrProviderContext) { }); it('should properly set cookie and authenticate user', async () => { - const response = await supertest + let response = await supertest .get('/security/account') .ca(CA_CERT) .pfx(FIRST_CLIENT_CERT) @@ -136,29 +137,32 @@ export default function ({ getService }: FtrProviderContext) { checkCookieIsSet(sessionCookie); // Cookie should be accepted. - await supertest + response = await supertest .get('/internal/security/me') .set('kbn-xsrf', 'xxx') .ca(CA_CERT) .pfx(FIRST_CLIENT_CERT) .set('Cookie', sessionCookie.cookieString()) - .expect(200, { - username: 'first_client', - roles: ['kibana_admin'], - full_name: null, - email: null, - enabled: true, - metadata: { - pki_delegated_by_realm: 'reserved', - pki_delegated_by_user: 'kibana_system', - pki_dn: 'CN=first_client', - }, - authentication_realm: { name: 'pki1', type: 'pki' }, - lookup_realm: { name: 'pki1', type: 'pki' }, - authentication_provider: { name: 'pki', type: 'pki' }, - authentication_type: 'token', - elastic_cloud_user: false, - }); + .expect(200); + + jestExpect(response.body).toEqual({ + username: 'first_client', + roles: ['kibana_admin'], + full_name: null, + email: null, + enabled: true, + metadata: { + pki_delegated_by_realm: 'reserved', + pki_delegated_by_user: 'kibana_system', + pki_dn: 'CN=first_client', + }, + authentication_realm: { name: 'pki1', type: 'pki' }, + lookup_realm: { name: 'pki1', type: 'pki' }, + authentication_provider: { name: 'pki', type: 'pki' }, + authentication_type: 'token', + elastic_cloud_user: false, + profile_uid: jestExpect.any(String), + }); }); it('should update session if new certificate is provided', async () => { @@ -180,23 +184,26 @@ export default function ({ getService }: FtrProviderContext) { .pfx(SECOND_CLIENT_CERT) .set('kbn-xsrf', 'xxx') .set('Cookie', sessionCookie.cookieString()) - .expect(200, { - username: 'second_client', - roles: [], - full_name: null, - email: null, - enabled: true, - metadata: { - pki_delegated_by_realm: 'reserved', - pki_delegated_by_user: 'kibana_system', - pki_dn: 'CN=second_client', - }, - authentication_realm: { name: 'pki1', type: 'pki' }, - lookup_realm: { name: 'pki1', type: 'pki' }, - authentication_provider: { name: 'pki', type: 'pki' }, - authentication_type: 'realm', - elastic_cloud_user: false, - }); + .expect(200); + + jestExpect(response.body).toEqual({ + username: 'second_client', + roles: [], + full_name: null, + email: null, + enabled: true, + metadata: { + pki_delegated_by_realm: 'reserved', + pki_delegated_by_user: 'kibana_system', + pki_dn: 'CN=second_client', + }, + authentication_realm: { name: 'pki1', type: 'pki' }, + lookup_realm: { name: 'pki1', type: 'pki' }, + authentication_provider: { name: 'pki', type: 'pki' }, + authentication_type: 'realm', + elastic_cloud_user: false, + profile_uid: jestExpect.any(String), + }); checkCookieIsSet(parseCookie(response.headers['set-cookie'][0])!); }); diff --git a/x-pack/test/security_api_integration/tests/saml/saml_login.ts b/x-pack/test/security_api_integration/tests/saml/saml_login.ts index 474525eab4979..43d38a818c8ff 100644 --- a/x-pack/test/security_api_integration/tests/saml/saml_login.ts +++ b/x-pack/test/security_api_integration/tests/saml/saml_login.ts @@ -55,7 +55,7 @@ export default function ({ getService }: FtrProviderContext) { .set('Cookie', sessionCookie.cookieString()) .expect(200); - expect(apiResponse.body).to.only.have.keys([ + expect(apiResponse.body).to.have.keys([ 'username', 'full_name', 'email', diff --git a/x-pack/test/security_api_integration/tests/user_profiles/get_current.ts b/x-pack/test/security_api_integration/tests/user_profiles/get_current.ts index d7f23545aecd0..a56c5ac9004b8 100644 --- a/x-pack/test/security_api_integration/tests/user_profiles/get_current.ts +++ b/x-pack/test/security_api_integration/tests/user_profiles/get_current.ts @@ -6,6 +6,7 @@ */ import { parse as parseCookie } from 'tough-cookie'; +import expect from 'expect'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService }: FtrProviderContext) { @@ -64,6 +65,10 @@ export default function ({ getService }: FtrProviderContext) { .get('/internal/security/user_profile?dataPath=some') .set('Cookie', sessionCookie.cookieString()) .expect(200); + const { body: userWithProfileId } = await supertestWithoutAuth + .get('/internal/security/me') + .set('Cookie', sessionCookie.cookieString()) + .expect(200); // Profile UID is supposed to be stable. expectSnapshot(profileWithoutData).toMatchInline(` @@ -134,6 +139,7 @@ export default function ({ getService }: FtrProviderContext) { }, } `); + expect(userWithProfileId.profile_uid).toBe('u_K1WXIRQbRoHiuJylXp842IEhAO_OdqT7SDHrJSzUIjU_0'); }); }); } diff --git a/x-pack/test/security_solution_endpoint/apps/endpoint/responder.ts b/x-pack/test/security_solution_endpoint/apps/endpoint/responder.ts index 9caf231089860..ddcbbc6251fdf 100644 --- a/x-pack/test/security_solution_endpoint/apps/endpoint/responder.ts +++ b/x-pack/test/security_solution_endpoint/apps/endpoint/responder.ts @@ -116,7 +116,8 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { }); }); - describe('from timeline', () => { + // FLAKY: https://github.com/elastic/kibana/issues/140546 + describe.skip('from timeline', () => { let timeline: TimelineResponse; before(async () => { diff --git a/x-pack/test/stack_functional_integration/apps/filebeat/filebeat.ts b/x-pack/test/stack_functional_integration/apps/filebeat/filebeat.ts index 4bcdc75d7fa50..c8ddb8aabec30 100644 --- a/x-pack/test/stack_functional_integration/apps/filebeat/filebeat.ts +++ b/x-pack/test/stack_functional_integration/apps/filebeat/filebeat.ts @@ -16,7 +16,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('filebeat- should have hit count GT 0', async function () { await PageObjects.common.navigateToApp('discover', { insertTimestamp: false }); await PageObjects.discover.selectIndexPattern('filebeat-*'); - await PageObjects.timePicker.setCommonlyUsedTime('Last_30 days'); + await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year'); await retry.try(async () => { const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10); expect(hitCount).to.be.greaterThan(0); diff --git a/x-pack/test/stack_functional_integration/apps/heartbeat/_heartbeat.ts b/x-pack/test/stack_functional_integration/apps/heartbeat/_heartbeat.ts index 801e651d8b92e..9f402c019d0a7 100644 --- a/x-pack/test/stack_functional_integration/apps/heartbeat/_heartbeat.ts +++ b/x-pack/test/stack_functional_integration/apps/heartbeat/_heartbeat.ts @@ -10,11 +10,12 @@ import { FtrProviderContext } from '../../../functional/ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'uptime']); + const PageObjects = getPageObjects(['common', 'uptime', 'timePicker']); describe('check heartbeat overview page', function () { it('Uptime app should show 1 UP monitor', async function () { await PageObjects.common.navigateToApp('uptime', { insertTimestamp: false }); + await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year'); await retry.try(async function () { const upCount = parseInt((await PageObjects.uptime.getSnapshotCount()).up, 10); diff --git a/x-pack/test/stack_functional_integration/apps/metricbeat/_metricbeat.ts b/x-pack/test/stack_functional_integration/apps/metricbeat/_metricbeat.ts index 79dc213e5485a..f6a8aa7875302 100644 --- a/x-pack/test/stack_functional_integration/apps/metricbeat/_metricbeat.ts +++ b/x-pack/test/stack_functional_integration/apps/metricbeat/_metricbeat.ts @@ -26,7 +26,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { } await PageObjects.discover.selectIndexPattern('metricbeat-*'); - await PageObjects.timePicker.setCommonlyUsedTime('Today'); + await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year'); await retry.try(async function () { const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10); expect(hitCount).to.be.greaterThan(0); diff --git a/x-pack/test/stack_functional_integration/apps/packetbeat/_packetbeat.ts b/x-pack/test/stack_functional_integration/apps/packetbeat/_packetbeat.ts index d0d7e326441a0..e4bf8288a2093 100644 --- a/x-pack/test/stack_functional_integration/apps/packetbeat/_packetbeat.ts +++ b/x-pack/test/stack_functional_integration/apps/packetbeat/_packetbeat.ts @@ -30,7 +30,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await appsMenu.clickLink('Discover'); } await PageObjects.discover.selectIndexPattern('packetbeat-*'); - await PageObjects.timePicker.setCommonlyUsedTime('Today'); + await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year'); await retry.try(async function () { const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10); expect(hitCount).to.be.greaterThan(0); diff --git a/x-pack/test/stack_functional_integration/apps/winlogbeat/_winlogbeat.ts b/x-pack/test/stack_functional_integration/apps/winlogbeat/_winlogbeat.ts index 9ef8b85c0ec09..4f8107f937a77 100644 --- a/x-pack/test/stack_functional_integration/apps/winlogbeat/_winlogbeat.ts +++ b/x-pack/test/stack_functional_integration/apps/winlogbeat/_winlogbeat.ts @@ -25,7 +25,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await appsMenu.clickLink('Discover'); } await PageObjects.discover.selectIndexPattern('winlogbeat-*'); - await PageObjects.timePicker.setCommonlyUsedTime('Today'); + await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year'); await retry.try(async function () { const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10); expect(hitCount).to.be.greaterThan(0); diff --git a/x-pack/test/upgrade/apps/dashboard/dashboard_smoke_tests.ts b/x-pack/test/upgrade/apps/dashboard/dashboard_smoke_tests.ts index 9f1b14040c6a6..b156f909d7a5d 100644 --- a/x-pack/test/upgrade/apps/dashboard/dashboard_smoke_tests.ts +++ b/x-pack/test/upgrade/apps/dashboard/dashboard_smoke_tests.ts @@ -58,7 +58,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { log.debug('Checking saved searches rendered'); await dashboardExpect.savedSearchRowCount(49); log.debug('Checking input controls rendered'); - await dashboardExpect.inputControlItemCount(3); + await dashboardExpect.controlCount(3); log.debug('Checking tag cloud rendered'); await dashboardExpect.tagCloudWithValuesFound([ 'Sunny', diff --git a/yarn.lock b/yarn.lock index 085f55146d4ed..62d61b9fd93f3 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 "" @@ -3566,6 +3578,10 @@ version "0.0.0" uid "" +"@kbn/securitysolution-exception-list-components@link:bazel-bin/packages/kbn-securitysolution-exception-list-components": + version "0.0.0" + uid "" + "@kbn/securitysolution-hook-utils@link:bazel-bin/packages/kbn-securitysolution-hook-utils": version "0.0.0" uid "" @@ -7247,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 "" @@ -7283,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 "" @@ -7683,6 +7711,10 @@ version "0.0.0" uid "" +"@types/kbn__securitysolution-exception-list-components@link:bazel-bin/packages/kbn-securitysolution-exception-list-components/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__securitysolution-hook-utils@link:bazel-bin/packages/kbn-securitysolution-hook-utils/npm_module_types": version "0.0.0" uid "" @@ -12551,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" @@ -12575,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" @@ -14671,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" @@ -23354,10 +23386,10 @@ react-grid-layout@^1.3.4: react-draggable "^4.0.0" react-resizable "^3.0.4" -react-hook-form@^7.35.0: - version "7.35.0" - resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.35.0.tgz#b133de48fc84b1e62f9277ba79dfbacd9bb13dd3" - integrity sha512-9CYdOed+Itbiu5VMVxW0PK9mBR3f0gDGJcZEyUSm0eJbDymQ913TRs2gHcQZZmfTC+rtxyDFRuelMxx/+xwMcw== +react-hook-form@^7.36.1: + version "7.36.1" + resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.36.1.tgz#82a311fe8cbe75e689fd4529f083b7c983da6520" + integrity sha512-EbYYkCG2p8ywe7ikOH2l02lAFMrrrslZi1I8fqd8ifDGNAkhomHZQzQsP6ksvzrWBKntRe8b5L5L7Zsd+Gm02Q== react-input-autosize@^3.0.0: version "3.0.0" @@ -27942,10 +27974,10 @@ vega-label@~1.2.0: vega-scenegraph "^4.9.2" vega-util "^1.15.2" -vega-lite@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/vega-lite/-/vega-lite-5.3.0.tgz#b9b9ecd80e869e823e6848c67d0a8ad94954bdee" - integrity sha512-6giodZ/bJnWyLq6Gj4OyiDt7EndoGyC9f5xDQjo82yPpUiO4MuG9iiPMqR1SPKmG9/qPBf+klWQR0v/7Mgju0Q== +vega-lite@^5.5.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/vega-lite/-/vega-lite-5.5.0.tgz#07345713d538cd63278748ec119c261722be66ff" + integrity sha512-MQBJt/iaUegvhRTS/hZVWfMOSF5ai4awlR2qtwTgHd84bErf9v7GtaZ9ArhJqXCb+FizvZ2jatmoYCzovgAhkg== dependencies: "@types/clone" "~2.1.1" array-flat-polyfill "^1.0.1"