From ad59308b24106497e9ce61d8b0bc454563cd2a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Thu, 31 Aug 2023 14:18:44 +0200 Subject: [PATCH] [Log Explorer] Convert log explorer profile into standalone app (#164493) Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Marco Antonio Ghiani --- .buildkite/ftr_configs.yml | 2 +- .../steps/storybooks/build_and_upload.ts | 2 +- .github/CODEOWNERS | 3 +- config/serverless.oblt.yml | 1 - docs/developer/plugin-list.asciidoc | 12 +- package.json | 3 +- packages/deeplinks/observability/constants.ts | 2 + .../deeplinks/observability/deep_links.ts | 7 +- .../deeplinks/observability/tsconfig.json | 1 - packages/kbn-optimizer/limits.yml | 5 +- src/dev/storybook/aliases.ts | 2 +- .../collectors/application_usage/schema.ts | 1 + src/plugins/telemetry/schema/oss_plugins.json | 131 +++++++++ .../test_suites/core_plugins/rendering.ts | 5 +- tsconfig.base.json | 6 +- x-pack/.i18nrc.json | 3 +- .../plugins/discover_log_explorer/README.md | 8 - .../common/runtime_types.ts | 53 ---- .../discover_log_explorer/kibana.jsonc | 15 -- .../public/deep_links.ts | 21 -- .../discover_log_explorer/public/plugin.ts | 38 --- .../discover_log_explorer/public/types.ts | 16 -- .../discover_log_explorer/server/config.ts | 31 --- x-pack/plugins/infra/public/plugin.ts | 6 + .../.storybook/__mocks__/package_icon.tsx | 0 .../.storybook/main.js | 0 .../.storybook/preview.js | 0 x-pack/plugins/log_explorer/README.md | 8 + .../common/constants.ts | 0 .../common/datasets/errors.ts | 0 .../common/datasets/index.ts | 0 .../common/datasets/models/dataset.ts | 0 .../common/datasets/models/integration.ts | 0 .../common/datasets/types.ts | 0 .../common/datasets/v1/common.ts | 0 .../common/datasets/v1/find_datasets.ts | 0 .../common/datasets/v1/find_integrations.ts | 0 .../common/datasets/v1/index.ts | 0 .../common/hashed_cache.ts | 0 .../common/latest.ts | 0 .../log_explorer/common/plugin_config.ts | 9 + .../log_explorer/common/runtime_types.ts | 8 + .../jest.config.js | 8 +- x-pack/plugins/log_explorer/kibana.jsonc | 27 ++ .../components/dataset_selector/constants.tsx | 42 ++- .../dataset_selector.stories.tsx | 2 +- .../dataset_selector/dataset_selector.tsx | 0 .../components/dataset_selector/index.ts | 0 .../state_machine/defaults.ts | 0 .../dataset_selector/state_machine/index.ts | 0 .../state_machine/state_machine.ts | 0 .../dataset_selector/state_machine/types.ts | 0 .../state_machine/use_dataset_selector.ts | 0 .../sub_components/datasets_list.tsx | 2 +- .../sub_components/datasets_popover.tsx | 0 .../sub_components/datasets_skeleton.tsx | 0 .../integrations_list_status.tsx | 2 +- .../sub_components/search_controls.tsx | 0 .../components/dataset_selector/types.ts | 0 .../components/dataset_selector/utils.tsx | 0 .../public/components/log_explorer/index.ts | 8 + .../components/log_explorer/log_explorer.tsx | 62 +++++ .../customizations/custom_dataset_filters.tsx | 10 - .../custom_dataset_selector.tsx | 0 .../customizations/log_explorer_profile.tsx | 2 +- .../public/hooks/use_control_panels.tsx | 0 .../public/hooks/use_dataset_selection.ts | 0 .../public/hooks/use_datasets.ts | 0 .../public/hooks/use_integrations.ts | 0 .../public/hooks/use_intersection_ref.ts | 0 x-pack/plugins/log_explorer/public/index.ts | 15 ++ x-pack/plugins/log_explorer/public/plugin.ts | 35 +++ .../services/datasets/datasets_client.mock.ts | 0 .../services/datasets/datasets_client.ts | 0 .../datasets/datasets_service.mock.ts | 0 .../services/datasets/datasets_service.ts | 0 .../public/services/datasets/index.ts | 0 .../public/services/datasets/types.ts | 0 .../public/state_machines/datasets/index.ts | 0 .../state_machines/datasets/src/defaults.ts | 0 .../state_machines/datasets/src/index.ts | 0 .../datasets/src/state_machine.ts | 0 .../state_machines/datasets/src/types.ts | 0 .../state_machines/integrations/index.ts | 0 .../integrations/src/defaults.ts | 0 .../state_machines/integrations/src/index.ts | 0 .../integrations/src/state_machine.ts | 0 .../state_machines/integrations/src/types.ts | 0 .../log_explorer_profile/index.ts | 0 .../src/data_view_service.ts | 0 .../log_explorer_profile/src/defaults.ts | 0 .../log_explorer_profile/src/index.ts | 0 .../log_explorer_profile/src/notifications.ts | 18 +- .../log_explorer_profile/src/state_machine.ts | 0 .../log_explorer_profile/src/types.ts | 0 .../src/url_state_storage_service.ts | 0 .../log_explorer_profile/src/utils.ts | 0 x-pack/plugins/log_explorer/public/types.ts | 23 ++ .../public/utils/comparator_by_field.ts | 0 .../all_dataset_selection.ts | 0 .../utils/dataset_selection/encoding.test.ts | 0 .../utils/dataset_selection/encoding.ts | 0 .../public/utils/dataset_selection/errors.ts | 0 .../hydrate_dataset_selection.ts.ts | 0 .../public/utils/dataset_selection/index.ts | 0 .../single_dataset_selection.ts | 0 .../public/utils/dataset_selection/types.ts | 0 .../public/utils/dynamic.tsx | 0 .../log_explorer/public/utils/proxies.ts | 36 +++ x-pack/plugins/log_explorer/server/index.ts | 10 + .../server/plugin.ts | 2 +- .../tsconfig.json | 2 +- .../.storybook/__mocks__/package_icon.tsx | 11 + .../.storybook/main.js | 22 ++ .../.storybook/preview.js | 13 + .../observability_log_explorer/README.md | 3 + .../common/plugin_config.ts | 6 +- .../common/translations.ts | 23 ++ .../observability_log_explorer/jest.config.js | 18 ++ .../observability_log_explorer/kibana.jsonc | 24 ++ .../observability_log_explorer.tsx | 73 +++++ .../public/components/page_template.tsx | 36 +++ .../public/index.ts | 8 +- .../public/plugin.ts | 66 +++++ .../public/routes/main/index.tsx | 8 + .../public/routes/main/main_route.tsx | 38 +++ .../public/types.ts | 28 ++ .../public/utils/breadcrumbs.tsx | 49 ++++ .../public/utils/use_kibana.tsx | 46 ++++ .../server/config.ts | 39 +++ .../server/index.ts | 4 +- .../server/plugin.ts | 14 + .../observability_log_explorer/tsconfig.json | 29 ++ .../components/side_navigation/index.tsx | 6 +- .../discover_log_explorer/customization.ts | 74 ----- .../apps/observability_log_explorer/app.ts | 28 ++ .../columns_selection.ts | 20 +- .../config.ts | 0 .../dataset_selection_state.ts | 45 ++-- .../dataset_selector.ts | 253 +++++++++--------- .../filter_controls.ts | 28 ++ .../index.ts | 5 +- x-pack/test/functional/config.base.js | 3 + .../data_streams/data.json.gz | Bin .../data_streams/mappings.json | 0 x-pack/test/functional/page_objects/index.ts | 4 +- ...lorer.ts => observability_log_explorer.ts} | 12 +- .../global_search/global_search_providers.ts | 2 +- .../test_serverless/functional/config.base.ts | 3 + .../cypress/e2e/navigation.cy.ts | 9 +- .../discover_log_explorer/customization.ts | 65 ----- .../test_suites/observability/index.ts | 3 +- .../test_suites/observability/navigation.ts | 21 +- .../observability_log_explorer/app.ts | 25 ++ .../columns_selection.ts | 20 +- .../dataset_selection_state.ts | 49 ++-- .../dataset_selector.ts | 253 +++++++++--------- .../filter_controls.ts | 28 ++ .../index.ts | 7 +- x-pack/test_serverless/tsconfig.json | 1 + yarn.lock | 12 +- 161 files changed, 1493 insertions(+), 746 deletions(-) delete mode 100755 x-pack/plugins/discover_log_explorer/README.md delete mode 100644 x-pack/plugins/discover_log_explorer/common/runtime_types.ts delete mode 100644 x-pack/plugins/discover_log_explorer/kibana.jsonc delete mode 100644 x-pack/plugins/discover_log_explorer/public/deep_links.ts delete mode 100644 x-pack/plugins/discover_log_explorer/public/plugin.ts delete mode 100644 x-pack/plugins/discover_log_explorer/public/types.ts delete mode 100644 x-pack/plugins/discover_log_explorer/server/config.ts rename x-pack/plugins/{discover_log_explorer => log_explorer}/.storybook/__mocks__/package_icon.tsx (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/.storybook/main.js (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/.storybook/preview.js (100%) create mode 100755 x-pack/plugins/log_explorer/README.md rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/constants.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/datasets/errors.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/datasets/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/datasets/models/dataset.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/datasets/models/integration.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/datasets/types.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/datasets/v1/common.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/datasets/v1/find_datasets.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/datasets/v1/find_integrations.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/datasets/v1/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/hashed_cache.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/common/latest.ts (100%) create mode 100644 x-pack/plugins/log_explorer/common/plugin_config.ts create mode 100644 x-pack/plugins/log_explorer/common/runtime_types.ts rename x-pack/plugins/{discover_log_explorer => log_explorer}/jest.config.js (66%) create mode 100644 x-pack/plugins/log_explorer/kibana.jsonc rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/constants.tsx (57%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/dataset_selector.stories.tsx (99%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/dataset_selector.tsx (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/state_machine/defaults.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/state_machine/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/state_machine/state_machine.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/state_machine/types.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/state_machine/use_dataset_selector.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/sub_components/datasets_list.tsx (97%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/sub_components/datasets_popover.tsx (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/sub_components/datasets_skeleton.tsx (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/sub_components/integrations_list_status.tsx (96%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/sub_components/search_controls.tsx (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/types.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/components/dataset_selector/utils.tsx (100%) create mode 100644 x-pack/plugins/log_explorer/public/components/log_explorer/index.ts create mode 100644 x-pack/plugins/log_explorer/public/components/log_explorer/log_explorer.tsx rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/customizations/custom_dataset_filters.tsx (91%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/customizations/custom_dataset_selector.tsx (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/customizations/log_explorer_profile.tsx (97%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/hooks/use_control_panels.tsx (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/hooks/use_dataset_selection.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/hooks/use_datasets.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/hooks/use_integrations.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/hooks/use_intersection_ref.ts (100%) create mode 100644 x-pack/plugins/log_explorer/public/index.ts create mode 100644 x-pack/plugins/log_explorer/public/plugin.ts rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/services/datasets/datasets_client.mock.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/services/datasets/datasets_client.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/services/datasets/datasets_service.mock.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/services/datasets/datasets_service.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/services/datasets/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/services/datasets/types.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/datasets/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/datasets/src/defaults.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/datasets/src/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/datasets/src/state_machine.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/datasets/src/types.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/integrations/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/integrations/src/defaults.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/integrations/src/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/integrations/src/state_machine.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/integrations/src/types.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/log_explorer_profile/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/log_explorer_profile/src/data_view_service.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/log_explorer_profile/src/defaults.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/log_explorer_profile/src/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/log_explorer_profile/src/notifications.ts (57%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/log_explorer_profile/src/state_machine.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/log_explorer_profile/src/types.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/log_explorer_profile/src/url_state_storage_service.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/state_machines/log_explorer_profile/src/utils.ts (100%) create mode 100644 x-pack/plugins/log_explorer/public/types.ts rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/comparator_by_field.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/dataset_selection/all_dataset_selection.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/dataset_selection/encoding.test.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/dataset_selection/encoding.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/dataset_selection/errors.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/dataset_selection/hydrate_dataset_selection.ts.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/dataset_selection/index.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/dataset_selection/single_dataset_selection.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/dataset_selection/types.ts (100%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/public/utils/dynamic.tsx (100%) create mode 100644 x-pack/plugins/log_explorer/public/utils/proxies.ts create mode 100644 x-pack/plugins/log_explorer/server/index.ts rename x-pack/plugins/{discover_log_explorer => log_explorer}/server/plugin.ts (83%) rename x-pack/plugins/{discover_log_explorer => log_explorer}/tsconfig.json (94%) create mode 100644 x-pack/plugins/observability_log_explorer/.storybook/__mocks__/package_icon.tsx create mode 100644 x-pack/plugins/observability_log_explorer/.storybook/main.js create mode 100644 x-pack/plugins/observability_log_explorer/.storybook/preview.js create mode 100644 x-pack/plugins/observability_log_explorer/README.md rename x-pack/plugins/{discover_log_explorer => observability_log_explorer}/common/plugin_config.ts (73%) create mode 100644 x-pack/plugins/observability_log_explorer/common/translations.ts create mode 100644 x-pack/plugins/observability_log_explorer/jest.config.js create mode 100644 x-pack/plugins/observability_log_explorer/kibana.jsonc create mode 100644 x-pack/plugins/observability_log_explorer/public/applications/observability_log_explorer.tsx create mode 100644 x-pack/plugins/observability_log_explorer/public/components/page_template.tsx rename x-pack/plugins/{discover_log_explorer => observability_log_explorer}/public/index.ts (53%) create mode 100644 x-pack/plugins/observability_log_explorer/public/plugin.ts create mode 100644 x-pack/plugins/observability_log_explorer/public/routes/main/index.tsx create mode 100644 x-pack/plugins/observability_log_explorer/public/routes/main/main_route.tsx create mode 100644 x-pack/plugins/observability_log_explorer/public/types.ts create mode 100644 x-pack/plugins/observability_log_explorer/public/utils/breadcrumbs.tsx create mode 100644 x-pack/plugins/observability_log_explorer/public/utils/use_kibana.tsx create mode 100644 x-pack/plugins/observability_log_explorer/server/config.ts rename x-pack/plugins/{discover_log_explorer => observability_log_explorer}/server/index.ts (67%) create mode 100644 x-pack/plugins/observability_log_explorer/server/plugin.ts create mode 100644 x-pack/plugins/observability_log_explorer/tsconfig.json delete mode 100644 x-pack/test/functional/apps/discover_log_explorer/customization.ts create mode 100644 x-pack/test/functional/apps/observability_log_explorer/app.ts rename x-pack/test/functional/apps/{discover_log_explorer => observability_log_explorer}/columns_selection.ts (69%) rename x-pack/test/functional/apps/{discover_log_explorer => observability_log_explorer}/config.ts (100%) rename x-pack/test/functional/apps/{discover_log_explorer => observability_log_explorer}/dataset_selection_state.ts (64%) rename x-pack/test/functional/apps/{discover_log_explorer => observability_log_explorer}/dataset_selector.ts (61%) create mode 100644 x-pack/test/functional/apps/observability_log_explorer/filter_controls.ts rename x-pack/test/functional/apps/{discover_log_explorer => observability_log_explorer}/index.ts (78%) rename x-pack/test/functional/es_archives/{discover_log_explorer => observability_log_explorer}/data_streams/data.json.gz (100%) rename x-pack/test/functional/es_archives/{discover_log_explorer => observability_log_explorer}/data_streams/mappings.json (100%) rename x-pack/test/functional/page_objects/{discover_log_explorer.ts => observability_log_explorer.ts} (95%) delete mode 100644 x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts create mode 100644 x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/app.ts rename x-pack/test_serverless/functional/test_suites/observability/{discover_log_explorer => observability_log_explorer}/columns_selection.ts (69%) rename x-pack/test_serverless/functional/test_suites/observability/{discover_log_explorer => observability_log_explorer}/dataset_selection_state.ts (60%) rename x-pack/test_serverless/functional/test_suites/observability/{discover_log_explorer => observability_log_explorer}/dataset_selector.ts (61%) create mode 100644 x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/filter_controls.ts rename x-pack/test_serverless/functional/test_suites/observability/{discover_log_explorer => observability_log_explorer}/index.ts (69%) diff --git a/.buildkite/ftr_configs.yml b/.buildkite/ftr_configs.yml index 10924aaa18785..a781c62894d25 100644 --- a/.buildkite/ftr_configs.yml +++ b/.buildkite/ftr_configs.yml @@ -279,7 +279,6 @@ enabled: - x-pack/test/functional/apps/data_views/config.ts - x-pack/test/functional/apps/dev_tools/config.ts - x-pack/test/functional/apps/discover/config.ts - - x-pack/test/functional/apps/discover_log_explorer/config.ts - x-pack/test/functional/apps/graph/config.ts - x-pack/test/functional/apps/grok_debugger/config.ts - x-pack/test/functional/apps/home/config.ts @@ -313,6 +312,7 @@ enabled: - x-pack/test/functional/apps/ml/short_tests/config.ts - x-pack/test/functional/apps/ml/stack_management_jobs/config.ts - x-pack/test/functional/apps/monitoring/config.ts + - x-pack/test/functional/apps/observability_log_explorer/config.ts - x-pack/test/functional/apps/remote_clusters/config.ts - x-pack/test/functional/apps/reporting_management/config.ts - x-pack/test/functional/apps/rollup_job/config.ts diff --git a/.buildkite/scripts/steps/storybooks/build_and_upload.ts b/.buildkite/scripts/steps/storybooks/build_and_upload.ts index e9014da1cefae..2afc5f4037148 100644 --- a/.buildkite/scripts/steps/storybooks/build_and_upload.ts +++ b/.buildkite/scripts/steps/storybooks/build_and_upload.ts @@ -26,7 +26,7 @@ const STORYBOOKS = [ 'dashboard_enhanced', 'dashboard', 'data', - 'discover_log_explorer', + 'log_explorer', 'embeddable', 'expression_error', 'expression_image', diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 847c11ea9c6fb..03daae961776d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -329,7 +329,6 @@ packages/kbn-dev-utils @elastic/kibana-operations examples/developer_examples @elastic/appex-sharedux examples/discover_customization_examples @elastic/kibana-data-discovery x-pack/plugins/discover_enhanced @elastic/kibana-data-discovery -x-pack/plugins/discover_log_explorer @elastic/infra-monitoring-ui src/plugins/discover @elastic/kibana-data-discovery packages/kbn-discover-utils @elastic/kibana-data-discovery packages/kbn-doc-links @elastic/docs @@ -472,6 +471,7 @@ packages/kbn-lint-ts-projects-cli @elastic/kibana-operations x-pack/plugins/lists @elastic/security-detection-engine examples/locator_examples @elastic/kibana-app-services examples/locator_explorer @elastic/kibana-app-services +x-pack/plugins/log_explorer @elastic/infra-monitoring-ui packages/kbn-logging @elastic/kibana-core packages/kbn-logging-mocks @elastic/kibana-core x-pack/plugins/logs_shared @elastic/infra-monitoring-ui @@ -524,6 +524,7 @@ packages/kbn-object-versioning @elastic/appex-sharedux x-pack/plugins/observability_ai_assistant @elastic/obs-ai-assistant x-pack/packages/observability/alert_details @elastic/actionable-observability x-pack/test/cases_api_integration/common/plugins/observability @elastic/response-ops +x-pack/plugins/observability_log_explorer @elastic/infra-monitoring-ui x-pack/plugins/observability_onboarding @elastic/apm-ui x-pack/plugins/observability @elastic/actionable-observability x-pack/plugins/observability_shared @elastic/observability-ui diff --git a/config/serverless.oblt.yml b/config/serverless.oblt.yml index 44d26351b5380..5e6b9a58cbc35 100644 --- a/config/serverless.oblt.yml +++ b/config/serverless.oblt.yml @@ -10,7 +10,6 @@ xpack.serverless.observability.enabled: true ## Configure plugins xpack.infra.logs.app_target: discover -xpack.discoverLogExplorer.featureFlags.deepLinkVisible: true ## Set the home route uiSettings.overrides.defaultRoute: /app/observability/landing diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 632bce5883c28..e33bde623f518 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -520,10 +520,6 @@ Plugin server-side only. Plugin has three main functions: |Contains the enhancements to the OSS discover app. -|{kib-repo}blob/{branch}/x-pack/plugins/discover_log_explorer/README.md[discoverLogExplorer] -|This plugin registers a log-explorer profile using the Discover customization framework, offering several affordances specifically designed for log consumption. - - |{kib-repo}blob/{branch}/x-pack/plugins/ecs_data_quality_dashboard/README.md[ecsDataQualityDashboard] |This plugin implements (server) APIs used to render the content of the Data Quality dashboard. @@ -632,6 +628,10 @@ the infrastructure monitoring use-case within Kibana. using the CURL scripts in the scripts folder. +|{kib-repo}blob/{branch}/x-pack/plugins/log_explorer/README.md[logExplorer] +|This plugin provides a LogExplorer component using the Discover customization framework, offering several affordances specifically designed for log consumption. + + |{kib-repo}blob/{branch}/x-pack/plugins/logs_shared/README.md[logsShared] |Exposes the shared components and APIs to access and visualize logs. @@ -669,6 +669,10 @@ Elastic. |This document gives an overview of the features of the Observability AI Assistant at the time of writing, and how to use them. At a high level, the Observability AI Assistant offers contextual insights, and a chat functionality that we enrich with function calling, allowing the LLM to hook into the user's data. We also allow the LLM to store things it considers new information as embeddings into Elasticsearch, and query this knowledge base when it decides it needs more information, using ELSER. +|{kib-repo}blob/{branch}/x-pack/plugins/observability_log_explorer/README.md[observabilityLogExplorer] +|This plugin provides an app based on the LogExplorer component from the log_explorer plugin, but adds observability-specific affordances. + + |{kib-repo}blob/{branch}/x-pack/plugins/observability_onboarding/README.md[observabilityOnboarding] |This plugin provides an onboarding framework for observability solutions: Logs and APM. diff --git a/package.json b/package.json index 28e41434a567c..a0d3c7270c911 100644 --- a/package.json +++ b/package.json @@ -374,7 +374,6 @@ "@kbn/developer-examples-plugin": "link:examples/developer_examples", "@kbn/discover-customization-examples-plugin": "link:examples/discover_customization_examples", "@kbn/discover-enhanced-plugin": "link:x-pack/plugins/discover_enhanced", - "@kbn/discover-log-explorer-plugin": "link:x-pack/plugins/discover_log_explorer", "@kbn/discover-plugin": "link:src/plugins/discover", "@kbn/discover-utils": "link:packages/kbn-discover-utils", "@kbn/doc-links": "link:packages/kbn-doc-links", @@ -494,6 +493,7 @@ "@kbn/lists-plugin": "link:x-pack/plugins/lists", "@kbn/locator-examples-plugin": "link:examples/locator_examples", "@kbn/locator-explorer-plugin": "link:examples/locator_explorer", + "@kbn/log-explorer-plugin": "link:x-pack/plugins/log_explorer", "@kbn/logging": "link:packages/kbn-logging", "@kbn/logging-mocks": "link:packages/kbn-logging-mocks", "@kbn/logs-shared-plugin": "link:x-pack/plugins/logs_shared", @@ -543,6 +543,7 @@ "@kbn/observability-ai-assistant-plugin": "link:x-pack/plugins/observability_ai_assistant", "@kbn/observability-alert-details": "link:x-pack/packages/observability/alert_details", "@kbn/observability-fixtures-plugin": "link:x-pack/test/cases_api_integration/common/plugins/observability", + "@kbn/observability-log-explorer-plugin": "link:x-pack/plugins/observability_log_explorer", "@kbn/observability-onboarding-plugin": "link:x-pack/plugins/observability_onboarding", "@kbn/observability-plugin": "link:x-pack/plugins/observability", "@kbn/observability-shared-plugin": "link:x-pack/plugins/observability_shared", diff --git a/packages/deeplinks/observability/constants.ts b/packages/deeplinks/observability/constants.ts index addd326de2ce3..a28c9e4aaff21 100644 --- a/packages/deeplinks/observability/constants.ts +++ b/packages/deeplinks/observability/constants.ts @@ -8,6 +8,8 @@ export const LOGS_APP_ID = 'logs'; +export const OBSERVABILITY_LOG_EXPLORER = 'observability-log-explorer'; + export const OBSERVABILITY_OVERVIEW_APP_ID = 'observability-overview'; export const METRICS_APP_ID = 'metrics'; diff --git a/packages/deeplinks/observability/deep_links.ts b/packages/deeplinks/observability/deep_links.ts index 19432ef37d3ba..1d405c1a20620 100644 --- a/packages/deeplinks/observability/deep_links.ts +++ b/packages/deeplinks/observability/deep_links.ts @@ -5,10 +5,10 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { DISCOVER_APP_ID } from '@kbn/deeplinks-analytics'; import { LOGS_APP_ID, + OBSERVABILITY_LOG_EXPLORER, OBSERVABILITY_OVERVIEW_APP_ID, METRICS_APP_ID, APM_APP_ID, @@ -16,6 +16,7 @@ import { } from './constants'; type LogsApp = typeof LOGS_APP_ID; +type ObservabilityLogExplorerApp = typeof OBSERVABILITY_LOG_EXPLORER; type ObservabilityOverviewApp = typeof OBSERVABILITY_OVERVIEW_APP_ID; type MetricsApp = typeof METRICS_APP_ID; type ApmApp = typeof APM_APP_ID; @@ -23,13 +24,12 @@ type ObservabilityOnboardingApp = typeof OBSERVABILITY_ONBOARDING_APP_ID; export type AppId = | LogsApp + | ObservabilityLogExplorerApp | ObservabilityOverviewApp | ObservabilityOnboardingApp | ApmApp | MetricsApp; -export type DiscoverLogExplorerId = `${typeof DISCOVER_APP_ID}:log-explorer`; - export type LogsLinkId = 'log-categories' | 'settings' | 'anomalies' | 'stream'; export type ObservabilityOverviewLinkId = @@ -55,7 +55,6 @@ export type LinkId = LogsLinkId | ObservabilityOverviewLinkId | MetricsLinkId | export type DeepLinkId = | AppId - | DiscoverLogExplorerId | `${LogsApp}:${LogsLinkId}` | `${ObservabilityOverviewApp}:${ObservabilityOverviewLinkId}` | `${MetricsApp}:${MetricsLinkId}` diff --git a/packages/deeplinks/observability/tsconfig.json b/packages/deeplinks/observability/tsconfig.json index 9f5bc24d4f316..94b099694eaf4 100644 --- a/packages/deeplinks/observability/tsconfig.json +++ b/packages/deeplinks/observability/tsconfig.json @@ -16,6 +16,5 @@ "target/**/*" ], "kbn_references": [ - "@kbn/deeplinks-analytics", ] } diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index d68f1f8a8caed..21dc7806e2e98 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -28,7 +28,7 @@ pageLoadAssetSize: dashboard: 82025 dashboardEnhanced: 65646 data: 454087 - dataViewEditor: 13000 + dataViewEditor: 28082 dataViewFieldEditor: 27000 dataViewManagement: 5000 dataViews: 47000 @@ -36,7 +36,6 @@ pageLoadAssetSize: devTools: 38637 discover: 99999 discoverEnhanced: 42730 - discoverLogExplorer: 39045 embeddable: 87309 embeddableEnhanced: 22107 enterpriseSearch: 50858 @@ -87,6 +86,7 @@ pageLoadAssetSize: licenseManagement: 41817 licensing: 29004 lists: 22900 + logExplorer: 39045 logsShared: 281060 logstash: 53548 management: 46112 @@ -99,6 +99,7 @@ pageLoadAssetSize: noDataPage: 5000 observability: 115443 observabilityAIAssistant: 25000 + observabilityLogExplorer: 23686 observabilityOnboarding: 19573 observabilityShared: 52256 osquery: 107090 diff --git a/src/dev/storybook/aliases.ts b/src/dev/storybook/aliases.ts index b02009cd155d2..fea9d8629f382 100644 --- a/src/dev/storybook/aliases.ts +++ b/src/dev/storybook/aliases.ts @@ -27,7 +27,7 @@ export const storybookAliases = { dashboard: 'src/plugins/dashboard/.storybook', data: 'src/plugins/data/.storybook', discover: 'src/plugins/discover/.storybook', - discover_log_explorer: 'x-pack/plugins/discover_log_explorer/.storybook', + log_explorer: 'x-pack/plugins/log_explorer/.storybook', embeddable: 'src/plugins/embeddable/.storybook', es_ui_shared: 'src/plugins/es_ui_shared/.storybook', expression_error: 'src/plugins/expression_error/.storybook', diff --git a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts index 27cf9c59e57df..2b43cbe6c5a1d 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts @@ -154,6 +154,7 @@ export const applicationUsageSchema = { maps: commonSchema, ml: commonSchema, monitoring: commonSchema, + 'observability-log-explorer': commonSchema, 'observability-overview': commonSchema, observabilityOnboarding: commonSchema, observabilityAIAssistant: commonSchema, diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index c8d9fc690fce1..7beb57daee234 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -4587,6 +4587,137 @@ } } }, + "observability-log-explorer": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "Always `main`" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen over the last 90 days" + } + }, + "views": { + "type": "array", + "items": { + "properties": { + "appId": { + "type": "keyword", + "_meta": { + "description": "The application being tracked" + } + }, + "viewId": { + "type": "keyword", + "_meta": { + "description": "The application view being tracked" + } + }, + "clicks_total": { + "type": "long", + "_meta": { + "description": "General number of clicks in the application sub view since we started counting them" + } + }, + "clicks_7_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 7 days" + } + }, + "clicks_30_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 30 days" + } + }, + "clicks_90_days": { + "type": "long", + "_meta": { + "description": "General number of clicks in the active application sub view over the last 90 days" + } + }, + "minutes_on_screen_total": { + "type": "float", + "_meta": { + "description": "Minutes the application sub view is active and on-screen since we started counting them." + } + }, + "minutes_on_screen_7_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 7 days" + } + }, + "minutes_on_screen_30_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 30 days" + } + }, + "minutes_on_screen_90_days": { + "type": "float", + "_meta": { + "description": "Minutes the application is active and on-screen active application sub view over the last 90 days" + } + } + } + } + } + } + }, "observability-overview": { "properties": { "appId": { diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index 729baf5023f58..ab7ac29eabaf6 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -293,10 +293,7 @@ export default function ({ getService }: PluginFunctionalProviderContext) { 'xpack.observability.unsafe.alertDetails.observability.enabled (boolean)', 'xpack.observability.unsafe.thresholdRule.enabled (boolean)', 'xpack.observability_onboarding.ui.enabled (boolean)', - /** - * xpack.discoverLogExplorer.featureFlags is conditional and will never resolve if used in non-serverless environment - */ - 'xpack.discoverLogExplorer.featureFlags.deepLinkVisible (any)', + 'xpack.observabilityLogExplorer.navigation.showAppLink (any)', // conditional, is actually a boolean ]; // We don't assert that actualExposedConfigKeys and expectedExposedConfigKeys are equal, because test failure messages with large // arrays are hard to grok. Instead, we take the difference between the two arrays and assert them separately, that way it's diff --git a/tsconfig.base.json b/tsconfig.base.json index 56c849d8611e7..c916d9bc563e3 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -652,8 +652,6 @@ "@kbn/discover-customization-examples-plugin/*": ["examples/discover_customization_examples/*"], "@kbn/discover-enhanced-plugin": ["x-pack/plugins/discover_enhanced"], "@kbn/discover-enhanced-plugin/*": ["x-pack/plugins/discover_enhanced/*"], - "@kbn/discover-log-explorer-plugin": ["x-pack/plugins/discover_log_explorer"], - "@kbn/discover-log-explorer-plugin/*": ["x-pack/plugins/discover_log_explorer/*"], "@kbn/discover-plugin": ["src/plugins/discover"], "@kbn/discover-plugin/*": ["src/plugins/discover/*"], "@kbn/discover-utils": ["packages/kbn-discover-utils"], @@ -938,6 +936,8 @@ "@kbn/locator-examples-plugin/*": ["examples/locator_examples/*"], "@kbn/locator-explorer-plugin": ["examples/locator_explorer"], "@kbn/locator-explorer-plugin/*": ["examples/locator_explorer/*"], + "@kbn/log-explorer-plugin": ["x-pack/plugins/log_explorer"], + "@kbn/log-explorer-plugin/*": ["x-pack/plugins/log_explorer/*"], "@kbn/logging": ["packages/kbn-logging"], "@kbn/logging/*": ["packages/kbn-logging/*"], "@kbn/logging-mocks": ["packages/kbn-logging-mocks"], @@ -1042,6 +1042,8 @@ "@kbn/observability-alert-details/*": ["x-pack/packages/observability/alert_details/*"], "@kbn/observability-fixtures-plugin": ["x-pack/test/cases_api_integration/common/plugins/observability"], "@kbn/observability-fixtures-plugin/*": ["x-pack/test/cases_api_integration/common/plugins/observability/*"], + "@kbn/observability-log-explorer-plugin": ["x-pack/plugins/observability_log_explorer"], + "@kbn/observability-log-explorer-plugin/*": ["x-pack/plugins/observability_log_explorer/*"], "@kbn/observability-onboarding-plugin": ["x-pack/plugins/observability_onboarding"], "@kbn/observability-onboarding-plugin/*": ["x-pack/plugins/observability_onboarding/*"], "@kbn/observability-plugin": ["x-pack/plugins/observability"], diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 17fd0b07ec44e..bcca0b5e14318 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -21,7 +21,6 @@ "xpack.customBranding": "plugins/custom_branding", "xpack.dashboard": "plugins/dashboard_enhanced", "xpack.discover": "plugins/discover_enhanced", - "xpack.discoverLogExplorer": "plugins/discover_log_explorer", "xpack.crossClusterReplication": "plugins/cross_cluster_replication", "xpack.elasticAssistant": "packages/kbn-elastic-assistant", "xpack.ecsDataQualityDashboard": "plugins/ecs_data_quality_dashboard", @@ -39,6 +38,7 @@ "xpack.idxMgmt": "plugins/index_management", "xpack.indexLifecycleMgmt": "plugins/index_lifecycle_management", "xpack.infra": "plugins/infra", + "xpack.logExplorer": "plugins/log_explorer", "xpack.logsShared": "plugins/logs_shared", "xpack.fleet": "plugins/fleet", "xpack.ingestPipelines": "plugins/ingest_pipelines", @@ -61,6 +61,7 @@ ], "xpack.monitoring": ["plugins/monitoring"], "xpack.observability": "plugins/observability", + "xpack.observabilityLogExplorer": "plugins/observability_log_explorer", "xpack.observabilityShared": "plugins/observability_shared", "xpack.observability_onboarding": "plugins/observability_onboarding", "xpack.observabilityAiAssistant": "plugins/observability_ai_assistant", diff --git a/x-pack/plugins/discover_log_explorer/README.md b/x-pack/plugins/discover_log_explorer/README.md deleted file mode 100755 index 4b3453a451bf8..0000000000000 --- a/x-pack/plugins/discover_log_explorer/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Discover Log Explorer - -This plugin registers a `log-explorer` profile using the Discover customization framework, offering several affordances specifically designed for log consumption. - -The plugin enhances the capabilities of Discover in the following ways: - -- **Dataset selector**: this customization on the Discover page replaces the DataViews picker with a Logs dataset selector built ad-hoc to provide a better experience when navigating throught all the available datasets. - diff --git a/x-pack/plugins/discover_log_explorer/common/runtime_types.ts b/x-pack/plugins/discover_log_explorer/common/runtime_types.ts deleted file mode 100644 index d6d0336eafdd7..0000000000000 --- a/x-pack/plugins/discover_log_explorer/common/runtime_types.ts +++ /dev/null @@ -1,53 +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 { fold } from 'fp-ts/lib/Either'; -import { identity } from 'fp-ts/lib/function'; -import { pipe } from 'fp-ts/lib/pipeable'; -import { Context, Errors, IntersectionType, Type, UnionType, ValidationError } from 'io-ts'; - -type ErrorFactory = (message: string) => Error; - -const getErrorPath = ([first, ...rest]: Context): string[] => { - if (typeof first === 'undefined') { - return []; - } else if (first.type instanceof IntersectionType) { - const [, ...next] = rest; - return getErrorPath(next); - } else if (first.type instanceof UnionType) { - const [, ...next] = rest; - return [first.key, ...getErrorPath(next)]; - } - - return [first.key, ...getErrorPath(rest)]; -}; - -const getErrorType = ({ context }: ValidationError) => - context[context.length - 1]?.type?.name ?? 'unknown'; - -const formatError = (error: ValidationError) => - error.message ?? - `in ${getErrorPath(error.context).join('/')}: ${JSON.stringify( - error.value - )} does not match expected type ${getErrorType(error)}`; - -export const formatErrors = (errors: ValidationError[]) => - `Failed to validate: \n${errors.map((error) => ` ${formatError(error)}`).join('\n')}`; - -export const createPlainError = (message: string) => new Error(message); - -export const throwErrors = (createError: ErrorFactory) => (errors: Errors) => { - throw createError(formatErrors(errors)); -}; - -export const decodeOrThrow = - ( - runtimeType: Type, - createError: ErrorFactory = createPlainError - ) => - (inputValue: InputValue) => - pipe(runtimeType.decode(inputValue), fold(throwErrors(createError), identity)); diff --git a/x-pack/plugins/discover_log_explorer/kibana.jsonc b/x-pack/plugins/discover_log_explorer/kibana.jsonc deleted file mode 100644 index 89d00e3ce4eeb..0000000000000 --- a/x-pack/plugins/discover_log_explorer/kibana.jsonc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "plugin", - "id": "@kbn/discover-log-explorer-plugin", - "owner": "@elastic/infra-monitoring-ui", - "description": "This plugin exposes and registers Logs+ features.", - "plugin": { - "id": "discoverLogExplorer", - "server": true, - "browser": true, - "configPath": ["xpack", "discoverLogExplorer"], - "requiredPlugins": ["data", "dataViews", "discover", "fleet", "kibanaReact", "kibanaUtils", "controls", "embeddable"], - "optionalPlugins": [], - "requiredBundles": [] - } -} diff --git a/x-pack/plugins/discover_log_explorer/public/deep_links.ts b/x-pack/plugins/discover_log_explorer/public/deep_links.ts deleted file mode 100644 index 2740fbab56b16..0000000000000 --- a/x-pack/plugins/discover_log_explorer/public/deep_links.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { AppDeepLink, AppNavLinkStatus, DEFAULT_APP_CATEGORIES } from '@kbn/core/public'; -import { i18n } from '@kbn/i18n'; -import { LOG_EXPLORER_PROFILE_ID } from '../common/constants'; - -export const getLogExplorerDeepLink = ({ isVisible }: { isVisible: boolean }): AppDeepLink => ({ - id: LOG_EXPLORER_PROFILE_ID, - title: i18n.translate('xpack.discoverLogExplorer.deepLink', { - defaultMessage: 'Logs Explorer', - }), - path: `#/p/${LOG_EXPLORER_PROFILE_ID}`, - category: DEFAULT_APP_CATEGORIES.observability, - euiIconType: 'logoObservability', - navLinkStatus: isVisible ? AppNavLinkStatus.visible : AppNavLinkStatus.default, -}); diff --git a/x-pack/plugins/discover_log_explorer/public/plugin.ts b/x-pack/plugins/discover_log_explorer/public/plugin.ts deleted file mode 100644 index e39c831cdb432..0000000000000 --- a/x-pack/plugins/discover_log_explorer/public/plugin.ts +++ /dev/null @@ -1,38 +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 { CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public'; -import { LOG_EXPLORER_PROFILE_ID } from '../common/constants'; -import { DiscoverLogExplorerConfig } from '../common/plugin_config'; -import { createLogExplorerProfileCustomizations } from './customizations/log_explorer_profile'; -import { getLogExplorerDeepLink } from './deep_links'; -import { - DiscoverLogExplorerPluginSetup, - DiscoverLogExplorerPluginStart, - DiscoverLogExplorerStartDeps, -} from './types'; - -export class DiscoverLogExplorerPlugin - implements Plugin -{ - private config: DiscoverLogExplorerConfig; - - constructor(context: PluginInitializerContext) { - this.config = context.config.get(); - } - - public setup() {} - - public start(core: CoreStart, plugins: DiscoverLogExplorerStartDeps) { - const { discover, data } = plugins; - - discover.registerCustomizationProfile(LOG_EXPLORER_PROFILE_ID, { - customize: createLogExplorerProfileCustomizations({ core, data }), - deepLinks: [getLogExplorerDeepLink({ isVisible: this.config.featureFlags.deepLinkVisible })], - }); - } -} diff --git a/x-pack/plugins/discover_log_explorer/public/types.ts b/x-pack/plugins/discover_log_explorer/public/types.ts deleted file mode 100644 index 4ec95ba94ec5a..0000000000000 --- a/x-pack/plugins/discover_log_explorer/public/types.ts +++ /dev/null @@ -1,16 +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 { DataPublicPluginStart } from '@kbn/data-plugin/public'; -import { DiscoverStart } from '@kbn/discover-plugin/public'; - -export type DiscoverLogExplorerPluginSetup = void; -export type DiscoverLogExplorerPluginStart = void; - -export interface DiscoverLogExplorerStartDeps { - data: DataPublicPluginStart; - discover: DiscoverStart; -} diff --git a/x-pack/plugins/discover_log_explorer/server/config.ts b/x-pack/plugins/discover_log_explorer/server/config.ts deleted file mode 100644 index 0fece328c2964..0000000000000 --- a/x-pack/plugins/discover_log_explorer/server/config.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 { schema, offeringBasedSchema } from '@kbn/config-schema'; -import { PluginConfigDescriptor } from '@kbn/core/server'; - -import { DiscoverLogExplorerConfig } from '../common/plugin_config'; - -export const configSchema = schema.object({ - featureFlags: schema.object({ - deepLinkVisible: offeringBasedSchema({ - serverless: schema.boolean(), - options: { - defaultValue: false, - }, - }), - }), -}); - -export const config: PluginConfigDescriptor = { - schema: configSchema, - exposeToBrowser: { - featureFlags: { - deepLinkVisible: true, - }, - }, -}; diff --git a/x-pack/plugins/infra/public/plugin.ts b/x-pack/plugins/infra/public/plugin.ts index 7ea1dbdfa7cd2..04e3f34e067b4 100644 --- a/x-pack/plugins/infra/public/plugin.ts +++ b/x-pack/plugins/infra/public/plugin.ts @@ -130,6 +130,12 @@ export class Plugin implements InfraClientPluginClass { label: 'Logs', sortKey: 200, entries: [ + { + label: 'Explorer', + app: 'observability-log-explorer', + path: '/', + isBetaFeature: true, + }, { label: 'Stream', app: 'logs', path: '/stream' }, { label: 'Anomalies', app: 'logs', path: '/anomalies' }, { label: 'Categories', app: 'logs', path: '/log-categories' }, diff --git a/x-pack/plugins/discover_log_explorer/.storybook/__mocks__/package_icon.tsx b/x-pack/plugins/log_explorer/.storybook/__mocks__/package_icon.tsx similarity index 100% rename from x-pack/plugins/discover_log_explorer/.storybook/__mocks__/package_icon.tsx rename to x-pack/plugins/log_explorer/.storybook/__mocks__/package_icon.tsx diff --git a/x-pack/plugins/discover_log_explorer/.storybook/main.js b/x-pack/plugins/log_explorer/.storybook/main.js similarity index 100% rename from x-pack/plugins/discover_log_explorer/.storybook/main.js rename to x-pack/plugins/log_explorer/.storybook/main.js diff --git a/x-pack/plugins/discover_log_explorer/.storybook/preview.js b/x-pack/plugins/log_explorer/.storybook/preview.js similarity index 100% rename from x-pack/plugins/discover_log_explorer/.storybook/preview.js rename to x-pack/plugins/log_explorer/.storybook/preview.js diff --git a/x-pack/plugins/log_explorer/README.md b/x-pack/plugins/log_explorer/README.md new file mode 100755 index 0000000000000..bb4a266988a33 --- /dev/null +++ b/x-pack/plugins/log_explorer/README.md @@ -0,0 +1,8 @@ +# Log Explorer + +This plugin provides a `LogExplorer` component using the Discover customization framework, offering several affordances specifically designed for log consumption. + +The plugin enhances the capabilities of Discover in the following ways: + +- **Dataset selector**: this customization replaces the DataViews picker with a Logs dataset selector built ad-hoc to provide a better experience when navigating throught all the available datasets. + diff --git a/x-pack/plugins/discover_log_explorer/common/constants.ts b/x-pack/plugins/log_explorer/common/constants.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/constants.ts rename to x-pack/plugins/log_explorer/common/constants.ts diff --git a/x-pack/plugins/discover_log_explorer/common/datasets/errors.ts b/x-pack/plugins/log_explorer/common/datasets/errors.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/datasets/errors.ts rename to x-pack/plugins/log_explorer/common/datasets/errors.ts diff --git a/x-pack/plugins/discover_log_explorer/common/datasets/index.ts b/x-pack/plugins/log_explorer/common/datasets/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/datasets/index.ts rename to x-pack/plugins/log_explorer/common/datasets/index.ts diff --git a/x-pack/plugins/discover_log_explorer/common/datasets/models/dataset.ts b/x-pack/plugins/log_explorer/common/datasets/models/dataset.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/datasets/models/dataset.ts rename to x-pack/plugins/log_explorer/common/datasets/models/dataset.ts diff --git a/x-pack/plugins/discover_log_explorer/common/datasets/models/integration.ts b/x-pack/plugins/log_explorer/common/datasets/models/integration.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/datasets/models/integration.ts rename to x-pack/plugins/log_explorer/common/datasets/models/integration.ts diff --git a/x-pack/plugins/discover_log_explorer/common/datasets/types.ts b/x-pack/plugins/log_explorer/common/datasets/types.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/datasets/types.ts rename to x-pack/plugins/log_explorer/common/datasets/types.ts diff --git a/x-pack/plugins/discover_log_explorer/common/datasets/v1/common.ts b/x-pack/plugins/log_explorer/common/datasets/v1/common.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/datasets/v1/common.ts rename to x-pack/plugins/log_explorer/common/datasets/v1/common.ts diff --git a/x-pack/plugins/discover_log_explorer/common/datasets/v1/find_datasets.ts b/x-pack/plugins/log_explorer/common/datasets/v1/find_datasets.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/datasets/v1/find_datasets.ts rename to x-pack/plugins/log_explorer/common/datasets/v1/find_datasets.ts diff --git a/x-pack/plugins/discover_log_explorer/common/datasets/v1/find_integrations.ts b/x-pack/plugins/log_explorer/common/datasets/v1/find_integrations.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/datasets/v1/find_integrations.ts rename to x-pack/plugins/log_explorer/common/datasets/v1/find_integrations.ts diff --git a/x-pack/plugins/discover_log_explorer/common/datasets/v1/index.ts b/x-pack/plugins/log_explorer/common/datasets/v1/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/datasets/v1/index.ts rename to x-pack/plugins/log_explorer/common/datasets/v1/index.ts diff --git a/x-pack/plugins/discover_log_explorer/common/hashed_cache.ts b/x-pack/plugins/log_explorer/common/hashed_cache.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/hashed_cache.ts rename to x-pack/plugins/log_explorer/common/hashed_cache.ts diff --git a/x-pack/plugins/discover_log_explorer/common/latest.ts b/x-pack/plugins/log_explorer/common/latest.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/common/latest.ts rename to x-pack/plugins/log_explorer/common/latest.ts diff --git a/x-pack/plugins/log_explorer/common/plugin_config.ts b/x-pack/plugins/log_explorer/common/plugin_config.ts new file mode 100644 index 0000000000000..b9a9274392d61 --- /dev/null +++ b/x-pack/plugins/log_explorer/common/plugin_config.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. + */ + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface LogExplorerConfig {} diff --git a/x-pack/plugins/log_explorer/common/runtime_types.ts b/x-pack/plugins/log_explorer/common/runtime_types.ts new file mode 100644 index 0000000000000..00043671edff4 --- /dev/null +++ b/x-pack/plugins/log_explorer/common/runtime_types.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 { createPlainError, decodeOrThrow, formatErrors, throwErrors } from '@kbn/io-ts-utils'; diff --git a/x-pack/plugins/discover_log_explorer/jest.config.js b/x-pack/plugins/log_explorer/jest.config.js similarity index 66% rename from x-pack/plugins/discover_log_explorer/jest.config.js rename to x-pack/plugins/log_explorer/jest.config.js index 988de065d4013..fea1fd32ee5d9 100644 --- a/x-pack/plugins/discover_log_explorer/jest.config.js +++ b/x-pack/plugins/log_explorer/jest.config.js @@ -8,10 +8,8 @@ module.exports = { preset: '@kbn/test', rootDir: '../../..', - roots: ['/x-pack/plugins/discover_log_explorer'], - coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/discover_log_explorer', + roots: ['/x-pack/plugins/log_explorer'], + coverageDirectory: '/target/kibana-coverage/jest/x-pack/plugins/log_explorer', coverageReporters: ['text', 'html'], - collectCoverageFrom: [ - '/x-pack/plugins/discover_log_explorer/{common,public}/**/*.{ts,tsx}', - ], + collectCoverageFrom: ['/x-pack/plugins/log_explorer/{common,public}/**/*.{ts,tsx}'], }; diff --git a/x-pack/plugins/log_explorer/kibana.jsonc b/x-pack/plugins/log_explorer/kibana.jsonc new file mode 100644 index 0000000000000..612bd34859b98 --- /dev/null +++ b/x-pack/plugins/log_explorer/kibana.jsonc @@ -0,0 +1,27 @@ +{ + "type": "plugin", + "id": "@kbn/log-explorer-plugin", + "owner": "@elastic/infra-monitoring-ui", + "description": "This plugin provides a LogExplorer component using the Discover customization framework, offering several affordances specifically designed for log consumption.", + "plugin": { + "id": "logExplorer", + "server": true, + "browser": true, + "configPath": [ + "xpack", + "logExplorer" + ], + "requiredPlugins": [ + "data", + "dataViews", + "discover", + "fleet", + "kibanaReact", + "kibanaUtils", + "controls", + "embeddable" + ], + "optionalPlugins": [], + "requiredBundles": [] + } +} diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/constants.tsx b/x-pack/plugins/log_explorer/public/components/dataset_selector/constants.tsx similarity index 57% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/constants.tsx rename to x-pack/plugins/log_explorer/public/components/dataset_selector/constants.tsx index a3ea4b85bbb00..5890b92f3bf1a 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/constants.tsx +++ b/x-pack/plugins/log_explorer/public/components/dataset_selector/constants.tsx @@ -16,59 +16,53 @@ export const DATA_VIEW_POPOVER_CONTENT_WIDTH = 300; export const contextMenuStyles = { maxHeight: 440 }; export const selectDatasetLabel = i18n.translate( - 'xpack.discoverLogExplorer.datasetSelector.selectDataset', + 'xpack.logExplorer.datasetSelector.selectDataset', { defaultMessage: 'Select dataset' } ); -export const integrationsLabel = i18n.translate( - 'xpack.discoverLogExplorer.datasetSelector.integrations', - { defaultMessage: 'Integrations' } -); +export const integrationsLabel = i18n.translate('xpack.logExplorer.datasetSelector.integrations', { + defaultMessage: 'Integrations', +}); export const uncategorizedLabel = i18n.translate( - 'xpack.discoverLogExplorer.datasetSelector.uncategorized', + 'xpack.logExplorer.datasetSelector.uncategorized', { defaultMessage: 'Uncategorized' } ); -export const sortOrdersLabel = i18n.translate( - 'xpack.discoverLogExplorer.datasetSelector.sortOrders', - { defaultMessage: 'Sort directions' } -); +export const sortOrdersLabel = i18n.translate('xpack.logExplorer.datasetSelector.sortOrders', { + defaultMessage: 'Sort directions', +}); -export const noDatasetsLabel = i18n.translate( - 'xpack.discoverLogExplorer.datasetSelector.noDatasets', - { defaultMessage: 'No data streams found' } -); +export const noDatasetsLabel = i18n.translate('xpack.logExplorer.datasetSelector.noDatasets', { + defaultMessage: 'No data streams found', +}); export const noDatasetsDescriptionLabel = i18n.translate( - 'xpack.discoverLogExplorer.datasetSelector.noDatasetsDescription', + 'xpack.logExplorer.datasetSelector.noDatasetsDescription', { defaultMessage: 'No datasets or search results found.', } ); export const noIntegrationsLabel = i18n.translate( - 'xpack.discoverLogExplorer.datasetSelector.noIntegrations', + 'xpack.logExplorer.datasetSelector.noIntegrations', { defaultMessage: 'No integrations found' } ); export const noIntegrationsDescriptionLabel = i18n.translate( - 'xpack.discoverLogExplorer.datasetSelector.noIntegrationsDescription', + 'xpack.logExplorer.datasetSelector.noIntegrationsDescription', { defaultMessage: 'No integrations or search results found.', } ); -export const errorLabel = i18n.translate('xpack.discoverLogExplorer.datasetSelector.error', { +export const errorLabel = i18n.translate('xpack.logExplorer.datasetSelector.error', { defaultMessage: 'error', }); -export const noDataRetryLabel = i18n.translate( - 'xpack.discoverLogExplorer.datasetSelector.noDataRetry', - { - defaultMessage: 'Retry', - } -); +export const noDataRetryLabel = i18n.translate('xpack.logExplorer.datasetSelector.noDataRetry', { + defaultMessage: 'Retry', +}); export const sortOptions = [ { diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/dataset_selector.stories.tsx b/x-pack/plugins/log_explorer/public/components/dataset_selector/dataset_selector.stories.tsx similarity index 99% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/dataset_selector.stories.tsx rename to x-pack/plugins/log_explorer/public/components/dataset_selector/dataset_selector.stories.tsx index d96cdc07bd9bc..c1549bc899ab4 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/dataset_selector.stories.tsx +++ b/x-pack/plugins/log_explorer/public/components/dataset_selector/dataset_selector.stories.tsx @@ -22,7 +22,7 @@ import { const meta: Meta = { component: DatasetSelector, - title: 'discover_log_explorer/DatasetSelector', + title: 'log_explorer/DatasetSelector', decorators: [(wrappedStory) => {wrappedStory()}], argTypes: { datasetsError: { diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/dataset_selector.tsx b/x-pack/plugins/log_explorer/public/components/dataset_selector/dataset_selector.tsx similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/dataset_selector.tsx rename to x-pack/plugins/log_explorer/public/components/dataset_selector/dataset_selector.tsx diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/index.ts b/x-pack/plugins/log_explorer/public/components/dataset_selector/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/index.ts rename to x-pack/plugins/log_explorer/public/components/dataset_selector/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/defaults.ts b/x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/defaults.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/defaults.ts rename to x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/defaults.ts diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/index.ts b/x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/index.ts rename to x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/state_machine.ts b/x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/state_machine.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/state_machine.ts rename to x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/state_machine.ts diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/types.ts b/x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/types.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/types.ts rename to x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/types.ts diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/use_dataset_selector.ts b/x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/use_dataset_selector.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/state_machine/use_dataset_selector.ts rename to x-pack/plugins/log_explorer/public/components/dataset_selector/state_machine/use_dataset_selector.ts diff --git a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx b/x-pack/plugins/log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx similarity index 97% rename from x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx rename to x-pack/plugins/log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx index 134bd7616ac8a..8664a428c9c3f 100644 --- a/x-pack/plugins/discover_log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx +++ b/x-pack/plugins/log_explorer/public/components/dataset_selector/sub_components/datasets_list.tsx @@ -52,7 +52,7 @@ export const DatasetsList = ({ titleSize="s" body={ { + const logExplorerCustomizations = [createLogExplorerProfileCustomizations({ core, data })]; + + const overrideServices = { + data: createDataServiceProxy(data), + }; + + return ({ scopedHistory }: LogExplorerProps) => { + return ( + + ); + }; +}; + +/** + * Create proxy for the data service, in which session service enablement calls + * are no-ops. + */ +const createDataServiceProxy = (data: DataPublicPluginStart) => { + return createPropertyGetProxy(data, { + search: (searchService: ISearchStart) => + createPropertyGetProxy(searchService, { + session: (sessionService: ISessionService) => + createPropertyGetProxy(sessionService, { + enableStorage: () => () => {}, + }), + }), + }); +}; diff --git a/x-pack/plugins/discover_log_explorer/public/customizations/custom_dataset_filters.tsx b/x-pack/plugins/log_explorer/public/customizations/custom_dataset_filters.tsx similarity index 91% rename from x-pack/plugins/discover_log_explorer/public/customizations/custom_dataset_filters.tsx rename to x-pack/plugins/log_explorer/public/customizations/custom_dataset_filters.tsx index a669ebea33942..1f27f4a12b05f 100644 --- a/x-pack/plugins/discover_log_explorer/public/customizations/custom_dataset_filters.tsx +++ b/x-pack/plugins/log_explorer/public/customizations/custom_dataset_filters.tsx @@ -45,16 +45,6 @@ const ControlGroupContainer = euiStyled.div` .controlGroup { min-height: unset; } - - .euiFormLabel { - padding-top: 0; - padding-bottom: 0; - line-height: 32px !important; - } - - .euiFormControlLayout { - height: 32px; - } `; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/plugins/discover_log_explorer/public/customizations/custom_dataset_selector.tsx b/x-pack/plugins/log_explorer/public/customizations/custom_dataset_selector.tsx similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/customizations/custom_dataset_selector.tsx rename to x-pack/plugins/log_explorer/public/customizations/custom_dataset_selector.tsx diff --git a/x-pack/plugins/discover_log_explorer/public/customizations/log_explorer_profile.tsx b/x-pack/plugins/log_explorer/public/customizations/log_explorer_profile.tsx similarity index 97% rename from x-pack/plugins/discover_log_explorer/public/customizations/log_explorer_profile.tsx rename to x-pack/plugins/log_explorer/public/customizations/log_explorer_profile.tsx index d9b7a15269cb5..7a468d064de08 100644 --- a/x-pack/plugins/discover_log_explorer/public/customizations/log_explorer_profile.tsx +++ b/x-pack/plugins/log_explorer/public/customizations/log_explorer_profile.tsx @@ -14,7 +14,7 @@ import { dynamic } from '../utils/dynamic'; const LazyCustomDatasetSelector = dynamic(() => import('./custom_dataset_selector')); const LazyCustomDatasetFilters = dynamic(() => import('./custom_dataset_filters')); -interface CreateLogExplorerProfileCustomizationsDeps { +export interface CreateLogExplorerProfileCustomizationsDeps { core: CoreStart; data: DataPublicPluginStart; } diff --git a/x-pack/plugins/discover_log_explorer/public/hooks/use_control_panels.tsx b/x-pack/plugins/log_explorer/public/hooks/use_control_panels.tsx similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/hooks/use_control_panels.tsx rename to x-pack/plugins/log_explorer/public/hooks/use_control_panels.tsx diff --git a/x-pack/plugins/discover_log_explorer/public/hooks/use_dataset_selection.ts b/x-pack/plugins/log_explorer/public/hooks/use_dataset_selection.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/hooks/use_dataset_selection.ts rename to x-pack/plugins/log_explorer/public/hooks/use_dataset_selection.ts diff --git a/x-pack/plugins/discover_log_explorer/public/hooks/use_datasets.ts b/x-pack/plugins/log_explorer/public/hooks/use_datasets.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/hooks/use_datasets.ts rename to x-pack/plugins/log_explorer/public/hooks/use_datasets.ts diff --git a/x-pack/plugins/discover_log_explorer/public/hooks/use_integrations.ts b/x-pack/plugins/log_explorer/public/hooks/use_integrations.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/hooks/use_integrations.ts rename to x-pack/plugins/log_explorer/public/hooks/use_integrations.ts diff --git a/x-pack/plugins/discover_log_explorer/public/hooks/use_intersection_ref.ts b/x-pack/plugins/log_explorer/public/hooks/use_intersection_ref.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/hooks/use_intersection_ref.ts rename to x-pack/plugins/log_explorer/public/hooks/use_intersection_ref.ts diff --git a/x-pack/plugins/log_explorer/public/index.ts b/x-pack/plugins/log_explorer/public/index.ts new file mode 100644 index 0000000000000..c145f6fd88864 --- /dev/null +++ b/x-pack/plugins/log_explorer/public/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 type { PluginInitializerContext } from '@kbn/core/public'; +import type { LogExplorerConfig } from '../common/plugin_config'; +import { LogExplorerPlugin } from './plugin'; +export type { LogExplorerPluginSetup, LogExplorerPluginStart } from './types'; + +export function plugin(context: PluginInitializerContext) { + return new LogExplorerPlugin(context); +} diff --git a/x-pack/plugins/log_explorer/public/plugin.ts b/x-pack/plugins/log_explorer/public/plugin.ts new file mode 100644 index 0000000000000..5807e8260f326 --- /dev/null +++ b/x-pack/plugins/log_explorer/public/plugin.ts @@ -0,0 +1,35 @@ +/* + * Copyright 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 { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public'; +import { createLogExplorer } from './components/log_explorer'; +import { + LogExplorerPluginSetup, + LogExplorerPluginStart, + LogExplorerSetupDeps, + LogExplorerStartDeps, +} from './types'; + +export class LogExplorerPlugin implements Plugin { + constructor(context: PluginInitializerContext) {} + + public setup(core: CoreSetup, plugins: LogExplorerSetupDeps) {} + + public start(core: CoreStart, plugins: LogExplorerStartDeps) { + const { data, discover } = plugins; + + const LogExplorer = createLogExplorer({ + core, + data, + discover, + }); + + return { + LogExplorer, + }; + } +} diff --git a/x-pack/plugins/discover_log_explorer/public/services/datasets/datasets_client.mock.ts b/x-pack/plugins/log_explorer/public/services/datasets/datasets_client.mock.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/services/datasets/datasets_client.mock.ts rename to x-pack/plugins/log_explorer/public/services/datasets/datasets_client.mock.ts diff --git a/x-pack/plugins/discover_log_explorer/public/services/datasets/datasets_client.ts b/x-pack/plugins/log_explorer/public/services/datasets/datasets_client.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/services/datasets/datasets_client.ts rename to x-pack/plugins/log_explorer/public/services/datasets/datasets_client.ts diff --git a/x-pack/plugins/discover_log_explorer/public/services/datasets/datasets_service.mock.ts b/x-pack/plugins/log_explorer/public/services/datasets/datasets_service.mock.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/services/datasets/datasets_service.mock.ts rename to x-pack/plugins/log_explorer/public/services/datasets/datasets_service.mock.ts diff --git a/x-pack/plugins/discover_log_explorer/public/services/datasets/datasets_service.ts b/x-pack/plugins/log_explorer/public/services/datasets/datasets_service.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/services/datasets/datasets_service.ts rename to x-pack/plugins/log_explorer/public/services/datasets/datasets_service.ts diff --git a/x-pack/plugins/discover_log_explorer/public/services/datasets/index.ts b/x-pack/plugins/log_explorer/public/services/datasets/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/services/datasets/index.ts rename to x-pack/plugins/log_explorer/public/services/datasets/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/services/datasets/types.ts b/x-pack/plugins/log_explorer/public/services/datasets/types.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/services/datasets/types.ts rename to x-pack/plugins/log_explorer/public/services/datasets/types.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/datasets/index.ts b/x-pack/plugins/log_explorer/public/state_machines/datasets/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/datasets/index.ts rename to x-pack/plugins/log_explorer/public/state_machines/datasets/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/datasets/src/defaults.ts b/x-pack/plugins/log_explorer/public/state_machines/datasets/src/defaults.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/datasets/src/defaults.ts rename to x-pack/plugins/log_explorer/public/state_machines/datasets/src/defaults.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/datasets/src/index.ts b/x-pack/plugins/log_explorer/public/state_machines/datasets/src/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/datasets/src/index.ts rename to x-pack/plugins/log_explorer/public/state_machines/datasets/src/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/datasets/src/state_machine.ts b/x-pack/plugins/log_explorer/public/state_machines/datasets/src/state_machine.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/datasets/src/state_machine.ts rename to x-pack/plugins/log_explorer/public/state_machines/datasets/src/state_machine.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/datasets/src/types.ts b/x-pack/plugins/log_explorer/public/state_machines/datasets/src/types.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/datasets/src/types.ts rename to x-pack/plugins/log_explorer/public/state_machines/datasets/src/types.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/integrations/index.ts b/x-pack/plugins/log_explorer/public/state_machines/integrations/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/integrations/index.ts rename to x-pack/plugins/log_explorer/public/state_machines/integrations/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/integrations/src/defaults.ts b/x-pack/plugins/log_explorer/public/state_machines/integrations/src/defaults.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/integrations/src/defaults.ts rename to x-pack/plugins/log_explorer/public/state_machines/integrations/src/defaults.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/integrations/src/index.ts b/x-pack/plugins/log_explorer/public/state_machines/integrations/src/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/integrations/src/index.ts rename to x-pack/plugins/log_explorer/public/state_machines/integrations/src/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/integrations/src/state_machine.ts b/x-pack/plugins/log_explorer/public/state_machines/integrations/src/state_machine.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/integrations/src/state_machine.ts rename to x-pack/plugins/log_explorer/public/state_machines/integrations/src/state_machine.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/integrations/src/types.ts b/x-pack/plugins/log_explorer/public/state_machines/integrations/src/types.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/integrations/src/types.ts rename to x-pack/plugins/log_explorer/public/state_machines/integrations/src/types.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/index.ts b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/index.ts rename to x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/data_view_service.ts b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/data_view_service.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/data_view_service.ts rename to x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/data_view_service.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/defaults.ts b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/defaults.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/defaults.ts rename to x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/defaults.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/index.ts b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/index.ts rename to x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/notifications.ts b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/notifications.ts similarity index 57% rename from x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/notifications.ts rename to x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/notifications.ts index e4dc78b056814..1c2cd471b9f6e 100644 --- a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/notifications.ts +++ b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/notifications.ts @@ -11,23 +11,21 @@ import { i18n } from '@kbn/i18n'; export const createDatasetSelectionRestoreFailedNotifier = (toasts: IToasts) => () => toasts.addWarning({ title: i18n.translate( - 'xpack.discoverLogExplorer.datasetSelection.restoreDatasetSelectionFailedToastTitle', + 'xpack.logExplorer.datasetSelection.restoreDatasetSelectionFailedToastTitle', { defaultMessage: "We couldn't restore your datasets selection." } ), text: i18n.translate( - 'xpack.discoverLogExplorer.datasetSelection.restoreDatasetSelectionFailedToastMessage', + 'xpack.logExplorer.datasetSelection.restoreDatasetSelectionFailedToastMessage', { defaultMessage: 'We switched to "All log datasets" as the default selection.' } ), }); export const createCreateDataViewFailedNotifier = (toasts: IToasts) => () => toasts.addWarning({ - title: i18n.translate( - 'xpack.discoverLogExplorer.datasetSelection.createDataViewFailedToastTitle', - { defaultMessage: "We couldn't create a data view for your selection." } - ), - text: i18n.translate( - 'xpack.discoverLogExplorer.datasetSelection.createDataViewFailedToastMessage', - { defaultMessage: 'We switched to "All log datasets" as the default selection.' } - ), + title: i18n.translate('xpack.logExplorer.datasetSelection.createDataViewFailedToastTitle', { + defaultMessage: "We couldn't create a data view for your selection.", + }), + text: i18n.translate('xpack.logExplorer.datasetSelection.createDataViewFailedToastMessage', { + defaultMessage: 'We switched to "All log datasets" as the default selection.', + }), }); diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/state_machine.ts b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/state_machine.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/state_machine.ts rename to x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/state_machine.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/types.ts b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/types.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/types.ts rename to x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/types.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/url_state_storage_service.ts b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/url_state_storage_service.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/url_state_storage_service.ts rename to x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/url_state_storage_service.ts diff --git a/x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/utils.ts b/x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/utils.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/state_machines/log_explorer_profile/src/utils.ts rename to x-pack/plugins/log_explorer/public/state_machines/log_explorer_profile/src/utils.ts diff --git a/x-pack/plugins/log_explorer/public/types.ts b/x-pack/plugins/log_explorer/public/types.ts new file mode 100644 index 0000000000000..d0b488950fee4 --- /dev/null +++ b/x-pack/plugins/log_explorer/public/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 type { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import type { DiscoverStart } from '@kbn/discover-plugin/public'; +import type { ComponentType } from 'react'; +import type { LogExplorerProps } from './components/log_explorer'; + +export type LogExplorerPluginSetup = void; +export interface LogExplorerPluginStart { + LogExplorer: ComponentType; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface LogExplorerSetupDeps {} + +export interface LogExplorerStartDeps { + data: DataPublicPluginStart; + discover: DiscoverStart; +} diff --git a/x-pack/plugins/discover_log_explorer/public/utils/comparator_by_field.ts b/x-pack/plugins/log_explorer/public/utils/comparator_by_field.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/comparator_by_field.ts rename to x-pack/plugins/log_explorer/public/utils/comparator_by_field.ts diff --git a/x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/all_dataset_selection.ts b/x-pack/plugins/log_explorer/public/utils/dataset_selection/all_dataset_selection.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/all_dataset_selection.ts rename to x-pack/plugins/log_explorer/public/utils/dataset_selection/all_dataset_selection.ts diff --git a/x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/encoding.test.ts b/x-pack/plugins/log_explorer/public/utils/dataset_selection/encoding.test.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/encoding.test.ts rename to x-pack/plugins/log_explorer/public/utils/dataset_selection/encoding.test.ts diff --git a/x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/encoding.ts b/x-pack/plugins/log_explorer/public/utils/dataset_selection/encoding.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/encoding.ts rename to x-pack/plugins/log_explorer/public/utils/dataset_selection/encoding.ts diff --git a/x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/errors.ts b/x-pack/plugins/log_explorer/public/utils/dataset_selection/errors.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/errors.ts rename to x-pack/plugins/log_explorer/public/utils/dataset_selection/errors.ts diff --git a/x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/hydrate_dataset_selection.ts.ts b/x-pack/plugins/log_explorer/public/utils/dataset_selection/hydrate_dataset_selection.ts.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/hydrate_dataset_selection.ts.ts rename to x-pack/plugins/log_explorer/public/utils/dataset_selection/hydrate_dataset_selection.ts.ts diff --git a/x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/index.ts b/x-pack/plugins/log_explorer/public/utils/dataset_selection/index.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/index.ts rename to x-pack/plugins/log_explorer/public/utils/dataset_selection/index.ts diff --git a/x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/single_dataset_selection.ts b/x-pack/plugins/log_explorer/public/utils/dataset_selection/single_dataset_selection.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/single_dataset_selection.ts rename to x-pack/plugins/log_explorer/public/utils/dataset_selection/single_dataset_selection.ts diff --git a/x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/types.ts b/x-pack/plugins/log_explorer/public/utils/dataset_selection/types.ts similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/dataset_selection/types.ts rename to x-pack/plugins/log_explorer/public/utils/dataset_selection/types.ts diff --git a/x-pack/plugins/discover_log_explorer/public/utils/dynamic.tsx b/x-pack/plugins/log_explorer/public/utils/dynamic.tsx similarity index 100% rename from x-pack/plugins/discover_log_explorer/public/utils/dynamic.tsx rename to x-pack/plugins/log_explorer/public/utils/dynamic.tsx diff --git a/x-pack/plugins/log_explorer/public/utils/proxies.ts b/x-pack/plugins/log_explorer/public/utils/proxies.ts new file mode 100644 index 0000000000000..5599f061f4d67 --- /dev/null +++ b/x-pack/plugins/log_explorer/public/utils/proxies.ts @@ -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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +/** + * Creates a Proxy in which certain property accesses are redirected to + * replacement factories. + * + * @param target the object to proxy + * @param replacements a map of keys to replacement factories + * @returns a proxy of the object + */ +export const createPropertyGetProxy = ( + target: Target, + replacements: { + [key in Key]: (value: Target[Key]) => Target[Key]; + } +) => + new Proxy(target, { + get(accessedTarget, accessedKey, ...rest) { + const value = Reflect.get(accessedTarget, accessedKey, ...rest); + if (hasKey(replacements, accessedKey)) { + return replacements[accessedKey](value); + } else { + return value; + } + }, + }); + +const hasKey = ( + obj: T, + key: string | number | symbol +): key is K => obj.hasOwnProperty(key); diff --git a/x-pack/plugins/log_explorer/server/index.ts b/x-pack/plugins/log_explorer/server/index.ts new file mode 100644 index 0000000000000..634e4cfe02566 --- /dev/null +++ b/x-pack/plugins/log_explorer/server/index.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 { LogExplorerServerPlugin } from './plugin'; + +export const plugin = () => new LogExplorerServerPlugin(); diff --git a/x-pack/plugins/discover_log_explorer/server/plugin.ts b/x-pack/plugins/log_explorer/server/plugin.ts similarity index 83% rename from x-pack/plugins/discover_log_explorer/server/plugin.ts rename to x-pack/plugins/log_explorer/server/plugin.ts index a1e971fc2b502..140d32a564ca4 100644 --- a/x-pack/plugins/discover_log_explorer/server/plugin.ts +++ b/x-pack/plugins/log_explorer/server/plugin.ts @@ -7,7 +7,7 @@ import { Plugin } from '@kbn/core/server'; -export class DiscoverLogExplorerServerPlugin implements Plugin { +export class LogExplorerServerPlugin implements Plugin { setup() {} start() {} diff --git a/x-pack/plugins/discover_log_explorer/tsconfig.json b/x-pack/plugins/log_explorer/tsconfig.json similarity index 94% rename from x-pack/plugins/discover_log_explorer/tsconfig.json rename to x-pack/plugins/log_explorer/tsconfig.json index 61ea70ece2d38..756f4bd6b156a 100644 --- a/x-pack/plugins/discover_log_explorer/tsconfig.json +++ b/x-pack/plugins/log_explorer/tsconfig.json @@ -19,7 +19,7 @@ "@kbn/kibana-react-plugin", "@kbn/data-plugin", "@kbn/unified-field-list", - "@kbn/config-schema", + "@kbn/core-application-browser", ], "exclude": ["target/**/*"] } diff --git a/x-pack/plugins/observability_log_explorer/.storybook/__mocks__/package_icon.tsx b/x-pack/plugins/observability_log_explorer/.storybook/__mocks__/package_icon.tsx new file mode 100644 index 0000000000000..2bb5c6c7614aa --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/.storybook/__mocks__/package_icon.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. + */ +import React from 'react'; +import { EuiIcon } from '@elastic/eui'; + +// Export mock package icon that doesn't trigger http requests +export const PackageIcon = () => ; diff --git a/x-pack/plugins/observability_log_explorer/.storybook/main.js b/x-pack/plugins/observability_log_explorer/.storybook/main.js new file mode 100644 index 0000000000000..79b438e7eb7ce --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/.storybook/main.js @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +const defaultConfig = require('@kbn/storybook').defaultConfig; + +module.exports = { + ...defaultConfig, + stories: ['../**/*.stories.mdx', ...defaultConfig.stories], + webpackFinal: async (config) => { + const originalConfig = await defaultConfig.webpackFinal(config); + + // Mock fleet plugin for PackageIcon component + originalConfig.resolve.alias['@kbn/fleet-plugin/public'] = require.resolve( + './__mocks__/package_icon' + ); + return originalConfig; + }, +}; diff --git a/x-pack/plugins/observability_log_explorer/.storybook/preview.js b/x-pack/plugins/observability_log_explorer/.storybook/preview.js new file mode 100644 index 0000000000000..33a07bd3fac1f --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/.storybook/preview.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +export const parameters = { + docs: { + source: { + type: 'code', // without this, stories in mdx documents freeze the browser + }, + }, +}; diff --git a/x-pack/plugins/observability_log_explorer/README.md b/x-pack/plugins/observability_log_explorer/README.md new file mode 100644 index 0000000000000..604b33dd2b288 --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/README.md @@ -0,0 +1,3 @@ +# Observability Log Explorer + +This plugin provides an app based on the `LogExplorer` component from the `log_explorer` plugin, but adds observability-specific affordances. diff --git a/x-pack/plugins/discover_log_explorer/common/plugin_config.ts b/x-pack/plugins/observability_log_explorer/common/plugin_config.ts similarity index 73% rename from x-pack/plugins/discover_log_explorer/common/plugin_config.ts rename to x-pack/plugins/observability_log_explorer/common/plugin_config.ts index ca8a3dab2a182..6d467f4236c3e 100644 --- a/x-pack/plugins/discover_log_explorer/common/plugin_config.ts +++ b/x-pack/plugins/observability_log_explorer/common/plugin_config.ts @@ -5,8 +5,8 @@ * 2.0. */ -export interface DiscoverLogExplorerConfig { - featureFlags: { - deepLinkVisible: boolean; +export interface ObservabilityLogExplorerConfig { + navigation: { + showAppLink: boolean; }; } diff --git a/x-pack/plugins/observability_log_explorer/common/translations.ts b/x-pack/plugins/observability_log_explorer/common/translations.ts new file mode 100644 index 0000000000000..5ec1940fa8dff --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/common/translations.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 { i18n } from '@kbn/i18n'; + +export const logExplorerAppTitle = i18n.translate('xpack.observabilityLogExplorer.appTitle', { + defaultMessage: 'Log Explorer', +}); + +export const betaBadgeTitle = i18n.translate('xpack.observabilityLogExplorer.betaBadgeTitle', { + defaultMessage: 'Beta', +}); + +export const betaBadgeDescription = i18n.translate( + 'xpack.observabilityLogExplorer.betaBadgeDescription', + { + defaultMessage: 'This application is in beta and therefore subject to change.', + } +); diff --git a/x-pack/plugins/observability_log_explorer/jest.config.js b/x-pack/plugins/observability_log_explorer/jest.config.js new file mode 100644 index 0000000000000..f258a72a9d0c6 --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/jest.config.js @@ -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. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../..', + roots: ['/x-pack/plugins/observability_log_explorer'], + coverageDirectory: + '/target/kibana-coverage/jest/x-pack/plugins/observability_log_explorer', + coverageReporters: ['text', 'html'], + collectCoverageFrom: [ + '/x-pack/plugins/observability_log_explorer/{common,public}/**/*.{ts,tsx}', + ], +}; diff --git a/x-pack/plugins/observability_log_explorer/kibana.jsonc b/x-pack/plugins/observability_log_explorer/kibana.jsonc new file mode 100644 index 0000000000000..35121b578c39c --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/kibana.jsonc @@ -0,0 +1,24 @@ +{ + "type": "plugin", + "id": "@kbn/observability-log-explorer-plugin", + "owner": "@elastic/infra-monitoring-ui", + "description": "This plugin exposes and registers observability log consumption features.", + "plugin": { + "id": "observabilityLogExplorer", + "server": true, + "browser": true, + "configPath": [ + "xpack", + "observabilityLogExplorer" + ], + "requiredPlugins": [ + "data", + "logExplorer", + "observabilityShared" + ], + "optionalPlugins": [ + "serverless" + ], + "requiredBundles": [] + } +} diff --git a/x-pack/plugins/observability_log_explorer/public/applications/observability_log_explorer.tsx b/x-pack/plugins/observability_log_explorer/public/applications/observability_log_explorer.tsx new file mode 100644 index 0000000000000..7d6863e4eb45a --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/public/applications/observability_log_explorer.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { AppMountParameters, CoreStart, ScopedHistory } from '@kbn/core/public'; +import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; +import { Route, Router, Routes } from '@kbn/shared-ux-router'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import { ObservablityLogExplorerMainRoute } from '../routes/main'; +import { ObservabilityLogExplorerPluginStart, ObservabilityLogExplorerStartDeps } from '../types'; + +export const renderObservabilityLogExplorer = ( + core: CoreStart, + pluginsStart: ObservabilityLogExplorerStartDeps, + ownPluginStart: ObservabilityLogExplorerPluginStart, + { element, history }: AppMountParameters +) => { + ReactDOM.render( + , + element + ); + + return () => { + // work around race condition between unmount effect and current app id + // observable in the search session service + pluginsStart.data.search.session.clear(); + + ReactDOM.unmountComponentAtNode(element); + }; +}; + +export interface ObservabilityLogExplorerAppProps { + core: CoreStart; + plugins: ObservabilityLogExplorerStartDeps; + pluginStart: ObservabilityLogExplorerPluginStart; + history: ScopedHistory; +} + +export const ObservabilityLogExplorerApp = ({ + core, + plugins: { logExplorer, observabilityShared, serverless }, + pluginStart, + history, +}: ObservabilityLogExplorerAppProps) => ( + + + + ( + + )} + /> + + + +); diff --git a/x-pack/plugins/observability_log_explorer/public/components/page_template.tsx b/x-pack/plugins/observability_log_explorer/public/components/page_template.tsx new file mode 100644 index 0000000000000..e79b8b1bc6271 --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/public/components/page_template.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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { EuiPageSectionProps } from '@elastic/eui'; +import { css } from '@emotion/react'; +import type { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; +import React from 'react'; + +export const ObservabilityLogExplorerPageTemplate = ({ + children, + observabilityShared, +}: React.PropsWithChildren<{ + observabilityShared: ObservabilitySharedPluginStart; +}>) => ( + + {children} + +); + +const fullHeightContentStyles = css` + display: flex; + flex-direction: column; + flex: 1 0 auto; + width: 100%; + height: 100%; +`; + +const pageSectionProps: EuiPageSectionProps = { + grow: true, + paddingSize: 'none', + contentProps: { css: fullHeightContentStyles }, +}; diff --git a/x-pack/plugins/discover_log_explorer/public/index.ts b/x-pack/plugins/observability_log_explorer/public/index.ts similarity index 53% rename from x-pack/plugins/discover_log_explorer/public/index.ts rename to x-pack/plugins/observability_log_explorer/public/index.ts index 0c4298100c558..18e03f7889385 100644 --- a/x-pack/plugins/discover_log_explorer/public/index.ts +++ b/x-pack/plugins/observability_log_explorer/public/index.ts @@ -6,9 +6,9 @@ */ import { PluginInitializerContext } from '@kbn/core/public'; -import { DiscoverLogExplorerConfig } from '../common/plugin_config'; -import { DiscoverLogExplorerPlugin } from './plugin'; +import { ObservabilityLogExplorerConfig } from '../common/plugin_config'; +import { ObservabilityLogExplorerPlugin } from './plugin'; -export function plugin(context: PluginInitializerContext) { - return new DiscoverLogExplorerPlugin(context); +export function plugin(context: PluginInitializerContext) { + return new ObservabilityLogExplorerPlugin(context); } diff --git a/x-pack/plugins/observability_log_explorer/public/plugin.ts b/x-pack/plugins/observability_log_explorer/public/plugin.ts new file mode 100644 index 0000000000000..6afb62235ba15 --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/public/plugin.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 { + AppNavLinkStatus, + CoreSetup, + CoreStart, + DEFAULT_APP_CATEGORIES, + Plugin, + PluginInitializerContext, +} from '@kbn/core/public'; +import { type ObservabilityLogExplorerConfig } from '../common/plugin_config'; +import { logExplorerAppTitle } from '../common/translations'; +import { renderObservabilityLogExplorer } from './applications/observability_log_explorer'; +import type { + ObservabilityLogExplorerPluginSetup, + ObservabilityLogExplorerPluginStart, + ObservabilityLogExplorerSetupDeps, + ObservabilityLogExplorerStartDeps, +} from './types'; + +export class ObservabilityLogExplorerPlugin + implements Plugin +{ + private config: ObservabilityLogExplorerConfig; + + constructor(context: PluginInitializerContext) { + this.config = context.config.get(); + } + + public setup( + core: CoreSetup, + _pluginsSetup: ObservabilityLogExplorerSetupDeps + ) { + core.application.register({ + id: 'observability-log-explorer', + title: logExplorerAppTitle, + category: DEFAULT_APP_CATEGORIES.observability, + euiIconType: 'logoLogging', + navLinkStatus: this.config.navigation.showAppLink + ? AppNavLinkStatus.visible + : AppNavLinkStatus.hidden, + searchable: true, + mount: async (appMountParams) => { + const [coreStart, pluginsStart, ownPluginStart] = await core.getStartServices(); + + return renderObservabilityLogExplorer( + coreStart, + pluginsStart, + ownPluginStart, + appMountParams + ); + }, + }); + + return {}; + } + + public start(_core: CoreStart, _pluginsStart: ObservabilityLogExplorerStartDeps) { + return {}; + } +} diff --git a/x-pack/plugins/observability_log_explorer/public/routes/main/index.tsx b/x-pack/plugins/observability_log_explorer/public/routes/main/index.tsx new file mode 100644 index 0000000000000..889e340497cf9 --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/public/routes/main/index.tsx @@ -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 './main_route'; diff --git a/x-pack/plugins/observability_log_explorer/public/routes/main/main_route.tsx b/x-pack/plugins/observability_log_explorer/public/routes/main/main_route.tsx new file mode 100644 index 0000000000000..5e9b22fb1ad5d --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/public/routes/main/main_route.tsx @@ -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 { CoreStart, ScopedHistory } from '@kbn/core/public'; +import { LogExplorerPluginStart } from '@kbn/log-explorer-plugin/public'; +import { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; +import { ServerlessPluginStart } from '@kbn/serverless/public'; +import React from 'react'; +import { ObservabilityLogExplorerPageTemplate } from '../../components/page_template'; +import { noBreadcrumbs, useBreadcrumbs } from '../../utils/breadcrumbs'; + +export interface ObservablityLogExplorerMainRouteProps { + core: CoreStart; + history: ScopedHistory; + logExplorer: LogExplorerPluginStart; + observabilityShared: ObservabilitySharedPluginStart; + serverless?: ServerlessPluginStart; +} + +export const ObservablityLogExplorerMainRoute = ({ + core, + history, + logExplorer, + observabilityShared, + serverless, +}: ObservablityLogExplorerMainRouteProps) => { + useBreadcrumbs(noBreadcrumbs, core.chrome, serverless); + + return ( + + + + ); +}; diff --git a/x-pack/plugins/observability_log_explorer/public/types.ts b/x-pack/plugins/observability_log_explorer/public/types.ts new file mode 100644 index 0000000000000..f5e6526c502d9 --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/public/types.ts @@ -0,0 +1,28 @@ +/* + * Copyright 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 { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import { LogExplorerPluginStart } from '@kbn/log-explorer-plugin/public'; +import { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; +import { ServerlessPluginStart } from '@kbn/serverless/public'; + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ObservabilityLogExplorerPluginSetup {} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface ObservabilityLogExplorerPluginStart {} + +export interface ObservabilityLogExplorerSetupDeps { + serverless?: ServerlessPluginStart; +} + +export interface ObservabilityLogExplorerStartDeps { + data: DataPublicPluginStart; + logExplorer: LogExplorerPluginStart; + observabilityShared: ObservabilitySharedPluginStart; + serverless?: ServerlessPluginStart; +} diff --git a/x-pack/plugins/observability_log_explorer/public/utils/breadcrumbs.tsx b/x-pack/plugins/observability_log_explorer/public/utils/breadcrumbs.tsx new file mode 100644 index 0000000000000..a8b575d5341dc --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/public/utils/breadcrumbs.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 { EuiBreadcrumb } from '@elastic/eui'; +import type { ChromeStart } from '@kbn/core-chrome-browser'; +import type { ServerlessPluginStart } from '@kbn/serverless/public'; +import { useEffect } from 'react'; +import { + betaBadgeDescription, + betaBadgeTitle, + logExplorerAppTitle, +} from '../../common/translations'; + +export const useBreadcrumbs = ( + breadcrumbs: EuiBreadcrumb[], + chromeService: ChromeStart, + serverlessService?: ServerlessPluginStart +) => { + useEffect(() => { + setBreadcrumbs(breadcrumbs, chromeService, serverlessService); + }, [breadcrumbs, chromeService, serverlessService]); +}; + +export function setBreadcrumbs( + breadcrumbs: EuiBreadcrumb[], + chromeService: ChromeStart, + serverlessService?: ServerlessPluginStart +) { + if (serverlessService) { + serverlessService.setBreadcrumbs(breadcrumbs); + } else if (chromeService) { + chromeService.setBreadcrumbs([ + { + text: logExplorerAppTitle, + }, + ...breadcrumbs, + ]); + } + chromeService.setBadge({ + text: betaBadgeTitle, + tooltip: betaBadgeDescription, + }); +} + +export const noBreadcrumbs: EuiBreadcrumb[] = []; diff --git a/x-pack/plugins/observability_log_explorer/public/utils/use_kibana.tsx b/x-pack/plugins/observability_log_explorer/public/utils/use_kibana.tsx new file mode 100644 index 0000000000000..d8b2235586e55 --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/public/utils/use_kibana.tsx @@ -0,0 +1,46 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart } from '@kbn/core/public'; +import { + createKibanaReactContext, + KibanaReactContextValue, + useKibana, +} from '@kbn/kibana-react-plugin/public'; +import { useMemo } from 'react'; +import { ObservabilityLogExplorerPluginStart, ObservabilityLogExplorerStartDeps } from '../types'; + +export type PluginKibanaContextValue = CoreStart & + ObservabilityLogExplorerStartDeps & + ObservabilityLogExplorerPluginStart; + +export const createKibanaContextForPlugin = ( + core: CoreStart, + plugins: ObservabilityLogExplorerStartDeps, + pluginStart: ObservabilityLogExplorerPluginStart +) => + createKibanaReactContext({ + ...core, + ...plugins, + ...pluginStart, + }); + +export const useKibanaContextForPlugin = + useKibana as () => KibanaReactContextValue; + +export const useKibanaContextForPluginProvider = ( + core: CoreStart, + plugins: ObservabilityLogExplorerStartDeps, + pluginStart: ObservabilityLogExplorerPluginStart +) => { + const { Provider } = useMemo( + () => createKibanaContextForPlugin(core, plugins, pluginStart), + [core, pluginStart, plugins] + ); + + return Provider; +}; diff --git a/x-pack/plugins/observability_log_explorer/server/config.ts b/x-pack/plugins/observability_log_explorer/server/config.ts new file mode 100644 index 0000000000000..1977c5e625c15 --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/server/config.ts @@ -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 { schema, offeringBasedSchema } from '@kbn/config-schema'; +import { PluginConfigDescriptor } from '@kbn/core/server'; +import { ObservabilityLogExplorerConfig } from '../common/plugin_config'; + +export const configSchema = schema.object({ + navigation: schema.object({ + showAppLink: offeringBasedSchema({ + serverless: schema.boolean({ + defaultValue: true, + }), + options: { + defaultValue: false, + }, + }), + }), +}); + +export const config: PluginConfigDescriptor = { + schema: configSchema, + deprecations: ({ renameFromRoot }) => [ + renameFromRoot( + 'xpack.discoverLogExplorer.featureFlags.deepLinkVisible', + 'xpack.observabilityLogExplorer.navigation.showAppLink', + { level: 'warning' } + ), + ], + exposeToBrowser: { + navigation: { + showAppLink: true, + }, + }, +}; diff --git a/x-pack/plugins/discover_log_explorer/server/index.ts b/x-pack/plugins/observability_log_explorer/server/index.ts similarity index 67% rename from x-pack/plugins/discover_log_explorer/server/index.ts rename to x-pack/plugins/observability_log_explorer/server/index.ts index 091fe7bb47e47..a487aefc8fd14 100644 --- a/x-pack/plugins/discover_log_explorer/server/index.ts +++ b/x-pack/plugins/observability_log_explorer/server/index.ts @@ -5,8 +5,8 @@ * 2.0. */ -import { DiscoverLogExplorerServerPlugin } from './plugin'; +import { ObservabilityLogExplorerServerPlugin } from './plugin'; export { config } from './config'; -export const plugin = () => new DiscoverLogExplorerServerPlugin(); +export const plugin = () => new ObservabilityLogExplorerServerPlugin(); diff --git a/x-pack/plugins/observability_log_explorer/server/plugin.ts b/x-pack/plugins/observability_log_explorer/server/plugin.ts new file mode 100644 index 0000000000000..da2d5edee0e96 --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/server/plugin.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 { Plugin } from '@kbn/core/server'; + +export class ObservabilityLogExplorerServerPlugin implements Plugin { + setup() {} + + start() {} +} diff --git a/x-pack/plugins/observability_log_explorer/tsconfig.json b/x-pack/plugins/observability_log_explorer/tsconfig.json new file mode 100644 index 0000000000000..5f94d15d30fea --- /dev/null +++ b/x-pack/plugins/observability_log_explorer/tsconfig.json @@ -0,0 +1,29 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types" + }, + "include": [ + "../../../typings/**/*", + "common/**/*", + "public/**/*", + "server/**/*", + ".storybook/**/*.tsx" + ], + "kbn_references": [ + "@kbn/core", + "@kbn/log-explorer-plugin", + "@kbn/i18n", + "@kbn/react-kibana-context-render", + "@kbn/shared-ux-router", + "@kbn/observability-shared-plugin", + "@kbn/data-plugin", + "@kbn/kibana-react-plugin", + "@kbn/serverless", + "@kbn/core-chrome-browser", + "@kbn/config-schema", + ], + "exclude": [ + "target/**/*" + ] +} diff --git a/x-pack/plugins/serverless_observability/public/components/side_navigation/index.tsx b/x-pack/plugins/serverless_observability/public/components/side_navigation/index.tsx index 34b0e2652b5de..3808a64e3baff 100644 --- a/x-pack/plugins/serverless_observability/public/components/side_navigation/index.tsx +++ b/x-pack/plugins/serverless_observability/public/components/side_navigation/index.tsx @@ -31,10 +31,10 @@ const navigationTree: NavigationTreeDefinition = { id: 'discover-dashboard-alerts-slos', children: [ { - title: i18n.translate('xpack.serverlessObservability.nav.discover', { - defaultMessage: 'Discover', + title: i18n.translate('xpack.serverlessObservability.nav.logExplorer', { + defaultMessage: 'Log Explorer', }), - link: 'discover:log-explorer', + link: 'observability-log-explorer', }, { title: i18n.translate('xpack.serverlessObservability.nav.dashboards', { diff --git a/x-pack/test/functional/apps/discover_log_explorer/customization.ts b/x-pack/test/functional/apps/discover_log_explorer/customization.ts deleted file mode 100644 index 6cd713a40f63a..0000000000000 --- a/x-pack/test/functional/apps/discover_log_explorer/customization.ts +++ /dev/null @@ -1,74 +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 ({ getService, getPageObjects }: FtrProviderContext) { - const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects(['common', 'navigationalSearch']); - const testSubjects = getService('testSubjects'); - - describe('Customizations', () => { - before('initialize tests', async () => { - await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); - }); - - after('clean up archives', async () => { - await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); - }); - - describe('when Discover is loaded with the log-explorer profile', () => { - it('DatasetSelector should replace the DataViewPicker', async () => { - // Assert does not render on discover app - await PageObjects.common.navigateToApp('discover'); - await testSubjects.missingOrFail('datasetSelectorPopover'); - - // Assert it renders on log-explorer profile - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - await testSubjects.existOrFail('datasetSelectorPopover'); - }); - - it('the TopNav bar should hide then New, Open and Save options', async () => { - // Assert does not render on discover app - await PageObjects.common.navigateToApp('discover'); - await testSubjects.existOrFail('discoverNewButton'); - await testSubjects.existOrFail('discoverOpenButton'); - await testSubjects.existOrFail('shareTopNavButton'); - await testSubjects.existOrFail('discoverAlertsButton'); - await testSubjects.existOrFail('openInspectorButton'); - await testSubjects.existOrFail('discoverSaveButton'); - - // Assert it renders on log-explorer profile - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - await testSubjects.missingOrFail('discoverNewButton'); - await testSubjects.missingOrFail('discoverOpenButton'); - await testSubjects.existOrFail('shareTopNavButton'); - await testSubjects.existOrFail('discoverAlertsButton'); - await testSubjects.existOrFail('openInspectorButton'); - await testSubjects.missingOrFail('discoverSaveButton'); - }); - - it('should add a searchable deep link to the profile page', async () => { - await PageObjects.common.navigateToApp('home'); - await PageObjects.navigationalSearch.searchFor('discover log explorer'); - - const results = await PageObjects.navigationalSearch.getDisplayedResults(); - expect(results[0].label).to.eql('Discover / Logs Explorer'); - }); - - it('should render a filter controls section as part of the unified search bar', async () => { - // Assert does not render on discover app - await PageObjects.common.navigateToApp('discover'); - await testSubjects.missingOrFail('datasetFiltersCustomization'); - - // Assert it renders on log-explorer profile - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - await testSubjects.existOrFail('datasetFiltersCustomization', { allowHidden: true }); - }); - }); - }); -} diff --git a/x-pack/test/functional/apps/observability_log_explorer/app.ts b/x-pack/test/functional/apps/observability_log_explorer/app.ts new file mode 100644 index 0000000000000..26fb9b4e8d19e --- /dev/null +++ b/x-pack/test/functional/apps/observability_log_explorer/app.ts @@ -0,0 +1,28 @@ +/* + * Copyright 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 ({ getService, getPageObjects }: FtrProviderContext) { + const PageObjects = getPageObjects(['common', 'navigationalSearch', 'observabilityLogExplorer']); + const testSubjects = getService('testSubjects'); + + describe('Application', () => { + it('is shown in the global search', async () => { + await PageObjects.common.navigateToApp('home'); + await PageObjects.navigationalSearch.searchFor('log explorer'); + + const results = await PageObjects.navigationalSearch.getDisplayedResults(); + expect(results[0].label).to.eql('Log Explorer'); + }); + + it('is shown in the observability side navigation', async () => { + await PageObjects.observabilityLogExplorer.navigateTo(); + await testSubjects.existOrFail('observability-nav-observability-log-explorer-explorer'); + }); + }); +} diff --git a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts b/x-pack/test/functional/apps/observability_log_explorer/columns_selection.ts similarity index 69% rename from x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts rename to x-pack/test/functional/apps/observability_log_explorer/columns_selection.ts index c1a9aee81758a..c61a2586522fd 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/columns_selection.ts +++ b/x-pack/test/functional/apps/observability_log_explorer/columns_selection.ts @@ -5,6 +5,8 @@ * 2.0. */ import expect from '@kbn/expect'; +import rison from '@kbn/rison'; +import querystring from 'querystring'; import { FtrProviderContext } from '../../ftr_provider_context'; const defaultLogColumns = ['@timestamp', 'message']; @@ -12,24 +14,24 @@ const defaultLogColumns = ['@timestamp', 'message']; export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'discover']); + const PageObjects = getPageObjects(['discover', 'observabilityLogExplorer']); describe('Columns selection initialization and update', () => { before(async () => { await esArchiver.load( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); }); after(async () => { await esArchiver.unload( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); }); - describe('when the log explorer profile loads', () => { + describe('when the log explorer loads', () => { it("should initialize the table columns to logs' default selection", async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); @@ -39,8 +41,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should restore the table columns from the URL state if exists', async () => { - await PageObjects.common.navigateToApp('discover', { - hash: '/p/log-explorer?_a=(columns:!(message,data_stream.namespace))', + await PageObjects.observabilityLogExplorer.navigateTo({ + search: querystring.stringify({ + _a: rison.encode({ + columns: ['message', 'data_stream.namespace'], + }), + }), }); await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); diff --git a/x-pack/test/functional/apps/discover_log_explorer/config.ts b/x-pack/test/functional/apps/observability_log_explorer/config.ts similarity index 100% rename from x-pack/test/functional/apps/discover_log_explorer/config.ts rename to x-pack/test/functional/apps/observability_log_explorer/config.ts diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selection_state.ts b/x-pack/test/functional/apps/observability_log_explorer/dataset_selection_state.ts similarity index 64% rename from x-pack/test/functional/apps/discover_log_explorer/dataset_selection_state.ts rename to x-pack/test/functional/apps/observability_log_explorer/dataset_selection_state.ts index c1c2b335358bc..c9bcade9dce5b 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selection_state.ts +++ b/x-pack/test/functional/apps/observability_log_explorer/dataset_selection_state.ts @@ -5,19 +5,21 @@ * 2.0. */ import expect from '@kbn/expect'; +import rison from '@kbn/rison'; +import querystring from 'querystring'; import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); + const PageObjects = getPageObjects(['common', 'observabilityLogExplorer']); describe('DatasetSelection initialization and update', () => { describe('when the "index" query param does not exist', () => { it('should initialize the "All log datasets" selection', async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); const datasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(datasetSelectionTitle).to.be('All log datasets'); }); @@ -27,53 +29,58 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should decode and restore the selection from a valid encoded index', async () => { const azureActivitylogsIndex = 'BQZwpgNmDGAuCWB7AdgLmAEwIay+W6yWAtmKgOQSIDmIAtFgF4CuATmAHRZzwBu8sAJ5VadAFTkANAlhRU3BPyEiQASklFS8lu2kC55AII6wAAgAyNEFN5hWIJGnIBGDgFYOAJgDM5deCgeFAAVQQAHMgdkaihVIA==='; - await PageObjects.common.navigateToApp('discover', { - hash: `/p/log-explorer?_a=(index:${encodeURIComponent(azureActivitylogsIndex)})`, + await PageObjects.observabilityLogExplorer.navigateTo({ + search: querystring.stringify({ + _a: rison.encode({ index: azureActivitylogsIndex }), + }), }); const datasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(datasetSelectionTitle).to.be('[Azure Logs] activitylogs'); }); it('should fallback to the "All log datasets" selection and notify the user of an invalid encoded index', async () => { const invalidEncodedIndex = 'invalid-encoded-index'; - await PageObjects.common.navigateToApp('discover', { - hash: `/p/log-explorer?_a=(index:${encodeURIComponent(invalidEncodedIndex)})`, + await PageObjects.observabilityLogExplorer.navigateTo({ + search: querystring.stringify({ + _a: rison.encode({ index: invalidEncodedIndex }), + }), }); const datasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); - await PageObjects.discoverLogExplorer.assertRestoreFailureToastExist(); + await PageObjects.observabilityLogExplorer.assertRestoreFailureToastExist(); expect(datasetSelectionTitle).to.be('All log datasets'); }); }); describe('when navigating back and forth on the page history', () => { it('should decode and restore the selection for the current index', async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); const allDatasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(allDatasetSelectionTitle).to.be('All log datasets'); const azureActivitylogsIndex = 'BQZwpgNmDGAuCWB7AdgLmAEwIay+W6yWAtmKgOQSIDmIAtFgF4CuATmAHRZzwBu8sAJ5VadAFTkANAlhRU3BPyEiQASklFS8lu2kC55AII6wAAgAyNEFN5hWIJGnIBGDgFYOAJgDM5deCgeFAAVQQAHMgdkaihVIA==='; - await PageObjects.common.navigateToApp('discover', { - hash: `/p/log-explorer?_a=(index:${encodeURIComponent( - azureActivitylogsIndex - )})&controlPanels=()`, + await PageObjects.observabilityLogExplorer.navigateTo({ + search: querystring.stringify({ + _a: rison.encode({ index: azureActivitylogsIndex }), + controlPanels: rison.encode({}), + }), }); const azureDatasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(azureDatasetSelectionTitle).to.be('[Azure Logs] activitylogs'); // Go back to previous page selection await retry.try(async () => { await browser.goBack(); const backNavigationDatasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(backNavigationDatasetSelectionTitle).to.be('All log datasets'); }); @@ -81,7 +88,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await retry.try(async () => { await browser.goForward(); const forwardNavigationDatasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(forwardNavigationDatasetSelectionTitle).to.be('[Azure Logs] activitylogs'); }); }); diff --git a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts similarity index 61% rename from x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts rename to x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts index b456da8bddb2a..f7a5595634895 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts @@ -20,28 +20,28 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const esArchiver = getService('esArchiver'); const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); + const PageObjects = getPageObjects(['common', 'observabilityLogExplorer']); describe('Dataset Selector', () => { before(async () => { - await PageObjects.discoverLogExplorer.removeInstalledPackages(); + await PageObjects.observabilityLogExplorer.removeInstalledPackages(); }); describe('without installed integrations or uncategorized data streams', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); describe('when open on the first navigation level', () => { it('should always display the "All log datasets" entry as the first item', async () => { const allLogDatasetButton = - await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getAllLogDatasetsButton(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); const firstEntryTitle = await menuEntries[0].getVisibleText(); @@ -52,8 +52,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should always display the unmanaged datasets entry as the second item', async () => { const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); const secondEntryTitle = await menuEntries[1].getVisibleText(); @@ -66,15 +66,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // Skip the test in case network condition utils are not available try { await retry.try(async () => { - await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoIntegrationsPromptExists(); }); await PageObjects.common.sleep(5000); await browser.setNetworkConditions('OFFLINE'); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('a'); await retry.try(async () => { - await PageObjects.discoverLogExplorer.assertNoIntegrationsErrorExists(); + await PageObjects.observabilityLogExplorer.assertNoIntegrationsErrorExists(); }); await browser.restoreNetworkConditions(); @@ -84,10 +84,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should display an empty prompt for no integrations', async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations.length).to.be(0); - await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoIntegrationsPromptExists(); }); }); @@ -97,10 +97,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { try { await browser.setNetworkConditions('SLOW_3G'); // Almost stuck network conditions const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await unamanagedDatasetButton.click(); - await PageObjects.discoverLogExplorer.assertLoadingSkeletonExists(); + await PageObjects.observabilityLogExplorer.assertLoadingSkeletonExists(); await browser.restoreNetworkConditions(); } catch (error) { @@ -112,18 +112,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // Skip the test in case network condition utils are not available try { const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await unamanagedDatasetButton.click(); await retry.try(async () => { - await PageObjects.discoverLogExplorer.assertNoDataStreamsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoDataStreamsPromptExists(); }); await browser.setNetworkConditions('OFFLINE'); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('a'); await retry.try(async () => { - await PageObjects.discoverLogExplorer.assertNoDataStreamsErrorExists(); + await PageObjects.observabilityLogExplorer.assertNoDataStreamsErrorExists(); }); await browser.restoreNetworkConditions(); @@ -134,15 +134,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should display an empty prompt for no data streams', async () => { const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await unamanagedDatasetButton.click(); const unamanagedDatasetEntries = - await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(unamanagedDatasetEntries.length).to.be(0); - await PageObjects.discoverLogExplorer.assertNoDataStreamsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoDataStreamsPromptExists(); }); }); }); @@ -152,32 +152,33 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { before(async () => { await esArchiver.load( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); - cleanupIntegrationsSetup = await PageObjects.discoverLogExplorer.setupInitialIntegrations(); + cleanupIntegrationsSetup = + await PageObjects.observabilityLogExplorer.setupInitialIntegrations(); }); after(async () => { await esArchiver.unload( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); await cleanupIntegrationsSetup(); }); describe('when open on the first navigation level', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); it('should always display the "All log datasets" entry as the first item', async () => { const allLogDatasetButton = - await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getAllLogDatasetsButton(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); const firstEntryTitle = await menuEntries[0].getVisibleText(); @@ -188,8 +189,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should always display the unmanaged datasets entry as the second item', async () => { const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); const secondEntryTitle = await menuEntries[1].getVisibleText(); @@ -199,7 +200,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should display a list of installed integrations', async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations.length).to.be(3); expect(integrations).to.eql(initialPackagesTexts); @@ -207,82 +208,82 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should sort the integrations list by the clicked sorting option', async () => { // Test ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql(initialPackagesTexts); }); // Test descending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('desc'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql(initialPackagesTexts.slice().reverse()); }); // Test back ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql(initialPackagesTexts); }); }); it('should filter the integrations list by the typed integration name', async () => { - await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('system'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.system]); }); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('a'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.apache, initialPackageMap.aws]); }); }); it('should display an empty prompt when the search does not match any result', async () => { - await PageObjects.discoverLogExplorer.typeSearchFieldWith('no result search text'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('no result search text'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations.length).to.be(0); }); - await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoIntegrationsPromptExists(); }); it('should load more integrations by scrolling to the end of the list', async () => { // Install more integrations and reload the page const cleanupAdditionalSetup = - await PageObjects.discoverLogExplorer.setupAdditionalIntegrations(); + await PageObjects.observabilityLogExplorer.setupAdditionalIntegrations(); await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); // Initially fetched integrations await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(nodes.length).to.be(15); - await nodes.at(-1)?.scrollIntoViewIfNecessary(); + await nodes.at(-1)?.scrollIntoView(); }); // Load more integrations await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(nodes.length).to.be(20); - await nodes.at(-1)?.scrollIntoViewIfNecessary(); + await nodes.at(-1)?.scrollIntoView(); }); // No other integrations to load after scrolling to last integration await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(nodes.length).to.be(20); }); @@ -292,24 +293,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('when clicking on integration and moving into the second navigation level', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); it('should display a list of available datasets', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); expect(await menuEntries[0].getVisibleText()).to.be('access'); @@ -319,39 +320,39 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should sort the datasets list by the clicked sorting option', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); }); // Test ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); }); // Test descending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('desc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('error'); expect(await menuEntries[1].getVisibleText()).to.be('access'); }); // Test back ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); @@ -360,28 +361,28 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should filter the datasets list by the typed dataset name', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); }); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('err'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('err'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(menuEntries.length).to.be(1); expect(await menuEntries[0].getVisibleText()).to.be('error'); @@ -390,26 +391,27 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should update the current selection with the clicked dataset', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('access'); menuEntries[0].click(); }); await retry.try(async () => { - const selectorButton = await PageObjects.discoverLogExplorer.getDatasetSelectorButton(); + const selectorButton = + await PageObjects.observabilityLogExplorer.getDatasetSelectorButton(); expect(await selectorButton.getVisibleText()).to.be('[Apache HTTP Server] access'); }); @@ -418,22 +420,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('when navigating into Uncategorized data streams', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); it('should display a list of available datasets', async () => { - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const button = await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await button.click(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); @@ -443,20 +445,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should sort the datasets list by the clicked sorting option', async () => { - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const button = await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await button.click(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); }); // Test ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); @@ -464,9 +466,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); // Test descending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('desc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[2]); expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); @@ -474,9 +476,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); // Test back ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); @@ -485,28 +487,28 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should filter the datasets list by the typed dataset name', async () => { - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const button = await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await button.click(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); }); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('retail'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('retail'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(menuEntries.length).to.be(1); expect(await menuEntries[0].getVisibleText()).to.be('logs-retail-*'); @@ -514,25 +516,26 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should update the current selection with the clicked dataset', async () => { - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const button = await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await button.click(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('logs-gaming-*'); menuEntries[0].click(); }); await retry.try(async () => { - const selectorButton = await PageObjects.discoverLogExplorer.getDatasetSelectorButton(); + const selectorButton = + await PageObjects.observabilityLogExplorer.getDatasetSelectorButton(); expect(await selectorButton.getVisibleText()).to.be('logs-gaming-*'); }); @@ -541,37 +544,37 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('when open/close the selector', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); it('should restore the latest navigation panel', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); }); - await PageObjects.discoverLogExplorer.closeDatasetSelector(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.closeDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); expect(await menuEntries[0].getVisibleText()).to.be('access'); @@ -580,18 +583,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should restore the latest search results', async () => { - await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('system'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.system]); }); - await PageObjects.discoverLogExplorer.closeDatasetSelector(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.closeDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.system]); }); }); @@ -599,35 +602,36 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('when switching between integration panels', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); it('should remember the latest search and restore its results for each integration', async () => { - await PageObjects.discoverLogExplorer.openDatasetSelector(); - await PageObjects.discoverLogExplorer.clearSearchField(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.clearSearchField(); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('apache'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('apache'); await retry.try(async () => { - const { nodes, integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes, integrations } = + await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.apache]); nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); }); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('err'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('err'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(menuEntries.length).to.be(1); expect(await menuEntries[0].getVisibleText()).to.be('error'); @@ -635,23 +639,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // Navigate back to integrations const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); panelTitleNode.click(); await retry.try(async () => { - const { nodes, integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes, integrations } = + await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.apache]); - const searchValue = await PageObjects.discoverLogExplorer.getSearchFieldValue(); + const searchValue = await PageObjects.observabilityLogExplorer.getSearchFieldValue(); expect(searchValue).to.eql('apache'); nodes[0].click(); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); - const searchValue = await PageObjects.discoverLogExplorer.getSearchFieldValue(); + const searchValue = await PageObjects.observabilityLogExplorer.getSearchFieldValue(); expect(searchValue).to.eql('err'); expect(menuEntries.length).to.be(1); diff --git a/x-pack/test/functional/apps/observability_log_explorer/filter_controls.ts b/x-pack/test/functional/apps/observability_log_explorer/filter_controls.ts new file mode 100644 index 0000000000000..db04f6251d9bc --- /dev/null +++ b/x-pack/test/functional/apps/observability_log_explorer/filter_controls.ts @@ -0,0 +1,28 @@ +/* + * Copyright 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 kibanaServer = getService('kibanaServer'); + const PageObjects = getPageObjects(['observabilityLogExplorer']); + const testSubjects = getService('testSubjects'); + + describe('Filter controls customization', () => { + before('initialize tests', async () => { + await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); + }); + + after('clean up archives', async () => { + await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); + }); + + it('renders a filter controls section as part of the unified search bar', async () => { + await PageObjects.observabilityLogExplorer.navigateTo(); + await testSubjects.existOrFail('datasetFiltersCustomization', { allowHidden: true }); + }); + }); +} diff --git a/x-pack/test/functional/apps/discover_log_explorer/index.ts b/x-pack/test/functional/apps/observability_log_explorer/index.ts similarity index 78% rename from x-pack/test/functional/apps/discover_log_explorer/index.ts rename to x-pack/test/functional/apps/observability_log_explorer/index.ts index dd8b99db79ad0..90a52663e34ce 100644 --- a/x-pack/test/functional/apps/discover_log_explorer/index.ts +++ b/x-pack/test/functional/apps/observability_log_explorer/index.ts @@ -8,10 +8,11 @@ import { FtrProviderContext } from '../../ftr_provider_context'; export default function ({ loadTestFile }: FtrProviderContext) { - describe('Discover Log-Explorer profile', function () { + describe('Observability Log Explorer', function () { + loadTestFile(require.resolve('./app')); loadTestFile(require.resolve('./columns_selection')); - loadTestFile(require.resolve('./customization')); loadTestFile(require.resolve('./dataset_selection_state')); loadTestFile(require.resolve('./dataset_selector')); + loadTestFile(require.resolve('./filter_controls')); }); } diff --git a/x-pack/test/functional/config.base.js b/x-pack/test/functional/config.base.js index 36dc0c6d84c3c..5bb94fd5a8897 100644 --- a/x-pack/test/functional/config.base.js +++ b/x-pack/test/functional/config.base.js @@ -168,6 +168,9 @@ export default async function ({ readConfigFile }) { observability: { pathname: '/app/observability', }, + observabilityLogExplorer: { + pathname: '/app/observability-log-explorer', + }, connectors: { pathname: '/app/management/insightsAndAlerting/triggersActionsConnectors/', }, diff --git a/x-pack/test/functional/es_archives/discover_log_explorer/data_streams/data.json.gz b/x-pack/test/functional/es_archives/observability_log_explorer/data_streams/data.json.gz similarity index 100% rename from x-pack/test/functional/es_archives/discover_log_explorer/data_streams/data.json.gz rename to x-pack/test/functional/es_archives/observability_log_explorer/data_streams/data.json.gz diff --git a/x-pack/test/functional/es_archives/discover_log_explorer/data_streams/mappings.json b/x-pack/test/functional/es_archives/observability_log_explorer/data_streams/mappings.json similarity index 100% rename from x-pack/test/functional/es_archives/discover_log_explorer/data_streams/mappings.json rename to x-pack/test/functional/es_archives/observability_log_explorer/data_streams/mappings.json diff --git a/x-pack/test/functional/page_objects/index.ts b/x-pack/test/functional/page_objects/index.ts index dc7d2f9ee9a13..a8ac0895ed255 100644 --- a/x-pack/test/functional/page_objects/index.ts +++ b/x-pack/test/functional/page_objects/index.ts @@ -15,7 +15,6 @@ import { CanvasPageProvider } from './canvas_page'; import { CopySavedObjectsToSpacePageProvider } from './copy_saved_objects_to_space_page'; import { CrossClusterReplicationPageProvider } from './cross_cluster_replication_page'; import { DetectionsPageObject } from '../../security_solution_ftr/page_objects/detections'; -import { DiscoverLogExplorerPageObject } from './discover_log_explorer'; import { GeoFileUploadPageObject } from './geo_file_upload'; import { GisPageObject } from './gis_page'; import { GraphPageObject } from './graph_page'; @@ -34,6 +33,7 @@ import { LogstashPageObject } from './logstash_page'; import { MaintenanceWindowsPageProvider } from './maintenance_windows_page'; import { MonitoringPageObject } from './monitoring_page'; import { NavigationalSearchPageObject } from './navigational_search'; +import { ObservabilityLogExplorerPageObject } from './observability_log_explorer'; import { ObservabilityPageProvider } from './observability_page'; import { RemoteClustersPageProvider } from './remote_clusters_page'; import { ReportingPageObject } from './reporting_page'; @@ -62,7 +62,6 @@ export const pageObjects = { copySavedObjectsToSpace: CopySavedObjectsToSpacePageProvider, crossClusterReplication: CrossClusterReplicationPageProvider, detections: DetectionsPageObject, - discoverLogExplorer: DiscoverLogExplorerPageObject, geoFileUpload: GeoFileUploadPageObject, graph: GraphPageObject, grokDebugger: GrokDebuggerPageObject, @@ -81,6 +80,7 @@ export const pageObjects = { maps: GisPageObject, monitoring: MonitoringPageObject, navigationalSearch: NavigationalSearchPageObject, + observabilityLogExplorer: ObservabilityLogExplorerPageObject, observability: ObservabilityPageProvider, remoteClusters: RemoteClustersPageProvider, reporting: ReportingPageObject, diff --git a/x-pack/test/functional/page_objects/discover_log_explorer.ts b/x-pack/test/functional/page_objects/observability_log_explorer.ts similarity index 95% rename from x-pack/test/functional/page_objects/discover_log_explorer.ts rename to x-pack/test/functional/page_objects/observability_log_explorer.ts index 282a703863dc2..33e85e06a16a9 100644 --- a/x-pack/test/functional/page_objects/discover_log_explorer.ts +++ b/x-pack/test/functional/page_objects/observability_log_explorer.ts @@ -98,12 +98,18 @@ const packages: IntegrationPackage[] = [ const initialPackages = packages.slice(0, 3); const additionalPackages = packages.slice(3); -export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext) { +export function ObservabilityLogExplorerPageObject({ + getPageObjects, + getService, +}: FtrProviderContext) { + const PageObjects = getPageObjects(['common']); const log = getService('log'); const supertest = getService('supertest'); const testSubjects = getService('testSubjects'); const toasts = getService('toasts'); + type NavigateToAppOptions = Parameters[1]; + return { uninstallPackage: ({ name, version }: IntegrationPackage) => { return supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); @@ -165,6 +171,10 @@ export function DiscoverLogExplorerPageObject({ getService }: FtrProviderContext }; }, + async navigateTo(options?: NavigateToAppOptions) { + return await PageObjects.common.navigateToApp('observabilityLogExplorer', options); + }, + getDatasetSelector() { return testSubjects.find('datasetSelectorPopover'); }, diff --git a/x-pack/test/plugin_functional/test_suites/global_search/global_search_providers.ts b/x-pack/test/plugin_functional/test_suites/global_search/global_search_providers.ts index 684633d4aac13..daf1821ef5c05 100644 --- a/x-pack/test/plugin_functional/test_suites/global_search/global_search_providers.ts +++ b/x-pack/test/plugin_functional/test_suites/global_search/global_search_providers.ts @@ -87,7 +87,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { describe('Applications provider', function () { it('can search for root-level applications', async () => { const results = await findResultsWithApi('discover'); - expect(results.length).to.be(2); + expect(results.length).to.be(1); expect(results[0].title).to.be('Discover'); }); diff --git a/x-pack/test_serverless/functional/config.base.ts b/x-pack/test_serverless/functional/config.base.ts index 640ae2402b544..c266d184151af 100644 --- a/x-pack/test_serverless/functional/config.base.ts +++ b/x-pack/test_serverless/functional/config.base.ts @@ -52,6 +52,9 @@ export function createTestConfig(options: CreateTestConfigOptions) { observability: { pathname: '/app/observability', }, + observabilityLogExplorer: { + pathname: '/app/observability-log-explorer', + }, management: { pathname: '/app/management', }, diff --git a/x-pack/test_serverless/functional/test_suites/observability/cypress/e2e/navigation.cy.ts b/x-pack/test_serverless/functional/test_suites/observability/cypress/e2e/navigation.cy.ts index 84abae3258cff..4a8663666026c 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/cypress/e2e/navigation.cy.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/cypress/e2e/navigation.cy.ts @@ -11,7 +11,8 @@ describe('Serverless', () => { }); it('contains the side navigation for observabilitity serverless', () => { - cy.contains('Discover'); + cy.loginAsElasticUser(); + cy.contains('Log Explorer'); cy.contains('Dashboards'); cy.contains('Alerts'); cy.contains('AIOps'); @@ -22,8 +23,10 @@ describe('Serverless', () => { }); it('navigates to discover-dashboard-viz links', () => { - cy.contains('Discover').click(); - cy.url().should('include', '/app/discover'); + cy.loginAsElasticUser(); + + cy.contains('Log Explorer').click(); + cy.url().should('include', '/app/observability-log-explorer'); cy.contains('Dashboards').click(); cy.url().should('include', '/app/dashboards'); diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts b/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.ts deleted file mode 100644 index a647293a73145..0000000000000 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/customization.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 { FtrProviderContext } from '../../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const kibanaServer = getService('kibanaServer'); - const PageObjects = getPageObjects(['common']); - const testSubjects = getService('testSubjects'); - - describe('Customizations', () => { - before('initialize tests', async () => { - await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); - }); - - after('clean up archives', async () => { - await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); - }); - - describe('when Discover is loaded with the log-explorer profile', () => { - it('DatasetSelector should replace the DataViewPicker', async () => { - // Assert does not render on discover app - await PageObjects.common.navigateToApp('discover'); - await testSubjects.missingOrFail('datasetSelectorPopover'); - - // Assert it renders on log-explorer profile - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - await testSubjects.existOrFail('datasetSelectorPopover'); - }); - - it('the TopNav bar should hide New, Open and Save options', async () => { - // Assert does not render on discover app - await PageObjects.common.navigateToApp('discover'); - await testSubjects.existOrFail('discoverNewButton'); - await testSubjects.existOrFail('discoverOpenButton'); - await testSubjects.existOrFail('shareTopNavButton'); - await testSubjects.existOrFail('discoverAlertsButton'); - await testSubjects.existOrFail('openInspectorButton'); - await testSubjects.existOrFail('discoverSaveButton'); - - // Assert it renders on log-explorer profile - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - await testSubjects.missingOrFail('discoverNewButton'); - await testSubjects.missingOrFail('discoverOpenButton'); - await testSubjects.existOrFail('shareTopNavButton'); - await testSubjects.existOrFail('discoverAlertsButton'); - await testSubjects.existOrFail('openInspectorButton'); - await testSubjects.missingOrFail('discoverSaveButton'); - }); - - it('should render a filter controls section as part of the unified search bar', async () => { - // Assert does not render on discover app - await PageObjects.common.navigateToApp('discover'); - await testSubjects.missingOrFail('datasetFiltersCustomization'); - - // Assert it renders on log-explorer profile - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); - await testSubjects.existOrFail('datasetFiltersCustomization', { allowHidden: true }); - }); - }); - }); -} diff --git a/x-pack/test_serverless/functional/test_suites/observability/index.ts b/x-pack/test_serverless/functional/test_suites/observability/index.ts index f376e49f56daf..e24841e6fbff9 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/index.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/index.ts @@ -6,13 +6,12 @@ */ import { FtrProviderContext } from '../../ftr_provider_context'; -import loadDiscoverLogExplorerSuite from './discover_log_explorer'; export default function ({ loadTestFile }: FtrProviderContext) { describe('serverless observability UI', function () { loadTestFile(require.resolve('./landing_page')); loadTestFile(require.resolve('./navigation')); - loadDiscoverLogExplorerSuite(loadTestFile); + loadTestFile(require.resolve('./observability_log_explorer')); loadTestFile(require.resolve('./cases/attachment_framework')); loadTestFile(require.resolve('./cases/configure')); loadTestFile(require.resolve('./cases/list_view')); diff --git a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts index eb56af9f88688..7e84512ab4b0a 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/navigation.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/navigation.ts @@ -35,13 +35,15 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { }); await svlCommonNavigation.sidenav.expectSectionClosed('project_settings_project_nav'); - // navigate to discover - await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'discover:log-explorer' }); - await svlCommonNavigation.sidenav.expectLinkActive({ deepLinkId: 'discover:log-explorer' }); + // navigate to log explorer + await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-log-explorer' }); + await svlCommonNavigation.sidenav.expectLinkActive({ + deepLinkId: 'observability-log-explorer', + }); await svlCommonNavigation.breadcrumbs.expectBreadcrumbExists({ - deepLinkId: 'discover:log-explorer', + deepLinkId: 'observability-log-explorer', }); - await expect(await browser.getCurrentUrl()).contain('/app/discover'); + await expect(await browser.getCurrentUrl()).contain('/app/observability-log-explorer'); // check the aiops subsection await svlCommonNavigation.sidenav.clickLink({ navId: 'aiops' }); // open ai ops subsection @@ -77,15 +79,6 @@ export default function ({ getPageObject, getService }: FtrProviderContext) { await svlCommonNavigation.sidenav.expectSectionOpen('project_settings_project_nav'); }); - it('navigate using search', async () => { - await svlCommonNavigation.search.showSearch(); - await svlCommonNavigation.search.searchFor('discover log explorer'); - await svlCommonNavigation.search.clickOnOption(0); - await svlCommonNavigation.search.hideSearch(); - - await expect(await browser.getCurrentUrl()).contain('/app/discover#/p/log-explorer'); - }); - it('shows cases in sidebar navigation', async () => { await svlCommonNavigation.expectExists(); diff --git a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/app.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/app.ts new file mode 100644 index 0000000000000..6a9d76a9b594c --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/app.ts @@ -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 expect from '@kbn/expect'; +import { FtrProviderContext } from '../../../ftr_provider_context'; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const PageObjects = getPageObjects(['observabilityLogExplorer', 'svlCommonNavigation']); + + describe('Application', () => { + it('is shown in the global search', async () => { + await PageObjects.observabilityLogExplorer.navigateTo(); + await PageObjects.svlCommonNavigation.search.showSearch(); + await PageObjects.svlCommonNavigation.search.searchFor('log explorer'); + + const results = await PageObjects.svlCommonNavigation.search.getDisplayedResults(); + expect(results[0].label).to.eql('Log Explorer'); + + await PageObjects.svlCommonNavigation.search.hideSearch(); + }); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/columns_selection.ts similarity index 69% rename from x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts rename to x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/columns_selection.ts index dfba8f72a699d..92ccb09a27f00 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/columns_selection.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/columns_selection.ts @@ -5,6 +5,8 @@ * 2.0. */ import expect from '@kbn/expect'; +import rison from '@kbn/rison'; +import querystring from 'querystring'; import { FtrProviderContext } from '../../../ftr_provider_context'; const defaultLogColumns = ['@timestamp', 'message']; @@ -12,24 +14,24 @@ const defaultLogColumns = ['@timestamp', 'message']; export default function ({ getService, getPageObjects }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'discover']); + const PageObjects = getPageObjects(['discover', 'observabilityLogExplorer']); describe('Columns selection initialization and update', () => { before(async () => { await esArchiver.load( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); }); after(async () => { await esArchiver.unload( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); }); - describe('when the log explorer profile loads', () => { + describe('when the log explorer loads', () => { it("should initialize the table columns to logs' default selection", async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); @@ -39,8 +41,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should restore the table columns from the URL state if exists', async () => { - await PageObjects.common.navigateToApp('discover', { - hash: '/p/log-explorer?_a=(columns:!(message,data_stream.namespace))', + await PageObjects.observabilityLogExplorer.navigateTo({ + search: querystring.stringify({ + _a: rison.encode({ + columns: ['message', 'data_stream.namespace'], + }), + }), }); await PageObjects.discover.expandTimeRangeAsSuggestedInNoResultsMessage(); diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selection_state.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selection_state.ts similarity index 60% rename from x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selection_state.ts rename to x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selection_state.ts index 01f5551a94e29..5652843c3fc0c 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selection_state.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selection_state.ts @@ -5,75 +5,82 @@ * 2.0. */ import expect from '@kbn/expect'; +import rison from '@kbn/rison'; +import querystring from 'querystring'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); + const PageObjects = getPageObjects(['common', 'observabilityLogExplorer']); describe('DatasetSelection initialization and update', () => { describe('when the "index" query param does not exist', () => { it('should initialize the "All log datasets" selection', async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); const datasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(datasetSelectionTitle).to.be('All log datasets'); }); }); - describe('when the "index" query param exist', () => { + describe('when the "index" query param exists', () => { it('should decode and restore the selection from a valid encoded index', async () => { const azureActivitylogsIndex = 'BQZwpgNmDGAuCWB7AdgLmAEwIay+W6yWAtmKgOQSIDmIAtFgF4CuATmAHRZzwBu8sAJ5VadAFTkANAlhRU3BPyEiQASklFS8lu2kC55AII6wAAgAyNEFN5hWIJGnIBGDgFYOAJgDM5deCgeFAAVQQAHMgdkaihVIA==='; - await PageObjects.common.navigateToApp('discover', { - hash: `/p/log-explorer?_a=(index:${encodeURIComponent(azureActivitylogsIndex)})`, + await PageObjects.observabilityLogExplorer.navigateTo({ + search: querystring.stringify({ + _a: rison.encode({ index: azureActivitylogsIndex }), + }), }); const datasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(datasetSelectionTitle).to.be('[Azure Logs] activitylogs'); }); - it('should fallback to "All log datasets" selection and notify the user for an invalid encoded index', async () => { + it('should fallback to the "All log datasets" selection and notify the user of an invalid encoded index', async () => { const invalidEncodedIndex = 'invalid-encoded-index'; - await PageObjects.common.navigateToApp('discover', { - hash: `/p/log-explorer?_a=(index:${encodeURIComponent(invalidEncodedIndex)})`, + await PageObjects.observabilityLogExplorer.navigateTo({ + search: querystring.stringify({ + _a: rison.encode({ index: invalidEncodedIndex }), + }), }); const datasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); - await PageObjects.discoverLogExplorer.assertRestoreFailureToastExist(); + await PageObjects.observabilityLogExplorer.assertRestoreFailureToastExist(); expect(datasetSelectionTitle).to.be('All log datasets'); }); }); describe('when navigating back and forth on the page history', () => { it('should decode and restore the selection for the current index', async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); const allDatasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(allDatasetSelectionTitle).to.be('All log datasets'); const azureActivitylogsIndex = 'BQZwpgNmDGAuCWB7AdgLmAEwIay+W6yWAtmKgOQSIDmIAtFgF4CuATmAHRZzwBu8sAJ5VadAFTkANAlhRU3BPyEiQASklFS8lu2kC55AII6wAAgAyNEFN5hWIJGnIBGDgFYOAJgDM5deCgeFAAVQQAHMgdkaihVIA==='; - await PageObjects.common.navigateToApp('discover', { - hash: `/p/log-explorer?_a=(index:${encodeURIComponent( - azureActivitylogsIndex - )})&controlPanels=()`, + await PageObjects.observabilityLogExplorer.navigateTo({ + search: querystring.stringify({ + _a: rison.encode({ index: azureActivitylogsIndex }), + controlPanels: rison.encode({}), + }), }); const azureDatasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(azureDatasetSelectionTitle).to.be('[Azure Logs] activitylogs'); // Go back to previous page selection await retry.try(async () => { await browser.goBack(); const backNavigationDatasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(backNavigationDatasetSelectionTitle).to.be('All log datasets'); }); @@ -81,7 +88,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await retry.try(async () => { await browser.goForward(); const forwardNavigationDatasetSelectionTitle = - await PageObjects.discoverLogExplorer.getDatasetSelectorButtonText(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorButtonText(); expect(forwardNavigationDatasetSelectionTitle).to.be('[Azure Logs] activitylogs'); }); }); diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selector.ts similarity index 61% rename from x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts rename to x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selector.ts index 124bacb9ac1f3..622c282e716eb 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/dataset_selector.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/dataset_selector.ts @@ -20,28 +20,28 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const browser = getService('browser'); const esArchiver = getService('esArchiver'); const retry = getService('retry'); - const PageObjects = getPageObjects(['common', 'discoverLogExplorer']); + const PageObjects = getPageObjects(['common', 'observabilityLogExplorer']); describe('Dataset Selector', () => { before(async () => { - await PageObjects.discoverLogExplorer.removeInstalledPackages(); + await PageObjects.observabilityLogExplorer.removeInstalledPackages(); }); describe('without installed integrations or uncategorized data streams', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); describe('when open on the first navigation level', () => { it('should always display the "All log datasets" entry as the first item', async () => { const allLogDatasetButton = - await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getAllLogDatasetsButton(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); const firstEntryTitle = await menuEntries[0].getVisibleText(); @@ -52,8 +52,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should always display the unmanaged datasets entry as the second item', async () => { const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); const secondEntryTitle = await menuEntries[1].getVisibleText(); @@ -66,15 +66,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // Skip the test in case network condition utils are not available try { await retry.try(async () => { - await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoIntegrationsPromptExists(); }); await PageObjects.common.sleep(5000); await browser.setNetworkConditions('OFFLINE'); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('a'); await retry.try(async () => { - await PageObjects.discoverLogExplorer.assertNoIntegrationsErrorExists(); + await PageObjects.observabilityLogExplorer.assertNoIntegrationsErrorExists(); }); await browser.restoreNetworkConditions(); @@ -86,10 +86,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // Skip: failing assertion // Issue: https://github.com/elastic/kibana/issues/165138 it.skip('should display an empty prompt for no integrations', async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations.length).to.be(0); - await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoIntegrationsPromptExists(); }); }); @@ -99,10 +99,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { try { await browser.setNetworkConditions('SLOW_3G'); // Almost stuck network conditions const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await unamanagedDatasetButton.click(); - await PageObjects.discoverLogExplorer.assertLoadingSkeletonExists(); + await PageObjects.observabilityLogExplorer.assertLoadingSkeletonExists(); await browser.restoreNetworkConditions(); } catch (error) { @@ -114,18 +114,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // Skip the test in case network condition utils are not available try { const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await unamanagedDatasetButton.click(); await retry.try(async () => { - await PageObjects.discoverLogExplorer.assertNoDataStreamsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoDataStreamsPromptExists(); }); await browser.setNetworkConditions('OFFLINE'); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('a'); await retry.try(async () => { - await PageObjects.discoverLogExplorer.assertNoDataStreamsErrorExists(); + await PageObjects.observabilityLogExplorer.assertNoDataStreamsErrorExists(); }); await browser.restoreNetworkConditions(); @@ -136,15 +136,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should display an empty prompt for no data streams', async () => { const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await unamanagedDatasetButton.click(); const unamanagedDatasetEntries = - await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(unamanagedDatasetEntries.length).to.be(0); - await PageObjects.discoverLogExplorer.assertNoDataStreamsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoDataStreamsPromptExists(); }); }); }); @@ -154,32 +154,33 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { before(async () => { await esArchiver.load( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); - cleanupIntegrationsSetup = await PageObjects.discoverLogExplorer.setupInitialIntegrations(); + cleanupIntegrationsSetup = + await PageObjects.observabilityLogExplorer.setupInitialIntegrations(); }); after(async () => { await esArchiver.unload( - 'x-pack/test/functional/es_archives/discover_log_explorer/data_streams' + 'x-pack/test/functional/es_archives/observability_log_explorer/data_streams' ); await cleanupIntegrationsSetup(); }); describe('when open on the first navigation level', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); it('should always display the "All log datasets" entry as the first item', async () => { const allLogDatasetButton = - await PageObjects.discoverLogExplorer.getAllLogDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getAllLogDatasetsButton(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); const allLogDatasetTitle = await allLogDatasetButton.getVisibleText(); const firstEntryTitle = await menuEntries[0].getVisibleText(); @@ -190,8 +191,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should always display the unmanaged datasets entry as the second item', async () => { const unamanagedDatasetButton = - await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); const unmanagedDatasetTitle = await unamanagedDatasetButton.getVisibleText(); const secondEntryTitle = await menuEntries[1].getVisibleText(); @@ -201,7 +202,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should display a list of installed integrations', async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations.length).to.be(3); expect(integrations).to.eql(initialPackagesTexts); @@ -209,82 +210,82 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should sort the integrations list by the clicked sorting option', async () => { // Test ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql(initialPackagesTexts); }); // Test descending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('desc'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql(initialPackagesTexts.slice().reverse()); }); // Test back ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql(initialPackagesTexts); }); }); it('should filter the integrations list by the typed integration name', async () => { - await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('system'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.system]); }); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('a'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('a'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.apache, initialPackageMap.aws]); }); }); it('should display an empty prompt when the search does not match any result', async () => { - await PageObjects.discoverLogExplorer.typeSearchFieldWith('no result search text'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('no result search text'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations.length).to.be(0); }); - await PageObjects.discoverLogExplorer.assertNoIntegrationsPromptExists(); + await PageObjects.observabilityLogExplorer.assertNoIntegrationsPromptExists(); }); it('should load more integrations by scrolling to the end of the list', async () => { // Install more integrations and reload the page const cleanupAdditionalSetup = - await PageObjects.discoverLogExplorer.setupAdditionalIntegrations(); + await PageObjects.observabilityLogExplorer.setupAdditionalIntegrations(); await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); // Initially fetched integrations await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(nodes.length).to.be(15); - await nodes.at(-1)?.scrollIntoViewIfNecessary(); + await nodes.at(-1)?.scrollIntoView(); }); // Load more integrations await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(nodes.length).to.be(20); - await nodes.at(-1)?.scrollIntoViewIfNecessary(); + await nodes.at(-1)?.scrollIntoView(); }); // No other integrations to load after scrolling to last integration await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(nodes.length).to.be(20); }); @@ -294,24 +295,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('when clicking on integration and moving into the second navigation level', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); it('should display a list of available datasets', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); expect(await menuEntries[0].getVisibleText()).to.be('access'); @@ -321,39 +322,39 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should sort the datasets list by the clicked sorting option', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); }); // Test ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); }); // Test descending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('desc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('error'); expect(await menuEntries[1].getVisibleText()).to.be('access'); }); // Test back ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); @@ -362,28 +363,28 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should filter the datasets list by the typed dataset name', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); }); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('err'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('err'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(menuEntries.length).to.be(1); expect(await menuEntries[0].getVisibleText()).to.be('error'); @@ -392,26 +393,27 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { it('should update the current selection with the clicked dataset', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('access'); menuEntries[0].click(); }); await retry.try(async () => { - const selectorButton = await PageObjects.discoverLogExplorer.getDatasetSelectorButton(); + const selectorButton = + await PageObjects.observabilityLogExplorer.getDatasetSelectorButton(); expect(await selectorButton.getVisibleText()).to.be('[Apache HTTP Server] access'); }); @@ -420,22 +422,22 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('when navigating into Uncategorized data streams', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); it('should display a list of available datasets', async () => { - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const button = await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await button.click(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); @@ -445,20 +447,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should sort the datasets list by the clicked sorting option', async () => { - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const button = await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await button.click(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); }); // Test ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); @@ -466,9 +468,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); // Test descending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('desc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('desc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[2]); expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); @@ -476,9 +478,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); // Test back ascending order - await PageObjects.discoverLogExplorer.clickSortButtonBy('asc'); + await PageObjects.observabilityLogExplorer.clickSortButtonBy('asc'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); @@ -487,28 +489,28 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should filter the datasets list by the typed dataset name', async () => { - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const button = await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await button.click(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be(expectedUncategorized[0]); expect(await menuEntries[1].getVisibleText()).to.be(expectedUncategorized[1]); expect(await menuEntries[2].getVisibleText()).to.be(expectedUncategorized[2]); }); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('retail'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('retail'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(menuEntries.length).to.be(1); expect(await menuEntries[0].getVisibleText()).to.be('logs-retail-*'); @@ -516,25 +518,26 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should update the current selection with the clicked dataset', async () => { - const button = await PageObjects.discoverLogExplorer.getUnmanagedDatasetsButton(); + const button = await PageObjects.observabilityLogExplorer.getUnmanagedDatasetsButton(); await button.click(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); expect(await panelTitleNode.getVisibleText()).to.be('Uncategorized'); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await menuEntries[0].getVisibleText()).to.be('logs-gaming-*'); menuEntries[0].click(); }); await retry.try(async () => { - const selectorButton = await PageObjects.discoverLogExplorer.getDatasetSelectorButton(); + const selectorButton = + await PageObjects.observabilityLogExplorer.getDatasetSelectorButton(); expect(await selectorButton.getVisibleText()).to.be('logs-gaming-*'); }); @@ -543,37 +546,37 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('when open/close the selector', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); beforeEach(async () => { await browser.refresh(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); }); it('should restore the latest navigation panel', async () => { await retry.try(async () => { - const { nodes } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes } = await PageObjects.observabilityLogExplorer.getIntegrations(); await nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); }); - await PageObjects.discoverLogExplorer.closeDatasetSelector(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.closeDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); expect(await menuEntries[0].getVisibleText()).to.be('access'); @@ -582,18 +585,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should restore the latest search results', async () => { - await PageObjects.discoverLogExplorer.typeSearchFieldWith('system'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('system'); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.system]); }); - await PageObjects.discoverLogExplorer.closeDatasetSelector(); - await PageObjects.discoverLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.closeDatasetSelector(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); await retry.try(async () => { - const { integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { integrations } = await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.system]); }); }); @@ -601,35 +604,36 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('when switching between integration panels', () => { before(async () => { - await PageObjects.common.navigateToApp('discover', { hash: '/p/log-explorer' }); + await PageObjects.observabilityLogExplorer.navigateTo(); }); it('should remember the latest search and restore its results for each integration', async () => { - await PageObjects.discoverLogExplorer.openDatasetSelector(); - await PageObjects.discoverLogExplorer.clearSearchField(); + await PageObjects.observabilityLogExplorer.openDatasetSelector(); + await PageObjects.observabilityLogExplorer.clearSearchField(); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('apache'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('apache'); await retry.try(async () => { - const { nodes, integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes, integrations } = + await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.apache]); nodes[0].click(); }); await retry.try(async () => { const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(await panelTitleNode.getVisibleText()).to.be('Apache HTTP Server'); expect(await menuEntries[0].getVisibleText()).to.be('access'); expect(await menuEntries[1].getVisibleText()).to.be('error'); }); - await PageObjects.discoverLogExplorer.typeSearchFieldWith('err'); + await PageObjects.observabilityLogExplorer.typeSearchFieldWith('err'); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); expect(menuEntries.length).to.be(1); expect(await menuEntries[0].getVisibleText()).to.be('error'); @@ -637,23 +641,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { // Navigate back to integrations const panelTitleNode = - await PageObjects.discoverLogExplorer.getDatasetSelectorContextMenuPanelTitle(); + await PageObjects.observabilityLogExplorer.getDatasetSelectorContextMenuPanelTitle(); panelTitleNode.click(); await retry.try(async () => { - const { nodes, integrations } = await PageObjects.discoverLogExplorer.getIntegrations(); + const { nodes, integrations } = + await PageObjects.observabilityLogExplorer.getIntegrations(); expect(integrations).to.eql([initialPackageMap.apache]); - const searchValue = await PageObjects.discoverLogExplorer.getSearchFieldValue(); + const searchValue = await PageObjects.observabilityLogExplorer.getSearchFieldValue(); expect(searchValue).to.eql('apache'); nodes[0].click(); }); await retry.try(async () => { - const menuEntries = await PageObjects.discoverLogExplorer.getCurrentPanelEntries(); + const menuEntries = await PageObjects.observabilityLogExplorer.getCurrentPanelEntries(); - const searchValue = await PageObjects.discoverLogExplorer.getSearchFieldValue(); + const searchValue = await PageObjects.observabilityLogExplorer.getSearchFieldValue(); expect(searchValue).to.eql('err'); expect(menuEntries.length).to.be(1); diff --git a/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/filter_controls.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/filter_controls.ts new file mode 100644 index 0000000000000..b5e25744f2c5b --- /dev/null +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/filter_controls.ts @@ -0,0 +1,28 @@ +/* + * Copyright 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 kibanaServer = getService('kibanaServer'); + const PageObjects = getPageObjects(['observabilityLogExplorer']); + const testSubjects = getService('testSubjects'); + + describe('Filter controls customization', () => { + before('initialize tests', async () => { + await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); + }); + + after('clean up archives', async () => { + await kibanaServer.importExport.unload('test/functional/fixtures/kbn_archiver/discover'); + }); + + it('renders a filter controls section as part of the unified search bar', async () => { + await PageObjects.observabilityLogExplorer.navigateTo(); + await testSubjects.existOrFail('datasetFiltersCustomization', { allowHidden: true }); + }); + }); +} diff --git a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/index.ts similarity index 69% rename from x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts rename to x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/index.ts index 8e9843fc02815..b0555b4447d27 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/discover_log_explorer/index.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/observability_log_explorer/index.ts @@ -7,11 +7,12 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; -export default function (loadTestFile: FtrProviderContext['loadTestFile']) { - describe('Discover Log-Explorer profile', function () { +export default function ({ loadTestFile }: FtrProviderContext) { + describe('Observability Log Explorer', function () { + loadTestFile(require.resolve('./app')); loadTestFile(require.resolve('./columns_selection')); - loadTestFile(require.resolve('./customization')); loadTestFile(require.resolve('./dataset_selection_state')); loadTestFile(require.resolve('./dataset_selector')); + loadTestFile(require.resolve('./filter_controls')); }); } diff --git a/x-pack/test_serverless/tsconfig.json b/x-pack/test_serverless/tsconfig.json index c857534e8ba00..f23753f750382 100644 --- a/x-pack/test_serverless/tsconfig.json +++ b/x-pack/test_serverless/tsconfig.json @@ -52,5 +52,6 @@ "@kbn/data-plugin", "@kbn/dev-utils", "@kbn/bfetch-plugin", + "@kbn/rison", ] } diff --git a/yarn.lock b/yarn.lock index 54671604766c1..14e8f72e1138c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4229,10 +4229,6 @@ version "0.0.0" uid "" -"@kbn/discover-log-explorer-plugin@link:x-pack/plugins/discover_log_explorer": - version "0.0.0" - uid "" - "@kbn/discover-plugin@link:src/plugins/discover": version "0.0.0" uid "" @@ -4801,6 +4797,10 @@ version "0.0.0" uid "" +"@kbn/log-explorer-plugin@link:x-pack/plugins/log_explorer": + version "0.0.0" + uid "" + "@kbn/logging-mocks@link:packages/kbn-logging-mocks": version "0.0.0" uid "" @@ -5009,6 +5009,10 @@ version "0.0.0" uid "" +"@kbn/observability-log-explorer-plugin@link:x-pack/plugins/observability_log_explorer": + version "0.0.0" + uid "" + "@kbn/observability-onboarding-plugin@link:x-pack/plugins/observability_onboarding": version "0.0.0" uid ""