From 722f758156951996e6a695bd5b00ad1b0157cacd Mon Sep 17 00:00:00 2001 From: Gerard Soldevila Date: Fri, 8 Nov 2024 17:46:18 +0100 Subject: [PATCH] [8.x] Address some of the `no_group_crossing` dependencies (#198261) (#199165) # Backport This will backport the following commits from `main` to `8.x`: - [Address some of the `no_group_crossing` dependencies (#198261)](https://github.com/elastic/kibana/pull/198261) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .eslintrc.js | 50 ++++++------------- .../page/analytics_no_data/impl/kibana.jsonc | 4 +- .../page/analytics_no_data/mocks/kibana.jsonc | 4 +- .../page/analytics_no_data/types/kibana.jsonc | 4 +- .../selection/kibana.jsonc | 5 +- .../exploratory_view_example/kibana.jsonc | 2 + .../screenshotting_example/kibana.jsonc | 4 ++ .../ui_actions_enhanced_examples/kibana.jsonc | 4 ++ x-pack/packages/kbn-ai-assistant/kibana.jsonc | 4 +- .../security-solution/data_table/kibana.jsonc | 4 +- .../plugins/dashboard_enhanced/kibana.jsonc | 2 +- x-pack/plugins/data_quality/kibana.jsonc | 2 + x-pack/plugins/ingest_pipelines/kibana.jsonc | 2 + .../telemetry_collection/get_licenses.ts | 6 +-- x-pack/plugins/monitoring/tsconfig.json | 1 - .../observability_solution/infra/kibana.jsonc | 2 + .../inventory/kibana.jsonc | 2 + .../investigate_app/kibana.jsonc | 2 + .../lib/adapters/framework/adapter_types.ts | 2 - .../metrics_data_access/tsconfig.json | 1 - .../observability/common/typings.ts | 7 ++- .../alerts_table/common/get_columns.tsx | 31 ++---------- .../common/render_cell_value.test.tsx | 22 -------- .../alerts_table/common/render_cell_value.tsx | 19 +++---- .../alerts_table/slo/default_columns.tsx | 13 ++--- .../components/custom_threshold/types.ts | 48 +++++++++--------- .../pages/alerts/components/alert_actions.tsx | 6 +-- .../public/utils/test_helper.tsx | 3 +- .../observability/tsconfig.json | 2 - .../observability_ai_assistant/kibana.jsonc | 4 +- .../kibana.jsonc | 2 + .../public/helpers/test_helper.tsx | 3 +- .../tsconfig.json | 1 - .../slo/public/utils/test_helper.tsx | 3 +- .../observability_solution/slo/tsconfig.json | 1 - .../synthetics/e2e/kibana.jsonc | 2 + x-pack/plugins/screenshotting/kibana.jsonc | 2 +- x-pack/plugins/search_assistant/kibana.jsonc | 2 + .../server/index.ts | 2 - .../es_deprecation_logs.test.tsx | 3 -- .../helpers/app_context.mock.ts | 1 - x-pack/plugins/upgrade_assistant/kibana.jsonc | 3 +- .../upgrade_assistant/public/plugin.ts | 6 +-- .../plugins/upgrade_assistant/public/types.ts | 1 - 44 files changed, 121 insertions(+), 173 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index f751c9692c996..730c9599f23f9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1992,43 +1992,23 @@ module.exports = { }, { files: [ - 'packages/kbn-reporting/common/**', // TODO @elastic/appex-sharedux - A package depending on a plugin: @kbn/screenshotting-plugin, can we move theser interfaces to a platform/shared package? - 'packages/kbn-reporting/export_types/pdf_common/**', // TODO @elastic/appex-sharedux - A package depending on a plugin: @kbn/screenshotting-plugin, can we move theser interfaces to a platform/shared package? - 'packages/kbn-reporting/export_types/pdf/**', // TODO @elastic/appex-sharedux - A package depending on a plugin: @kbn/screenshotting-plugin, can we move theser interfaces to a platform/shared package? - 'packages/kbn-reporting/export_types/png_common/**', // TODO @elastic/appex-sharedux - A package depending on a plugin: @kbn/screenshotting-plugin, can we move theser interfaces to a platform/shared package? - 'packages/kbn-reporting/export_types/png/**', // TODO @elastic/appex-sharedux - A package depending on a plugin: @kbn/screenshotting-plugin, can we move theser interfaces to a platform/shared package? - 'packages/kbn-reporting/public/**', // TODO @elastic/appex-sharedux - A package depending on a plugin: @kbn/screenshotting-plugin, can we move theser interfaces to a platform/shared package? - 'packages/kbn-reporting/server/**', // TODO @elastic/appex-sharedux - A package depending on a plugin: @kbn/screenshotting-plugin, can we move theser interfaces to a platform/shared package? - 'packages/shared-ux/page/analytics_no_data/types/**', - 'scripts/create_observability_rules.js', // TODO - is importing "@kbn/observability-alerting-test-data" (observability/private) - 'src/cli_setup/**', // TODO @kibana/operations - is importing "@kbn/interactive-setup-plugin" (platform/private) - 'src/dev/build/tasks/install_chromium.ts', // TODO @kibana/operations - is importing "@kbn/screenshotting-plugin" (platform/private) - 'src/plugins/ai_assistant_management/selection/**', - 'src/plugins/dashboard/**', - 'src/plugins/discover/**', - 'test/**', - 'x-pack/examples/exploratory_view_example/**', - 'x-pack/examples/screenshotting_example/**', - 'x-pack/examples/ui_actions_enhanced_examples/**', - 'x-pack/packages/security-solution/data_table/**', - 'x-pack/plugins/aiops/**', - 'x-pack/plugins/data_quality/**', - 'x-pack/plugins/ingest_pipelines/**', - 'x-pack/plugins/ml/**', - 'x-pack/plugins/monitoring/**', - 'x-pack/plugins/observability_solution/infra/**', - 'x-pack/plugins/observability_solution/inventory/**', - 'x-pack/plugins/observability_solution/investigate_app/**', - 'x-pack/plugins/observability_solution/investigate/**', + // logsShared depends on o11y/private plugins, but platform plugins depend on it 'x-pack/plugins/observability_solution/logs_shared/**', - 'x-pack/plugins/observability_solution/metrics_data_access/**', - 'x-pack/plugins/observability_solution/observability_ai_assistant_app/**', - 'x-pack/plugins/observability_solution/observability_ai_assistant_management/**', - 'x-pack/plugins/observability_solution/observability/**', - 'x-pack/plugins/observability_solution/slo/**', - 'x-pack/plugins/observability_solution/synthetics/e2e/**', + + // this plugin depends on visTypeTimeseries plugin (for TSVB viz) which is platform/private ATM + 'x-pack/plugins/observability_solution/infra/**', + + // TODO @kibana/operations + 'scripts/create_observability_rules.js', // is importing "@kbn/observability-alerting-test-data" (observability/private) + 'src/cli_setup/**', // is importing "@kbn/interactive-setup-plugin" (platform/private) + 'src/dev/build/tasks/install_chromium.ts', // is importing "@kbn/screenshotting-plugin" (platform/private) + + // @kbn/osquery-plugin could be categorised as Security, but @kbn/infra-plugin (observability) depends on it! 'x-pack/plugins/osquery/**', - 'x-pack/plugins/search_assistant/**', + + // For now, we keep the exception to let tests depend on anythying. + // Ideally, we need to classify the solution specific ones to reduce CI times + 'test/**', 'x-pack/test_serverless/**', 'x-pack/test/**', 'x-pack/test/plugin_functional/plugins/resolver_test/**', diff --git a/packages/shared-ux/page/analytics_no_data/impl/kibana.jsonc b/packages/shared-ux/page/analytics_no_data/impl/kibana.jsonc index b8690de58bdb9..45c7a028be286 100644 --- a/packages/shared-ux/page/analytics_no_data/impl/kibana.jsonc +++ b/packages/shared-ux/page/analytics_no_data/impl/kibana.jsonc @@ -1,5 +1,7 @@ { "type": "shared-browser", "id": "@kbn/shared-ux-page-analytics-no-data", - "owner": "@elastic/appex-sharedux" + "owner": "@elastic/appex-sharedux", + "group": "platform", + "visibility": "private" } diff --git a/packages/shared-ux/page/analytics_no_data/mocks/kibana.jsonc b/packages/shared-ux/page/analytics_no_data/mocks/kibana.jsonc index cde1666e15f14..e7d570e4239e6 100644 --- a/packages/shared-ux/page/analytics_no_data/mocks/kibana.jsonc +++ b/packages/shared-ux/page/analytics_no_data/mocks/kibana.jsonc @@ -1,5 +1,7 @@ { "type": "shared-common", "id": "@kbn/shared-ux-page-analytics-no-data-mocks", - "owner": "@elastic/appex-sharedux" + "owner": "@elastic/appex-sharedux", + "group": "platform", + "visibility": "private" } diff --git a/packages/shared-ux/page/analytics_no_data/types/kibana.jsonc b/packages/shared-ux/page/analytics_no_data/types/kibana.jsonc index df5498181fe69..fd1740c0d757e 100644 --- a/packages/shared-ux/page/analytics_no_data/types/kibana.jsonc +++ b/packages/shared-ux/page/analytics_no_data/types/kibana.jsonc @@ -1,5 +1,7 @@ { "type": "shared-browser", "id": "@kbn/shared-ux-page-analytics-no-data-types", - "owner": "@elastic/appex-sharedux" + "owner": "@elastic/appex-sharedux", + "group": "platform", + "visibility": "private" } diff --git a/src/plugins/ai_assistant_management/selection/kibana.jsonc b/src/plugins/ai_assistant_management/selection/kibana.jsonc index 715b90f1d4d79..74640423685a9 100644 --- a/src/plugins/ai_assistant_management/selection/kibana.jsonc +++ b/src/plugins/ai_assistant_management/selection/kibana.jsonc @@ -4,8 +4,9 @@ "owner": [ "@elastic/obs-knowledge-team" ], + // This should probably be platform. While the code owner is currently observability, the package is a platform AI assistant selector. "group": "platform", - "visibility": "private", + "visibility": "shared", "plugin": { "id": "aiAssistantManagementSelection", "browser": true, @@ -25,4 +26,4 @@ "kibanaReact" ] } -} \ No newline at end of file +} diff --git a/x-pack/examples/exploratory_view_example/kibana.jsonc b/x-pack/examples/exploratory_view_example/kibana.jsonc index 6cf8fa64983ac..cf077336b0f90 100644 --- a/x-pack/examples/exploratory_view_example/kibana.jsonc +++ b/x-pack/examples/exploratory_view_example/kibana.jsonc @@ -2,6 +2,8 @@ "type": "plugin", "id": "@kbn/exploratory-view-example-plugin", "owner": "@elastic/obs-ux-infra_services-team", + "group": "observability", + "visibility": "private", "plugin": { "id": "exploratoryViewExample", "server": false, diff --git a/x-pack/examples/screenshotting_example/kibana.jsonc b/x-pack/examples/screenshotting_example/kibana.jsonc index 127706ad42e3d..3519bc91caa66 100644 --- a/x-pack/examples/screenshotting_example/kibana.jsonc +++ b/x-pack/examples/screenshotting_example/kibana.jsonc @@ -2,6 +2,10 @@ "type": "plugin", "id": "@kbn/screenshotting-example-plugin", "owner": "@elastic/appex-sharedux", + // This plugin is not meant to be referenced or imported + "visibility": "private", + // If cloned / used as an inspiration, please bear in mind that your plugin might belong to a specific solution group + "group": "platform", "description": "An example integration with the screenshotting plugin.", "plugin": { "id": "screenshottingExample", diff --git a/x-pack/examples/ui_actions_enhanced_examples/kibana.jsonc b/x-pack/examples/ui_actions_enhanced_examples/kibana.jsonc index 1da3e4f182875..25211ae2063bd 100644 --- a/x-pack/examples/ui_actions_enhanced_examples/kibana.jsonc +++ b/x-pack/examples/ui_actions_enhanced_examples/kibana.jsonc @@ -2,6 +2,10 @@ "type": "plugin", "id": "@kbn/ui-actions-enhanced-examples-plugin", "owner": "@elastic/appex-sharedux", + // This plugin is not meant to be referenced or imported + "visibility": "private", + // If cloned / used as an inspiration, please bear in mind that your plugin might belong to a specific solution group + "group": "platform", "plugin": { "id": "uiActionsEnhancedExamples", "server": false, diff --git a/x-pack/packages/kbn-ai-assistant/kibana.jsonc b/x-pack/packages/kbn-ai-assistant/kibana.jsonc index f8da31c9d6749..625dedc6c99f4 100644 --- a/x-pack/packages/kbn-ai-assistant/kibana.jsonc +++ b/x-pack/packages/kbn-ai-assistant/kibana.jsonc @@ -2,6 +2,6 @@ "id": "@kbn/ai-assistant", "owner": "@elastic/search-kibana", "type": "shared-browser", - "group": "observability", - "visibility": "private" + "group": "platform", + "visibility": "shared" } diff --git a/x-pack/packages/security-solution/data_table/kibana.jsonc b/x-pack/packages/security-solution/data_table/kibana.jsonc index 5298db752359f..9695411a65301 100644 --- a/x-pack/packages/security-solution/data_table/kibana.jsonc +++ b/x-pack/packages/security-solution/data_table/kibana.jsonc @@ -1,5 +1,7 @@ { "type": "shared-common", "id": "@kbn/securitysolution-data-table", - "owner": "@elastic/security-threat-hunting-investigations" + "owner": "@elastic/security-threat-hunting-investigations", + "group": "security", + "visibility": "private" } diff --git a/x-pack/plugins/dashboard_enhanced/kibana.jsonc b/x-pack/plugins/dashboard_enhanced/kibana.jsonc index 36f8a02e65ce9..bdf9ac804bac3 100644 --- a/x-pack/plugins/dashboard_enhanced/kibana.jsonc +++ b/x-pack/plugins/dashboard_enhanced/kibana.jsonc @@ -5,7 +5,7 @@ "@elastic/kibana-presentation" ], "group": "platform", - "visibility": "private", + "visibility": "shared", "plugin": { "id": "dashboardEnhanced", "browser": true, diff --git a/x-pack/plugins/data_quality/kibana.jsonc b/x-pack/plugins/data_quality/kibana.jsonc index ad1a64d4ed140..dc54e20f40bd7 100644 --- a/x-pack/plugins/data_quality/kibana.jsonc +++ b/x-pack/plugins/data_quality/kibana.jsonc @@ -2,6 +2,8 @@ "type": "plugin", "id": "@kbn/data-quality-plugin", "owner": "@elastic/obs-ux-logs-team", + "group": "observability", + "visibility": "private", "plugin": { "id": "dataQuality", "server": true, diff --git a/x-pack/plugins/ingest_pipelines/kibana.jsonc b/x-pack/plugins/ingest_pipelines/kibana.jsonc index 55fa46c61b377..85b3e43aedf4d 100644 --- a/x-pack/plugins/ingest_pipelines/kibana.jsonc +++ b/x-pack/plugins/ingest_pipelines/kibana.jsonc @@ -2,6 +2,8 @@ "type": "plugin", "id": "@kbn/ingest-pipelines-plugin", "owner": "@elastic/kibana-management", + "group": "platform", + "visibility": "shared", "plugin": { "id": "ingestPipelines", "server": true, diff --git a/x-pack/plugins/monitoring/server/telemetry_collection/get_licenses.ts b/x-pack/plugins/monitoring/server/telemetry_collection/get_licenses.ts index 4ea0077c21ba8..98f3932984546 100644 --- a/x-pack/plugins/monitoring/server/telemetry_collection/get_licenses.ts +++ b/x-pack/plugins/monitoring/server/telemetry_collection/get_licenses.ts @@ -7,7 +7,7 @@ import { ElasticsearchClient } from '@kbn/core/server'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import { ESLicense } from '@kbn/telemetry-collection-xpack-plugin/server'; +import type { LicenseGetLicenseInformation } from '@elastic/elasticsearch/lib/api/types'; import { INDEX_PATTERN_ELASTICSEARCH, USAGE_FETCH_INTERVAL } from '../../common/constants'; /** @@ -18,7 +18,7 @@ export async function getLicenses( callCluster: ElasticsearchClient, timestamp: number, maxBucketSize: number -): Promise<{ [clusterUuid: string]: ESLicense | undefined }> { +): Promise<{ [clusterUuid: string]: LicenseGetLicenseInformation | undefined }> { const response = await fetchLicenses(callCluster, clusterUuids, timestamp, maxBucketSize); return handleLicenses(response); } @@ -76,7 +76,7 @@ export async function fetchLicenses( export interface ESClusterStatsWithLicense { cluster_uuid: string; type: 'cluster_stats'; - license?: ESLicense; + license?: LicenseGetLicenseInformation; } /** diff --git a/x-pack/plugins/monitoring/tsconfig.json b/x-pack/plugins/monitoring/tsconfig.json index 957b256bd726b..3b78104e65b8c 100644 --- a/x-pack/plugins/monitoring/tsconfig.json +++ b/x-pack/plugins/monitoring/tsconfig.json @@ -19,7 +19,6 @@ "@kbn/features-plugin", "@kbn/infra-plugin", "@kbn/licensing-plugin", - "@kbn/telemetry-collection-xpack-plugin", "@kbn/triggers-actions-ui-plugin", "@kbn/expect", "@kbn/i18n", diff --git a/x-pack/plugins/observability_solution/infra/kibana.jsonc b/x-pack/plugins/observability_solution/infra/kibana.jsonc index 0f039fb02e356..6bcc6ef7259b4 100644 --- a/x-pack/plugins/observability_solution/infra/kibana.jsonc +++ b/x-pack/plugins/observability_solution/infra/kibana.jsonc @@ -2,6 +2,8 @@ "type": "plugin", "id": "@kbn/infra-plugin", "owner": ["@elastic/obs-ux-logs-team", "@elastic/obs-ux-infra_services-team"], + "group": "observability", + "visibility": "private", "description": "This plugin visualizes data from Filebeat and Metricbeat, and integrates with other Observability solutions", "plugin": { "id": "infra", diff --git a/x-pack/plugins/observability_solution/inventory/kibana.jsonc b/x-pack/plugins/observability_solution/inventory/kibana.jsonc index fc77163ae3c5f..e7cc398c9c655 100644 --- a/x-pack/plugins/observability_solution/inventory/kibana.jsonc +++ b/x-pack/plugins/observability_solution/inventory/kibana.jsonc @@ -2,6 +2,8 @@ "type": "plugin", "id": "@kbn/inventory-plugin", "owner": "@elastic/obs-ux-infra_services-team", + "group": "observability", + "visibility": "private", "plugin": { "id": "inventory", "server": true, diff --git a/x-pack/plugins/observability_solution/investigate_app/kibana.jsonc b/x-pack/plugins/observability_solution/investigate_app/kibana.jsonc index e55dc03c83266..9b8284808a657 100644 --- a/x-pack/plugins/observability_solution/investigate_app/kibana.jsonc +++ b/x-pack/plugins/observability_solution/investigate_app/kibana.jsonc @@ -2,6 +2,8 @@ "type": "plugin", "id": "@kbn/investigate-app-plugin", "owner": "@elastic/obs-ux-management-team", + "group": "observability", + "visibility": "private", "plugin": { "id": "investigateApp", "server": true, diff --git a/x-pack/plugins/observability_solution/metrics_data_access/server/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/observability_solution/metrics_data_access/server/lib/adapters/framework/adapter_types.ts index daea1177b19f8..246988ed96307 100644 --- a/x-pack/plugins/observability_solution/metrics_data_access/server/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/observability_solution/metrics_data_access/server/lib/adapters/framework/adapter_types.ts @@ -17,7 +17,6 @@ import { } from '@kbn/data-plugin/server'; import { PluginStart as DataViewsPluginStart } from '@kbn/data-views-plugin/server'; import { HomeServerPluginSetup } from '@kbn/home-plugin/server'; -import { VisTypeTimeseriesSetup } from '@kbn/vis-type-timeseries-plugin/server'; import { FeaturesPluginSetup } from '@kbn/features-plugin/server'; import { SpacesPluginSetup } from '@kbn/spaces-plugin/server'; import { PluginSetupContract as AlertingPluginContract } from '@kbn/alerting-plugin/server'; @@ -37,7 +36,6 @@ export interface InfraServerPluginSetupDeps { share: SharePluginSetup; spaces: SpacesPluginSetup; usageCollection: UsageCollectionSetup; - visTypeTimeseries: VisTypeTimeseriesSetup; ml?: MlPluginSetup; metricsDataAccess: MetricsDataPluginSetup; } diff --git a/x-pack/plugins/observability_solution/metrics_data_access/tsconfig.json b/x-pack/plugins/observability_solution/metrics_data_access/tsconfig.json index 0c2c471a6bf77..2889bddc82393 100644 --- a/x-pack/plugins/observability_solution/metrics_data_access/tsconfig.json +++ b/x-pack/plugins/observability_solution/metrics_data_access/tsconfig.json @@ -16,7 +16,6 @@ "@kbn/data-plugin", "@kbn/data-views-plugin", "@kbn/home-plugin", - "@kbn/vis-type-timeseries-plugin", "@kbn/features-plugin", "@kbn/spaces-plugin", "@kbn/alerting-plugin", diff --git a/x-pack/plugins/observability_solution/observability/common/typings.ts b/x-pack/plugins/observability_solution/observability/common/typings.ts index 03981f5941dc2..6c4eb09b284b7 100644 --- a/x-pack/plugins/observability_solution/observability/common/typings.ts +++ b/x-pack/plugins/observability_solution/observability/common/typings.ts @@ -11,7 +11,7 @@ import { ALERT_STATUS_RECOVERED, ALERT_STATUS_UNTRACKED, } from '@kbn/rule-data-utils'; -import { Filter } from '@kbn/es-query'; +import type { Filter } from '@kbn/es-query'; import { ALERT_STATUS_ALL } from './constants'; export type Maybe = T | null | undefined; @@ -54,5 +54,10 @@ export interface TimeRange { to?: string; } +export interface EventNonEcsData { + field: string; + value?: Maybe; +} + // Alert fields['kibana.alert.group] type export type GroupBy = Group[]; diff --git a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/get_columns.tsx b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/get_columns.tsx index 2d2c1b1c299cf..fa2f10c3516e7 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/get_columns.tsx +++ b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/get_columns.tsx @@ -5,11 +5,7 @@ * 2.0. */ -/** - * We need to produce types and code transpilation at different folders during the build of the package. - * We have types and code at different imports because we don't want to import the whole package in the resulting webpack bundle for the plugin. - * This way plugins can do targeted imports to reduce the final code bundle - */ +import type { EuiDataGridColumn } from '@elastic/eui'; import { ALERT_EVALUATION_VALUE, ALERT_EVALUATION_THRESHOLD, @@ -21,30 +17,18 @@ import { ALERT_INSTANCE_ID, TAGS, } from '@kbn/rule-data-utils'; -import { EuiDataGridColumn } from '@elastic/eui'; -import type { ColumnHeaderOptions } from '@kbn/timelines-plugin/common'; import { i18n } from '@kbn/i18n'; -/** - * columns implements a subset of `EuiDataGrid`'s `EuiDataGridColumn` interface, - * plus additional TGrid column properties - */ export const getColumns = ( { showRuleName, }: { showRuleName?: boolean; } = { showRuleName: false } -): Array< - Pick & ColumnHeaderOptions -> => { - const ruleNameColumn: Array< - Pick & - ColumnHeaderOptions - > = showRuleName +): EuiDataGridColumn[] => { + const ruleNameColumn: EuiDataGridColumn[] = showRuleName ? [ { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate( 'xpack.observability.alertsTGrid.ruleNameColumnDescription', { @@ -59,7 +43,6 @@ export const getColumns = ( return [ { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate('xpack.observability.alertsTGrid.statusColumnDescription', { defaultMessage: 'Alert Status', }), @@ -67,7 +50,6 @@ export const getColumns = ( initialWidth: 120, }, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate('xpack.observability.alertsTGrid.triggeredColumnDescription', { defaultMessage: 'Triggered', }), @@ -76,7 +58,6 @@ export const getColumns = ( schema: 'datetime', }, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate('xpack.observability.alertsTGrid.durationColumnDescription', { defaultMessage: 'Duration', }), @@ -85,7 +66,6 @@ export const getColumns = ( }, ...ruleNameColumn, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate('xpack.observability.alertsTGrid.sourceColumnDescription', { defaultMessage: 'Group', }), @@ -93,7 +73,6 @@ export const getColumns = ( initialWidth: 100, }, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate( 'xpack.observability.alertsTGrid.observedValueColumnDescription', { @@ -104,7 +83,6 @@ export const getColumns = ( initialWidth: 100, }, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate('xpack.observability.alertsTGrid.thresholdColumnDescription', { defaultMessage: 'Threshold', }), @@ -112,7 +90,6 @@ export const getColumns = ( initialWidth: 100, }, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate('xpack.observability.alertsTGrid.tagsColumnDescription', { defaultMessage: 'Tags', }), @@ -120,12 +97,10 @@ export const getColumns = ( initialWidth: 150, }, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate('xpack.observability.alertsTGrid.reasonColumnDescription', { defaultMessage: 'Reason', }), id: ALERT_REASON, - linkField: '*', }, ]; }; diff --git a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/render_cell_value.test.tsx b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/render_cell_value.test.tsx index d551f90f1097f..d9d01d85c5303 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/render_cell_value.test.tsx +++ b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/render_cell_value.test.tsx @@ -6,7 +6,6 @@ */ import { ALERT_STATUS, ALERT_STATUS_ACTIVE, ALERT_STATUS_RECOVERED } from '@kbn/rule-data-utils'; -import type { DeprecatedCellValueElementProps } from '@kbn/timelines-plugin/common'; import { render } from '../../../utils/test_helper'; import { getRenderCellValue } from './render_cell_value'; @@ -19,7 +18,6 @@ describe('getRenderCellValue', () => { it('should return an active indicator when alert status is active', async () => { const cell = render( getRenderCellValue({ - ...requiredProperties, columnId: ALERT_STATUS, data: makeAlertsTableRow({ alertStatus: ALERT_STATUS_ACTIVE }), }) @@ -31,7 +29,6 @@ describe('getRenderCellValue', () => { it('should return a recovered indicator when alert status is recovered', async () => { const cell = render( getRenderCellValue({ - ...requiredProperties, columnId: ALERT_STATUS, data: makeAlertsTableRow({ alertStatus: ALERT_STATUS_RECOVERED }), }) @@ -50,22 +47,3 @@ function makeAlertsTableRow({ alertStatus }: AlertsTableRow) { }, ]; } - -const requiredProperties: DeprecatedCellValueElementProps = { - rowIndex: 0, - colIndex: 0, - columnId: '', - setCellProps: jest.fn(), - isExpandable: false, - isExpanded: false, - isDetails: false, - data: [], - eventId: '', - header: { - id: '', - columnHeaderType: 'not-filtered', - }, - isDraggable: false, - linkValues: [], - scopeId: '', -}; diff --git a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/render_cell_value.tsx b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/render_cell_value.tsx index 6f6eb54a333d1..23757f889e058 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/render_cell_value.tsx +++ b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/common/render_cell_value.tsx @@ -23,7 +23,7 @@ import { ALERT_RULE_EXECUTION_TIMESTAMP, } from '@kbn/rule-data-utils'; import { isEmpty } from 'lodash'; -import type { TimelineNonEcsData } from '@kbn/timelines-plugin/common'; +import type { EventNonEcsData } from '../../../../common/typings'; import type { ObservabilityRuleTypeRegistry } from '../../..'; import { asDuration } from '../../../../common/utils/formatters'; import { AlertSeverityBadge } from '../../alert_severity_badge'; @@ -36,7 +36,7 @@ export const getMappedNonEcsValue = ({ data, fieldName, }: { - data: TimelineNonEcsData[]; + data: EventNonEcsData[]; fieldName: string; }): string[] | undefined => { const item = data.find((d) => d.field === fieldName); @@ -64,23 +64,24 @@ const getRenderValue = (mappedNonEcsValue: any) => { return '--'; }; +interface GetRenderCellValueParams { + columnId: string; + data?: EventNonEcsData[]; + setFlyoutAlert?: (alertId: string) => void; + observabilityRuleTypeRegistry?: ObservabilityRuleTypeRegistry; +} + /** * This implementation of `EuiDataGrid`'s `renderCellValue` * accepts `EuiDataGridCellValueElementProps`, plus `data` * from the TGrid */ - export const getRenderCellValue = ({ columnId, data, setFlyoutAlert, observabilityRuleTypeRegistry, -}: { - columnId: string; - data?: Array<{ field: string; value: any }>; - setFlyoutAlert?: (alertId: string) => void; - observabilityRuleTypeRegistry?: ObservabilityRuleTypeRegistry; -}) => { +}: GetRenderCellValueParams) => { if (!data) return null; const mappedNonEcsValue = getMappedNonEcsValue({ data, diff --git a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/default_columns.tsx b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/default_columns.tsx index ea67c7c158e83..3796667e2583f 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/default_columns.tsx +++ b/x-pack/plugins/observability_solution/observability/public/components/alerts_table/slo/default_columns.tsx @@ -10,20 +10,17 @@ * We have types and code at different imports because we don't want to import the whole package in the resulting webpack bundle for the plugin. * This way plugins can do targeted imports to reduce the final code bundle */ + +import type { EuiDataGridColumn } from '@elastic/eui'; import { ALERT_DURATION, ALERT_REASON, ALERT_STATUS, ALERT_RULE_NAME } from '@kbn/rule-data-utils'; -import { EuiDataGridColumn } from '@elastic/eui'; -import type { ColumnHeaderOptions } from '@kbn/timelines-plugin/common'; import { i18n } from '@kbn/i18n'; /** * columns implements a subset of `EuiDataGrid`'s `EuiDataGridColumn` interface, * plus additional TGrid column properties */ -export const columns: Array< - Pick & ColumnHeaderOptions -> = [ +export const columns: EuiDataGridColumn[] = [ { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate( 'xpack.observability.slo.sloAlertsEmbeddable.alertsTGrid.statusColumnDescription', { @@ -34,7 +31,6 @@ export const columns: Array< initialWidth: 110, }, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate( 'xpack.observability.slo.sloAlertsEmbeddable.alertsTGrid.durationColumnDescription', { @@ -45,7 +41,6 @@ export const columns: Array< initialWidth: 116, }, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate( 'xpack.observability.slo.sloAlertsEmbeddable.alertsTGrid.sloColumnDescription', { @@ -56,7 +51,6 @@ export const columns: Array< initialWidth: 110, }, { - columnHeaderType: 'not-filtered', displayAsText: i18n.translate( 'xpack.observability.slo.sloAlertsEmbeddable.alertsTGrid.reasonColumnDescription', { @@ -64,6 +58,5 @@ export const columns: Array< } ), id: ALERT_REASON, - linkField: '*', }, ]; diff --git a/x-pack/plugins/observability_solution/observability/public/components/custom_threshold/types.ts b/x-pack/plugins/observability_solution/observability/public/components/custom_threshold/types.ts index 891661b6bc82a..2c04cdf8f0767 100644 --- a/x-pack/plugins/observability_solution/observability/public/components/custom_threshold/types.ts +++ b/x-pack/plugins/observability_solution/observability/public/components/custom_threshold/types.ts @@ -6,35 +6,36 @@ */ import * as rt from 'io-ts'; -import { CasesPublicStart } from '@kbn/cases-plugin/public'; -import { ChartsPluginStart } from '@kbn/charts-plugin/public'; -import { DataPublicPluginStart } from '@kbn/data-plugin/public'; -import { DataView, DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; -import { DiscoverStart } from '@kbn/discover-plugin/public'; -import { EmbeddableStart } from '@kbn/embeddable-plugin/public'; -import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; -import { LensPublicStart } from '@kbn/lens-plugin/public'; -import { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; -import { OsqueryPluginStart } from '@kbn/osquery-plugin/public'; +import type { CasesPublicStart } from '@kbn/cases-plugin/public'; +import type { ChartsPluginStart } from '@kbn/charts-plugin/public'; +import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; +import type { DataView, DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; +import type { DiscoverStart } from '@kbn/discover-plugin/public'; +import type { EmbeddableStart } from '@kbn/embeddable-plugin/public'; +import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; +import type { LensPublicStart } from '@kbn/lens-plugin/public'; +import type { ObservabilitySharedPluginStart } from '@kbn/observability-shared-plugin/public'; +import type { OsqueryPluginStart } from '@kbn/osquery-plugin/public'; import { ALERT_GROUP, ALERT_RULE_PARAMETERS } from '@kbn/rule-data-utils'; -import { SharePluginStart } from '@kbn/share-plugin/public'; -import { SpacesPluginStart } from '@kbn/spaces-plugin/public'; -import { +import type { SharePluginStart } from '@kbn/share-plugin/public'; +import type { SpacesPluginStart } from '@kbn/spaces-plugin/public'; +import type { RuleTypeParams, TriggersAndActionsUIPublicPluginStart, } from '@kbn/triggers-actions-ui-plugin/public'; -import { UiActionsStart } from '@kbn/ui-actions-plugin/public'; -import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; -import { UsageCollectionStart } from '@kbn/usage-collection-plugin/public'; +import type { UiActionsStart } from '@kbn/ui-actions-plugin/public'; +import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import type { UsageCollectionStart } from '@kbn/usage-collection-plugin/public'; +import type { Group } from '../../../common/typings'; import { aggType, - CustomThresholdSearchSourceFields, - BaseMetricExpressionParams, - CustomMetricExpressionParams, - MetricExpressionParams, - ThresholdParams, + type CustomThresholdSearchSourceFields, + type BaseMetricExpressionParams, + type CustomMetricExpressionParams, + type MetricExpressionParams, + type ThresholdParams, } from '../../../common/custom_threshold_rule/types'; -import { ObservabilityPublicStart } from '../../plugin'; +import type { ObservabilityPublicStart } from '../../plugin'; export type CustomThresholdPrefillOptions = Partial< Omit & { criteria: Array> } @@ -90,8 +91,9 @@ export interface CustomThresholdRuleTypeParams extends RuleTypeParams { searchConfiguration: CustomThresholdSearchSourceFields; groupBy?: string | string[]; } + export interface CustomThresholdAlertFields { - [ALERT_GROUP]?: Array<{ field: string; value: string }>; + [ALERT_GROUP]?: Group[]; [ALERT_RULE_PARAMETERS]: CustomThresholdRuleTypeParams; } diff --git a/x-pack/plugins/observability_solution/observability/public/pages/alerts/components/alert_actions.tsx b/x-pack/plugins/observability_solution/observability/public/pages/alerts/components/alert_actions.tsx index f591347b17238..071b75ab89632 100644 --- a/x-pack/plugins/observability_solution/observability/public/pages/alerts/components/alert_actions.tsx +++ b/x-pack/plugins/observability_solution/observability/public/pages/alerts/components/alert_actions.tsx @@ -19,15 +19,15 @@ import { i18n } from '@kbn/i18n'; import { CaseAttachmentsWithoutOwner } from '@kbn/cases-plugin/public'; import { AttachmentType } from '@kbn/cases-plugin/common'; import { EcsSecurityExtension as Ecs } from '@kbn/securitysolution-ecs'; -import { TimelineNonEcsData } from '@kbn/timelines-plugin/common'; import type { AlertActionsProps } from '@kbn/triggers-actions-ui-plugin/public/types'; import { useRouteMatch } from 'react-router-dom'; import { SLO_ALERTS_TABLE_ID } from '@kbn/observability-shared-plugin/common'; +import type { EventNonEcsData } from '../../../../common/typings'; import { RULE_DETAILS_PAGE_ID } from '../../rule_details/constants'; import { paths, SLO_DETAIL_PATH } from '../../../../common/locators/paths'; import { useKibana } from '../../../utils/kibana_react'; import { parseAlert } from '../helpers/parse_alert'; -import { observabilityFeatureId, ObservabilityRuleTypeRegistry } from '../../..'; +import { observabilityFeatureId, type ObservabilityRuleTypeRegistry } from '../../..'; import type { ConfigSchema } from '../../../plugin'; import { ALERT_DETAILS_PAGE_ID } from '../../alert_details/alert_details'; @@ -58,7 +58,7 @@ export function AlertActions({ const data = useMemo( () => - Object.entries(alert ?? {}).reduce( + Object.entries(alert ?? {}).reduce( (acc, [field, value]) => [...acc, { field, value: value as string[] }], [] ), diff --git a/x-pack/plugins/observability_solution/observability/public/utils/test_helper.tsx b/x-pack/plugins/observability_solution/observability/public/utils/test_helper.tsx index dca5d29851469..16184c5621594 100644 --- a/x-pack/plugins/observability_solution/observability/public/utils/test_helper.tsx +++ b/x-pack/plugins/observability_solution/observability/public/utils/test_helper.tsx @@ -14,7 +14,6 @@ import { coreMock } from '@kbn/core/public/mocks'; import { __IntlProvider as IntlProvider } from '@kbn/i18n-react'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; -import translations from '@kbn/translations-plugin/translations/ja-JP.json'; import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; @@ -52,7 +51,7 @@ const queryClient = new QueryClient({ export const render = (component: React.ReactNode, config: Subset = {}) => { return testLibRender( - + + diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant_management/tsconfig.json b/x-pack/plugins/observability_solution/observability_ai_assistant_management/tsconfig.json index 99bce73e1722f..f0ad230f6f1b3 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant_management/tsconfig.json +++ b/x-pack/plugins/observability_solution/observability_ai_assistant_management/tsconfig.json @@ -19,7 +19,6 @@ "@kbn/core-chrome-browser", "@kbn/observability-ai-assistant-plugin", "@kbn/serverless", - "@kbn/translations-plugin", "@kbn/enterprise-search-plugin", "@kbn/management-settings-components-field-row", "@kbn/observability-shared-plugin", diff --git a/x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx b/x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx index 1fe6ece726610..014644d973b74 100644 --- a/x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx +++ b/x-pack/plugins/observability_solution/slo/public/utils/test_helper.tsx @@ -13,7 +13,6 @@ import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { createObservabilityRuleTypeRegistryMock } from '@kbn/observability-plugin/public'; import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template'; -import translations from '@kbn/translations-plugin/translations/ja-JP.json'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { render as testLibRender } from '@testing-library/react'; import React from 'react'; @@ -43,7 +42,7 @@ const queryClient = new QueryClient({ export const render = (component: React.ReactNode) => { return testLibRender( // @ts-ignore - + { prepend: (url: string) => url, }, }, - plugins: { - infra: {}, - }, }); }); diff --git a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/app_context.mock.ts b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/app_context.mock.ts index 0583c79eb3eff..31fd69648418f 100644 --- a/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/app_context.mock.ts +++ b/x-pack/plugins/upgrade_assistant/__jest__/client_integration/helpers/app_context.mock.ts @@ -108,7 +108,6 @@ export const getAppContextMock = (kibanaVersion: SemVer) => ({ }, plugins: { share: shareMock, - infra: undefined, cloud: { ...cloudMock.createSetup(), isCloudEnabled: false, diff --git a/x-pack/plugins/upgrade_assistant/kibana.jsonc b/x-pack/plugins/upgrade_assistant/kibana.jsonc index a339a06c9e60d..55a08297937bb 100644 --- a/x-pack/plugins/upgrade_assistant/kibana.jsonc +++ b/x-pack/plugins/upgrade_assistant/kibana.jsonc @@ -2,6 +2,8 @@ "type": "plugin", "id": "@kbn/upgrade-assistant-plugin", "owner": "@elastic/kibana-management", + "group": "platform", + "visibility": "private", "plugin": { "id": "upgradeAssistant", "server": true, @@ -21,7 +23,6 @@ "usageCollection", "cloud", "security", - "infra", "logsShared" ], "requiredBundles": [ diff --git a/x-pack/plugins/upgrade_assistant/public/plugin.ts b/x-pack/plugins/upgrade_assistant/public/plugin.ts index 694e29cd7cee3..ceeb674fef961 100644 --- a/x-pack/plugins/upgrade_assistant/public/plugin.ts +++ b/x-pack/plugins/upgrade_assistant/public/plugin.ts @@ -51,7 +51,7 @@ export class UpgradeAssistantUIPlugin title: pluginName, order: 1, async mount(params) { - const [coreStart, { data, ...plugins }] = await coreSetup.getStartServices(); + const [coreStart, { data }] = await coreSetup.getStartServices(); const { chrome: { docTitle }, @@ -65,10 +65,6 @@ export class UpgradeAssistantUIPlugin plugins: { cloud, share, - // Infra plugin doesnt export anything as a public interface. So the only - // way we have at this stage for checking if the plugin is available or not - // is by checking if the startServices has the `infra` key. - infra: Object.hasOwn(plugins, 'infra') ? {} : undefined, }, services: { core: coreStart, diff --git a/x-pack/plugins/upgrade_assistant/public/types.ts b/x-pack/plugins/upgrade_assistant/public/types.ts index f91a17323b02b..f01271443cb7f 100644 --- a/x-pack/plugins/upgrade_assistant/public/types.ts +++ b/x-pack/plugins/upgrade_assistant/public/types.ts @@ -47,7 +47,6 @@ export interface AppDependencies { plugins: { cloud?: CloudSetup; share: SharePluginSetup; - infra: object | undefined; }; services: { core: CoreStart;