Skip to content

Commit

Permalink
[Index Management] [Onboarding] Create new package folder for index_m…
Browse files Browse the repository at this point in the history
…anagement (#192594)

## Summary

We have to extract few components from `index_management` plugin to
shared packages for onboarding project. These extracted files would be
separated into small subject matter packages within a common folder -
`index-management` in `x-pack/packages/`.


What is covered in this PR? 

* Created new folder `index-management` under [
x-pack/packages/](https://github.com/elastic/kibana/tree/main/x-pack/packages)
as a home for subject matter packages.
* moved existing package -
[@kbn/index-management](https://github.com/elastic/kibana/tree/main/x-pack/packages/index-management)
under `x-pack/packages/index-management`
* update name of
[@kbn/index-management](https://github.com/elastic/kibana/tree/main/x-pack/packages/index-management)
to `@kbn/index-management-shared-types`
* updated related files which use `@kbn/index-management` to use
`@kbn/index-management-shared-types`

**Note** 
Extracting components required for onboarding project will be part of
another PR
  • Loading branch information
saarikabhasi authored Sep 13, 2024
1 parent e5f0134 commit 7264d3a
Show file tree
Hide file tree
Showing 50 changed files with 50 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,8 @@ src/plugins/image_embeddable @elastic/appex-sharedux
packages/kbn-import-locator @elastic/kibana-operations
packages/kbn-import-resolver @elastic/kibana-operations
x-pack/plugins/index_lifecycle_management @elastic/kibana-management
x-pack/packages/index-management @elastic/kibana-management
x-pack/plugins/index_management @elastic/kibana-management
x-pack/packages/index-management/index_management_shared_types @elastic/kibana-management
test/plugin_functional/plugins/index_patterns @elastic/kibana-data-discovery
x-pack/packages/ml/inference_integration_flyout @elastic/ml-ui
x-pack/plugins/inference @elastic/appex-ai-infra
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,8 @@
"@kbn/iframe-embedded-plugin": "link:x-pack/test/functional_embedded/plugins/iframe_embedded",
"@kbn/image-embeddable-plugin": "link:src/plugins/image_embeddable",
"@kbn/index-lifecycle-management-plugin": "link:x-pack/plugins/index_lifecycle_management",
"@kbn/index-management": "link:x-pack/packages/index-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",
"@kbn/index-patterns-test-plugin": "link:test/plugin_functional/plugins/index_patterns",
"@kbn/inference-plugin": "link:x-pack/plugins/inference",
"@kbn/inference_integration_flyout": "link:x-pack/packages/ml/inference_integration_flyout",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-text-based-editor/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { CoreStart } from '@kbn/core/public';
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import type { AggregateQuery } from '@kbn/es-query';
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
import type { IndexManagementPluginSetup } from '@kbn/index-management';
import type { IndexManagementPluginSetup } from '@kbn/index-management-shared-types';
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';

export interface TextBasedLanguagesEditorProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-text-based-editor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@kbn/data-plugin",
"@kbn/expressions-plugin",
"@kbn/data-views-plugin",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/code-editor",
"@kbn/shared-ux-markdown",
"@kbn/fields-metadata-plugin",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/esql/public/kibana_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { BehaviorSubject } from 'rxjs';
import type { CoreStart } from '@kbn/core/public';
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
import type { IndexManagementPluginSetup } from '@kbn/index-management';
import type { IndexManagementPluginSetup } from '@kbn/index-management-shared-types';
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';

export let core: CoreStart;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/esql/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Plugin, CoreStart, CoreSetup } from '@kbn/core/public';
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
import type { IndexManagementPluginSetup } from '@kbn/index-management';
import type { IndexManagementPluginSetup } from '@kbn/index-management-shared-types';
import type { UiActionsSetup, UiActionsStart } from '@kbn/ui-actions-plugin/public';
import type { FieldsMetadataPublicStart } from '@kbn/fields-metadata-plugin/public';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/esql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@kbn/core",
"@kbn/expressions-plugin",
"@kbn/data-views-plugin",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/i18n",
"@kbn/config-schema",
"@kbn/esql-utils",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1010,10 +1010,10 @@
"@kbn/import-resolver/*": ["packages/kbn-import-resolver/*"],
"@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": ["x-pack/packages/index-management"],
"@kbn/index-management/*": ["x-pack/packages/index-management/*"],
"@kbn/index-management-plugin": ["x-pack/plugins/index_management"],
"@kbn/index-management-plugin/*": ["x-pack/plugins/index_management/*"],
"@kbn/index-management-shared-types": ["x-pack/packages/index-management/index_management_shared_types"],
"@kbn/index-management-shared-types/*": ["x-pack/packages/index-management/index_management_shared_types/*"],
"@kbn/index-patterns-test-plugin": ["test/plugin_functional/plugins/index_patterns"],
"@kbn/index-patterns-test-plugin/*": ["test/plugin_functional/plugins/index_patterns/*"],
"@kbn/inference_integration_flyout": ["x-pack/packages/ml/inference_integration_flyout"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @kbn/index-management
# @kbn/index-management-shared-types

Contains types and functions used and exported by the index management plugin. Primarily used to avoid cyclical dependencies.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/x-pack/packages/index-management'],
rootDir: '../../../..',
roots: ['<rootDir>/x-pack/packages/index-management/index_management_shared_types'],
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/index-management",
"id": "@kbn/index-management-shared-types",
"owner": "@elastic/kibana-management"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@kbn/index-management",
"name": "@kbn/index-management-shared-types",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import { DataPublicPluginStart } from '@kbn/data-plugin/public';

import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
import { IndexMappingProps } from '@kbn/index-management';
import { IndexMappingProps } from '@kbn/index-management-shared-types';
import { LensPublicStart } from '@kbn/lens-plugin/public';
import { MlPluginStart } from '@kbn/ml-plugin/public';
import { ELASTICSEARCH_URL_PLACEHOLDER } from '@kbn/search-api-panels/constants';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { DataPublicPluginStart } from '@kbn/data-plugin/public';
import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
import type { HomePublicPluginSetup } from '@kbn/home-plugin/public';
import { i18n } from '@kbn/i18n';
import type { IndexManagementPluginStart } from '@kbn/index-management';
import type { IndexManagementPluginStart } from '@kbn/index-management-shared-types';
import { LensPublicStart } from '@kbn/lens-plugin/public';
import { LicensingPluginStart } from '@kbn/licensing-plugin/public';
import { MlPluginStart } from '@kbn/ml-plugin/public';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@kbn/search-playground",
"@kbn/search-inference-endpoints",
"@kbn/utility-types",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/deeplinks-search",
"@kbn/react-kibana-context-theme",
"@kbn/search-types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { euiThemeVars } from '@kbn/ui-theme';

import { ApplicationStart } from '@kbn/core/public';
import { Index, IndexDetailsTab } from '@kbn/index-management';
import { Index, IndexDetailsTab } from '@kbn/index-management-shared-types';
import { IlmExplainLifecycleLifecycleExplainManaged } from '@elastic/elasticsearch/lib/api/types';
import { Phase } from '../../../common/types';
import { getPolicyEditPath } from '../../application/services/navigation';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/index_lifecycle_management/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@kbn/shared-ux-router",
"@kbn/ui-theme",
"@kbn/shared-ux-link-redirect-app",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/react-kibana-context-render",
"@kbn/unsaved-changes-prompt",
"@kbn/shared-ux-table-persist",
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/index_management/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ export {

export { MAJOR_VERSION } from './plugin';

export { Section, IndexDetailsSection } from '@kbn/index-management';
export type { IndexDetailsTab, IndexDetailsTabId } from '@kbn/index-management';
export { Section, IndexDetailsSection } from '@kbn/index-management-shared-types';
export type { IndexDetailsTab, IndexDetailsTabId } from '@kbn/index-management-shared-types';
export * from './allow_auto_create';
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import type { EnrichSummary, EnrichPolicyType } from '@elastic/elasticsearch/lib/api/types';
import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';

export const getPolicyType = (policy: EnrichSummary): EnrichPolicyType => {
if (policy.config.match) {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/index_management/common/types/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

export type { Index } from '@kbn/index-management';
export type { Index } from '@kbn/index-management-shared-types';

export interface IndexModule {
number_of_shards: number | string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { i18n } from '@kbn/i18n';
import { Index } from '@kbn/index-management';
import { Index } from '@kbn/index-management-shared-types';
import { MlPluginStart } from '@kbn/ml-plugin/public';
import { useState, useEffect } from 'react';
import { normalize } from '../components/mappings_editor/lib';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import React, { createContext, useContext, useState } from 'react';
import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';

export type DraftPolicy = Partial<SerializedEnrichPolicy>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { useState, useMemo, useCallback } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiSteps, EuiStepStatus, EuiCallOut, EuiSpacer } from '@elastic/eui';

import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
import { useAppContext } from '../../app_context';
import { ConfigurationStep, FieldSelectionStep, CreateStep } from './steps';
import { useCreatePolicyContext } from './create_policy_context';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
EuiCodeBlock,
} from '@elastic/eui';

import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
import { useCreatePolicyContext } from '../create_policy_context';
import { serializeAsESPolicy, getESPolicyCreationApiCall } from '../../../../../common/lib';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
EuiButtonEmpty,
} from '@elastic/eui';
import { CodeEditor } from '@kbn/code-editor';
import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';

export interface Props {
policy: SerializedEnrichPolicy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { RouteComponentProps } from 'react-router-dom';
import { Location } from 'history';
import { parse } from 'query-string';

import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
import { APP_WRAPPER_CLASS, useExecutionContext } from '../../../../shared_imports';
import { useAppContext } from '../../../app_context';
import { useRedirectPath } from '../../../hooks/redirect_path';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { reactRouterNavigate } from '@kbn/kibana-react-plugin/public';
import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
import { useEuiTablePersist, DEFAULT_PAGE_SIZE_OPTIONS } from '@kbn/shared-ux-table-persist';
import { useAppContext } from '../../../../app_context';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { CoreStart } from '@kbn/core/public';
import { IndexMappingProps } from '@kbn/index-management';
import { IndexMappingProps } from '@kbn/index-management-shared-types';
import { AppDependencies } from '../../../../app_context';
import { ExtensionsService } from '../../../../../services/extensions_service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { METRIC_TYPE } from '@kbn/analytics';
import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
import { IndicesStatsResponse } from '@elastic/elasticsearch/lib/api/types';
import { InferenceAPIConfigResponse } from '@kbn/ml-trained-models-utils';
import { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/index_management/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ export type {
IndexMappingProps,
IndexManagementPluginSetup,
IndexManagementPluginStart,
} from '@kbn/index-management';
} from '@kbn/index-management-shared-types';

export { getIndexListUri, getTemplateDetailsLink } from './application/services/routing';
5 changes: 4 additions & 1 deletion x-pack/plugins/index_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
PluginInitializerContext,
ScopedHistory,
} from '@kbn/core/public';
import { IndexManagementPluginSetup, IndexManagementPluginStart } from '@kbn/index-management';
import {
IndexManagementPluginSetup,
IndexManagementPluginStart,
} from '@kbn/index-management-shared-types';
import { setExtensionsService } from './application/store/selectors/extension_service';
import { ExtensionsService } from './services/extensions_service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { ExtensionsSetup } from '@kbn/index-management/src/services/extensions_service';
import { ExtensionsSetup } from '@kbn/index-management-shared-types/src/services/extensions_service';
import { ExtensionsService } from './extensions_service';

export type ExtensionsSetupMock = jest.Mocked<ExtensionsSetup>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
EmptyListContent,
IndexContent,
ExtensionsSetup,
} from '@kbn/index-management';
} from '@kbn/index-management-shared-types';
import { IndexDetailsTab } from '../../common/constants';

export class ExtensionsService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { PublicApiServiceSetup } from '@kbn/index-management/src/services/public_api_service';
import { PublicApiServiceSetup } from '@kbn/index-management-shared-types/src/services/public_api_service';

export type PublicApiServiceSetupMock = jest.Mocked<PublicApiServiceSetup>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { IScopedClusterClient } from '@kbn/core/server';
import type { EnrichSummary } from '@elastic/elasticsearch/lib/api/types';
import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
import { getPolicyType } from '../../common/lib';

export const serializeEnrichmentPolicies = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { IScopedClusterClient } from '@kbn/core/server';
import { schema, TypeOf } from '@kbn/config-schema';

import type { SerializedEnrichPolicy } from '@kbn/index-management';
import type { SerializedEnrichPolicy } from '@kbn/index-management-shared-types';
import { RouteDependencies } from '../../../types';
import { addInternalBasePath } from '..';
import { enrichPoliciesActions } from '../../../lib/enrich_policies';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/index_management/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@kbn/monaco",
"@kbn/console-plugin",
"@kbn/shared-ux-utility",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/utility-types",
"@kbn/inference_integration_flyout",
"@kbn/ml-plugin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import type { Index } from '@kbn/index-management';
import type { Index } from '@kbn/index-management-shared-types';
import { useQuery } from '@tanstack/react-query';
import { useKibana } from '../use_kibana';

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/search_indices/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@kbn/share-plugin",
"@kbn/kibana-utils-plugin",
"@kbn/shared-ux-router",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/try-in-console",
"@kbn/cloud-plugin",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { CoreStart } from '@kbn/core/public';
import { IndexContent } from '@kbn/index-management';
import { IndexContent } from '@kbn/index-management-shared-types';

const IndexMappingsDocsLink: FunctionComponent<{ docLinks: CoreStart['docLinks'] }> = ({
docLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { EuiLoadingSpinner } from '@elastic/eui';

import { IndexContent } from '@kbn/index-management';
import { IndexContent } from '@kbn/index-management-shared-types';

import { ServerlessSearchPluginStartDependencies } from '../../../types';

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/serverless_search/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@kbn/core-logging-server-mocks",
"@kbn/discover-plugin",
"@kbn/search-connectors-plugin",
"@kbn/index-management",
"@kbn/index-management-shared-types",
"@kbn/react-kibana-context-render",
"@kbn/search-playground",
"@kbn/security-api-key-management",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5302,7 +5302,7 @@
version "0.0.0"
uid ""

"@kbn/index-management@link:x-pack/packages/index-management":
"@kbn/index-management-shared-types@link:x-pack/packages/index-management/index_management_shared_types":
version "0.0.0"
uid ""

Expand Down

0 comments on commit 7264d3a

Please sign in to comment.