diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 88a92a0df92b9..9712596344336 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -957,8 +957,9 @@ src/platform/packages/shared/kbn-std @elastic/kibana-core packages/kbn-stdio-dev-helpers @elastic/kibana-operations src/platform/packages/shared/kbn-storage-adapter @elastic/observability-ui packages/kbn-storybook @elastic/kibana-operations -x-pack/solutions/observability/plugins/streams_app @simianhacker @flash1293 @dgieselaar -x-pack/solutions/observability/plugins/streams @simianhacker @flash1293 @dgieselaar +x-pack/platform/plugins/shared/streams_app @elastic/streams-program-team +x-pack/solutions/observability/plugins/observability_streams_wrapper @elastic/streams-program-team +x-pack/platform/plugins/shared/streams @simianhacker @flash1293 @dgieselaar x-pack/platform/packages/shared/kbn-streams-schema @elastic/streams-program-team packages/kbn-styled-components-mapping-cli @elastic/kibana-operations @elastic/eui-team x-pack/solutions/observability/plugins/synthetics/e2e @elastic/obs-ux-management-team diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 2f2b95bd9c5e8..758fbb002542e 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -922,14 +922,18 @@ routes, etc. |The stack_connectors plugin provides connector types shipped with Kibana, built on top of the framework provided in the actions plugin. -|{kib-repo}blob/{branch}/x-pack/solutions/observability/plugins/streams/README.md[streams] +|{kib-repo}blob/{branch}/x-pack/platform/plugins/shared/streams/README.md[streams] |This plugin provides an interface to manage streams -|{kib-repo}blob/{branch}/x-pack/solutions/observability/plugins/streams_app/README.md[streamsApp] +|{kib-repo}blob/{branch}/x-pack/platform/plugins/shared/streams_app/README.md[streamsApp] |Home of the Streams app plugin, which allows users to manage Streams via the UI. +|{kib-repo}blob/{branch}/x-pack/solutions/observability/plugins/observability_streams_wrapper/README.md[streamsAppWrapper] +|Observability-specific wrapper for the streams app. This is responsible for actually registering the app and making it accessible in observability contexts + + |{kib-repo}blob/{branch}/x-pack/solutions/observability/plugins/synthetics/README.md[synthetics] |The purpose of this plugin is to provide users of Heartbeat more visibility of what's happening in their infrastructure. diff --git a/package.json b/package.json index 68ed9da5053ea..2b703237baaa1 100644 --- a/package.json +++ b/package.json @@ -937,8 +937,9 @@ "@kbn/status-plugin-b-plugin": "link:test/server_integration/plugins/status_plugin_b", "@kbn/std": "link:src/platform/packages/shared/kbn-std", "@kbn/storage-adapter": "link:src/platform/packages/shared/kbn-storage-adapter", - "@kbn/streams-app-plugin": "link:x-pack/solutions/observability/plugins/streams_app", - "@kbn/streams-plugin": "link:x-pack/solutions/observability/plugins/streams", + "@kbn/streams-app-plugin": "link:x-pack/platform/plugins/shared/streams_app", + "@kbn/streams-app-wrapper-plugin": "link:x-pack/solutions/observability/plugins/observability_streams_wrapper", + "@kbn/streams-plugin": "link:x-pack/platform/plugins/shared/streams", "@kbn/streams-schema": "link:x-pack/platform/packages/shared/kbn-streams-schema", "@kbn/synthetics-plugin": "link:x-pack/solutions/observability/plugins/synthetics", "@kbn/task-manager-fixture-plugin": "link:x-pack/test/alerting_api_integration/common/plugins/task_manager_fixture", diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 14ba76a5b79c9..dd0c61735dbc8 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -165,6 +165,7 @@ pageLoadAssetSize: stackConnectors: 67227 streams: 16742 streamsApp: 20537 + streamsAppWrapper: 20537 synthetics: 55971 telemetry: 51957 telemetryManagementSection: 38586 diff --git a/tsconfig.base.json b/tsconfig.base.json index ac042567f4bba..b4fe5e3625413 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1908,10 +1908,12 @@ "@kbn/storage-adapter/*": ["src/platform/packages/shared/kbn-storage-adapter/*"], "@kbn/storybook": ["packages/kbn-storybook"], "@kbn/storybook/*": ["packages/kbn-storybook/*"], - "@kbn/streams-app-plugin": ["x-pack/solutions/observability/plugins/streams_app"], - "@kbn/streams-app-plugin/*": ["x-pack/solutions/observability/plugins/streams_app/*"], - "@kbn/streams-plugin": ["x-pack/solutions/observability/plugins/streams"], - "@kbn/streams-plugin/*": ["x-pack/solutions/observability/plugins/streams/*"], + "@kbn/streams-app-plugin": ["x-pack/platform/plugins/shared/streams_app"], + "@kbn/streams-app-plugin/*": ["x-pack/platform/plugins/shared/streams_app/*"], + "@kbn/streams-app-wrapper-plugin": ["x-pack/solutions/observability/plugins/observability_streams_wrapper"], + "@kbn/streams-app-wrapper-plugin/*": ["x-pack/solutions/observability/plugins/observability_streams_wrapper/*"], + "@kbn/streams-plugin": ["x-pack/platform/plugins/shared/streams"], + "@kbn/streams-plugin/*": ["x-pack/platform/plugins/shared/streams/*"], "@kbn/streams-schema": ["x-pack/platform/packages/shared/kbn-streams-schema"], "@kbn/streams-schema/*": ["x-pack/platform/packages/shared/kbn-streams-schema/*"], "@kbn/styled-components-mapping-cli": ["packages/kbn-styled-components-mapping-cli"], diff --git a/x-pack/solutions/observability/plugins/streams/README.md b/x-pack/platform/plugins/shared/streams/README.md similarity index 100% rename from x-pack/solutions/observability/plugins/streams/README.md rename to x-pack/platform/plugins/shared/streams/README.md diff --git a/x-pack/solutions/observability/plugins/streams/common/assets.ts b/x-pack/platform/plugins/shared/streams/common/assets.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/common/assets.ts rename to x-pack/platform/plugins/shared/streams/common/assets.ts diff --git a/x-pack/solutions/observability/plugins/streams/common/config.ts b/x-pack/platform/plugins/shared/streams/common/config.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/common/config.ts rename to x-pack/platform/plugins/shared/streams/common/config.ts diff --git a/x-pack/solutions/observability/plugins/streams/common/constants.ts b/x-pack/platform/plugins/shared/streams/common/constants.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/common/constants.ts rename to x-pack/platform/plugins/shared/streams/common/constants.ts diff --git a/x-pack/solutions/observability/plugins/streams/common/index.ts b/x-pack/platform/plugins/shared/streams/common/index.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/common/index.ts rename to x-pack/platform/plugins/shared/streams/common/index.ts diff --git a/x-pack/solutions/observability/plugins/streams/jest.config.js b/x-pack/platform/plugins/shared/streams/jest.config.js similarity index 57% rename from x-pack/solutions/observability/plugins/streams/jest.config.js rename to x-pack/platform/plugins/shared/streams/jest.config.js index 12f11c9482d5c..b34247ad90eed 100644 --- a/x-pack/solutions/observability/plugins/streams/jest.config.js +++ b/x-pack/platform/plugins/shared/streams/jest.config.js @@ -8,11 +8,10 @@ module.exports = { preset: '@kbn/test', rootDir: '../../../../..', - roots: ['/x-pack/solutions/observability/plugins/streams'], - coverageDirectory: - '/target/kibana-coverage/jest/x-pack/solutions/observability/plugins/streams', + roots: ['/x-pack/platform/plugins/shared/streams'], + coverageDirectory: '/target/kibana-coverage/jest/x-pack/platform/plugins/shared/streams', coverageReporters: ['text', 'html'], collectCoverageFrom: [ - '/x-pack/solutions/observability/plugins/streams/{common,public,server}/**/*.{js,ts,tsx}', + '/x-pack/platform/plugins/shared/streams/{common,public,server}/**/*.{js,ts,tsx}', ], }; diff --git a/x-pack/solutions/observability/plugins/streams/kibana.jsonc b/x-pack/platform/plugins/shared/streams/kibana.jsonc similarity index 91% rename from x-pack/solutions/observability/plugins/streams/kibana.jsonc rename to x-pack/platform/plugins/shared/streams/kibana.jsonc index 3929d13e30079..29ec2eda4d887 100644 --- a/x-pack/solutions/observability/plugins/streams/kibana.jsonc +++ b/x-pack/platform/plugins/shared/streams/kibana.jsonc @@ -3,8 +3,8 @@ "id": "@kbn/streams-plugin", "owner": "@simianhacker @flash1293 @dgieselaar", "description": "A manager for Streams", - "group": "observability", - "visibility": "private", + "group": "platform", + "visibility": "shared", "plugin": { "id": "streams", "configPath": ["xpack", "streams"], diff --git a/x-pack/solutions/observability/plugins/streams/public/api/index.ts b/x-pack/platform/plugins/shared/streams/public/api/index.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/public/api/index.ts rename to x-pack/platform/plugins/shared/streams/public/api/index.ts diff --git a/x-pack/solutions/observability/plugins/streams/public/index.ts b/x-pack/platform/plugins/shared/streams/public/index.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/public/index.ts rename to x-pack/platform/plugins/shared/streams/public/index.ts diff --git a/x-pack/solutions/observability/plugins/streams/public/plugin.ts b/x-pack/platform/plugins/shared/streams/public/plugin.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/public/plugin.ts rename to x-pack/platform/plugins/shared/streams/public/plugin.ts diff --git a/x-pack/solutions/observability/plugins/streams/public/types.ts b/x-pack/platform/plugins/shared/streams/public/types.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/public/types.ts rename to x-pack/platform/plugins/shared/streams/public/types.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/index.ts b/x-pack/platform/plugins/shared/streams/server/index.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/index.ts rename to x-pack/platform/plugins/shared/streams/server/index.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/assets/asset_client.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/assets/asset_client.ts similarity index 95% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/assets/asset_client.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/assets/asset_client.ts index a1abe9f2bd2cd..9fab99661222c 100644 --- a/x-pack/solutions/observability/plugins/streams/server/lib/streams/assets/asset_client.ts +++ b/x-pack/platform/plugins/shared/streams/server/lib/streams/assets/asset_client.ts @@ -7,11 +7,11 @@ import { SanitizedRule } from '@kbn/alerting-plugin/common'; import { RulesClient } from '@kbn/alerting-plugin/server'; import { SavedObject, SavedObjectsClientContract } from '@kbn/core/server'; -import { termQuery } from '@kbn/observability-utils-server/es/queries/term_query'; import { IStorageClient } from '@kbn/storage-adapter'; import { keyBy } from 'lodash'; import objectHash from 'object-hash'; import pLimit from 'p-limit'; +import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types'; import { ASSET_TYPES, Asset, @@ -24,6 +24,22 @@ import { import { ASSET_ENTITY_ID, ASSET_ENTITY_TYPE, ASSET_TYPE } from './fields'; import { AssetStorageSettings } from './storage_settings'; +interface TermQueryOpts { + queryEmptyString: boolean; +} + +function termQuery( + field: T, + value: string | boolean | number | undefined | null, + opts: TermQueryOpts = { queryEmptyString: true } +): QueryDslQueryContainer[] { + if (value === null || value === undefined || (!opts.queryEmptyString && value === '')) { + return []; + } + + return [{ term: { [field]: value } }]; +} + function sloSavedObjectToAsset( sloId: string, savedObject: SavedObject<{ name: string; tags: string[] }> diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/assets/asset_service.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/assets/asset_service.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/assets/asset_service.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/assets/asset_service.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/assets/fields.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/assets/fields.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/assets/fields.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/assets/fields.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/assets/storage_settings.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/assets/storage_settings.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/assets/storage_settings.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/assets/storage_settings.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/client.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/client.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/client.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/client.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/component_templates/generate_layer.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/component_templates/generate_layer.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/component_templates/generate_layer.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/component_templates/generate_layer.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/component_templates/logs_layer.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/component_templates/logs_layer.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/component_templates/logs_layer.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/component_templates/logs_layer.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/component_templates/manage_component_templates.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/component_templates/manage_component_templates.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/component_templates/manage_component_templates.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/component_templates/manage_component_templates.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/component_templates/name.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/component_templates/name.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/component_templates/name.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/component_templates/name.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/data_streams/manage_data_streams.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/data_streams/manage_data_streams.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/data_streams/manage_data_streams.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/data_streams/manage_data_streams.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/component_template_not_found_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/component_template_not_found_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/component_template_not_found_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/component_template_not_found_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/definition_id_invalid_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/definition_id_invalid_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/definition_id_invalid_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/definition_id_invalid_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/definition_not_found_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/definition_not_found_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/definition_not_found_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/definition_not_found_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/detected_mapping_failure_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/detected_mapping_failure_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/detected_mapping_failure_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/detected_mapping_failure_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/forbidden_member_type_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/forbidden_member_type_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/forbidden_member_type_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/forbidden_member_type_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_children_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/malformed_children_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_children_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/malformed_children_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_fields_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/malformed_fields_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_fields_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/malformed_fields_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_stream_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/malformed_stream_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_stream_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/malformed_stream_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_stream_id_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/malformed_stream_id_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_stream_id_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/malformed_stream_id_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/name_taken_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/name_taken_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/name_taken_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/name_taken_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/root_stream_immutability_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/root_stream_immutability_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/root_stream_immutability_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/root_stream_immutability_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/security_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/security_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/security_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/security_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/status_error.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/errors/status_error.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/status_error.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/errors/status_error.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/condition_to_painless.test.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/condition_to_painless.test.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/condition_to_painless.test.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/condition_to_painless.test.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/condition_to_painless.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/condition_to_painless.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/condition_to_painless.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/condition_to_painless.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/namespaced_ecs.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/namespaced_ecs.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/namespaced_ecs.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/namespaced_ecs.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/processing.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/processing.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/processing.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/processing.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/retry.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/retry.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/retry.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/retry.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/sync.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/sync.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/sync.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/sync.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/validate_fields.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/validate_fields.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/validate_fields.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/validate_fields.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/validate_stream.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/validate_stream.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/helpers/validate_stream.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/helpers/validate_stream.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/index_templates/generate_index_template.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/index_templates/generate_index_template.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/index_templates/generate_index_template.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/index_templates/generate_index_template.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/index_templates/manage_index_templates.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/index_templates/manage_index_templates.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/index_templates/manage_index_templates.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/index_templates/manage_index_templates.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/index_templates/name.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/index_templates/name.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/index_templates/name.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/index_templates/name.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/generate_ingest_pipeline.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/generate_ingest_pipeline.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/generate_ingest_pipeline.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/generate_ingest_pipeline.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/generate_reroute_pipeline.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/generate_reroute_pipeline.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/generate_reroute_pipeline.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/generate_reroute_pipeline.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/logs_default_pipeline.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/logs_default_pipeline.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/logs_default_pipeline.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/logs_default_pipeline.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/manage_ingest_pipelines.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/manage_ingest_pipelines.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/manage_ingest_pipelines.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/manage_ingest_pipelines.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/name.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/name.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/ingest_pipelines/name.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/ingest_pipelines/name.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/root_stream_definition.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/root_stream_definition.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/root_stream_definition.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/root_stream_definition.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/service.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/service.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/service.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/service.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/lib/streams/stream_crud.ts b/x-pack/platform/plugins/shared/streams/server/lib/streams/stream_crud.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/lib/streams/stream_crud.ts rename to x-pack/platform/plugins/shared/streams/server/lib/streams/stream_crud.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/plugin.ts b/x-pack/platform/plugins/shared/streams/server/plugin.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/plugin.ts rename to x-pack/platform/plugins/shared/streams/server/plugin.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/create_server_route.ts b/x-pack/platform/plugins/shared/streams/server/routes/create_server_route.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/create_server_route.ts rename to x-pack/platform/plugins/shared/streams/server/routes/create_server_route.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/dashboards/route.ts b/x-pack/platform/plugins/shared/streams/server/routes/dashboards/route.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/dashboards/route.ts rename to x-pack/platform/plugins/shared/streams/server/routes/dashboards/route.ts diff --git a/x-pack/platform/plugins/shared/streams/server/routes/esql/query_helpers.ts b/x-pack/platform/plugins/shared/streams/server/routes/esql/query_helpers.ts new file mode 100644 index 0000000000000..e2bf6dfb98c80 --- /dev/null +++ b/x-pack/platform/plugins/shared/streams/server/routes/esql/query_helpers.ts @@ -0,0 +1,58 @@ +/* + * Copyright 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 { estypes } from '@elastic/elasticsearch'; +import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; + +function excludeTiersQuery( + excludedDataTiers: Array<'data_frozen' | 'data_cold' | 'data_warm' | 'data_hot'> +): estypes.QueryDslQueryContainer[] { + return [ + { + bool: { + must_not: [ + { + terms: { + _tier: excludedDataTiers, + }, + }, + ], + }, + }, + ]; +} + +export function excludeFrozenQuery(): estypes.QueryDslQueryContainer[] { + return excludeTiersQuery(['data_frozen']); +} + +export function kqlQuery(kql?: string): estypes.QueryDslQueryContainer[] { + if (!kql) { + return []; + } + + const ast = fromKueryExpression(kql); + return [toElasticsearchQuery(ast)]; +} + +export function rangeQuery( + start?: number, + end?: number, + field = '@timestamp' +): estypes.QueryDslQueryContainer[] { + return [ + { + range: { + [field]: { + gte: start, + lte: end, + format: 'epoch_millis', + }, + }, + }, + ]; +} diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/esql/route.ts b/x-pack/platform/plugins/shared/streams/server/routes/esql/route.ts similarity index 83% rename from x-pack/solutions/observability/plugins/streams/server/routes/esql/route.ts rename to x-pack/platform/plugins/shared/streams/server/routes/esql/route.ts index 73a8ab7e60b05..e70ab43890352 100644 --- a/x-pack/solutions/observability/plugins/streams/server/routes/esql/route.ts +++ b/x-pack/platform/plugins/shared/streams/server/routes/esql/route.ts @@ -5,13 +5,11 @@ * 2.0. */ -import { excludeFrozenQuery } from '@kbn/observability-utils-common/es/queries/exclude_frozen_query'; -import { kqlQuery } from '@kbn/observability-utils-common/es/queries/kql_query'; -import { rangeQuery } from '@kbn/observability-utils-common/es/queries/range_query'; import { UnparsedEsqlResponse, createTracedEsClient } from '@kbn/traced-es-client'; import { z } from '@kbn/zod'; import { isNumber } from 'lodash'; import { createServerRoute } from '../create_server_route'; +import { excludeFrozenQuery, kqlQuery, rangeQuery } from './query_helpers'; export const executeEsqlRoute = createServerRoute({ endpoint: 'POST /internal/streams/esql', @@ -37,7 +35,7 @@ export const executeEsqlRoute = createServerRoute({ }), handler: async ({ params, request, logger, getScopedClients }): Promise => { const { scopedClusterClient } = await getScopedClients({ request }); - const observabilityEsClient = createTracedEsClient({ + const tracedEsClient = createTracedEsClient({ client: scopedClusterClient.asCurrentUser, logger, plugin: 'streams', @@ -47,7 +45,7 @@ export const executeEsqlRoute = createServerRoute({ body: { operationName, query, filter, kuery, start, end }, } = params; - const response = await observabilityEsClient.esql( + const response = await tracedEsClient.esql( operationName, { query, diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/index.ts b/x-pack/platform/plugins/shared/streams/server/routes/index.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/index.ts rename to x-pack/platform/plugins/shared/streams/server/routes/index.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/streams/crud/read_stream.ts b/x-pack/platform/plugins/shared/streams/server/routes/streams/crud/read_stream.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/streams/crud/read_stream.ts rename to x-pack/platform/plugins/shared/streams/server/routes/streams/crud/read_stream.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/streams/crud/route.ts b/x-pack/platform/plugins/shared/streams/server/routes/streams/crud/route.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/streams/crud/route.ts rename to x-pack/platform/plugins/shared/streams/server/routes/streams/crud/route.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/streams/enablement/route.ts b/x-pack/platform/plugins/shared/streams/server/routes/streams/enablement/route.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/streams/enablement/route.ts rename to x-pack/platform/plugins/shared/streams/server/routes/streams/enablement/route.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/streams/ingest/route.ts b/x-pack/platform/plugins/shared/streams/server/routes/streams/ingest/route.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/streams/ingest/route.ts rename to x-pack/platform/plugins/shared/streams/server/routes/streams/ingest/route.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/streams/management/route.ts b/x-pack/platform/plugins/shared/streams/server/routes/streams/management/route.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/streams/management/route.ts rename to x-pack/platform/plugins/shared/streams/server/routes/streams/management/route.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/streams/processing/route.ts b/x-pack/platform/plugins/shared/streams/server/routes/streams/processing/route.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/streams/processing/route.ts rename to x-pack/platform/plugins/shared/streams/server/routes/streams/processing/route.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/streams/processing/simulation_handler.ts b/x-pack/platform/plugins/shared/streams/server/routes/streams/processing/simulation_handler.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/streams/processing/simulation_handler.ts rename to x-pack/platform/plugins/shared/streams/server/routes/streams/processing/simulation_handler.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/streams/processing/suggestions_handler.ts b/x-pack/platform/plugins/shared/streams/server/routes/streams/processing/suggestions_handler.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/streams/processing/suggestions_handler.ts rename to x-pack/platform/plugins/shared/streams/server/routes/streams/processing/suggestions_handler.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/streams/schema/route.ts b/x-pack/platform/plugins/shared/streams/server/routes/streams/schema/route.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/streams/schema/route.ts rename to x-pack/platform/plugins/shared/streams/server/routes/streams/schema/route.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/routes/types.ts b/x-pack/platform/plugins/shared/streams/server/routes/types.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/routes/types.ts rename to x-pack/platform/plugins/shared/streams/server/routes/types.ts diff --git a/x-pack/solutions/observability/plugins/streams/server/types.ts b/x-pack/platform/plugins/shared/streams/server/types.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams/server/types.ts rename to x-pack/platform/plugins/shared/streams/server/types.ts diff --git a/x-pack/solutions/observability/plugins/streams/tsconfig.json b/x-pack/platform/plugins/shared/streams/tsconfig.json similarity index 90% rename from x-pack/solutions/observability/plugins/streams/tsconfig.json rename to x-pack/platform/plugins/shared/streams/tsconfig.json index 98437334bc5c4..c43efe29767ad 100644 --- a/x-pack/solutions/observability/plugins/streams/tsconfig.json +++ b/x-pack/platform/plugins/shared/streams/tsconfig.json @@ -29,8 +29,6 @@ "@kbn/licensing-plugin", "@kbn/server-route-repository-client", "@kbn/object-utils", - "@kbn/observability-utils-server", - "@kbn/observability-utils-common", "@kbn/alerting-plugin", "@kbn/std", "@kbn/safer-lodash-set", @@ -39,6 +37,7 @@ "@kbn/server-route-repository-utils", "@kbn/inference-plugin", "@kbn/storage-adapter", - "@kbn/traced-es-client" + "@kbn/traced-es-client", + "@kbn/es-query" ] } diff --git a/x-pack/solutions/observability/plugins/streams_app/.storybook/get_mock_streams_app_context.tsx b/x-pack/platform/plugins/shared/streams_app/.storybook/get_mock_streams_app_context.tsx similarity index 92% rename from x-pack/solutions/observability/plugins/streams_app/.storybook/get_mock_streams_app_context.tsx rename to x-pack/platform/plugins/shared/streams_app/.storybook/get_mock_streams_app_context.tsx index 5e57ea3250907..e21bda36ece52 100644 --- a/x-pack/solutions/observability/plugins/streams_app/.storybook/get_mock_streams_app_context.tsx +++ b/x-pack/platform/plugins/shared/streams_app/.storybook/get_mock_streams_app_context.tsx @@ -9,7 +9,6 @@ import { coreMock } from '@kbn/core/public/mocks'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import type { StreamsPluginStart } from '@kbn/streams-plugin/public'; -import type { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { SharePublicStart } from '@kbn/share-plugin/public/plugin'; import { NavigationPublicStart } from '@kbn/navigation-plugin/public/types'; @@ -27,7 +26,6 @@ export function getMockStreamsAppContext(): StreamsAppKibanaContext { core, dependencies: { start: { - observabilityShared: {} as unknown as ObservabilitySharedPluginStart, dataViews: {} as unknown as DataViewsPublicPluginStart, data: {} as unknown as DataPublicPluginStart, unifiedSearch: {} as unknown as UnifiedSearchPublicPluginStart, @@ -40,6 +38,7 @@ export function getMockStreamsAppContext(): StreamsAppKibanaContext { }, services: { dataStreamsClient: Promise.resolve({} as unknown as DataStreamsStatsClient), + PageTemplate: () => null, }, isServerless: false, }; diff --git a/x-pack/solutions/observability/plugins/streams_app/.storybook/jest_setup.js b/x-pack/platform/plugins/shared/streams_app/.storybook/jest_setup.js similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/.storybook/jest_setup.js rename to x-pack/platform/plugins/shared/streams_app/.storybook/jest_setup.js diff --git a/x-pack/solutions/observability/plugins/streams_app/.storybook/main.js b/x-pack/platform/plugins/shared/streams_app/.storybook/main.js similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/.storybook/main.js rename to x-pack/platform/plugins/shared/streams_app/.storybook/main.js diff --git a/x-pack/solutions/observability/plugins/streams_app/.storybook/preview.js b/x-pack/platform/plugins/shared/streams_app/.storybook/preview.js similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/.storybook/preview.js rename to x-pack/platform/plugins/shared/streams_app/.storybook/preview.js diff --git a/x-pack/solutions/observability/plugins/streams_app/.storybook/storybook_decorator.tsx b/x-pack/platform/plugins/shared/streams_app/.storybook/storybook_decorator.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/.storybook/storybook_decorator.tsx rename to x-pack/platform/plugins/shared/streams_app/.storybook/storybook_decorator.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/README.md b/x-pack/platform/plugins/shared/streams_app/README.md similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/README.md rename to x-pack/platform/plugins/shared/streams_app/README.md diff --git a/x-pack/solutions/observability/plugins/streams_app/common/entity_source_query.ts b/x-pack/platform/plugins/shared/streams_app/common/entity_source_query.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/common/entity_source_query.ts rename to x-pack/platform/plugins/shared/streams_app/common/entity_source_query.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/common/index.ts b/x-pack/platform/plugins/shared/streams_app/common/index.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/common/index.ts rename to x-pack/platform/plugins/shared/streams_app/common/index.ts diff --git a/x-pack/platform/plugins/shared/streams_app/jest.config.js b/x-pack/platform/plugins/shared/streams_app/jest.config.js new file mode 100644 index 0000000000000..fe0d45efb6c94 --- /dev/null +++ b/x-pack/platform/plugins/shared/streams_app/jest.config.js @@ -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. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../../../..', + roots: [ + '/x-pack/platform/plugins/shared/streams_app/public', + '/x-pack/platform/plugins/shared/streams_app/common', + '/x-pack/platform/plugins/shared/streams_app/server', + ], + setupFiles: ['/x-pack/platform/plugins/shared/streams_app/.storybook/jest_setup.js'], + collectCoverage: true, + collectCoverageFrom: [ + '/x-pack/platform/plugins/shared/streams_app/{public,common,server}/**/*.{js,ts,tsx}', + ], + + coverageReporters: ['html'], +}; diff --git a/x-pack/solutions/observability/plugins/streams_app/kibana.jsonc b/x-pack/platform/plugins/shared/streams_app/kibana.jsonc similarity index 80% rename from x-pack/solutions/observability/plugins/streams_app/kibana.jsonc rename to x-pack/platform/plugins/shared/streams_app/kibana.jsonc index 716376423337c..dee602b134183 100644 --- a/x-pack/solutions/observability/plugins/streams_app/kibana.jsonc +++ b/x-pack/platform/plugins/shared/streams_app/kibana.jsonc @@ -1,9 +1,9 @@ { "type": "plugin", "id": "@kbn/streams-app-plugin", - "owner": "@simianhacker @flash1293 @dgieselaar", - "group": "observability", - "visibility": "private", + "owner": "@elastic/streams-program-team", + "group": "platform", + "visibility": "shared", "plugin": { "id": "streamsApp", "server": true, @@ -11,7 +11,6 @@ "configPath": ["xpack", "streamsApp"], "requiredPlugins": [ "streams", - "observabilityShared", "data", "dataViews", "unifiedSearch", diff --git a/x-pack/solutions/observability/plugins/streams_app/public/application.tsx b/x-pack/platform/plugins/shared/streams_app/public/application.tsx similarity index 62% rename from x-pack/solutions/observability/plugins/streams_app/public/application.tsx rename to x-pack/platform/plugins/shared/streams_app/public/application.tsx index 6c38d68063418..b23222fb124d5 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/application.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/application.tsx @@ -5,15 +5,13 @@ * 2.0. */ import React from 'react'; -import ReactDOM from 'react-dom'; -import { APP_WRAPPER_CLASS, type AppMountParameters, type CoreStart } from '@kbn/core/public'; +import { type AppMountParameters, type CoreStart } from '@kbn/core/public'; import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render'; -import { css } from '@emotion/css'; import type { StreamsAppStartDependencies } from './types'; import { StreamsAppServices } from './services/types'; import { AppRoot } from './components/app_root'; -export const renderApp = ({ +export const StreamsApplication = ({ coreStart, pluginsStart, services, @@ -25,15 +23,7 @@ export const renderApp = ({ services: StreamsAppServices; isServerless: boolean; } & { appMountParameters: AppMountParameters }) => { - const { element } = appMountParameters; - - const appWrapperClassName = css` - overflow: auto; - `; - const appWrapperElement = document.getElementsByClassName(APP_WRAPPER_CLASS)[1]; - appWrapperElement.classList.add(appWrapperClassName); - - ReactDOM.render( + return ( - , - element + ); - return () => { - ReactDOM.unmountComponentAtNode(element); - appWrapperElement.classList.remove(APP_WRAPPER_CLASS); - }; }; diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/app_root/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/app_root/index.tsx similarity index 96% rename from x-pack/solutions/observability/plugins/streams_app/public/components/app_root/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/app_root/index.tsx index d03684dd3e72e..e138f86185eab 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/app_root/index.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/app_root/index.tsx @@ -13,12 +13,12 @@ import { RouteRenderer, RouterProvider, } from '@kbn/typed-react-router-config'; -import { HeaderMenuPortal } from '@kbn/observability-shared-plugin/public'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { StreamsAppContextProvider } from '../streams_app_context_provider'; import { streamsAppRouter } from '../../routes/config'; import { StreamsAppStartDependencies } from '../../types'; import { StreamsAppServices } from '../../services/types'; +import { HeaderMenuPortal } from '../header_menu'; export function AppRoot({ coreStart, diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/asset_image/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/asset_image/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/no_results_dark.png b/x-pack/platform/plugins/shared/streams_app/public/components/asset_image/no_results_dark.png similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/no_results_dark.png rename to x-pack/platform/plugins/shared/streams_app/public/components/asset_image/no_results_dark.png diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/no_results_light.png b/x-pack/platform/plugins/shared/streams_app/public/components/asset_image/no_results_light.png similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/no_results_light.png rename to x-pack/platform/plugins/shared/streams_app/public/components/asset_image/no_results_light.png diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/welcome_dark.png b/x-pack/platform/plugins/shared/streams_app/public/components/asset_image/welcome_dark.png similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/welcome_dark.png rename to x-pack/platform/plugins/shared/streams_app/public/components/asset_image/welcome_dark.png diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/welcome_light.png b/x-pack/platform/plugins/shared/streams_app/public/components/asset_image/welcome_light.png similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/asset_image/welcome_light.png rename to x-pack/platform/plugins/shared/streams_app/public/components/asset_image/welcome_light.png diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/condition_editor/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/condition_editor/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/condition_editor/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/condition_editor/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/entity_detail_view/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/entity_detail_view/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/entity_detail_view/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/entity_detail_view/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/entity_detail_view_header_section/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/entity_detail_view_header_section/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/entity_detail_view_header_section/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/entity_detail_view_header_section/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/entity_overview_tab_list/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/entity_overview_tab_list/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/entity_overview_tab_list/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/entity_overview_tab_list/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/esql_chart/controlled_esql_chart.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/esql_chart/controlled_esql_chart.tsx similarity index 92% rename from x-pack/solutions/observability/plugins/streams_app/public/components/esql_chart/controlled_esql_chart.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/esql_chart/controlled_esql_chart.tsx index 80131f2c9af72..f6275129f0d7c 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/esql_chart/controlled_esql_chart.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/esql_chart/controlled_esql_chart.tsx @@ -20,14 +20,24 @@ import { } from '@elastic/charts'; import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { getTimeZone } from '@kbn/observability-utils-browser/utils/ui_settings/get_timezone'; import { css } from '@emotion/css'; import { AbortableAsyncState } from '@kbn/react-hooks'; import type { UnparsedEsqlResponse } from '@kbn/traced-es-client'; +import { IUiSettingsClient } from '@kbn/core/public'; +import { UI_SETTINGS } from '@kbn/data-plugin/public'; import { esqlResultToTimeseries } from '../../util/esql_result_to_timeseries'; import { useKibana } from '../../hooks/use_kibana'; import { LoadingPanel } from '../loading_panel'; +function getTimeZone(uiSettings?: IUiSettingsClient) { + const kibanaTimeZone = uiSettings?.get<'Browser' | string>(UI_SETTINGS.DATEFORMAT_TZ); + if (!kibanaTimeZone || kibanaTimeZone === 'Browser') { + return 'local'; + } + + return kibanaTimeZone; +} + const END_ZONE_LABEL = i18n.translate('xpack.streams.esqlChart.endzone', { defaultMessage: 'The selected time range does not include this entire bucket. It might contain partial data.', diff --git a/x-pack/platform/plugins/shared/streams_app/public/components/header_menu/header_menu_portal.test.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/header_menu/header_menu_portal.test.tsx new file mode 100644 index 0000000000000..055c974dcf6db --- /dev/null +++ b/x-pack/platform/plugins/shared/streams_app/public/components/header_menu/header_menu_portal.test.tsx @@ -0,0 +1,30 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { render } from '@testing-library/react'; +import React from 'react'; +import HeaderMenuPortal from './header_menu_portal'; +import { themeServiceMock } from '@kbn/core/public/mocks'; + +describe('HeaderMenuPortal', () => { + describe('when unmounted', () => { + it('calls setHeaderActionMenu with undefined', () => { + const setHeaderActionMenu = jest.fn(); + const theme$ = themeServiceMock.createTheme$(); + + const { unmount } = render( + + test + + ); + + unmount(); + + expect(setHeaderActionMenu).toHaveBeenCalledWith(undefined); + }); + }); +}); diff --git a/x-pack/platform/plugins/shared/streams_app/public/components/header_menu/header_menu_portal.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/header_menu/header_menu_portal.tsx new file mode 100644 index 0000000000000..b05f0ac0d2011 --- /dev/null +++ b/x-pack/platform/plugins/shared/streams_app/public/components/header_menu/header_menu_portal.tsx @@ -0,0 +1,41 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { useEffect, useMemo, ReactNode } from 'react'; +import { createHtmlPortalNode, InPortal, OutPortal } from 'react-reverse-portal'; +// FIXME use import { toMountPoint } from '@kbn/react-kibana-mount'; +import { toMountPoint } from '@kbn/kibana-react-plugin/public'; +import { AppMountParameters } from '@kbn/core/public'; + +export interface HeaderMenuPortalProps { + children: ReactNode; + setHeaderActionMenu: AppMountParameters['setHeaderActionMenu']; + theme$: AppMountParameters['theme$']; +} + +// eslint-disable-next-line import/no-default-export +export default function HeaderMenuPortal({ + children, + setHeaderActionMenu, + theme$, +}: HeaderMenuPortalProps) { + const portalNode = useMemo(() => createHtmlPortalNode(), []); + + useEffect(() => { + setHeaderActionMenu((element) => { + const mount = toMountPoint(, { theme$ }); + return mount(element); + }); + + return () => { + portalNode.unmount(); + setHeaderActionMenu(undefined); + }; + }, [portalNode, setHeaderActionMenu, theme$]); + + return {children}; +} diff --git a/x-pack/platform/plugins/shared/streams_app/public/components/header_menu/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/header_menu/index.tsx new file mode 100644 index 0000000000000..90987a98e5d33 --- /dev/null +++ b/x-pack/platform/plugins/shared/streams_app/public/components/header_menu/index.tsx @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { lazy, Suspense } from 'react'; +import { EuiLoadingSpinner } from '@elastic/eui'; +import type { HeaderMenuPortalProps } from './header_menu_portal'; + +const HeaderMenuPortalLazy = lazy(() => import('./header_menu_portal')); + +export function HeaderMenuPortal(props: HeaderMenuPortalProps) { + return ( + }> + + + ); +} diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/loading_panel/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/loading_panel/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/loading_panel/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/loading_panel/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/management_bottom_bar/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/management_bottom_bar/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/management_bottom_bar/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/management_bottom_bar/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/nested_view/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/nested_view/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/nested_view/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/nested_view/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/not_found/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/not_found/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/not_found/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/not_found/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/preview_table/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/preview_table/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/preview_table/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/preview_table/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/redirect_to/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/redirect_to/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/redirect_to/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/redirect_to/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/constants.ts b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/constants.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/constants.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/constants.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/field_actions.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/field_actions.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/field_actions.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/field_actions.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/field_parent.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/field_parent.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/field_parent.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/field_parent.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/field_status.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/field_status.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/field_status.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/field_status.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/field_type.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/field_type.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/field_type.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/field_type.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/filters/filter_group.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/filters/filter_group.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/filters/filter_group.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/filters/filter_group.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/filters/status_filter_group.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/filters/status_filter_group.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/filters/status_filter_group.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/filters/status_filter_group.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/filters/type_filter_group.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/filters/type_filter_group.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/filters/type_filter_group.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/filters/type_filter_group.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/advanced_field_mapping_options.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/advanced_field_mapping_options.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/advanced_field_mapping_options.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/advanced_field_mapping_options.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/children_affected_callout.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/children_affected_callout.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/children_affected_callout.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/children_affected_callout.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/ecs_recommendation.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/ecs_recommendation.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/ecs_recommendation.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/ecs_recommendation.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/field_form_format.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/field_form_format.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/field_form_format.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/field_form_format.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/field_form_type.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/field_form_type.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/field_form_type.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/field_form_type.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/field_summary.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/field_summary.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/field_summary.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/field_summary.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/sample_preview_table.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/sample_preview_table.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/flyout/sample_preview_table.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/flyout/sample_preview_table.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/hooks/use_controls.ts b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/hooks/use_controls.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/hooks/use_controls.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/hooks/use_controls.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/hooks/use_schema_fields.ts b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/hooks/use_schema_fields.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/hooks/use_schema_fields.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/hooks/use_schema_fields.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/schema_editor_context.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/schema_editor_context.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/schema_editor_context.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/schema_editor_context.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/schema_editor_controls.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/schema_editor_controls.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/schema_editor_controls.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/schema_editor_controls.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/schema_editor_table.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/schema_editor_table.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/schema_editor_table.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/schema_editor_table.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/types.ts b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/types.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/types.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/types.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/unpromote_field_modal.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/unpromote_field_modal.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/unpromote_field_modal.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/unpromote_field_modal.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/utils.ts b/x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/utils.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/schema_editor/utils.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/schema_editor/utils.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_delete_modal/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_delete_modal/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_delete_modal/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_delete_modal/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_dashboards_view/add_dashboard_flyout.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_dashboards_view/add_dashboard_flyout.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_dashboards_view/add_dashboard_flyout.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_dashboards_view/add_dashboard_flyout.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_dashboards_view/dashboard_table.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_dashboards_view/dashboard_table.tsx similarity index 97% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_dashboards_view/dashboard_table.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_dashboards_view/dashboard_table.tsx index 7490c57e7e332..fda074071ddeb 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_dashboards_view/dashboard_table.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_dashboards_view/dashboard_table.tsx @@ -16,9 +16,9 @@ import React, { useMemo } from 'react'; import type { SanitizedDashboardAsset } from '@kbn/streams-plugin/server/routes/dashboards/route'; import { DASHBOARD_APP_LOCATOR } from '@kbn/deeplinks-analytics'; import { DashboardLocatorParams } from '@kbn/dashboard-plugin/public'; -import { useDateRange } from '@kbn/observability-utils-browser/hooks/use_date_range'; import { useKibana } from '../../hooks/use_kibana'; import { tagListToReferenceList } from './to_reference_list'; +import { useDateRange } from '../../hooks/use_date_range'; export function DashboardsTable({ dashboards, diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_dashboards_view/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_dashboards_view/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_dashboards_view/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_dashboards_view/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_dashboards_view/to_reference_list.ts b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_dashboards_view/to_reference_list.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_dashboards_view/to_reference_list.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_dashboards_view/to_reference_list.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/hooks/use_definition.ts b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/hooks/use_definition.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/hooks/use_definition.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/hooks/use_definition.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/hooks/use_processing_simulator.ts b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/hooks/use_processing_simulator.ts similarity index 99% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/hooks/use_processing_simulator.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/hooks/use_processing_simulator.ts index fac29daee60a4..e08a2ceb12bb7 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/hooks/use_processing_simulator.ts +++ b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/hooks/use_processing_simulator.ts @@ -17,7 +17,6 @@ import { FlattenRecord, } from '@kbn/streams-schema'; import { IHttpFetchError, ResponseErrorBody } from '@kbn/core/public'; -import { useDateRange } from '@kbn/observability-utils-browser/hooks/use_date_range'; import { APIReturnType } from '@kbn/streams-plugin/public/api'; import { i18n } from '@kbn/i18n'; import { flattenObjectNestedLast } from '@kbn/object-utils'; @@ -25,6 +24,7 @@ import { useStreamsAppFetch } from '../../../hooks/use_streams_app_fetch'; import { useKibana } from '../../../hooks/use_kibana'; import { DetectedField, ProcessorDefinitionWithUIAttributes } from '../types'; import { processorConverter } from '../utils'; +import { useDateRange } from '../../../hooks/use_date_range'; export type Simulation = APIReturnType<'POST /api/streams/{name}/processing/_simulate'>; export type ProcessorMetrics = diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/page_content.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/page_content.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/page_content.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/page_content.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processor_outcome_preview.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processor_outcome_preview.tsx similarity index 98% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processor_outcome_preview.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processor_outcome_preview.tsx index aa28b24e4c1d4..0e10fe8d3a596 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processor_outcome_preview.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processor_outcome_preview.tsx @@ -6,7 +6,6 @@ */ import React, { useMemo } from 'react'; -import { useDateRange } from '@kbn/observability-utils-browser/hooks/use_date_range'; import { EuiFlexGroup, EuiFilterButton, @@ -30,6 +29,7 @@ import { docsFilterOptions, } from './hooks/use_processing_simulator'; import { AssetImage } from '../asset_image'; +import { useDateRange } from '../../hooks/use_date_range'; interface ProcessorOutcomePreviewProps { columns: TableColumn[]; diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/dissect/dissect_append_separator.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/dissect/dissect_append_separator.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/dissect/dissect_append_separator.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/dissect/dissect_append_separator.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/dissect/dissect_pattern_definition.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/dissect/dissect_pattern_definition.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/dissect/dissect_pattern_definition.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/dissect/dissect_pattern_definition.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/dissect/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/dissect/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/dissect/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/dissect/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_ai_suggestions.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_ai_suggestions.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_ai_suggestions.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_ai_suggestions.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_pattern_definition.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_pattern_definition.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_pattern_definition.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_pattern_definition.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_patterns_editor.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_patterns_editor.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_patterns_editor.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/grok/grok_patterns_editor.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/grok/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/grok/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/grok/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/grok/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/ignore_toggles.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/ignore_toggles.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/ignore_toggles.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/ignore_toggles.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/optional_fields_accordion.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/optional_fields_accordion.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/optional_fields_accordion.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/optional_fields_accordion.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/processor_condition_editor.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/processor_condition_editor.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/processor_condition_editor.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/processor_condition_editor.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/processor_field_selector.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/processor_field_selector.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/processor_field_selector.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/processor_field_selector.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/processor_metrics.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/processor_metrics.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/processor_metrics.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/processor_metrics.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/processor_type_selector.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/processor_type_selector.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/processor_type_selector.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/processor_type_selector.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/toggle_field.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/toggle_field.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors/toggle_field.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors/toggle_field.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors_list.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors_list.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/processors_list.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/processors_list.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/root_stream_empty_prompt.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/root_stream_empty_prompt.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/root_stream_empty_prompt.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/root_stream_empty_prompt.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/simulation_playground.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/simulation_playground.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/simulation_playground.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/simulation_playground.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/simulator_context.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/simulator_context.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/simulator_context.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/simulator_context.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/sortable_list.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/sortable_list.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/sortable_list.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/sortable_list.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/types.ts b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/types.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/types.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/types.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/utils.ts b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/utils.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_enrichment/utils.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_enrichment/utils.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/helpers/format_bytes.ts b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/helpers/format_bytes.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/helpers/format_bytes.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/helpers/format_bytes.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/helpers/ingestion_rate_query.ts b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/helpers/ingestion_rate_query.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/helpers/ingestion_rate_query.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/helpers/ingestion_rate_query.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/hooks/use_data_stream_stats.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/hooks/use_data_stream_stats.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/hooks/use_data_stream_stats.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/hooks/use_data_stream_stats.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/ingestion_rate.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/ingestion_rate.tsx similarity index 98% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/ingestion_rate.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/ingestion_rate.tsx index 3ffda07c2be46..14a3573f203a5 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/ingestion_rate.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/ingestion_rate.tsx @@ -20,13 +20,13 @@ import { EuiText, } from '@elastic/eui'; import { AreaSeries, Axis, Chart, Settings } from '@elastic/charts'; -import { useDateRange } from '@kbn/observability-utils-browser/hooks/use_date_range'; import { useKibana } from '../../hooks/use_kibana'; import { DataStreamStats } from './hooks/use_data_stream_stats'; import { useStreamsAppFetch } from '../../hooks/use_streams_app_fetch'; import { ingestionRateQuery } from './helpers/ingestion_rate_query'; import { formatBytes } from './helpers/format_bytes'; import { StreamsAppSearchBar } from '../streams_app_search_bar'; +import { useDateRange } from '../../hooks/use_date_range'; export function IngestionRate({ definition, diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/metadata.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/metadata.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/metadata.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/metadata.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/modal.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/modal.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/modal.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/modal.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/summary.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/summary.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_lifecycle/summary.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_lifecycle/summary.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_management/classic.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_management/classic.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_management/classic.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_management/classic.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_management/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_management/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_management/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_management/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_management/wired.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_management/wired.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_management/wired.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_management/wired.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_management/wrapper.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_management/wrapper.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_management/wrapper.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_management/wrapper.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_overview/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_overview/index.tsx similarity index 98% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_overview/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_overview/index.tsx index eb19d094d86ec..caa6f5b171b9b 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_overview/index.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_overview/index.tsx @@ -25,7 +25,6 @@ import { isUnwiredStreamGetResponse, isWiredStreamDefinition, } from '@kbn/streams-schema'; -import { useDateRange } from '@kbn/observability-utils-browser/hooks/use_date_range'; import type { SanitizedDashboardAsset } from '@kbn/streams-plugin/server/routes/dashboards/route'; import { useKibana } from '../../hooks/use_kibana'; import { useStreamsAppFetch } from '../../hooks/use_streams_app_fetch'; @@ -38,6 +37,7 @@ import { useDashboardsFetch } from '../../hooks/use_dashboards_fetch'; import { DashboardsTable } from '../stream_detail_dashboards_view/dashboard_table'; import { AssetImage } from '../asset_image'; import { useWiredStreams } from '../../hooks/use_wired_streams'; +import { useDateRange } from '../../hooks/use_date_range'; const formatNumber = (val: number) => { return Number(val).toLocaleString('en', { @@ -151,7 +151,7 @@ export function StreamDetailOverview({ definition }: { definition?: IngestStream }, }); }, - // eslint-disable-next-line react-hooks/exhaustive-deps + [definition, dataViews, streamsRepositoryClient, start, end] ); diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/child_stream_list.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/child_stream_list.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/child_stream_list.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/child_stream_list.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/control_bar.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/control_bar.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/control_bar.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/control_bar.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/current_stream_entry.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/current_stream_entry.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/current_stream_entry.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/current_stream_entry.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/hooks/routing_state.ts b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/hooks/routing_state.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/hooks/routing_state.ts rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/hooks/routing_state.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/new_routing_stream_entry.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/new_routing_stream_entry.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/new_routing_stream_entry.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/new_routing_stream_entry.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/preview_matches.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/preview_matches.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/preview_matches.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/preview_matches.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/preview_panel.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/preview_panel.tsx similarity index 98% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/preview_panel.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/preview_panel.tsx index 33737b388b716..afd5bc32fe54f 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/preview_panel.tsx +++ b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/preview_panel.tsx @@ -14,7 +14,6 @@ import { EuiSpacer, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { useDateRange } from '@kbn/observability-utils-browser/hooks/use_date_range'; import { WiredStreamGetResponse } from '@kbn/streams-schema'; import { css } from '@emotion/css'; import React from 'react'; @@ -25,6 +24,7 @@ import { StreamsAppSearchBar } from '../streams_app_search_bar'; import { useRoutingState } from './hooks/routing_state'; import { PreviewPanelIllustration } from './preview_panel_illustration'; import { PreviewMatches } from './preview_matches'; +import { useDateRange } from '../../hooks/use_date_range'; export function PreviewPanel({ definition, diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/preview_panel_illustration.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/preview_panel_illustration.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/preview_panel_illustration.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/preview_panel_illustration.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/routing_stream_entry.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/routing_stream_entry.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/routing_stream_entry.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_routing/routing_stream_entry.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_schema_editor/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_schema_editor/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_schema_editor/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_schema_editor/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_view/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_view/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_view/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_detail_view/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_list_view/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/stream_list_view/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/stream_list_view/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/stream_list_view/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_context_provider/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/streams_app_context_provider/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_context_provider/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/streams_app_context_provider/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_page_body/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/streams_app_page_body/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_page_body/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/streams_app_page_body/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_page_header/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/streams_app_page_header/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_page_header/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/streams_app_page_header/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_page_header/streams_app_page_header_title.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/streams_app_page_header/streams_app_page_header_title.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_page_header/streams_app_page_header_title.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/streams_app_page_header/streams_app_page_header_title.tsx diff --git a/x-pack/platform/plugins/shared/streams_app/public/components/streams_app_page_template/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/streams_app_page_template/index.tsx new file mode 100644 index 0000000000000..737e71819fc8e --- /dev/null +++ b/x-pack/platform/plugins/shared/streams_app/public/components/streams_app_page_template/index.tsx @@ -0,0 +1,33 @@ +/* + * Copyright 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 { css } from '@emotion/css'; +import React from 'react'; +import { EuiPanel } from '@elastic/eui'; +import { useKibana } from '../../hooks/use_kibana'; + +export function StreamsAppPageTemplate({ children }: { children: React.ReactNode }) { + const { + services: { PageTemplate }, + } = useKibana(); + + return ( + + + {children} + + + ); +} diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_router_breadcrumb/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/streams_app_router_breadcrumb/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_router_breadcrumb/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/streams_app_router_breadcrumb/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_search_bar/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/streams_app_search_bar/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_search_bar/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/streams_app_search_bar/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/streams_list/index.tsx b/x-pack/platform/plugins/shared/streams_app/public/components/streams_list/index.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/components/streams_list/index.tsx rename to x-pack/platform/plugins/shared/streams_app/public/components/streams_list/index.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/queries/use_async_sample.tsx b/x-pack/platform/plugins/shared/streams_app/public/hooks/queries/use_async_sample.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/queries/use_async_sample.tsx rename to x-pack/platform/plugins/shared/streams_app/public/hooks/queries/use_async_sample.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_dashboards_api.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_dashboards_api.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_dashboards_api.ts rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_dashboards_api.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_dashboards_fetch.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_dashboards_fetch.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_dashboards_fetch.ts rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_dashboards_fetch.ts diff --git a/x-pack/platform/plugins/shared/streams_app/public/hooks/use_date_range.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_date_range.ts new file mode 100644 index 0000000000000..941e106247b87 --- /dev/null +++ b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_date_range.ts @@ -0,0 +1,63 @@ +/* + * Copyright 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 { TimeRange } from '@kbn/data-plugin/common'; +import { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import { useCallback, useEffect, useMemo, useState } from 'react'; + +export function useDateRange({ data }: { data: DataPublicPluginStart }): { + timeRange: TimeRange; + absoluteTimeRange: { + start: number; + end: number; + }; + setTimeRange: React.Dispatch>; +} { + const timefilter = data.query.timefilter.timefilter; + + const [timeRange, setTimeRange] = useState(() => timefilter.getTime()); + + const [absoluteTimeRange, setAbsoluteTimeRange] = useState(() => timefilter.getAbsoluteTime()); + + useEffect(() => { + const timeUpdateSubscription = timefilter.getTimeUpdate$().subscribe({ + next: () => { + setTimeRange(() => timefilter.getTime()); + setAbsoluteTimeRange(() => timefilter.getAbsoluteTime()); + }, + }); + + return () => { + timeUpdateSubscription.unsubscribe(); + }; + }, [timefilter]); + + const setTimeRangeMemoized: React.Dispatch> = useCallback( + (nextOrCallback) => { + const val = + typeof nextOrCallback === 'function' + ? nextOrCallback(timefilter.getTime()) + : nextOrCallback; + + timefilter.setTime(val); + }, + [timefilter] + ); + + const asEpoch = useMemo(() => { + return { + start: new Date(absoluteTimeRange.from).getTime(), + end: new Date(absoluteTimeRange.to).getTime(), + }; + }, [absoluteTimeRange]); + + return { + timeRange, + absoluteTimeRange: asEpoch, + setTimeRange: setTimeRangeMemoized, + }; +} diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_discard_confirm.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_discard_confirm.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_discard_confirm.ts rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_discard_confirm.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_kibana.tsx b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_kibana.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_kibana.tsx rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_kibana.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_breadcrumbs.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_breadcrumbs.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_breadcrumbs.ts rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_breadcrumbs.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_fetch.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_fetch.ts similarity index 97% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_fetch.ts rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_fetch.ts index 01e2a55a2ee5a..3c233bb332a88 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_fetch.ts +++ b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_fetch.ts @@ -69,7 +69,6 @@ export const useStreamsAppFetch: UseAbortableAsync<{}, { disableToastOnError?: b return callback({ signal }); }, - // eslint-disable-next-line react-hooks/exhaustive-deps deps, optionsForHook ); diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_params.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_params.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_params.ts rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_params.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_route_path.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_route_path.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_route_path.ts rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_route_path.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_router.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_router.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_streams_app_router.ts rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_streams_app_router.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/hooks/use_wired_streams.ts b/x-pack/platform/plugins/shared/streams_app/public/hooks/use_wired_streams.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/hooks/use_wired_streams.ts rename to x-pack/platform/plugins/shared/streams_app/public/hooks/use_wired_streams.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/index.ts b/x-pack/platform/plugins/shared/streams_app/public/index.ts similarity index 81% rename from x-pack/solutions/observability/plugins/streams_app/public/index.ts rename to x-pack/platform/plugins/shared/streams_app/public/index.ts index eea2d8b7452a8..bace0636c6c1a 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/index.ts +++ b/x-pack/platform/plugins/shared/streams_app/public/index.ts @@ -13,9 +13,16 @@ import type { StreamsAppSetupDependencies, StreamsAppStartDependencies, ConfigSchema, + StreamsApplicationComponentType, + StreamsApplicationProps, } from './types'; -export type { StreamsAppPublicSetup, StreamsAppPublicStart }; +export type { + StreamsAppPublicSetup, + StreamsAppPublicStart, + StreamsApplicationComponentType, + StreamsApplicationProps, +}; export const plugin: PluginInitializer< StreamsAppPublicSetup, diff --git a/x-pack/platform/plugins/shared/streams_app/public/plugin.tsx b/x-pack/platform/plugins/shared/streams_app/public/plugin.tsx new file mode 100644 index 0000000000000..de3fde0a64d4b --- /dev/null +++ b/x-pack/platform/plugins/shared/streams_app/public/plugin.tsx @@ -0,0 +1,68 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public'; +import type { Logger } from '@kbn/logging'; +import { DataStreamsStatsService } from '@kbn/dataset-quality-plugin/public'; +import { dynamic } from '@kbn/shared-ux-utility'; +import React from 'react'; +import type { + ConfigSchema, + StreamsAppPublicSetup, + StreamsAppPublicStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies, + StreamsApplicationProps, +} from './types'; +import { StreamsAppServices } from './services/types'; + +const StreamsApplication = dynamic(() => + import('./application').then((mod) => ({ default: mod.StreamsApplication })) +); + +export class StreamsAppPlugin + implements + Plugin< + StreamsAppPublicSetup, + StreamsAppPublicStart, + StreamsAppSetupDependencies, + StreamsAppStartDependencies + > +{ + logger: Logger; + + constructor(private readonly context: PluginInitializerContext) { + this.logger = context.logger.get(); + } + setup(): StreamsAppPublicSetup { + return {}; + } + + start(coreStart: CoreStart, pluginsStart: StreamsAppStartDependencies): StreamsAppPublicStart { + return { + createStreamsApplicationComponent: () => { + return ({ appMountParameters, PageTemplate }: StreamsApplicationProps) => { + const services: StreamsAppServices = { + dataStreamsClient: new DataStreamsStatsService() + .start({ http: coreStart.http }) + .getClient(), + PageTemplate, + }; + return ( + + ); + }; + }, + }; + } +} diff --git a/x-pack/solutions/observability/plugins/streams_app/public/routes/config.tsx b/x-pack/platform/plugins/shared/streams_app/public/routes/config.tsx similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/routes/config.tsx rename to x-pack/platform/plugins/shared/streams_app/public/routes/config.tsx diff --git a/x-pack/solutions/observability/plugins/streams_app/public/services/types.ts b/x-pack/platform/plugins/shared/streams_app/public/services/types.ts similarity index 88% rename from x-pack/solutions/observability/plugins/streams_app/public/services/types.ts rename to x-pack/platform/plugins/shared/streams_app/public/services/types.ts index 69f51c04df1e6..f571119d659bd 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/services/types.ts +++ b/x-pack/platform/plugins/shared/streams_app/public/services/types.ts @@ -9,4 +9,5 @@ import { IDataStreamsStatsClient } from '@kbn/dataset-quality-plugin/public'; export interface StreamsAppServices { dataStreamsClient: Promise; + PageTemplate: React.FC>; } diff --git a/x-pack/solutions/observability/plugins/streams_app/public/types.ts b/x-pack/platform/plugins/shared/streams_app/public/types.ts similarity index 83% rename from x-pack/solutions/observability/plugins/streams_app/public/types.ts rename to x-pack/platform/plugins/shared/streams_app/public/types.ts index 6990b72ef0541..b21ca888d539d 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/types.ts +++ b/x-pack/platform/plugins/shared/streams_app/public/types.ts @@ -9,10 +9,6 @@ import type { DataViewsPublicPluginSetup, DataViewsPublicPluginStart, } from '@kbn/data-views-plugin/public'; -import type { - ObservabilitySharedPluginSetup, - ObservabilitySharedPluginStart, -} from '@kbn/observability-shared-plugin/public'; import type { StreamsPluginSetup, StreamsPluginStart } from '@kbn/streams-plugin/public'; import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { SharePublicSetup, SharePublicStart } from '@kbn/share-plugin/public/plugin'; @@ -23,15 +19,22 @@ import { ObservabilityAIAssistantPublicSetup, ObservabilityAIAssistantPublicStart, } from '@kbn/observability-ai-assistant-plugin/public'; +import { AppMountParameters } from '@kbn/core/public'; /* eslint-disable @typescript-eslint/no-empty-interface*/ export interface ConfigSchema {} +export interface StreamsApplicationProps { + appMountParameters: AppMountParameters; + PageTemplate: React.FC>; +} + +export type StreamsApplicationComponentType = React.FC; + export interface StreamsAppSetupDependencies { streams: StreamsPluginSetup; data: DataPublicPluginSetup; dataViews: DataViewsPublicPluginSetup; - observabilityShared: ObservabilitySharedPluginSetup; unifiedSearch: {}; share: SharePublicSetup; observabilityAIAssistant?: ObservabilityAIAssistantPublicSetup; @@ -41,7 +44,6 @@ export interface StreamsAppStartDependencies { streams: StreamsPluginStart; data: DataPublicPluginStart; dataViews: DataViewsPublicPluginStart; - observabilityShared: ObservabilitySharedPluginStart; unifiedSearch: UnifiedSearchPublicPluginStart; share: SharePublicStart; savedObjectsTagging: SavedObjectTaggingPluginStart; @@ -52,4 +54,6 @@ export interface StreamsAppStartDependencies { export interface StreamsAppPublicSetup {} -export interface StreamsAppPublicStart {} +export interface StreamsAppPublicStart { + createStreamsApplicationComponent: () => StreamsApplicationComponentType; +} diff --git a/x-pack/solutions/observability/plugins/streams_app/public/util/condition.ts b/x-pack/platform/plugins/shared/streams_app/public/util/condition.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/util/condition.ts rename to x-pack/platform/plugins/shared/streams_app/public/util/condition.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/util/errors.ts b/x-pack/platform/plugins/shared/streams_app/public/util/errors.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/util/errors.ts rename to x-pack/platform/plugins/shared/streams_app/public/util/errors.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/util/esql_result_to_timeseries.ts b/x-pack/platform/plugins/shared/streams_app/public/util/esql_result_to_timeseries.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/util/esql_result_to_timeseries.ts rename to x-pack/platform/plugins/shared/streams_app/public/util/esql_result_to_timeseries.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/util/hierarchy_helpers.ts b/x-pack/platform/plugins/shared/streams_app/public/util/hierarchy_helpers.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/util/hierarchy_helpers.ts rename to x-pack/platform/plugins/shared/streams_app/public/util/hierarchy_helpers.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/public/util/use_debounce.ts b/x-pack/platform/plugins/shared/streams_app/public/util/use_debounce.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/public/util/use_debounce.ts rename to x-pack/platform/plugins/shared/streams_app/public/util/use_debounce.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/server/config.ts b/x-pack/platform/plugins/shared/streams_app/server/config.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/server/config.ts rename to x-pack/platform/plugins/shared/streams_app/server/config.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/server/index.ts b/x-pack/platform/plugins/shared/streams_app/server/index.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/server/index.ts rename to x-pack/platform/plugins/shared/streams_app/server/index.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/server/plugin.ts b/x-pack/platform/plugins/shared/streams_app/server/plugin.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/server/plugin.ts rename to x-pack/platform/plugins/shared/streams_app/server/plugin.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/server/types.ts b/x-pack/platform/plugins/shared/streams_app/server/types.ts similarity index 100% rename from x-pack/solutions/observability/plugins/streams_app/server/types.ts rename to x-pack/platform/plugins/shared/streams_app/server/types.ts diff --git a/x-pack/solutions/observability/plugins/streams_app/tsconfig.json b/x-pack/platform/plugins/shared/streams_app/tsconfig.json similarity index 93% rename from x-pack/solutions/observability/plugins/streams_app/tsconfig.json rename to x-pack/platform/plugins/shared/streams_app/tsconfig.json index 3f33c3ddc109c..9e9684efea288 100644 --- a/x-pack/solutions/observability/plugins/streams_app/tsconfig.json +++ b/x-pack/platform/plugins/shared/streams_app/tsconfig.json @@ -18,7 +18,6 @@ "@kbn/core", "@kbn/data-plugin", "@kbn/data-views-plugin", - "@kbn/observability-shared-plugin", "@kbn/unified-search-plugin", "@kbn/share-plugin", "@kbn/navigation-plugin", @@ -27,14 +26,12 @@ "@kbn/typed-react-router-config", "@kbn/react-kibana-context-render", "@kbn/code-editor", - "@kbn/observability-utils-browser", "@kbn/ui-theme", "@kbn/calculate-auto", "@kbn/kibana-react-plugin", "@kbn/es-query", "@kbn/server-route-repository-client", "@kbn/logging", - "@kbn/deeplinks-observability", "@kbn/config-schema", "@kbn/calculate-auto", "@kbn/streams-plugin", diff --git a/x-pack/solutions/observability/plugins/observability_streams_wrapper/README.md b/x-pack/solutions/observability/plugins/observability_streams_wrapper/README.md new file mode 100644 index 0000000000000..73fb8bc7bf3ad --- /dev/null +++ b/x-pack/solutions/observability/plugins/observability_streams_wrapper/README.md @@ -0,0 +1,3 @@ +# Streams observability wrapper + +Observability-specific wrapper for the streams app. This is responsible for actually registering the app and making it accessible in observability contexts diff --git a/x-pack/solutions/observability/plugins/observability_streams_wrapper/jest.config.js b/x-pack/solutions/observability/plugins/observability_streams_wrapper/jest.config.js new file mode 100644 index 0000000000000..000b273c4be7f --- /dev/null +++ b/x-pack/solutions/observability/plugins/observability_streams_wrapper/jest.config.js @@ -0,0 +1,17 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../../../../..', + roots: ['/x-pack/solutions/observability/plugins/observability_streams_wrapper/public'], + setupFiles: [], + collectCoverage: false, + collectCoverageFrom: [], + + coverageReporters: ['html'], +}; diff --git a/x-pack/solutions/observability/plugins/observability_streams_wrapper/kibana.jsonc b/x-pack/solutions/observability/plugins/observability_streams_wrapper/kibana.jsonc new file mode 100644 index 0000000000000..a1f21a15d9c88 --- /dev/null +++ b/x-pack/solutions/observability/plugins/observability_streams_wrapper/kibana.jsonc @@ -0,0 +1,21 @@ +{ + "type": "plugin", + "id": "@kbn/streams-app-wrapper-plugin", + "owner": "@elastic/streams-program-team", + "group": "platform", + "visibility": "shared", + "plugin": { + "id": "streamsAppWrapper", + "server": false, + "browser": true, + "requiredPlugins": [ + "streamsApp", + "streams", + "observabilityShared", + "navigation", + ], + "requiredBundles": [], + "optionalPlugins": [], + "extraPublicDirs": [] + } +} diff --git a/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/index.ts b/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/index.ts new file mode 100644 index 0000000000000..22182b5390eb5 --- /dev/null +++ b/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/index.ts @@ -0,0 +1,26 @@ +/* + * Copyright 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 { PluginInitializer, PluginInitializerContext } from '@kbn/core/public'; + +import { ObservabilityStreamsWrapperPlugin } from './plugin'; +import type { + ObservabilityStreamsWrapperPublicSetup, + ObservabilityStreamsWrapperPublicStart, + ObservabilityStreamsWrapperSetupDependencies, + ObservabilityStreamsWrapperStartDependencies, + ConfigSchema, +} from './types'; + +export type { ObservabilityStreamsWrapperPublicSetup, ObservabilityStreamsWrapperPublicStart }; + +export const plugin: PluginInitializer< + ObservabilityStreamsWrapperPublicSetup, + ObservabilityStreamsWrapperPublicStart, + ObservabilityStreamsWrapperSetupDependencies, + ObservabilityStreamsWrapperStartDependencies +> = (pluginInitializerContext: PluginInitializerContext) => + new ObservabilityStreamsWrapperPlugin(pluginInitializerContext); diff --git a/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/observability_streams_page_template.tsx b/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/observability_streams_page_template.tsx new file mode 100644 index 0000000000000..7623f0c076429 --- /dev/null +++ b/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/observability_streams_page_template.tsx @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { css } from '@emotion/css'; +import React from 'react'; +import useObservable from 'react-use/lib/useObservable'; +import { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; +import { NavigationPublicStart } from '@kbn/navigation-plugin/public/types'; + +export const createObservabilityStreamsAppPageTemplate = + ({ + observabilityShared, + navigation, + }: { + observabilityShared: ObservabilitySharedPluginStart; + navigation: NavigationPublicStart; + }) => + ({ children }: { children?: React.ReactNode }) => { + const { PageTemplate } = observabilityShared.navigation; + + const isSolutionNavEnabled = useObservable(navigation.isSolutionNavEnabled$); + + return ( + + {children} + + ); + }; diff --git a/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/plugin.tsx b/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/plugin.tsx new file mode 100644 index 0000000000000..8cfed888fc357 --- /dev/null +++ b/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/plugin.tsx @@ -0,0 +1,180 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { map } from 'rxjs'; +import { + AppUpdater, + CoreSetup, + DEFAULT_APP_CATEGORIES, + Plugin, + PluginInitializerContext, +} from '@kbn/core/public'; +import type { Logger } from '@kbn/logging'; +import { STREAMS_APP_ID } from '@kbn/deeplinks-observability/constants'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import { APP_WRAPPER_CLASS, type AppMountParameters, type CoreStart } from '@kbn/core/public'; +import { css } from '@emotion/css'; +import { StreamsApplicationComponentType } from '@kbn/streams-app-plugin/public'; +import { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; +import { NavigationPublicStart } from '@kbn/navigation-plugin/public/types'; +import type { + ConfigSchema, + ObservabilityStreamsWrapperPublicSetup, + ObservabilityStreamsWrapperPublicStart, + ObservabilityStreamsWrapperSetupDependencies, + ObservabilityStreamsWrapperStartDependencies, +} from './types'; +import { createObservabilityStreamsAppPageTemplate } from './observability_streams_page_template'; + +export const renderApp = ({ + appMountParameters, + StreamsApplicationComponent, + observabilityShared, + navigation, +}: { + appMountParameters: AppMountParameters; + StreamsApplicationComponent: StreamsApplicationComponentType; + observabilityShared: ObservabilitySharedPluginStart; + navigation: NavigationPublicStart; +}) => { + const { element } = appMountParameters; + + const appWrapperClassName = css` + overflow: auto; + `; + const appWrapperElement = document.getElementsByClassName(APP_WRAPPER_CLASS)[1]; + appWrapperElement.classList.add(appWrapperClassName); + + ReactDOM.render( + , + element + ); + return () => { + ReactDOM.unmountComponentAtNode(element); + appWrapperElement.classList.remove(APP_WRAPPER_CLASS); + }; +}; + +export class ObservabilityStreamsWrapperPlugin + implements + Plugin< + ObservabilityStreamsWrapperPublicSetup, + ObservabilityStreamsWrapperPublicStart, + ObservabilityStreamsWrapperSetupDependencies, + ObservabilityStreamsWrapperStartDependencies + > +{ + logger: Logger; + + constructor(context: PluginInitializerContext) { + this.logger = context.logger.get(); + } + setup( + coreSetup: CoreSetup< + ObservabilityStreamsWrapperStartDependencies, + ObservabilityStreamsWrapperPublicStart + >, + pluginsSetup: ObservabilityStreamsWrapperSetupDependencies + ): ObservabilityStreamsWrapperPublicSetup { + pluginsSetup.observabilityShared.navigation.registerSections( + pluginsSetup.streams.status$.pipe( + map(({ status }) => { + if (status !== 'enabled') { + return []; + } + + return [ + { + label: '', + sortKey: 101, + entries: [ + { + label: i18n.translate('app_not_found_in_i18nrc.streamsAppLinkTitle', { + defaultMessage: 'Streams', + }), + app: STREAMS_APP_ID, + path: '/', + isTechnicalPreview: true, + matchPath(currentPath: string) { + return ['/', ''].some((testPath) => currentPath.startsWith(testPath)); + }, + }, + ], + }, + ]; + }) + ) + ); + + coreSetup.application.register({ + id: STREAMS_APP_ID, + title: i18n.translate('app_not_found_in_i18nrc.appTitle', { + defaultMessage: 'Streams', + }), + euiIconType: 'logoObservability', + appRoute: '/app/streams', + category: DEFAULT_APP_CATEGORIES.observability, + order: 8001, + updater$: pluginsSetup.streams.status$.pipe( + map(({ status }): AppUpdater => { + return (app) => { + if (status !== 'enabled') { + return { + visibleIn: [], + deepLinks: [], + }; + } + + return { + visibleIn: ['sideNav', 'globalSearch'], + deepLinks: + status === 'enabled' + ? [ + { + id: 'streams', + title: i18n.translate('app_not_found_in_i18nrc.streamsAppDeepLinkTitle', { + defaultMessage: 'Streams', + }), + path: '/', + }, + ] + : [], + }; + }; + }) + ), + mount: async (appMountParameters: AppMountParameters) => { + // Load application bundle and Get start services + const [_, pluginsStart] = await coreSetup.getStartServices(); + + const StreamsApplicationComponent = + pluginsStart.streamsApp.createStreamsApplicationComponent(); + + return renderApp({ + StreamsApplicationComponent, + appMountParameters, + observabilityShared: pluginsStart.observabilityShared, + navigation: pluginsStart.navigation, + }); + }, + }); + + return {}; + } + + start( + coreStart: CoreStart, + pluginsStart: ObservabilityStreamsWrapperStartDependencies + ): ObservabilityStreamsWrapperPublicStart { + return {}; + } +} diff --git a/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/types.ts b/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/types.ts new file mode 100644 index 0000000000000..19c29dc942e8a --- /dev/null +++ b/x-pack/solutions/observability/plugins/observability_streams_wrapper/public/types.ts @@ -0,0 +1,57 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; 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 { + DataViewsPublicPluginSetup, + DataViewsPublicPluginStart, +} from '@kbn/data-views-plugin/public'; +import type { + ObservabilitySharedPluginSetup, + ObservabilitySharedPluginStart, +} from '@kbn/observability-shared-plugin/public'; +import type { StreamsPluginSetup, StreamsPluginStart } from '@kbn/streams-plugin/public'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import type { SharePublicSetup, SharePublicStart } from '@kbn/share-plugin/public/plugin'; +import type { SavedObjectTaggingPluginStart } from '@kbn/saved-objects-tagging-plugin/public'; +import { NavigationPublicStart } from '@kbn/navigation-plugin/public/types'; +import { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public'; +import { + ObservabilityAIAssistantPublicSetup, + ObservabilityAIAssistantPublicStart, +} from '@kbn/observability-ai-assistant-plugin/public'; +import { StreamsAppPublicSetup, StreamsAppPublicStart } from '@kbn/streams-app-plugin/public'; +/* eslint-disable @typescript-eslint/no-empty-interface*/ + +export interface ConfigSchema {} + +export interface ObservabilityStreamsWrapperSetupDependencies { + streams: StreamsPluginSetup; + streamsApp: StreamsAppPublicSetup; + dataViews: DataViewsPublicPluginSetup; + observabilityShared: ObservabilitySharedPluginSetup; + unifiedSearch: {}; + share: SharePublicSetup; + observabilityAIAssistant?: ObservabilityAIAssistantPublicSetup; +} + +export interface ObservabilityStreamsWrapperStartDependencies { + streams: StreamsPluginStart; + streamsApp: StreamsAppPublicStart; + data: DataPublicPluginStart; + dataViews: DataViewsPublicPluginStart; + observabilityShared: ObservabilitySharedPluginStart; + unifiedSearch: UnifiedSearchPublicPluginStart; + share: SharePublicStart; + savedObjectsTagging: SavedObjectTaggingPluginStart; + navigation: NavigationPublicStart; + fieldsMetadata: FieldsMetadataPublicStart; + observabilityAIAssistant?: ObservabilityAIAssistantPublicStart; +} + +export interface ObservabilityStreamsWrapperPublicSetup {} + +export interface ObservabilityStreamsWrapperPublicStart {} diff --git a/x-pack/solutions/observability/plugins/observability_streams_wrapper/tsconfig.json b/x-pack/solutions/observability/plugins/observability_streams_wrapper/tsconfig.json new file mode 100644 index 0000000000000..037168e416719 --- /dev/null +++ b/x-pack/solutions/observability/plugins/observability_streams_wrapper/tsconfig.json @@ -0,0 +1,35 @@ +{ + "extends": "../../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types" + }, + "include": [ + "common/**/*", + "public/**/*", + "typings/**/*", + "public/**/*.json", + "server/**/*", + ".storybook/**/*" + ], + "exclude": ["target/**/*", ".storybook/**/*.js"], + "kbn_references": [ + "@kbn/i18n", + "@kbn/streams-plugin", + "@kbn/core", + "@kbn/data-plugin", + "@kbn/data-views-plugin", + "@kbn/unified-search-plugin", + "@kbn/share-plugin", + "@kbn/navigation-plugin", + "@kbn/saved-objects-tagging-plugin", + "@kbn/logging", + "@kbn/streams-plugin", + "@kbn/share-plugin", + "@kbn/navigation-plugin", + "@kbn/fields-metadata-plugin", + "@kbn/observability-ai-assistant-plugin", + "@kbn/observability-shared-plugin", + "@kbn/streams-app-plugin", + "@kbn/deeplinks-observability", + ] +} diff --git a/x-pack/solutions/observability/plugins/streams_app/jest.config.js b/x-pack/solutions/observability/plugins/streams_app/jest.config.js deleted file mode 100644 index f18fb09f5c2f9..0000000000000 --- a/x-pack/solutions/observability/plugins/streams_app/jest.config.js +++ /dev/null @@ -1,25 +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. - */ - -module.exports = { - preset: '@kbn/test', - rootDir: '../../../../..', - roots: [ - '/x-pack/solutions/observability/plugins/streams_app/public', - '/x-pack/solutions/observability/plugins/streams_app/common', - '/x-pack/solutions/observability/plugins/streams_app/server', - ], - setupFiles: [ - '/x-pack/solutions/observability/plugins/streams_app/.storybook/jest_setup.js', - ], - collectCoverage: true, - collectCoverageFrom: [ - '/x-pack/solutions/observability/plugins/streams_app/{public,common,server}/**/*.{js,ts,tsx}', - ], - - coverageReporters: ['html'], -}; diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_page_template/index.tsx b/x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_page_template/index.tsx deleted file mode 100644 index 280c32841811a..0000000000000 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/streams_app_page_template/index.tsx +++ /dev/null @@ -1,61 +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 { css } from '@emotion/css'; -import React from 'react'; -import { EuiPanel } from '@elastic/eui'; -import useObservable from 'react-use/lib/useObservable'; -import { useKibana } from '../../hooks/use_kibana'; - -export function StreamsAppPageTemplate({ children }: { children: React.ReactNode }) { - const { - dependencies: { - start: { observabilityShared, navigation }, - }, - } = useKibana(); - - const { PageTemplate } = observabilityShared.navigation; - - const isSolutionNavEnabled = useObservable(navigation.isSolutionNavEnabled$); - - return ( - - - {children} - - - ); -} diff --git a/x-pack/solutions/observability/plugins/streams_app/public/plugin.ts b/x-pack/solutions/observability/plugins/streams_app/public/plugin.ts deleted file mode 100644 index dbe50f39b6308..0000000000000 --- a/x-pack/solutions/observability/plugins/streams_app/public/plugin.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { i18n } from '@kbn/i18n'; -import { map } from 'rxjs'; -import { - AppMountParameters, - AppUpdater, - CoreSetup, - CoreStart, - DEFAULT_APP_CATEGORIES, - Plugin, - PluginInitializerContext, -} from '@kbn/core/public'; -import type { Logger } from '@kbn/logging'; -import { STREAMS_APP_ID } from '@kbn/deeplinks-observability/constants'; -import { DataStreamsStatsService } from '@kbn/dataset-quality-plugin/public'; -import type { - ConfigSchema, - StreamsAppPublicSetup, - StreamsAppPublicStart, - StreamsAppSetupDependencies, - StreamsAppStartDependencies, -} from './types'; -import { StreamsAppServices } from './services/types'; - -export class StreamsAppPlugin - implements - Plugin< - StreamsAppPublicSetup, - StreamsAppPublicStart, - StreamsAppSetupDependencies, - StreamsAppStartDependencies - > -{ - logger: Logger; - - constructor(private readonly context: PluginInitializerContext) { - this.logger = context.logger.get(); - } - setup( - coreSetup: CoreSetup, - pluginsSetup: StreamsAppSetupDependencies - ): StreamsAppPublicSetup { - pluginsSetup.observabilityShared.navigation.registerSections( - pluginsSetup.streams.status$.pipe( - map(({ status }) => { - if (status !== 'enabled') { - return []; - } - - return [ - { - label: '', - sortKey: 101, - entries: [ - { - label: i18n.translate('xpack.streams.streamsAppLinkTitle', { - defaultMessage: 'Streams', - }), - app: STREAMS_APP_ID, - path: '/', - isTechnicalPreview: true, - matchPath(currentPath: string) { - return ['/', ''].some((testPath) => currentPath.startsWith(testPath)); - }, - }, - ], - }, - ]; - }) - ) - ); - - coreSetup.application.register({ - id: STREAMS_APP_ID, - title: i18n.translate('xpack.streams.appTitle', { - defaultMessage: 'Streams', - }), - euiIconType: 'logoObservability', - appRoute: '/app/streams', - category: DEFAULT_APP_CATEGORIES.observability, - order: 8001, - updater$: pluginsSetup.streams.status$.pipe( - map(({ status }): AppUpdater => { - return (app) => { - if (status !== 'enabled') { - return { - visibleIn: [], - deepLinks: [], - }; - } - - return { - visibleIn: ['sideNav', 'globalSearch'], - deepLinks: - status === 'enabled' - ? [ - { - id: 'streams', - title: i18n.translate('xpack.streams.streamsAppDeepLinkTitle', { - defaultMessage: 'Streams', - }), - path: '/', - }, - ] - : [], - }; - }; - }) - ), - mount: async (appMountParameters: AppMountParameters) => { - // Load application bundle and Get start services - const [{ renderApp }, [coreStart, pluginsStart]] = await Promise.all([ - import('./application'), - coreSetup.getStartServices(), - ]); - - const services: StreamsAppServices = { - dataStreamsClient: new DataStreamsStatsService() - .start({ http: coreStart.http }) - .getClient(), - }; - - return renderApp({ - coreStart, - pluginsStart, - services, - appMountParameters, - isServerless: this.context.env.packageInfo.buildFlavor === 'serverless', - }); - }, - }); - - return {}; - } - - start(coreStart: CoreStart, pluginsStart: StreamsAppStartDependencies): StreamsAppPublicStart { - return {}; - } -} diff --git a/yarn.lock b/yarn.lock index 585b1c82d2f7c..92442f18a62b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7670,11 +7670,15 @@ version "0.0.0" uid "" -"@kbn/streams-app-plugin@link:x-pack/solutions/observability/plugins/streams_app": +"@kbn/streams-app-plugin@link:x-pack/platform/plugins/shared/streams_app": version "0.0.0" uid "" -"@kbn/streams-plugin@link:x-pack/solutions/observability/plugins/streams": +"@kbn/streams-app-wrapper-plugin@link:x-pack/solutions/observability/plugins/observability_streams_wrapper": + version "0.0.0" + uid "" + +"@kbn/streams-plugin@link:x-pack/platform/plugins/shared/streams": version "0.0.0" uid ""