From 5ac922768a37021abf5178c440f05ecc2dd53625 Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Thu, 14 Nov 2024 03:52:12 -0600 Subject: [PATCH] [8.x] [ilm] Remove observability solution dependency on index lifecycle management plugin bundle (#199383) (#199986) # Backport This will backport the following commits from `main` to `8.x`: - [[ilm] Remove observability solution dependency on index lifecycle management plugin bundle (#199383)](https://github.com/elastic/kibana/pull/199383) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- package.json | 1 + tsconfig.base.json | 2 ++ .../README.md | 3 +++ .../index.ts | 9 +++++++++ .../kibana.jsonc | 5 +++++ .../package.json | 6 ++++++ .../src}/policies.ts | 0 .../tsconfig.json | 20 +++++++++++++++++++ .../common/types/index.ts | 2 +- .../public/locator.ts | 3 ++- .../index_lifecycle_management/tsconfig.json | 1 + .../synthetics/kibana.jsonc | 3 +-- .../components/settings/hooks/api.ts | 2 +- .../components/settings/policy_link.tsx | 2 +- .../synthetics/tsconfig.json | 4 ++-- yarn.lock | 4 ++++ 16 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/README.md create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/index.ts create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/kibana.jsonc create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/package.json rename x-pack/{plugins/index_lifecycle_management/common/types => packages/index-lifecycle-management/index_lifecycle_management_common_shared/src}/policies.ts (100%) create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json diff --git a/package.json b/package.json index 1313a35c78d5e..b9c1d1014c9ba 100644 --- a/package.json +++ b/package.json @@ -568,6 +568,7 @@ "@kbn/iframe-embedded-plugin": "link:x-pack/test/functional_embedded/plugins/iframe_embedded", "@kbn/image-embeddable-plugin": "link:src/plugins/image_embeddable", "@kbn/index-adapter": "link:packages/kbn-index-adapter", + "@kbn/index-lifecycle-management-common-shared": "link:x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared", "@kbn/index-lifecycle-management-plugin": "link:x-pack/plugins/index_lifecycle_management", "@kbn/index-management-plugin": "link:x-pack/plugins/index_management", "@kbn/index-management-shared-types": "link:x-pack/packages/index-management/index_management_shared_types", diff --git a/tsconfig.base.json b/tsconfig.base.json index cfc15fccddfa0..48de99923a12b 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1036,6 +1036,8 @@ "@kbn/import-resolver/*": ["packages/kbn-import-resolver/*"], "@kbn/index-adapter": ["packages/kbn-index-adapter"], "@kbn/index-adapter/*": ["packages/kbn-index-adapter/*"], + "@kbn/index-lifecycle-management-common-shared": ["x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared"], + "@kbn/index-lifecycle-management-common-shared/*": ["x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/*"], "@kbn/index-lifecycle-management-plugin": ["x-pack/plugins/index_lifecycle_management"], "@kbn/index-lifecycle-management-plugin/*": ["x-pack/plugins/index_lifecycle_management/*"], "@kbn/index-management-plugin": ["x-pack/plugins/index_management"], diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/README.md b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/README.md new file mode 100644 index 0000000000000..66d1ff7e3c8f2 --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/README.md @@ -0,0 +1,3 @@ +# @kbn/index-lifecycle-management-common-shared + +Contains types and functions used and exported by the index lifecycle management plugin. Primarily used to address dependency issues. diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/index.ts b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/index.ts new file mode 100644 index 0000000000000..044ab18aa34df --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const ILM_LOCATOR_ID = 'ILM_LOCATOR_ID'; +export * from './src/policies'; diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/kibana.jsonc b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/kibana.jsonc new file mode 100644 index 0000000000000..dfaef1d0dfb9c --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-common", + "id": "@kbn/index-lifecycle-management-common-shared", + "owner": "@elastic/kibana-management" +} diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/package.json b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/package.json new file mode 100644 index 0000000000000..9c3e7c99dd7d9 --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/package.json @@ -0,0 +1,6 @@ +{ + "name": "@kbn/index-lifecycle-management-common-shared", + "private": true, + "version": "1.0.0", + "license": "Elastic License 2.0" +} diff --git a/x-pack/plugins/index_lifecycle_management/common/types/policies.ts b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/src/policies.ts similarity index 100% rename from x-pack/plugins/index_lifecycle_management/common/types/policies.ts rename to x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/src/policies.ts diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json new file mode 100644 index 0000000000000..12a691a15cc4f --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "jest", + "node", + "react" + ] + }, + "include": [ + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + ] +} diff --git a/x-pack/plugins/index_lifecycle_management/common/types/index.ts b/x-pack/plugins/index_lifecycle_management/common/types/index.ts index bc7e881a8c230..ee5939e328ce5 100644 --- a/x-pack/plugins/index_lifecycle_management/common/types/index.ts +++ b/x-pack/plugins/index_lifecycle_management/common/types/index.ts @@ -7,7 +7,7 @@ export * from './api'; -export * from './policies'; +export * from '@kbn/index-lifecycle-management-common-shared'; /** * These roles reflect how nodes are stratified into different data tiers. diff --git a/x-pack/plugins/index_lifecycle_management/public/locator.ts b/x-pack/plugins/index_lifecycle_management/public/locator.ts index 24599b6a6b47e..382cbc4ad1838 100644 --- a/x-pack/plugins/index_lifecycle_management/public/locator.ts +++ b/x-pack/plugins/index_lifecycle_management/public/locator.ts @@ -8,6 +8,7 @@ import type { SerializableRecord } from '@kbn/utility-types'; import { ManagementAppLocator } from '@kbn/management-plugin/common'; import { LocatorDefinition } from '@kbn/share-plugin/public'; +import { ILM_LOCATOR_ID } from '@kbn/index-lifecycle-management-common-shared'; import { getPoliciesListPath, getPolicyCreatePath, @@ -15,7 +16,7 @@ import { } from './application/services/navigation'; import { PLUGIN } from '../common/constants'; -export const ILM_LOCATOR_ID = 'ILM_LOCATOR_ID'; +export { ILM_LOCATOR_ID }; export interface IlmLocatorParams extends SerializableRecord { page: 'policies_list' | 'policy_edit' | 'policy_create'; diff --git a/x-pack/plugins/index_lifecycle_management/tsconfig.json b/x-pack/plugins/index_lifecycle_management/tsconfig.json index 7c3913fcae1bd..08346dcdc2d35 100644 --- a/x-pack/plugins/index_lifecycle_management/tsconfig.json +++ b/x-pack/plugins/index_lifecycle_management/tsconfig.json @@ -41,6 +41,7 @@ "@kbn/react-kibana-context-render", "@kbn/unsaved-changes-prompt", "@kbn/shared-ux-table-persist", + "@kbn/index-lifecycle-management-common-shared", ], "exclude": [ "target/**/*", diff --git a/x-pack/plugins/observability_solution/synthetics/kibana.jsonc b/x-pack/plugins/observability_solution/synthetics/kibana.jsonc index 89870a9e6c881..44d549843f469 100644 --- a/x-pack/plugins/observability_solution/synthetics/kibana.jsonc +++ b/x-pack/plugins/observability_solution/synthetics/kibana.jsonc @@ -63,8 +63,7 @@ "kibanaUtils", "observability", "spaces", - "indexLifecycleManagement", "unifiedDocViewer" ] } -} \ No newline at end of file +} diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/api.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/api.ts index ad3d45d0ba806..a113f86bdfef4 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/api.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/api.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { PolicyFromES } from '@kbn/index-lifecycle-management-plugin/common/types'; +import { PolicyFromES } from '@kbn/index-lifecycle-management-common-shared'; import { DataStream } from '@kbn/index-management-plugin/common'; import { CatIndicesResponse } from '@elastic/elasticsearch/lib/api/types'; import { apiService } from '../../../../../utils/api_service'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/policy_link.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/policy_link.tsx index 0c9cb465c127f..3918e20bccabd 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/policy_link.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/policy_link.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiIconTip, EuiLink, EuiSkeletonText, EuiToolTip, EuiText } from '@elastic/eui'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { ILM_LOCATOR_ID } from '@kbn/index-lifecycle-management-plugin/public'; +import { ILM_LOCATOR_ID } from '@kbn/index-lifecycle-management-common-shared'; import { useFetcher } from '@kbn/observability-shared-plugin/public'; import { i18n } from '@kbn/i18n'; import { useSyntheticsSettingsContext } from '../../contexts'; diff --git a/x-pack/plugins/observability_solution/synthetics/tsconfig.json b/x-pack/plugins/observability_solution/synthetics/tsconfig.json index 5df6d4257b4e9..267298a234271 100644 --- a/x-pack/plugins/observability_solution/synthetics/tsconfig.json +++ b/x-pack/plugins/observability_solution/synthetics/tsconfig.json @@ -18,7 +18,6 @@ "@kbn/observability-plugin", "@kbn/fleet-plugin", "@kbn/unified-search-plugin", - "@kbn/index-lifecycle-management-plugin", "@kbn/i18n", "@kbn/core", "@kbn/config-schema", @@ -105,7 +104,8 @@ "@kbn/slo-plugin", "@kbn/ebt-tools", "@kbn/alerting-types", - "@kbn/core-chrome-browser" + "@kbn/core-chrome-browser", + "@kbn/index-lifecycle-management-common-shared" ], "exclude": ["target/**/*"] } diff --git a/yarn.lock b/yarn.lock index 41cdaf6649259..889c2ec3291f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5330,6 +5330,10 @@ version "0.0.0" uid "" +"@kbn/index-lifecycle-management-common-shared@link:x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared": + version "0.0.0" + uid "" + "@kbn/index-lifecycle-management-plugin@link:x-pack/plugins/index_lifecycle_management": version "0.0.0" uid ""