mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Move shared index management types to package (#179932)
## Summary This moves a number of types that are used outside of the index management plugin to a package so we can avoid cyclical dependencies in the work we're doing to add semantic text as a mapping type. That will depend on the ML plugin, which has dependencies that themselves depend on a few types from index management. I split this into a separate PR for ease of reviewing. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This commit is contained in:
parent
3744a30b32
commit
1fa7a69fb6
56 changed files with 328 additions and 234 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -478,6 +478,7 @@ 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
|
||||
test/plugin_functional/plugins/index_patterns @elastic/kibana-data-discovery
|
||||
x-pack/packages/kbn-infra-forge @elastic/obs-ux-management-team
|
||||
|
|
|
@ -509,6 +509,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-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-patterns-test-plugin": "link:test/plugin_functional/plugins/index_patterns",
|
||||
"@kbn/infra-forge": "link:x-pack/packages/kbn-infra-forge",
|
||||
|
|
|
@ -22,7 +22,7 @@ import { getAggregateQueryMode, getLanguageDisplayName } from '@kbn/es-query';
|
|||
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
|
||||
import type { ExpressionsStart } from '@kbn/expressions-plugin/public';
|
||||
import type { CoreStart } from '@kbn/core/public';
|
||||
import type { IndexManagementPluginSetup } from '@kbn/index-management-plugin/public';
|
||||
import type { IndexManagementPluginSetup } from '@kbn/index-management';
|
||||
import { TooltipWrapper } from '@kbn/visualization-utils';
|
||||
import {
|
||||
type LanguageDocumentationSections,
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"@kbn/data-plugin",
|
||||
"@kbn/expressions-plugin",
|
||||
"@kbn/data-views-plugin",
|
||||
"@kbn/index-management-plugin",
|
||||
"@kbn/index-management",
|
||||
"@kbn/visualization-utils",
|
||||
"@kbn/code-editor",
|
||||
"@kbn/shared-ux-markdown",
|
||||
|
|
|
@ -10,7 +10,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 { IndexManagementPluginSetup } from '@kbn/index-management-plugin/public';
|
||||
import { IndexManagementPluginSetup } from '@kbn/index-management';
|
||||
|
||||
export let core: CoreStart;
|
||||
|
||||
|
|
|
@ -9,7 +9,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 { IndexManagementPluginSetup } from '@kbn/index-management-plugin/public';
|
||||
import type { IndexManagementPluginSetup } from '@kbn/index-management';
|
||||
import { setKibanaServices } from './kibana_services';
|
||||
|
||||
interface TextBasedLanguagesPluginStart {
|
||||
|
|
|
@ -15,10 +15,9 @@
|
|||
"@kbn/core",
|
||||
"@kbn/expressions-plugin",
|
||||
"@kbn/data-views-plugin",
|
||||
"@kbn/index-management-plugin",
|
||||
"@kbn/index-management"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -950,6 +950,8 @@
|
|||
"@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-patterns-test-plugin": ["test/plugin_functional/plugins/index_patterns"],
|
||||
|
@ -1814,7 +1816,9 @@
|
|||
"@kbn/zod-helpers/*": ["packages/kbn-zod-helpers/*"],
|
||||
// END AUTOMATED PACKAGE LISTING
|
||||
// Allows for importing from `kibana` package for the exported types.
|
||||
"@emotion/core": ["typings/@emotion"]
|
||||
"@emotion/core": [
|
||||
"typings/@emotion"
|
||||
]
|
||||
},
|
||||
// Support .tsx files and transform JSX into calls to React.createElement
|
||||
"jsx": "react",
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
],
|
||||
"xpack.grokDebugger": "plugins/grokdebugger",
|
||||
"xpack.idxMgmt": "plugins/index_management",
|
||||
"xpack.idxMgmtPackage": "packages/index-management",
|
||||
"xpack.indexLifecycleMgmt": "plugins/index_lifecycle_management",
|
||||
"xpack.infra": "plugins/observability_solution/infra",
|
||||
"xpack.logsExplorer": "plugins/observability_solution/logs_explorer",
|
||||
|
|
3
x-pack/packages/index-management/README.md
Normal file
3
x-pack/packages/index-management/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# @kbn/index-management
|
||||
|
||||
Contains types and functions used and exported by the index management plugin. Primarily used to avoid cyclical dependencies.
|
10
x-pack/packages/index-management/index.ts
Normal file
10
x-pack/packages/index-management/index.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export * from './src/types';
|
||||
export * from './src/home_sections';
|
||||
export * from './src/services';
|
12
x-pack/packages/index-management/jest.config.js
Normal file
12
x-pack/packages/index-management/jest.config.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* 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: ['<rootDir>/x-pack/packages/index-management'],
|
||||
};
|
5
x-pack/packages/index-management/kibana.jsonc
Normal file
5
x-pack/packages/index-management/kibana.jsonc
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type": "shared-common",
|
||||
"id": "@kbn/index-management",
|
||||
"owner": "@elastic/kibana-management"
|
||||
}
|
6
x-pack/packages/index-management/package.json
Normal file
6
x-pack/packages/index-management/package.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "@kbn/index-management",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"license": "Elastic License 2.0"
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
import { FunctionComponent, ReactNode } from 'react';
|
||||
import { ApplicationStart } from '@kbn/core-application-browser';
|
||||
import { EuiBreadcrumb } from '@elastic/eui';
|
||||
import { Index } from '../types';
|
||||
import { Index } from './types';
|
||||
|
||||
export enum Section {
|
||||
Indices = 'indices',
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* 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 { FunctionComponent, ReactNode } from 'react';
|
||||
import { ApplicationStart } from '@kbn/core-application-browser';
|
||||
import { EuiBadgeProps } from '@elastic/eui';
|
||||
import { IndexDetailsTab } from '../home_sections';
|
||||
import { Index } from '../types';
|
||||
|
||||
export interface IndexContent {
|
||||
renderContent: (args: {
|
||||
index: Index;
|
||||
getUrlForApp: ApplicationStart['getUrlForApp'];
|
||||
}) => ReturnType<FunctionComponent>;
|
||||
}
|
||||
|
||||
export interface IndexToggle {
|
||||
matchIndex: (index: Index) => boolean;
|
||||
label: string;
|
||||
name: string;
|
||||
}
|
||||
export interface IndexBadge {
|
||||
matchIndex: (index: Index) => boolean;
|
||||
label: string;
|
||||
// a parseable search bar filter expression, for example "isFollowerIndex:true"
|
||||
filterExpression?: string;
|
||||
color: EuiBadgeProps['color'];
|
||||
}
|
||||
|
||||
export interface EmptyListContent {
|
||||
renderContent: (args: {
|
||||
// the button to open the "create index" modal
|
||||
createIndexButton: ReturnType<FunctionComponent>;
|
||||
}) => ReturnType<FunctionComponent>;
|
||||
}
|
||||
|
||||
export interface IndicesListColumn {
|
||||
fieldName: string;
|
||||
label: string;
|
||||
order: number;
|
||||
render?: (index: Index) => ReactNode;
|
||||
// return a value used for sorting (only if the value is different from the original value at index[fieldName])
|
||||
sort?: (index: Index) => any;
|
||||
}
|
||||
|
||||
export interface ExtensionsSetup {
|
||||
// adds an option to the "manage index" menu
|
||||
addAction(action: any): void;
|
||||
// adds a banner to the indices list
|
||||
addBanner(banner: any): void;
|
||||
// adds a filter to the indices list
|
||||
addFilter(filter: any): void;
|
||||
// adds a badge to the index name
|
||||
addBadge(badge: IndexBadge): void;
|
||||
// adds a toggle to the indices list
|
||||
addToggle(toggle: IndexToggle): void;
|
||||
// adds a column to display additional information added via a data enricher
|
||||
addColumn(column: IndicesListColumn): void;
|
||||
// set the content to render when the indices list is empty
|
||||
setEmptyListContent(content: EmptyListContent): void;
|
||||
// adds a tab to the index details page
|
||||
addIndexDetailsTab(tab: IndexDetailsTab): void;
|
||||
// sets content to render instead of the code block on the overview tab of the index page
|
||||
setIndexOverviewContent(content: IndexContent): void;
|
||||
// sets content to render below the docs link on the mappings tab of the index page
|
||||
setIndexMappingsContent(content: IndexContent): void;
|
||||
}
|
8
x-pack/packages/index-management/src/services/index.ts
Normal file
8
x-pack/packages/index-management/src/services/index.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
export * from './extensions_service';
|
||||
export * from './public_api_service';
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { EnrichPolicyType } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { SendRequestResponse } from '../types';
|
||||
|
||||
export interface SerializedEnrichPolicy {
|
||||
type: EnrichPolicyType;
|
||||
name: string;
|
||||
sourceIndices: string[];
|
||||
matchField: string;
|
||||
enrichFields: string[];
|
||||
query?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface PublicApiServiceSetup {
|
||||
getAllEnrichPolicies(): Promise<SendRequestResponse<SerializedEnrichPolicy[]>>;
|
||||
}
|
85
x-pack/packages/index-management/src/types.ts
Normal file
85
x-pack/packages/index-management/src/types.ts
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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 {
|
||||
IlmExplainLifecycleLifecycleExplain,
|
||||
HealthStatus,
|
||||
IndicesStatsIndexMetadataState,
|
||||
Uuid,
|
||||
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
|
||||
import type { ManagementSetup } from '@kbn/management-plugin/public';
|
||||
import type { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public';
|
||||
import type { CloudSetup } from '@kbn/cloud-plugin/public';
|
||||
import type { ConsolePluginStart } from '@kbn/console-plugin/public';
|
||||
import type { ScopedHistory } from '@kbn/core-application-browser';
|
||||
import { ExtensionsSetup } from './services/extensions_service';
|
||||
import { PublicApiServiceSetup } from './services/public_api_service';
|
||||
|
||||
export interface IndexManagementPluginSetup {
|
||||
apiService: PublicApiServiceSetup;
|
||||
extensionsService: ExtensionsSetup;
|
||||
}
|
||||
|
||||
export interface IndexManagementPluginStart {
|
||||
extensionsService: ExtensionsSetup;
|
||||
getIndexMappingComponent: (deps: {
|
||||
history: ScopedHistory<unknown>;
|
||||
}) => React.FC<IndexMappingProps>;
|
||||
}
|
||||
|
||||
export interface SetupDependencies {
|
||||
fleet?: unknown;
|
||||
usageCollection: UsageCollectionSetup;
|
||||
management: ManagementSetup;
|
||||
share: SharePluginSetup;
|
||||
cloud?: CloudSetup;
|
||||
}
|
||||
|
||||
export interface StartDependencies {
|
||||
cloud?: CloudSetup;
|
||||
console?: ConsolePluginStart;
|
||||
share: SharePluginStart;
|
||||
fleet?: unknown;
|
||||
usageCollection: UsageCollectionSetup;
|
||||
management: ManagementSetup;
|
||||
}
|
||||
|
||||
export interface Index {
|
||||
name: string;
|
||||
primary?: number | string;
|
||||
replica?: number | string;
|
||||
isFrozen: boolean;
|
||||
hidden: boolean;
|
||||
aliases: string | string[];
|
||||
data_stream?: string;
|
||||
|
||||
// The types below are added by extension services if corresponding plugins are enabled (ILM, Rollup, CCR)
|
||||
isRollupIndex?: boolean;
|
||||
ilm?: IlmExplainLifecycleLifecycleExplain;
|
||||
isFollowerIndex?: boolean;
|
||||
|
||||
// The types from here below represent information returned from the index stats API;
|
||||
// treated optional as the stats API is not available on serverless
|
||||
health?: HealthStatus;
|
||||
status?: IndicesStatsIndexMetadataState;
|
||||
uuid?: Uuid;
|
||||
documents?: number;
|
||||
size?: string;
|
||||
primary_size?: string;
|
||||
documents_deleted?: number;
|
||||
}
|
||||
|
||||
export interface IndexMappingProps {
|
||||
index?: Index;
|
||||
showAboutMappings?: boolean;
|
||||
}
|
||||
|
||||
export interface SendRequestResponse<D = any, E = any> {
|
||||
data: D | null;
|
||||
error: E | null;
|
||||
}
|
26
x-pack/packages/index-management/tsconfig.json
Normal file
26
x-pack/packages/index-management/tsconfig.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types",
|
||||
"types": [
|
||||
"jest",
|
||||
"node",
|
||||
"react"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*"
|
||||
],
|
||||
"kbn_references": [
|
||||
"@kbn/core-application-browser",
|
||||
"@kbn/usage-collection-plugin",
|
||||
"@kbn/management-plugin",
|
||||
"@kbn/share-plugin",
|
||||
"@kbn/cloud-plugin",
|
||||
"@kbn/console-plugin",
|
||||
]
|
||||
}
|
|
@ -15,7 +15,7 @@ import type { AppMockRenderer } from '../../common/mock';
|
|||
import { createAppMockRenderer } from '../../common/mock';
|
||||
import { MAX_DESCRIPTION_LENGTH } from '../../../common/constants';
|
||||
import { FormTestComponent } from '../../common/test_utils';
|
||||
import type { FormSchema } from '@kbn/index-management-plugin/public/shared_imports';
|
||||
import type { FormSchema } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
|
||||
describe('Description', () => {
|
||||
let appMockRender: AppMockRenderer;
|
||||
|
|
|
@ -11,12 +11,10 @@
|
|||
],
|
||||
"kbn_references": [
|
||||
"@kbn/core",
|
||||
|
||||
// optionalPlugins from ./kibana.json
|
||||
"@kbn/lens-plugin",
|
||||
"@kbn/security-plugin",
|
||||
"@kbn/spaces-plugin",
|
||||
|
||||
// Required from './kibana.json'
|
||||
"@kbn/actions-plugin",
|
||||
"@kbn/rule-registry-plugin",
|
||||
|
@ -68,7 +66,6 @@
|
|||
"@kbn/core-http-server",
|
||||
"@kbn/alerting-plugin",
|
||||
"@kbn/content-management-plugin",
|
||||
"@kbn/index-management-plugin",
|
||||
"@kbn/rison",
|
||||
"@kbn/core-application-browser",
|
||||
"@kbn/react-kibana-context-render",
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
|
||||
|
||||
import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public';
|
||||
import { IndexMappingProps } from '@kbn/index-management-plugin/public';
|
||||
import { IndexMappingProps } from '@kbn/index-management';
|
||||
import { LensPublicStart } from '@kbn/lens-plugin/public';
|
||||
import { MlPluginStart } from '@kbn/ml-plugin/public';
|
||||
import { ELASTICSEARCH_URL_PLACEHOLDER } from '@kbn/search-api-panels/constants';
|
||||
|
|
|
@ -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 { IndexManagementPluginStart } from '@kbn/index-management-plugin/public';
|
||||
import type { IndexManagementPluginStart } from '@kbn/index-management';
|
||||
import { LensPublicStart } from '@kbn/lens-plugin/public';
|
||||
import { LicensingPluginStart } from '@kbn/licensing-plugin/public';
|
||||
import { MlPluginStart } from '@kbn/ml-plugin/public';
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
"@kbn/search-connectors-plugin",
|
||||
"@kbn/search-playground",
|
||||
"@kbn/utility-types",
|
||||
"@kbn/index-management-plugin",
|
||||
"@kbn/index-management",
|
||||
"@kbn/deeplinks-search"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ import {
|
|||
import { euiThemeVars } from '@kbn/ui-theme';
|
||||
|
||||
import { ApplicationStart } from '@kbn/core/public';
|
||||
import { Index } from '@kbn/index-management-plugin/common';
|
||||
import { IndexDetailsTab } from '@kbn/index-management-plugin/common/constants';
|
||||
import { Index, IndexDetailsTab } from '@kbn/index-management';
|
||||
import { IlmExplainLifecycleLifecycleExplainManaged } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { Phase } from '../../../common/types';
|
||||
import { getPolicyEditPath } from '../../application/services/navigation';
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
"@kbn/config-schema",
|
||||
"@kbn/shared-ux-router",
|
||||
"@kbn/ui-theme",
|
||||
"@kbn/shared-ux-link-redirect-app"
|
||||
"@kbn/shared-ux-link-redirect-app",
|
||||
"@kbn/index-management"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
|
|
|
@ -52,6 +52,6 @@ export {
|
|||
|
||||
export { MAJOR_VERSION } from './plugin';
|
||||
|
||||
export { Section, IndexDetailsSection } from './home_sections';
|
||||
export type { IndexDetailsTab, IndexDetailsTabId } from './home_sections';
|
||||
export { Section, IndexDetailsSection } from '@kbn/index-management';
|
||||
export type { IndexDetailsTab, IndexDetailsTabId } from '@kbn/index-management';
|
||||
export * from './allow_auto_create';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import type { EnrichSummary, EnrichPolicyType } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { SerializedEnrichPolicy } from '../types';
|
||||
import type { SerializedEnrichPolicy } from '@kbn/index-management';
|
||||
|
||||
export const getPolicyType = (policy: EnrichSummary): EnrichPolicyType => {
|
||||
if (policy.config.match) {
|
||||
|
|
|
@ -5,17 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { EnrichPolicyType } from '@elastic/elasticsearch/lib/api/types';
|
||||
|
||||
export interface SerializedEnrichPolicy {
|
||||
type: EnrichPolicyType;
|
||||
name: string;
|
||||
sourceIndices: string[];
|
||||
matchField: string;
|
||||
enrichFields: string[];
|
||||
query?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface FieldItem {
|
||||
name: string;
|
||||
type: string;
|
||||
|
|
|
@ -5,12 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
HealthStatus,
|
||||
IlmExplainLifecycleLifecycleExplain,
|
||||
IndicesStatsIndexMetadataState,
|
||||
Uuid,
|
||||
} from '@elastic/elasticsearch/lib/api/types';
|
||||
export type { Index } from '@kbn/index-management';
|
||||
|
||||
interface IndexModule {
|
||||
number_of_shards: number | string;
|
||||
|
@ -58,31 +53,6 @@ export interface IndexSettings {
|
|||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface Index {
|
||||
name: string;
|
||||
primary?: number | string;
|
||||
replica?: number | string;
|
||||
isFrozen: boolean;
|
||||
hidden: boolean;
|
||||
aliases: string | string[];
|
||||
data_stream?: string;
|
||||
|
||||
// The types below are added by extension services if corresponding plugins are enabled (ILM, Rollup, CCR)
|
||||
isRollupIndex?: boolean;
|
||||
ilm?: IlmExplainLifecycleLifecycleExplain;
|
||||
isFollowerIndex?: boolean;
|
||||
|
||||
// The types from here below represent information returned from the index stats API;
|
||||
// treated optional as the stats API is not available on serverless
|
||||
health?: HealthStatus;
|
||||
status?: IndicesStatsIndexMetadataState;
|
||||
uuid?: Uuid;
|
||||
documents?: number;
|
||||
size?: string;
|
||||
primary_size?: string;
|
||||
documents_deleted?: number;
|
||||
}
|
||||
|
||||
export interface IndexSettingsResponse {
|
||||
settings: IndexSettings;
|
||||
defaults: IndexSettings;
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
import React from 'react';
|
||||
import { EuiButton, EuiEmptyPrompt } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { ExtensionsService } from '../../../services';
|
||||
import { CreateIndexButton } from '../../sections/home/index_list/create_index/create_index_button';
|
||||
import { ExtensionsService } from '../../../services/extensions_service';
|
||||
|
||||
export const NoMatch = ({
|
||||
loadIndices,
|
||||
|
|
|
@ -13,10 +13,9 @@ import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
|
|||
|
||||
import { CloudSetup } from '@kbn/cloud-plugin/public';
|
||||
import { Observable } from 'rxjs';
|
||||
import { StartDependencies } from '@kbn/index-management';
|
||||
import { UIM_APP_NAME } from '../../common/constants';
|
||||
import { PLUGIN } from '../../common/constants/plugin';
|
||||
import { ExtensionsService } from '../services';
|
||||
import { StartDependencies } from '../types';
|
||||
import { AppDependencies } from './app_context';
|
||||
import { breadcrumbService } from './services/breadcrumbs';
|
||||
import { documentationService } from './services/documentation';
|
||||
|
@ -26,6 +25,7 @@ import { renderApp } from '.';
|
|||
import { setUiMetricService } from './services/api';
|
||||
import { notificationService } from './services/notification';
|
||||
import { httpService } from './services/http';
|
||||
import { ExtensionsService } from '../services/extensions_service';
|
||||
|
||||
function initSetup({
|
||||
usageCollection,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React, { createContext, useContext, useState } from 'react';
|
||||
import type { SerializedEnrichPolicy } from '../../../../common';
|
||||
import type { SerializedEnrichPolicy } from '@kbn/index-management';
|
||||
|
||||
export type DraftPolicy = Partial<SerializedEnrichPolicy>;
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ 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 { useAppContext } from '../../app_context';
|
||||
import { ConfigurationStep, FieldSelectionStep, CreateStep } from './steps';
|
||||
import { useCreatePolicyContext } from './create_policy_context';
|
||||
import { createEnrichPolicy } from '../../services/api';
|
||||
import type { Error } from '../../../shared_imports';
|
||||
import type { SerializedEnrichPolicy } from '../../../../common';
|
||||
|
||||
const CONFIGURATION = 1;
|
||||
const FIELD_SELECTION = 2;
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
EuiCodeBlock,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import type { SerializedEnrichPolicy } from '../../../../../common';
|
||||
import type { SerializedEnrichPolicy } from '@kbn/index-management';
|
||||
import { useCreatePolicyContext } from '../create_policy_context';
|
||||
import { serializeAsESPolicy, getESPolicyCreationApiCall } from '../../../../../common/lib';
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
EuiButtonEmpty,
|
||||
} from '@elastic/eui';
|
||||
import { CodeEditor } from '@kbn/code-editor';
|
||||
import type { SerializedEnrichPolicy } from '../../../../../../common';
|
||||
import type { SerializedEnrichPolicy } from '@kbn/index-management';
|
||||
|
||||
export interface Props {
|
||||
policy: SerializedEnrichPolicy;
|
||||
|
|
|
@ -12,8 +12,8 @@ import { RouteComponentProps } from 'react-router-dom';
|
|||
import { Location } from 'history';
|
||||
import { parse } from 'query-string';
|
||||
|
||||
import type { SerializedEnrichPolicy } from '@kbn/index-management';
|
||||
import { APP_WRAPPER_CLASS, useExecutionContext } from '../../../../shared_imports';
|
||||
import type { SerializedEnrichPolicy } from '../../../../../common';
|
||||
import { useAppContext } from '../../../app_context';
|
||||
import { useRedirectPath } from '../../../hooks/redirect_path';
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ 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 { useAppContext } from '../../../../app_context';
|
||||
import type { SerializedEnrichPolicy } from '../../../../../../common/types';
|
||||
|
||||
export interface Props {
|
||||
policies: SerializedEnrichPolicy[];
|
||||
|
|
|
@ -6,35 +6,9 @@
|
|||
*/
|
||||
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { ExtensionsService } from '../../../../../services';
|
||||
import { IndexMappingProps } from '@kbn/index-management';
|
||||
import { AppDependencies } from '../../../../app_context';
|
||||
|
||||
// duplicating this Index interface here so we don't blow up the bundle by importing all the types
|
||||
interface Index {
|
||||
name: string;
|
||||
primary?: number | string;
|
||||
replica?: number | string;
|
||||
isFrozen: boolean;
|
||||
hidden: boolean;
|
||||
aliases: string | string[];
|
||||
data_stream?: string;
|
||||
|
||||
// The types below are added by extension services if corresponding plugins are enabled (ILM, Rollup, CCR)
|
||||
isRollupIndex?: boolean;
|
||||
isFollowerIndex?: boolean;
|
||||
|
||||
// The types from here below represent information returned from the index stats API;
|
||||
// treated optional as the stats API is not available on serverless
|
||||
documents?: number;
|
||||
size?: string;
|
||||
primary_size?: string;
|
||||
documents_deleted?: number;
|
||||
}
|
||||
|
||||
export interface IndexMappingProps {
|
||||
index?: Index;
|
||||
showAboutMappings?: boolean;
|
||||
}
|
||||
import { ExtensionsService } from '../../../../../services/extensions_service';
|
||||
|
||||
export type IndexMappingWithContextProps = {
|
||||
core: CoreStart;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import { METRIC_TYPE } from '@kbn/analytics';
|
||||
import { IndicesStatsResponse } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { SerializedEnrichPolicy } from '@kbn/index-management';
|
||||
import {
|
||||
API_BASE_PATH,
|
||||
INTERNAL_API_BASE_PATH,
|
||||
|
@ -44,7 +45,7 @@ import {
|
|||
import { useRequest, sendRequest } from './use_request';
|
||||
import { httpService } from './http';
|
||||
import { UiMetricService } from './ui_metric';
|
||||
import type { SerializedEnrichPolicy, FieldFromIndicesRequest } from '../../../common';
|
||||
import type { FieldFromIndicesRequest } from '../../../common';
|
||||
import { Fields } from '../components/mappings_editor/types';
|
||||
|
||||
interface ReloadIndicesOptions {
|
||||
|
|
|
@ -14,10 +14,11 @@ export const plugin = (ctx: PluginInitializerContext) => {
|
|||
return new IndexMgmtUIPlugin(ctx);
|
||||
};
|
||||
|
||||
export type { IndexManagementPluginSetup, IndexManagementPluginStart } from './types';
|
||||
export type {
|
||||
Index,
|
||||
IndexMappingProps,
|
||||
IndexManagementPluginSetup,
|
||||
IndexManagementPluginStart,
|
||||
} from '@kbn/index-management';
|
||||
|
||||
export { getIndexListUri, getTemplateDetailsLink } from './application/services/routing';
|
||||
|
||||
export type { Index } from '../common';
|
||||
|
||||
export type { IndexMappingProps } from './application/sections/home/index_list/details_page/index_mapping_with_context_types';
|
||||
|
|
|
@ -15,21 +15,21 @@ import {
|
|||
PluginInitializerContext,
|
||||
ScopedHistory,
|
||||
} from '@kbn/core/public';
|
||||
import { setExtensionsService } from './application/store/selectors/extension_service';
|
||||
|
||||
import { ExtensionsService, PublicApiService } from './services';
|
||||
|
||||
import {
|
||||
IndexManagementPluginSetup,
|
||||
SetupDependencies,
|
||||
StartDependencies,
|
||||
ClientConfigType,
|
||||
IndexManagementPluginStart,
|
||||
} from './types';
|
||||
} from '@kbn/index-management';
|
||||
import { setExtensionsService } from './application/store/selectors/extension_service';
|
||||
import { ExtensionsService } from './services/extensions_service';
|
||||
|
||||
import { ClientConfigType } from './types';
|
||||
|
||||
// avoid import from index files in plugin.ts, use specific import paths
|
||||
import { PLUGIN } from '../common/constants/plugin';
|
||||
import { IndexMapping } from './application/sections/home/index_list/details_page/index_mappings_embeddable';
|
||||
import { PublicApiService } from './services/public_api_service';
|
||||
|
||||
export class IndexMgmtUIPlugin
|
||||
implements
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import { ExtensionsService, ExtensionsSetup } from './extensions_service';
|
||||
import { ExtensionsSetup } from '@kbn/index-management/src/services/extensions_service';
|
||||
import { ExtensionsService } from './extensions_service';
|
||||
|
||||
export type ExtensionsSetupMock = jest.Mocked<ExtensionsSetup>;
|
||||
|
||||
|
|
|
@ -6,70 +6,15 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FunctionComponent, ReactNode } from 'react';
|
||||
import { ApplicationStart } from '@kbn/core-application-browser';
|
||||
import { EuiBadgeProps } from '@elastic/eui';
|
||||
import type { IndexDetailsTab } from '../../common/constants';
|
||||
import { Index } from '..';
|
||||
|
||||
export interface IndexContent {
|
||||
renderContent: (args: {
|
||||
index: Index;
|
||||
getUrlForApp: ApplicationStart['getUrlForApp'];
|
||||
}) => ReturnType<FunctionComponent>;
|
||||
}
|
||||
|
||||
export interface IndexToggle {
|
||||
matchIndex: (index: Index) => boolean;
|
||||
label: string;
|
||||
name: string;
|
||||
}
|
||||
export interface IndexBadge {
|
||||
matchIndex: (index: Index) => boolean;
|
||||
label: string;
|
||||
// a parseable search bar filter expression, for example "isFollowerIndex:true"
|
||||
filterExpression?: string;
|
||||
color: EuiBadgeProps['color'];
|
||||
}
|
||||
|
||||
export interface EmptyListContent {
|
||||
renderContent: (args: {
|
||||
// the button to open the "create index" modal
|
||||
createIndexButton: ReturnType<FunctionComponent>;
|
||||
}) => ReturnType<FunctionComponent>;
|
||||
}
|
||||
|
||||
export interface IndicesListColumn {
|
||||
fieldName: string;
|
||||
label: string;
|
||||
order: number;
|
||||
render?: (index: Index) => ReactNode;
|
||||
// return a value used for sorting (only if the value is different from the original value at index[fieldName])
|
||||
sort?: (index: Index) => any;
|
||||
}
|
||||
|
||||
export interface ExtensionsSetup {
|
||||
// adds an option to the "manage index" menu
|
||||
addAction(action: any): void;
|
||||
// adds a banner to the indices list
|
||||
addBanner(banner: any): void;
|
||||
// adds a filter to the indices list
|
||||
addFilter(filter: any): void;
|
||||
// adds a badge to the index name
|
||||
addBadge(badge: IndexBadge): void;
|
||||
// adds a toggle to the indices list
|
||||
addToggle(toggle: IndexToggle): void;
|
||||
// adds a column to display additional information added via a data enricher
|
||||
addColumn(column: IndicesListColumn): void;
|
||||
// set the content to render when the indices list is empty
|
||||
setEmptyListContent(content: EmptyListContent): void;
|
||||
// adds a tab to the index details page
|
||||
addIndexDetailsTab(tab: IndexDetailsTab): void;
|
||||
// sets content to render instead of the code block on the overview tab of the index page
|
||||
setIndexOverviewContent(content: IndexContent): void;
|
||||
// sets content to render below the docs link on the mappings tab of the index page
|
||||
setIndexMappingsContent(content: IndexContent): void;
|
||||
}
|
||||
import {
|
||||
IndexBadge,
|
||||
IndexToggle,
|
||||
IndicesListColumn,
|
||||
EmptyListContent,
|
||||
IndexContent,
|
||||
ExtensionsSetup,
|
||||
} from '@kbn/index-management';
|
||||
import { IndexDetailsTab } from '../../common/constants';
|
||||
|
||||
export class ExtensionsService {
|
||||
private _actions: any[] = [];
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export type { ExtensionsSetup, IndexContent } from './extensions_service';
|
||||
export { ExtensionsService } from './extensions_service';
|
||||
|
||||
export type { PublicApiServiceSetup } from './public_api_service';
|
||||
export { PublicApiService } from './public_api_service';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PublicApiServiceSetup } from './public_api_service';
|
||||
import { PublicApiServiceSetup } from '@kbn/index-management/src/services/public_api_service';
|
||||
|
||||
export type PublicApiServiceSetupMock = jest.Mocked<PublicApiServiceSetup>;
|
||||
|
||||
|
|
|
@ -5,14 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { HttpSetup } from '@kbn/core/public';
|
||||
import { sendRequest, SendRequestResponse } from '../shared_imports';
|
||||
import { INTERNAL_API_BASE_PATH } from '../../common/constants';
|
||||
import { SerializedEnrichPolicy } from '../../common/types';
|
||||
|
||||
export interface PublicApiServiceSetup {
|
||||
getAllEnrichPolicies(): Promise<SendRequestResponse<SerializedEnrichPolicy[]>>;
|
||||
}
|
||||
import { HttpSetup } from '@kbn/core-http-browser';
|
||||
import { INTERNAL_API_BASE_PATH } from '../../common';
|
||||
import { sendRequest } from '../shared_imports';
|
||||
|
||||
/**
|
||||
* Index Management public API service
|
||||
|
|
|
@ -5,44 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
|
||||
import { ManagementSetup } from '@kbn/management-plugin/public';
|
||||
import { SharePluginSetup, SharePluginStart } from '@kbn/share-plugin/public';
|
||||
import { CloudSetup } from '@kbn/cloud-plugin/public';
|
||||
import { ConsolePluginStart } from '@kbn/console-plugin/public';
|
||||
import { ScopedHistory } from '@kbn/core-application-browser';
|
||||
import { IndexMappingProps } from './application/sections/home/index_list/details_page/index_mapping_with_context_types';
|
||||
import { ExtensionsSetup, PublicApiServiceSetup } from './services';
|
||||
|
||||
export interface IndexManagementPluginSetup {
|
||||
apiService: PublicApiServiceSetup;
|
||||
extensionsService: ExtensionsSetup;
|
||||
}
|
||||
|
||||
export interface IndexManagementPluginStart {
|
||||
extensionsService: ExtensionsSetup;
|
||||
getIndexMappingComponent: (deps: {
|
||||
history: ScopedHistory<unknown>;
|
||||
}) => React.FC<IndexMappingProps>;
|
||||
}
|
||||
|
||||
export interface SetupDependencies {
|
||||
fleet?: unknown;
|
||||
usageCollection: UsageCollectionSetup;
|
||||
management: ManagementSetup;
|
||||
share: SharePluginSetup;
|
||||
cloud?: CloudSetup;
|
||||
}
|
||||
|
||||
export interface StartDependencies {
|
||||
cloud?: CloudSetup;
|
||||
console?: ConsolePluginStart;
|
||||
share: SharePluginStart;
|
||||
fleet?: unknown;
|
||||
usageCollection: UsageCollectionSetup;
|
||||
management: ManagementSetup;
|
||||
}
|
||||
|
||||
export interface ClientConfigType {
|
||||
ui: {
|
||||
enabled: boolean;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { IScopedClusterClient } from '@kbn/core/server';
|
||||
import type { EnrichSummary } from '@elastic/elasticsearch/lib/api/types';
|
||||
import type { SerializedEnrichPolicy } from '../../common/types';
|
||||
import type { SerializedEnrichPolicy } from '@kbn/index-management';
|
||||
import { getPolicyType } from '../../common/lib';
|
||||
|
||||
export const serializeEnrichmentPolicies = (
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
import { IScopedClusterClient } from '@kbn/core/server';
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
|
||||
import type { SerializedEnrichPolicy } from '@kbn/index-management';
|
||||
import { RouteDependencies } from '../../../types';
|
||||
import { addInternalBasePath } from '..';
|
||||
import { enrichPoliciesActions } from '../../../lib/enrich_policies';
|
||||
import { serializeAsESPolicy } from '../../../../common/lib';
|
||||
import { normalizeFieldsList, getIndices, FieldCapsList, getCommonFields } from './helpers';
|
||||
import type { SerializedEnrichPolicy } from '../../../../common';
|
||||
|
||||
const validationSchema = schema.object({
|
||||
policy: schema.object({
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
"@kbn/i18n",
|
||||
"@kbn/ml-trained-models-utils",
|
||||
"@kbn/analytics",
|
||||
"@kbn/utility-types",
|
||||
"@kbn/i18n-react",
|
||||
"@kbn/core-doc-links-browser-mocks",
|
||||
"@kbn/core-execution-context-browser-mocks",
|
||||
|
@ -42,11 +41,14 @@
|
|||
"@kbn/search-api-panels",
|
||||
"@kbn/cloud-plugin",
|
||||
"@kbn/ui-theme",
|
||||
"@kbn/core-application-browser",
|
||||
"@kbn/code-editor",
|
||||
"@kbn/monaco",
|
||||
"@kbn/console-plugin",
|
||||
"@kbn/shared-ux-utility"
|
||||
"@kbn/shared-ux-utility",
|
||||
"@kbn/index-management",
|
||||
"@kbn/utility-types"
|
||||
],
|
||||
"exclude": ["target/**/*"]
|
||||
"exclude": [
|
||||
"target/**/*"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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-plugin/public/services';
|
||||
import { IndexContent } from '@kbn/index-management';
|
||||
|
||||
const IndexMappingsDocsLink: FunctionComponent<{ docLinks: CoreStart['docLinks'] }> = ({
|
||||
docLinks,
|
||||
|
|
|
@ -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-plugin/public/services';
|
||||
import { IndexContent } from '@kbn/index-management';
|
||||
|
||||
import { ServerlessSearchPluginStartDependencies } from '../../../types';
|
||||
|
||||
|
|
|
@ -46,5 +46,6 @@
|
|||
"@kbn/core-logging-server-mocks",
|
||||
"@kbn/discover-plugin",
|
||||
"@kbn/search-connectors-plugin",
|
||||
"@kbn/index-management",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -4956,6 +4956,10 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/index-management@link:x-pack/packages/index-management":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/index-patterns-test-plugin@link:test/plugin_functional/plugins/index_patterns":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue