diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json
index f22f7e98d3b8a..b1cb9075434e8 100644
--- a/x-pack/.i18nrc.json
+++ b/x-pack/.i18nrc.json
@@ -16,7 +16,7 @@
"xpack.fileUpload": "legacy/plugins/file_upload",
"xpack.graph": ["legacy/plugins/graph", "plugins/graph"],
"xpack.grokDebugger": "legacy/plugins/grokdebugger",
- "xpack.idxMgmt": "legacy/plugins/index_management",
+ "xpack.idxMgmt": "plugins/index_management",
"xpack.indexLifecycleMgmt": "legacy/plugins/index_lifecycle_management",
"xpack.infra": "plugins/infra",
"xpack.ingestManager": "plugins/ingest_manager",
diff --git a/x-pack/legacy/plugins/cross_cluster_replication/index.js b/x-pack/legacy/plugins/cross_cluster_replication/index.js
index 1b5f42fc5107e..1b3aafcad5c0f 100644
--- a/x-pack/legacy/plugins/cross_cluster_replication/index.js
+++ b/x-pack/legacy/plugins/cross_cluster_replication/index.js
@@ -49,13 +49,12 @@ export function crossClusterReplication(kibana) {
init: function initCcrPlugin(server) {
registerLicenseChecker(server);
registerRoutes(server);
-
if (
server.config().get('xpack.ccr.ui.enabled') &&
- server.plugins.index_management &&
- server.plugins.index_management.addIndexManagementDataEnricher
+ server.newPlatform.setup.plugins.indexManagement &&
+ server.newPlatform.setup.plugins.indexManagement.indexDataEnricher
) {
- server.plugins.index_management.addIndexManagementDataEnricher(ccrDataEnricher);
+ server.newPlatform.setup.plugins.indexManagement.indexDataEnricher.add(ccrDataEnricher);
}
},
});
diff --git a/x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/components/detail_panel/detail_panel.js b/x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/components/detail_panel/detail_panel.js
index 16ed0a7d695ad..7b31ffa5024b7 100644
--- a/x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/components/detail_panel/detail_panel.js
+++ b/x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/components/detail_panel/detail_panel.js
@@ -7,7 +7,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from '@kbn/i18n/react';
-import { getIndexListUri } from '../../../../../../../../index_management/public/application/services/navigation';
+import { getIndexListUri } from '../../../../../../../../../../plugins/index_management/public';
import {
EuiButtonEmpty,
diff --git a/x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js b/x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js
index e3bda2e67097d..2ad118d28f38d 100644
--- a/x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js
+++ b/x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/follower_indices_list/components/detail_panel/detail_panel.js
@@ -7,8 +7,6 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from '@kbn/i18n/react';
-import { getIndexListUri } from '../../../../../../../../index_management/public/application/services/navigation';
-
import {
EuiButton,
EuiButtonEmpty,
@@ -31,12 +29,11 @@ import {
EuiTextColor,
EuiTitle,
} from '@elastic/eui';
-
import 'brace/theme/textmate';
-import { ContextMenu } from '../context_menu';
-
+import { getIndexListUri } from '../../../../../../../../../../plugins/index_management/public';
import { API_STATUS } from '../../../../../constants';
+import { ContextMenu } from '../context_menu';
export class DetailPanel extends Component {
static propTypes = {
diff --git a/x-pack/legacy/plugins/cross_cluster_replication/public/extend_index_management/index.js b/x-pack/legacy/plugins/cross_cluster_replication/public/extend_index_management/index.js
index 809a7c3e87b75..c44918c500849 100644
--- a/x-pack/legacy/plugins/cross_cluster_replication/public/extend_index_management/index.js
+++ b/x-pack/legacy/plugins/cross_cluster_replication/public/extend_index_management/index.js
@@ -4,11 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
-import { extensionsService } from '../../../index_management/public';
+import { npSetup } from 'ui/new_platform';
import { get } from 'lodash';
const propertyPath = 'isFollowerIndex';
-export const followerBadgeExtension = {
+
+const followerBadgeExtension = {
matchIndex: index => {
return get(index, propertyPath);
},
@@ -19,4 +20,6 @@ export const followerBadgeExtension = {
filterExpression: 'isFollowerIndex:true',
};
-extensionsService.addBadge(followerBadgeExtension);
+if (npSetup.plugins.indexManagement) {
+ npSetup.plugins.indexManagement.extensionsService.addBadge(followerBadgeExtension);
+}
diff --git a/x-pack/legacy/plugins/index_lifecycle_management/__jest__/extend_index_management.test.js b/x-pack/legacy/plugins/index_lifecycle_management/__jest__/extend_index_management.test.js
index bcbae7e093f46..d2619778617c3 100644
--- a/x-pack/legacy/plugins/index_lifecycle_management/__jest__/extend_index_management.test.js
+++ b/x-pack/legacy/plugins/index_lifecycle_management/__jest__/extend_index_management.test.js
@@ -27,8 +27,10 @@ initHttp(axios.create({ adapter: axiosXhrAdapter }), path => path);
initUiMetric(() => () => {});
jest.mock('ui/new_platform');
-jest.mock('../../index_management/public', async () => {
- const { indexManagementMock } = await import('../../index_management/public/mocks.ts');
+jest.mock('../../../../plugins/index_management/public', async () => {
+ const { indexManagementMock } = await import(
+ '../../../../plugins/index_management/public/mocks.ts'
+ );
return indexManagementMock.createSetup();
});
diff --git a/x-pack/legacy/plugins/index_lifecycle_management/plugin.ts b/x-pack/legacy/plugins/index_lifecycle_management/plugin.ts
index 8d7f937039203..38d1bea45ce07 100644
--- a/x-pack/legacy/plugins/index_lifecycle_management/plugin.ts
+++ b/x-pack/legacy/plugins/index_lifecycle_management/plugin.ts
@@ -41,14 +41,14 @@ export class Plugin {
registerPoliciesRoutes(server);
registerTemplatesRoutes(server);
- const serverPlugins = server.plugins as any;
+ const serverPlugins = server.newPlatform.setup.plugins as any;
if (
server.config().get('xpack.ilm.ui.enabled') &&
- serverPlugins.index_management &&
- serverPlugins.index_management.addIndexManagementDataEnricher
+ serverPlugins.indexManagement &&
+ serverPlugins.indexManagement.indexDataEnricher
) {
- serverPlugins.index_management.addIndexManagementDataEnricher(indexLifecycleDataEnricher);
+ serverPlugins.indexManagement.indexDataEnricher.add(indexLifecycleDataEnricher);
}
}
}
diff --git a/x-pack/legacy/plugins/index_lifecycle_management/public/legacy.ts b/x-pack/legacy/plugins/index_lifecycle_management/public/legacy.ts
index 3c21a644c0f78..f7f924add2c51 100644
--- a/x-pack/legacy/plugins/index_lifecycle_management/public/legacy.ts
+++ b/x-pack/legacy/plugins/index_lifecycle_management/public/legacy.ts
@@ -20,7 +20,9 @@ import { addAllExtensions } from './np_ready/extend_index_management';
if (chrome.getInjected('ilmUiEnabled')) {
// We have to initialize this outside of the NP lifecycle, otherwise these extensions won't
// be available in Index Management unless the user visits ILM first.
- addAllExtensions();
+ if ((npSetup.plugins as any).indexManagement) {
+ addAllExtensions((npSetup.plugins as any).indexManagement.extensionsService);
+ }
// This method handles the cleanup needed when route is scope is destroyed. It also prevents Angular
// from destroying scope when route changes and both old route and new route are this same route.
diff --git a/x-pack/legacy/plugins/index_lifecycle_management/public/np_ready/application/sections/policy_table/components/policy_table/policy_table.js b/x-pack/legacy/plugins/index_lifecycle_management/public/np_ready/application/sections/policy_table/components/policy_table/policy_table.js
index 83d32eae1097d..903161fe094fc 100644
--- a/x-pack/legacy/plugins/index_lifecycle_management/public/np_ready/application/sections/policy_table/components/policy_table/policy_table.js
+++ b/x-pack/legacy/plugins/index_lifecycle_management/public/np_ready/application/sections/policy_table/components/policy_table/policy_table.js
@@ -37,7 +37,7 @@ import {
import { RIGHT_ALIGNMENT } from '@elastic/eui/lib/services';
-import { getIndexListUri } from '../../../../../../../../index_management/public/application/services/navigation';
+import { getIndexListUri } from '../../../../../../../../../../plugins/index_management/public';
import { BASE_PATH } from '../../../../../../../common/constants';
import { UIM_EDIT_CLICK } from '../../../../constants';
import { getPolicyPath } from '../../../../services/navigation';
diff --git a/x-pack/legacy/plugins/index_lifecycle_management/public/np_ready/extend_index_management/index.js b/x-pack/legacy/plugins/index_lifecycle_management/public/np_ready/extend_index_management/index.js
index 0e662b78b2c18..69658d31695bc 100644
--- a/x-pack/legacy/plugins/index_lifecycle_management/public/np_ready/extend_index_management/index.js
+++ b/x-pack/legacy/plugins/index_lifecycle_management/public/np_ready/extend_index_management/index.js
@@ -9,7 +9,6 @@ import { get, every, any } from 'lodash';
import { i18n } from '@kbn/i18n';
import { EuiSearchBar } from '@elastic/eui';
-import { extensionsService } from '../../../../index_management/public';
import { init as initUiMetric } from '../application/services/ui_metric';
import { init as initNotification } from '../application/services/notification';
import { retryLifecycleForIndex } from '../application/services/api';
@@ -238,7 +237,7 @@ export const ilmFilterExtension = indices => {
}
};
-export const addAllExtensions = () => {
+export const addAllExtensions = extensionsService => {
extensionsService.addAction(retryLifecycleActionExtension);
extensionsService.addAction(removeLifecyclePolicyActionExtension);
extensionsService.addAction(addLifecyclePolicyActionExtension);
diff --git a/x-pack/legacy/plugins/index_management/index.ts b/x-pack/legacy/plugins/index_management/index.ts
index c92b38c0d94be..9eba98a526d2b 100644
--- a/x-pack/legacy/plugins/index_management/index.ts
+++ b/x-pack/legacy/plugins/index_management/index.ts
@@ -4,36 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { resolve } from 'path';
-import { Legacy } from 'kibana';
-import { PLUGIN } from './common/constants';
-import { plugin as initServerPlugin, Dependencies } from './server';
-
-export type ServerFacade = Legacy.Server;
-
export function indexManagement(kibana: any) {
return new kibana.Plugin({
- id: PLUGIN.id,
+ id: 'index_management',
configPrefix: 'xpack.index_management',
- publicDir: resolve(__dirname, 'public'),
- require: ['kibana', 'elasticsearch', 'xpack_main'],
-
- uiExports: {
- styleSheetPaths: resolve(__dirname, 'public/index.scss'),
- managementSections: ['plugins/index_management'],
- },
-
- init(server: ServerFacade) {
- const coreSetup = server.newPlatform.setup.core;
- const coreInitializerContext = server.newPlatform.coreContext;
- const pluginsSetup: Dependencies = {
- licensing: server.newPlatform.setup.plugins.licensing as any,
- };
-
- const serverPlugin = initServerPlugin(coreInitializerContext as any);
- const serverPublicApi = serverPlugin.setup(coreSetup, pluginsSetup);
-
- server.expose('addIndexManagementDataEnricher', serverPublicApi.indexDataEnricher.add);
- },
});
}
diff --git a/x-pack/legacy/plugins/index_management/public/index.html b/x-pack/legacy/plugins/index_management/public/index.html
deleted file mode 100644
index 0e9ac6fa0bc97..0000000000000
--- a/x-pack/legacy/plugins/index_management/public/index.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/x-pack/legacy/plugins/remote_clusters/index.ts b/x-pack/legacy/plugins/remote_clusters/index.ts
index 37b2224f8d7c2..439cb818d8a56 100644
--- a/x-pack/legacy/plugins/remote_clusters/index.ts
+++ b/x-pack/legacy/plugins/remote_clusters/index.ts
@@ -5,6 +5,8 @@
*/
import { resolve } from 'path';
+import { Legacy } from 'kibana';
+
import { PLUGIN } from './common';
export function remoteClusters(kibana: any) {
@@ -28,7 +30,7 @@ export function remoteClusters(kibana: any) {
enabled: Joi.boolean().default(true),
}).default();
},
- isEnabled(config: any) {
+ isEnabled(config: Legacy.KibanaConfig) {
return (
config.get('xpack.remote_clusters.enabled') && config.get('xpack.index_management.enabled')
);
diff --git a/x-pack/legacy/plugins/rollup/index.ts b/x-pack/legacy/plugins/rollup/index.ts
index 7548af23b3aae..2c8363cc397f4 100644
--- a/x-pack/legacy/plugins/rollup/index.ts
+++ b/x-pack/legacy/plugins/rollup/index.ts
@@ -40,7 +40,7 @@ export function rollup(kibana: any) {
},
init(server: any) {
const { core: coreSetup, plugins } = server.newPlatform.setup;
- const { usageCollection, metrics } = plugins;
+ const { usageCollection, metrics, indexManagement } = plugins;
const rollupSetup = (plugins.rollup as unknown) as RollupSetup;
@@ -54,11 +54,11 @@ export function rollup(kibana: any) {
rollupPluginInstance.setup(coreSetup, {
usageCollection,
metrics,
+ indexManagement,
__LEGACY: {
plugins: {
xpack_main: server.plugins.xpack_main,
rollup: server.plugins[PLUGIN.ID],
- index_management: server.plugins.index_management,
},
},
});
diff --git a/x-pack/legacy/plugins/rollup/public/legacy.ts b/x-pack/legacy/plugins/rollup/public/legacy.ts
index 64eb1f6436389..e3e663ac7b0f4 100644
--- a/x-pack/legacy/plugins/rollup/public/legacy.ts
+++ b/x-pack/legacy/plugins/rollup/public/legacy.ts
@@ -10,7 +10,6 @@ import { aggTypeFieldFilters } from 'ui/agg_types';
import { addSearchStrategy } from '../../../../../src/plugins/data/public';
import { RollupPlugin } from './plugin';
import { setup as management } from '../../../../../src/legacy/core_plugins/management/public/legacy';
-import { extensionsService } from '../../index_management/public';
const plugin = new RollupPlugin();
@@ -20,7 +19,6 @@ export const setup = plugin.setup(npSetup.core, {
aggTypeFilters,
aggTypeFieldFilters,
addSearchStrategy,
- indexManagementExtensions: extensionsService,
managementLegacy: management,
},
});
diff --git a/x-pack/legacy/plugins/rollup/public/plugin.ts b/x-pack/legacy/plugins/rollup/public/plugin.ts
index 90d7e2d9d0191..a01383f4733ef 100644
--- a/x-pack/legacy/plugins/rollup/public/plugin.ts
+++ b/x-pack/legacy/plugins/rollup/public/plugin.ts
@@ -27,7 +27,7 @@ import {
// @ts-ignore
import { CRUD_APP_BASE_PATH } from './crud_app/constants';
import { ManagementSetup } from '../../../../../src/plugins/management/public';
-import { IndexMgmtSetup } from '../../index_management/public';
+import { IndexMgmtSetup } from '../../../../plugins/index_management/public';
// @ts-ignore
import { setEsBaseAndXPackBase, setHttp } from './crud_app/services';
import { setNotifications, setFatalErrors } from './kibana_services';
@@ -39,30 +39,28 @@ export interface RollupPluginSetupDependencies {
aggTypeFieldFilters: AggTypeFieldFilters;
addSearchStrategy: (searchStrategy: SearchStrategyProvider) => void;
managementLegacy: ManagementSetupLegacy;
- indexManagementExtensions: IndexMgmtSetup['extensionsService'];
};
home?: HomePublicPluginSetup;
management: ManagementSetup;
+ indexManagement?: IndexMgmtSetup;
}
export class RollupPlugin implements Plugin {
setup(
core: CoreSetup,
{
- __LEGACY: {
- aggTypeFilters,
- aggTypeFieldFilters,
- addSearchStrategy,
- managementLegacy,
- indexManagementExtensions,
- },
+ __LEGACY: { aggTypeFilters, aggTypeFieldFilters, addSearchStrategy, managementLegacy },
home,
management,
+ indexManagement,
}: RollupPluginSetupDependencies
) {
setFatalErrors(core.fatalErrors);
- indexManagementExtensions.addBadge(rollupBadgeExtension);
- indexManagementExtensions.addToggle(rollupToggleExtension);
+
+ if (indexManagement) {
+ indexManagement.extensionsService.addBadge(rollupBadgeExtension);
+ indexManagement.extensionsService.addToggle(rollupToggleExtension);
+ }
const isRollupIndexPatternsEnabled = core.uiSettings.get(CONFIG_ROLLUPS);
diff --git a/x-pack/legacy/plugins/rollup/server/plugin.ts b/x-pack/legacy/plugins/rollup/server/plugin.ts
index 52b1e31af4eb2..090cb8a47377a 100644
--- a/x-pack/legacy/plugins/rollup/server/plugin.ts
+++ b/x-pack/legacy/plugins/rollup/server/plugin.ts
@@ -9,6 +9,7 @@ import { i18n } from '@kbn/i18n';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { VisTypeTimeseriesSetup } from 'src/plugins/vis_type_timeseries/server';
+import { IndexMgmtSetup } from '../../../../plugins/index_management/server';
import { registerLicenseChecker } from '../../../server/lib/register_license_checker';
import { PLUGIN } from '../common';
import { ServerShim, RouteDependencies } from './types';
@@ -38,10 +39,12 @@ export class RollupsServerPlugin implements Plugin {
__LEGACY: serverShim,
usageCollection,
metrics,
+ indexManagement,
}: {
__LEGACY: ServerShim;
usageCollection?: UsageCollectionSetup;
metrics?: VisTypeTimeseriesSetup;
+ indexManagement?: IndexMgmtSetup;
}
) {
const elasticsearch = await elasticsearchService.adminClient;
@@ -76,11 +79,8 @@ export class RollupsServerPlugin implements Plugin {
});
}
- if (
- serverShim.plugins.index_management &&
- serverShim.plugins.index_management.addIndexManagementDataEnricher
- ) {
- serverShim.plugins.index_management.addIndexManagementDataEnricher(rollupDataEnricher);
+ if (indexManagement && indexManagement.indexDataEnricher) {
+ indexManagement.indexDataEnricher.add(rollupDataEnricher);
}
if (metrics) {
diff --git a/x-pack/legacy/plugins/rollup/server/rollup_data_enricher.ts b/x-pack/legacy/plugins/rollup/server/rollup_data_enricher.ts
index 7c5e160c54a31..ad621f2d9ba80 100644
--- a/x-pack/legacy/plugins/rollup/server/rollup_data_enricher.ts
+++ b/x-pack/legacy/plugins/rollup/server/rollup_data_enricher.ts
@@ -4,14 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/
-interface Index {
- name: string;
- [key: string]: unknown;
-}
+import { Index } from '../../../../plugins/index_management/server';
export const rollupDataEnricher = async (indicesList: Index[], callWithRequest: any) => {
if (!indicesList || !indicesList.length) {
- return indicesList;
+ return Promise.resolve(indicesList);
}
const params = {
diff --git a/x-pack/legacy/plugins/rollup/server/types.ts b/x-pack/legacy/plugins/rollup/server/types.ts
index 62a4841133cff..bcc6770e9b8ee 100644
--- a/x-pack/legacy/plugins/rollup/server/types.ts
+++ b/x-pack/legacy/plugins/rollup/server/types.ts
@@ -11,7 +11,6 @@ export interface ServerShim {
plugins: {
xpack_main: XPackMainPlugin;
rollup: any;
- index_management: any;
};
}
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/constants.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/constants.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/constants.ts
rename to x-pack/plugins/index_management/__jest__/client_integration/helpers/constants.ts
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts
similarity index 96%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts
rename to x-pack/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts
index e5f0b25d89c3e..7e3e1fba9c44a 100644
--- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts
+++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts
@@ -12,10 +12,10 @@ import {
TestBedConfig,
findTestSubject,
nextTick,
-} from '../../../../../../test_utils';
-import { IndexManagementHome } from '../../../public/application/sections/home';
+} from '../../../../../test_utils';
+import { IndexManagementHome } from '../../../public/application/sections/home'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { BASE_PATH } from '../../../common/constants';
-import { indexManagementStore } from '../../../public/application/store';
+import { indexManagementStore } from '../../../public/application/store'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { Template } from '../../../common/types';
import { WithAppDependencies, services } from './setup_environment';
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/http_requests.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/http_requests.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/http_requests.ts
rename to x-pack/plugins/index_management/__jest__/client_integration/helpers/http_requests.ts
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts
similarity index 95%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/index.ts
rename to x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts
index 6dce4453a67f9..66021b531919a 100644
--- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/index.ts
+++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/index.ts
@@ -9,7 +9,7 @@ import { setup as templateCreateSetup } from './template_create.helpers';
import { setup as templateCloneSetup } from './template_clone.helpers';
import { setup as templateEditSetup } from './template_edit.helpers';
-export { nextTick, getRandomString, findTestSubject, TestBed } from '../../../../../../test_utils';
+export { nextTick, getRandomString, findTestSubject, TestBed } from '../../../../../test_utils';
export { setupEnvironment } from './setup_environment';
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/plugins/index_management/__jest__/client_integration/helpers/setup_environment.tsx
similarity index 95%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/setup_environment.tsx
rename to x-pack/plugins/index_management/__jest__/client_integration/helpers/setup_environment.tsx
index 0212efe1f322d..1eaf7efd17395 100644
--- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/setup_environment.tsx
+++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/setup_environment.tsx
@@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
+/* eslint-disable @kbn/eslint/no-restricted-paths */
import React from 'react';
import axios from 'axios';
import axiosXhrAdapter from 'axios/lib/adapters/xhr';
@@ -10,7 +11,7 @@ import axiosXhrAdapter from 'axios/lib/adapters/xhr';
import {
notificationServiceMock,
docLinksServiceMock,
-} from '../../../../../../../src/core/public/mocks';
+} from '../../../../../../src/core/public/mocks';
import { AppContextProvider } from '../../../public/application/app_context';
import { httpService } from '../../../public/application/services/http';
import { breadcrumbService } from '../../../public/application/services/breadcrumbs';
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts
similarity index 85%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts
rename to x-pack/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts
index cd1b67c08d934..36498b99ba143 100644
--- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts
+++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts
@@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { registerTestBed, TestBedConfig } from '../../../../../../test_utils';
+import { registerTestBed, TestBedConfig } from '../../../../../test_utils';
import { BASE_PATH } from '../../../common/constants';
-import { TemplateClone } from '../../../public/application/sections/template_clone';
+import { TemplateClone } from '../../../public/application/sections/template_clone'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { formSetup } from './template_form.helpers';
import { TEMPLATE_NAME } from './constants';
import { WithAppDependencies } from './setup_environment';
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts
similarity index 84%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts
rename to x-pack/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts
index 8e62bc25d6bd1..14a44968a93c3 100644
--- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts
+++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts
@@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { registerTestBed, TestBedConfig } from '../../../../../../test_utils';
+import { registerTestBed, TestBedConfig } from '../../../../../test_utils';
import { BASE_PATH } from '../../../common/constants';
-import { TemplateCreate } from '../../../public/application/sections/template_create';
+import { TemplateCreate } from '../../../public/application/sections/template_create'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { formSetup, TestSubjects } from './template_form.helpers';
import { WithAppDependencies } from './setup_environment';
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts
similarity index 85%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts
rename to x-pack/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts
index cb1025234b48e..af5fa8b79ecad 100644
--- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts
+++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts
@@ -4,9 +4,9 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { registerTestBed, TestBedConfig } from '../../../../../../test_utils';
+import { registerTestBed, TestBedConfig } from '../../../../../test_utils';
import { BASE_PATH } from '../../../common/constants';
-import { TemplateEdit } from '../../../public/application/sections/template_edit';
+import { TemplateEdit } from '../../../public/application/sections/template_edit'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { formSetup, TestSubjects } from './template_form.helpers';
import { TEMPLATE_NAME } from './constants';
import { WithAppDependencies } from './setup_environment';
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_form.helpers.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/template_form.helpers.ts
similarity index 99%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_form.helpers.ts
rename to x-pack/plugins/index_management/__jest__/client_integration/helpers/template_form.helpers.ts
index a7c87723b33fb..134c67c278b22 100644
--- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_form.helpers.ts
+++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/template_form.helpers.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { TestBed, SetupFunc, UnwrapPromise } from '../../../../../../test_utils';
+import { TestBed, SetupFunc, UnwrapPromise } from '../../../../../test_utils';
import { Template } from '../../../common/types';
import { nextTick } from './index';
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/home.test.ts b/x-pack/plugins/index_management/__jest__/client_integration/home.test.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/home.test.ts
rename to x-pack/plugins/index_management/__jest__/client_integration/home.test.ts
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/template_clone.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/template_clone.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/template_clone.test.tsx
rename to x-pack/plugins/index_management/__jest__/client_integration/template_clone.test.tsx
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/template_create.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/template_create.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/template_create.test.tsx
rename to x-pack/plugins/index_management/__jest__/client_integration/template_create.test.tsx
diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/template_edit.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/template_edit.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__jest__/client_integration/template_edit.test.tsx
rename to x-pack/plugins/index_management/__jest__/client_integration/template_edit.test.tsx
diff --git a/x-pack/legacy/plugins/index_management/__jest__/components/__snapshots__/index_table.test.js.snap b/x-pack/plugins/index_management/__jest__/components/__snapshots__/index_table.test.js.snap
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__jest__/components/__snapshots__/index_table.test.js.snap
rename to x-pack/plugins/index_management/__jest__/components/__snapshots__/index_table.test.js.snap
diff --git a/x-pack/legacy/plugins/index_management/__jest__/components/index_table.test.js b/x-pack/plugins/index_management/__jest__/components/index_table.test.js
similarity index 98%
rename from x-pack/legacy/plugins/index_management/__jest__/components/index_table.test.js
rename to x-pack/plugins/index_management/__jest__/components/index_table.test.js
index 2b4fd89436458..15c3ef0b84562 100644
--- a/x-pack/legacy/plugins/index_management/__jest__/components/index_table.test.js
+++ b/x-pack/plugins/index_management/__jest__/components/index_table.test.js
@@ -20,13 +20,13 @@ import { setUiMetricService } from '../../public/application/services/api';
import { indexManagementStore } from '../../public/application/store';
import { setExtensionsService } from '../../public/application/store/selectors';
import { BASE_PATH, API_BASE_PATH } from '../../common/constants';
-import { mountWithIntl } from '../../../../../test_utils/enzyme_helpers';
+import { mountWithIntl } from '../../../../test_utils/enzyme_helpers';
import { ExtensionsService } from '../../public/services';
import sinon from 'sinon';
import { findTestSubject } from '@elastic/eui/lib/test';
/* eslint-disable @kbn/eslint/no-restricted-paths */
-import { notificationServiceMock } from '../../../../../../src/core/public/notifications/notifications_service.mock';
+import { notificationServiceMock } from '../../../../../src/core/public/notifications/notifications_service.mock';
jest.mock('ui/new_platform');
diff --git a/x-pack/legacy/plugins/index_management/__jest__/lib/__snapshots__/flatten_object.test.js.snap b/x-pack/plugins/index_management/__jest__/lib/__snapshots__/flatten_object.test.js.snap
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__jest__/lib/__snapshots__/flatten_object.test.js.snap
rename to x-pack/plugins/index_management/__jest__/lib/__snapshots__/flatten_object.test.js.snap
diff --git a/x-pack/legacy/plugins/index_management/__jest__/lib/flatten_object.test.js b/x-pack/plugins/index_management/__jest__/lib/flatten_object.test.js
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__jest__/lib/flatten_object.test.js
rename to x-pack/plugins/index_management/__jest__/lib/flatten_object.test.js
diff --git a/x-pack/legacy/plugins/index_management/__mocks__/ace.js b/x-pack/plugins/index_management/__mocks__/ace.js
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__mocks__/ace.js
rename to x-pack/plugins/index_management/__mocks__/ace.js
diff --git a/x-pack/legacy/plugins/index_management/__mocks__/ui/documentation_links.js b/x-pack/plugins/index_management/__mocks__/ui/documentation_links.js
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__mocks__/ui/documentation_links.js
rename to x-pack/plugins/index_management/__mocks__/ui/documentation_links.js
diff --git a/x-pack/legacy/plugins/index_management/__mocks__/ui/notify.js b/x-pack/plugins/index_management/__mocks__/ui/notify.js
similarity index 100%
rename from x-pack/legacy/plugins/index_management/__mocks__/ui/notify.js
rename to x-pack/plugins/index_management/__mocks__/ui/notify.js
diff --git a/x-pack/legacy/plugins/index_management/common/constants/api_base_path.ts b/x-pack/plugins/index_management/common/constants/api_base_path.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/constants/api_base_path.ts
rename to x-pack/plugins/index_management/common/constants/api_base_path.ts
diff --git a/x-pack/legacy/plugins/index_management/common/constants/base_path.ts b/x-pack/plugins/index_management/common/constants/base_path.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/constants/base_path.ts
rename to x-pack/plugins/index_management/common/constants/base_path.ts
diff --git a/x-pack/legacy/plugins/index_management/common/constants/index.ts b/x-pack/plugins/index_management/common/constants/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/constants/index.ts
rename to x-pack/plugins/index_management/common/constants/index.ts
diff --git a/x-pack/legacy/plugins/index_management/common/constants/index_statuses.ts b/x-pack/plugins/index_management/common/constants/index_statuses.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/constants/index_statuses.ts
rename to x-pack/plugins/index_management/common/constants/index_statuses.ts
diff --git a/x-pack/legacy/plugins/index_management/common/constants/invalid_characters.ts b/x-pack/plugins/index_management/common/constants/invalid_characters.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/constants/invalid_characters.ts
rename to x-pack/plugins/index_management/common/constants/invalid_characters.ts
diff --git a/x-pack/legacy/plugins/index_management/common/constants/plugin.ts b/x-pack/plugins/index_management/common/constants/plugin.ts
similarity index 86%
rename from x-pack/legacy/plugins/index_management/common/constants/plugin.ts
rename to x-pack/plugins/index_management/common/constants/plugin.ts
index 2cd137f62d3db..e25f537edcf8d 100644
--- a/x-pack/legacy/plugins/index_management/common/constants/plugin.ts
+++ b/x-pack/plugins/index_management/common/constants/plugin.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { LicenseType } from '../../../../../plugins/licensing/common/types';
+import { LicenseType } from '../../../licensing/common/types';
const basicLicense: LicenseType = 'basic';
diff --git a/x-pack/legacy/plugins/index_management/common/constants/ui_metric.ts b/x-pack/plugins/index_management/common/constants/ui_metric.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/constants/ui_metric.ts
rename to x-pack/plugins/index_management/common/constants/ui_metric.ts
diff --git a/x-pack/legacy/plugins/index_management/common/index.ts b/x-pack/plugins/index_management/common/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/index.ts
rename to x-pack/plugins/index_management/common/index.ts
diff --git a/x-pack/legacy/plugins/index_management/common/lib/index.ts b/x-pack/plugins/index_management/common/lib/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/lib/index.ts
rename to x-pack/plugins/index_management/common/lib/index.ts
diff --git a/x-pack/legacy/plugins/index_management/common/lib/template_serialization.ts b/x-pack/plugins/index_management/common/lib/template_serialization.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/lib/template_serialization.ts
rename to x-pack/plugins/index_management/common/lib/template_serialization.ts
diff --git a/x-pack/legacy/plugins/index_management/common/types/index.ts b/x-pack/plugins/index_management/common/types/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/types/index.ts
rename to x-pack/plugins/index_management/common/types/index.ts
diff --git a/x-pack/legacy/plugins/index_management/common/types/templates.ts b/x-pack/plugins/index_management/common/types/templates.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/common/types/templates.ts
rename to x-pack/plugins/index_management/common/types/templates.ts
diff --git a/x-pack/plugins/index_management/kibana.json b/x-pack/plugins/index_management/kibana.json
new file mode 100644
index 0000000000000..7387a042988c0
--- /dev/null
+++ b/x-pack/plugins/index_management/kibana.json
@@ -0,0 +1,15 @@
+{
+ "id": "indexManagement",
+ "version": "kibana",
+ "server": true,
+ "ui": true,
+ "requiredPlugins": [
+ "home",
+ "licensing",
+ "management"
+ ],
+ "optionalPlugins": [
+ "usageCollection"
+ ],
+ "configPath": ["xpack", "index_management"]
+}
diff --git a/x-pack/legacy/plugins/index_management/public/application/app.tsx b/x-pack/plugins/index_management/public/application/app.tsx
similarity index 98%
rename from x-pack/legacy/plugins/index_management/public/application/app.tsx
rename to x-pack/plugins/index_management/public/application/app.tsx
index 3b475f3baba04..83997dd6ece18 100644
--- a/x-pack/legacy/plugins/index_management/public/application/app.tsx
+++ b/x-pack/plugins/index_management/public/application/app.tsx
@@ -16,7 +16,7 @@ import { useServices } from './app_context';
export const App = () => {
const { uiMetricService } = useServices();
- useEffect(() => uiMetricService.trackMetric('loaded', UIM_APP_LOAD), []);
+ useEffect(() => uiMetricService.trackMetric('loaded', UIM_APP_LOAD), [uiMetricService]);
return (
diff --git a/x-pack/legacy/plugins/index_management/public/application/app_context.tsx b/x-pack/plugins/index_management/public/application/app_context.tsx
similarity index 90%
rename from x-pack/legacy/plugins/index_management/public/application/app_context.tsx
rename to x-pack/plugins/index_management/public/application/app_context.tsx
index 12e0d362a2930..2bb618ad8efce 100644
--- a/x-pack/legacy/plugins/index_management/public/application/app_context.tsx
+++ b/x-pack/plugins/index_management/public/application/app_context.tsx
@@ -5,9 +5,9 @@
*/
import React, { createContext, useContext } from 'react';
-import { CoreStart } from '../../../../../../src/core/public';
+import { CoreStart } from '../../../../../src/core/public';
-import { UsageCollectionSetup } from '../../../../../../src/plugins/usage_collection/public';
+import { UsageCollectionSetup } from '../../../../../src/plugins/usage_collection/public';
import { IndexMgmtMetricsType } from '../types';
import { UiMetricService, NotificationService, HttpService } from './services';
import { ExtensionsService } from '../services';
diff --git a/x-pack/legacy/plugins/index_management/public/application/components/index.ts b/x-pack/plugins/index_management/public/application/components/index.ts
similarity index 100%
rename from x-pack/legacy/plugins/index_management/public/application/components/index.ts
rename to x-pack/plugins/index_management/public/application/components/index.ts
diff --git a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts
similarity index 90%
rename from x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts
rename to x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts
index e3313bfba56fd..6d64cb73da4bd 100644
--- a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts
@@ -10,7 +10,7 @@ export {
getRandomString,
findTestSubject,
TestBed,
-} from '../../../../../../../../../../test_utils';
+} from '../../../../../../../../../test_utils';
export const componentHelpers = {
mappingsEditor: { setup: mappingsEditorSetup },
diff --git a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts
similarity index 85%
rename from x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts
rename to x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts
index dcee956130a29..acb416654023e 100644
--- a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
-import { registerTestBed } from '../../../../../../../../../../test_utils';
+import { registerTestBed } from '../../../../../../../../../test_utils';
import { MappingsEditor } from '../../../mappings_editor';
export const setup = (props: any) =>
diff --git a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx
similarity index 100%
rename from x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx
rename to x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx
diff --git a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/_index.scss b/x-pack/plugins/index_management/public/application/components/mappings_editor/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/_index.scss
rename to x-pack/plugins/index_management/public/application/components/mappings_editor/_index.scss
diff --git a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/_index.scss b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/_index.scss
similarity index 100%
rename from x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/_index.scss
rename to x-pack/plugins/index_management/public/application/components/mappings_editor/components/_index.scss
diff --git a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/code_block.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/code_block.tsx
similarity index 100%
rename from x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/code_block.tsx
rename to x-pack/plugins/index_management/public/application/components/mappings_editor/components/code_block.tsx
diff --git a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx
similarity index 98%
rename from x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx
rename to x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx
index 0c5c9e2a15b75..9b0b8420f9ea9 100644
--- a/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx
+++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx
@@ -110,7 +110,7 @@ export const ConfigurationForm = React.memo(({ defaultValue }: Props) => {
});
});
return subscription.unsubscribe;
- }, [form]);
+ }, [form, dispatch]);
useEffect(() => {
if (didMountRef.current) {
@@ -121,14 +121,14 @@ export const ConfigurationForm = React.memo(({ defaultValue }: Props) => {
// Avoid reseting the form on component mount.
didMountRef.current = true;
}
- }, [defaultValue]);
+ }, [defaultValue, form]);
useEffect(() => {
return () => {
// On unmount => save in the state a snapshot of the current form data.
dispatch({ type: 'configuration.save' });
};
- }, []);
+ }, [dispatch]);
return (