diff --git a/src/plugins/management/public/index.ts b/src/plugins/management/public/index.ts index 4ece75bbf36da..9e59834303546 100644 --- a/src/plugins/management/public/index.ts +++ b/src/plugins/management/public/index.ts @@ -29,6 +29,7 @@ export { ManagementStart, RegisterManagementApp, RegisterManagementAppArgs, + ManagementAppMountParams, } from './types'; export { ManagementApp } from './management_app'; export { ManagementSection } from './management_section'; diff --git a/src/plugins/management/public/types.ts b/src/plugins/management/public/types.ts index 4dbea30ff062d..a8bdd5cca24a3 100644 --- a/src/plugins/management/public/types.ts +++ b/src/plugins/management/public/types.ts @@ -64,7 +64,7 @@ export type RegisterManagementApp = (managementApp: RegisterManagementAppArgs) = export type Unmount = () => Promise | void; -interface ManagementAppMountParams { +export interface ManagementAppMountParams { basePath: string; // base path for setting up your router element: HTMLElement; // element the section should render into setBreadcrumbs: (crumbs: ChromeBreadcrumb[]) => void; 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 cd107be408727..16ed0a7d695ad 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/app/services/navigation'; +import { getIndexListUri } from '../../../../../../../../index_management/public/application/services/navigation'; 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 d4e43a1bd1840..e3bda2e67097d 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,7 +7,7 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from '@kbn/i18n/react'; -import { getIndexListUri } from '../../../../../../../../index_management/public/app/services/navigation'; +import { getIndexListUri } from '../../../../../../../../index_management/public/application/services/navigation'; import { EuiButton, 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 549c71748e1be..809a7c3e87b75 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,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import { i18n } from '@kbn/i18n'; -import { addBadgeExtension } from '../../../index_management/public/index_management_extensions'; +import { extensionsService } from '../../../index_management/public'; import { get } from 'lodash'; const propertyPath = 'isFollowerIndex'; @@ -19,4 +19,4 @@ export const followerBadgeExtension = { filterExpression: 'isFollowerIndex:true', }; -addBadgeExtension(followerBadgeExtension); +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 cfae072b57a26..bcbae7e093f46 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 @@ -7,6 +7,7 @@ import moment from 'moment-timezone'; import axios from 'axios'; import axiosXhrAdapter from 'axios/lib/adapters/xhr'; + import { mountWithIntl } from '../../../../test_utils/enzyme_helpers'; import { retryLifecycleActionExtension, @@ -26,6 +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'); + return indexManagementMock.createSetup(); +}); const indexWithoutLifecyclePolicy = { health: 'yellow', 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 eba7f75aa9baf..83d32eae1097d 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/app/services/navigation'; +import { getIndexListUri } from '../../../../../../../../index_management/public/application/services/navigation'; 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 422a7986aa057..6958c4ecce0cc 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,13 +9,7 @@ import { get, every, any } from 'lodash'; import { i18n } from '@kbn/i18n'; import { EuiSearchBar } from '@elastic/eui'; -import { - addSummaryExtension, - addBannerExtension, - addActionExtension, - addFilterExtension, -} from '../../../../index_management/public/index_management_extensions'; - +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'; @@ -27,13 +21,17 @@ const stepPath = 'ilm.step'; export const retryLifecycleActionExtension = ({ indices, - createUiStatsReporter, + usageCollection, toasts, fatalErrors, }) => { // These are hacks that we can remove once the New Platform migration is done. They're needed here // because API requests and API errors require them. - initUiMetric(createUiStatsReporter); + const getLegacyReporter = appName => (type, name) => { + usageCollection.reportUiStats(appName, type, name); + }; + + initUiMetric(getLegacyReporter); initNotification(toasts, fatalErrors); const allHaveErrors = every(indices, index => { @@ -207,11 +205,11 @@ export const ilmFilterExtension = indices => { }; export const addAllExtensions = () => { - addActionExtension(retryLifecycleActionExtension); - addActionExtension(removeLifecyclePolicyActionExtension); - addActionExtension(addLifecyclePolicyActionExtension); + extensionsService.addAction(retryLifecycleActionExtension); + extensionsService.addAction(removeLifecyclePolicyActionExtension); + extensionsService.addAction(addLifecyclePolicyActionExtension); - addBannerExtension(ilmBannerExtension); - addSummaryExtension(ilmSummaryExtension); - addFilterExtension(ilmFilterExtension); + extensionsService.addBanner(ilmBannerExtension); + extensionsService.addSummary(ilmSummaryExtension); + extensionsService.addFilter(ilmFilterExtension); }; diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts index 4a4896347333c..e5f0b25d89c3e 100644 --- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts +++ b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/home.helpers.ts @@ -13,13 +13,14 @@ import { findTestSubject, nextTick, } from '../../../../../../test_utils'; -import { IndexManagementHome } from '../../../public/app/sections/home'; +import { IndexManagementHome } from '../../../public/application/sections/home'; import { BASE_PATH } from '../../../common/constants'; -import { indexManagementStore } from '../../../public/app/store'; +import { indexManagementStore } from '../../../public/application/store'; import { Template } from '../../../common/types'; +import { WithAppDependencies, services } from './setup_environment'; const testBedConfig: TestBedConfig = { - store: indexManagementStore, + store: () => indexManagementStore(services as any), memoryRouter: { initialEntries: [`${BASE_PATH}indices`], componentRoutePath: `${BASE_PATH}:section(indices|templates)`, @@ -27,7 +28,7 @@ const testBedConfig: TestBedConfig = { doMountAsync: true, }; -const initTestBed = registerTestBed(IndexManagementHome, testBedConfig); +const initTestBed = registerTestBed(WithAppDependencies(IndexManagementHome), testBedConfig); export interface IdxMgmtHomeTestBed extends TestBed { findAction: (action: 'edit' | 'clone' | 'delete') => ReactWrapper; diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/setup_environment.ts b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/setup_environment.ts deleted file mode 100644 index d5ac185a63ccd..0000000000000 --- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/setup_environment.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import axios from 'axios'; -import axiosXhrAdapter from 'axios/lib/adapters/xhr'; -import { init as initHttpRequests } from './http_requests'; -import { httpService } from '../../../public/app/services/http'; -import { breadcrumbService } from '../../../public/app/services/breadcrumbs'; -import { documentationService } from '../../../public/app/services/documentation'; -import { notificationService } from '../../../public/app/services/notification'; -import { uiMetricService } from '../../../public/app/services/ui_metric'; -import { createUiStatsReporter } from '../../../../../../../src/legacy/core_plugins/ui_metric/public'; - -/* eslint-disable @kbn/eslint/no-restricted-paths */ -import { notificationServiceMock } from '../../../../../../../src/core/public/notifications/notifications_service.mock'; -import { chromeServiceMock } from '../../../../../../../src/core/public/chrome/chrome_service.mock'; -import { docLinksServiceMock } from '../../../../../../../src/core/public/doc_links/doc_links_service.mock'; - -const mockHttpClient = axios.create({ adapter: axiosXhrAdapter }); - -export const setupEnvironment = () => { - // Mock initialization of services - // @ts-ignore - httpService.init(mockHttpClient); - breadcrumbService.init(chromeServiceMock.createStartContract(), ''); - documentationService.init(docLinksServiceMock.createStartContract()); - notificationService.init(notificationServiceMock.createStartContract()); - uiMetricService.init(createUiStatsReporter); - - const { server, httpRequestsMockHelpers } = initHttpRequests(); - - return { - server, - httpRequestsMockHelpers, - }; -}; diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/setup_environment.tsx b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/setup_environment.tsx new file mode 100644 index 0000000000000..0212efe1f322d --- /dev/null +++ b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/setup_environment.tsx @@ -0,0 +1,56 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React from 'react'; +import axios from 'axios'; +import axiosXhrAdapter from 'axios/lib/adapters/xhr'; + +import { + notificationServiceMock, + docLinksServiceMock, +} 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'; +import { documentationService } from '../../../public/application/services/documentation'; +import { notificationService } from '../../../public/application/services/notification'; +import { ExtensionsService } from '../../../public/services'; +import { UiMetricService } from '../../../public/application/services/ui_metric'; +import { setUiMetricService } from '../../../public/application/services/api'; +import { setExtensionsService } from '../../../public/application/store/selectors'; +import { init as initHttpRequests } from './http_requests'; + +const mockHttpClient = axios.create({ adapter: axiosXhrAdapter }); + +export const services = { + extensionsService: new ExtensionsService(), + uiMetricService: new UiMetricService('index_management'), +}; +services.uiMetricService.setup({ reportUiStats() {} } as any); +setExtensionsService(services.extensionsService); +setUiMetricService(services.uiMetricService); +const appDependencies = { services, core: {}, plugins: {} } as any; + +export const setupEnvironment = () => { + // Mock initialization of services + // @ts-ignore + httpService.setup(mockHttpClient); + breadcrumbService.setup(() => undefined); + documentationService.setup(docLinksServiceMock.createStartContract()); + notificationService.setup(notificationServiceMock.createSetupContract()); + + const { server, httpRequestsMockHelpers } = initHttpRequests(); + + return { + server, + httpRequestsMockHelpers, + }; +}; + +export const WithAppDependencies = (Comp: any) => (props: any) => ( + + + +); diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts index 286e56b4349e4..cd1b67c08d934 100644 --- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts +++ b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_clone.helpers.ts @@ -6,9 +6,10 @@ import { registerTestBed, TestBedConfig } from '../../../../../../test_utils'; import { BASE_PATH } from '../../../common/constants'; -import { TemplateClone } from '../../../public/app/sections/template_clone'; +import { TemplateClone } from '../../../public/application/sections/template_clone'; import { formSetup } from './template_form.helpers'; import { TEMPLATE_NAME } from './constants'; +import { WithAppDependencies } from './setup_environment'; const testBedConfig: TestBedConfig = { memoryRouter: { @@ -18,6 +19,6 @@ const testBedConfig: TestBedConfig = { doMountAsync: true, }; -const initTestBed = registerTestBed(TemplateClone, testBedConfig); +const initTestBed = registerTestBed(WithAppDependencies(TemplateClone), testBedConfig); export const setup = formSetup.bind(null, initTestBed); diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts index b1b5d51ef6a9d..8e62bc25d6bd1 100644 --- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts +++ b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_create.helpers.ts @@ -6,8 +6,9 @@ import { registerTestBed, TestBedConfig } from '../../../../../../test_utils'; import { BASE_PATH } from '../../../common/constants'; -import { TemplateCreate } from '../../../public/app/sections/template_create'; +import { TemplateCreate } from '../../../public/application/sections/template_create'; import { formSetup, TestSubjects } from './template_form.helpers'; +import { WithAppDependencies } from './setup_environment'; const testBedConfig: TestBedConfig = { memoryRouter: { @@ -17,6 +18,9 @@ const testBedConfig: TestBedConfig = { doMountAsync: true, }; -const initTestBed = registerTestBed(TemplateCreate, testBedConfig); +const initTestBed = registerTestBed( + WithAppDependencies(TemplateCreate), + testBedConfig +); export const setup = formSetup.bind(null, initTestBed); diff --git a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts index e8e19f637854d..cb1025234b48e 100644 --- a/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts +++ b/x-pack/legacy/plugins/index_management/__jest__/client_integration/helpers/template_edit.helpers.ts @@ -6,9 +6,10 @@ import { registerTestBed, TestBedConfig } from '../../../../../../test_utils'; import { BASE_PATH } from '../../../common/constants'; -import { TemplateEdit } from '../../../public/app/sections/template_edit'; +import { TemplateEdit } from '../../../public/application/sections/template_edit'; import { formSetup, TestSubjects } from './template_form.helpers'; import { TEMPLATE_NAME } from './constants'; +import { WithAppDependencies } from './setup_environment'; const testBedConfig: TestBedConfig = { memoryRouter: { @@ -18,6 +19,6 @@ const testBedConfig: TestBedConfig = { doMountAsync: true, }; -const initTestBed = registerTestBed(TemplateEdit, testBedConfig); +const initTestBed = registerTestBed(WithAppDependencies(TemplateEdit), testBedConfig); export const setup = formSetup.bind(null, initTestBed); diff --git a/x-pack/legacy/plugins/index_management/__jest__/components/index_table.test.js b/x-pack/legacy/plugins/index_management/__jest__/components/index_table.test.js index fe55b93d24a91..2b4fd89436458 100644 --- a/x-pack/legacy/plugins/index_management/__jest__/components/index_table.test.js +++ b/x-pack/legacy/plugins/index_management/__jest__/components/index_table.test.js @@ -8,23 +8,25 @@ import React from 'react'; import axios from 'axios'; import axiosXhrAdapter from 'axios/lib/adapters/xhr'; import { MemoryRouter } from 'react-router-dom'; -import { AppWithoutRouter } from '../../public/app/app'; +import { AppWithoutRouter } from '../../public/application/app'; +import { AppContextProvider } from '../../public/application/app_context'; import { Provider } from 'react-redux'; -import { loadIndicesSuccess } from '../../public/app/store/actions'; -import { breadcrumbService } from '../../public/app/services/breadcrumbs'; -import { uiMetricService } from '../../public/app/services/ui_metric'; -import { notificationService } from '../../public/app/services/notification'; -import { httpService } from '../../public/app/services/http'; -import { createUiStatsReporter } from '../../../../../../src/legacy/core_plugins/ui_metric/public'; -import { indexManagementStore } from '../../public/app/store'; +import { loadIndicesSuccess } from '../../public/application/store/actions'; +import { breadcrumbService } from '../../public/application/services/breadcrumbs'; +import { UiMetricService } from '../../public/application/services/ui_metric'; +import { notificationService } from '../../public/application/services/notification'; +import { httpService } from '../../public/application/services/http'; +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 { 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 { chromeServiceMock } from '../../../../../../src/core/public/chrome/chrome_service.mock'; jest.mock('ui/new_platform'); @@ -107,17 +109,29 @@ const namesText = rendered => { describe('index table', () => { beforeEach(() => { // Mock initialization of services + const services = { + extensionsService: new ExtensionsService(), + uiMetricService: new UiMetricService('index_management'), + }; + services.uiMetricService.setup({ reportUiStats() {} }); + setExtensionsService(services.extensionsService); + setUiMetricService(services.uiMetricService); + // @ts-ignore - httpService.init(mockHttpClient); - breadcrumbService.init(chromeServiceMock.createStartContract(), ''); - uiMetricService.init(createUiStatsReporter); - notificationService.init(notificationServiceMock.createStartContract()); + httpService.setup(mockHttpClient); + breadcrumbService.setup(() => undefined); + notificationService.setup(notificationServiceMock.createStartContract()); + + store = indexManagementStore(services); + + const appDependencies = { services, core: {}, plugins: {} }; - store = indexManagementStore(); component = ( - + + + ); @@ -141,6 +155,9 @@ describe('index table', () => { server.respondImmediately = true; }); afterEach(() => { + if (!server) { + return; + } server.restore(); }); @@ -294,6 +311,8 @@ describe('index table', () => { confirmButton.simulate('click'); snapshot(status(rendered, rowIndex)); }); + // Commenting the following 2 tests as it works in the browser (status changes to "closed" or "open") but the + // snapshot say the contrary. Need to be investigated. test('close index button works from context menu', done => { const modifiedIndices = indices.map(index => { return { diff --git a/x-pack/legacy/plugins/index_management/__jest__/lib/flatten_object.test.js b/x-pack/legacy/plugins/index_management/__jest__/lib/flatten_object.test.js index eb21459a3cbc7..0d6d5ee796627 100644 --- a/x-pack/legacy/plugins/index_management/__jest__/lib/flatten_object.test.js +++ b/x-pack/legacy/plugins/index_management/__jest__/lib/flatten_object.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { flattenObject } from '../../public/app/lib/flatten_object'; +import { flattenObject } from '../../public/application/lib/flatten_object'; describe('flatten_object', () => { test('it flattens an object', () => { const obj = { diff --git a/x-pack/legacy/plugins/index_management/public/app/index.tsx b/x-pack/legacy/plugins/index_management/public/app/index.tsx deleted file mode 100644 index 027839df2e20e..0000000000000 --- a/x-pack/legacy/plugins/index_management/public/app/index.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React from 'react'; -import { Provider } from 'react-redux'; -import { render, unmountComponentAtNode } from 'react-dom'; - -import { CoreStart } from '../../../../../../src/core/public'; - -import { App } from './app'; -import { indexManagementStore } from './store'; - -export const mountReactApp = (elem: HTMLElement | null, { core }: { core: CoreStart }): void => { - if (elem) { - const { i18n } = core; - const { Context: I18nContext } = i18n; - - render( - - - - - , - elem - ); - } -}; - -export const unmountReactApp = (elem: HTMLElement | null) => { - if (elem) { - unmountComponentAtNode(elem); - } -}; diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/detail_panel.js b/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/detail_panel.js deleted file mode 100644 index 0bfd32581ef4a..0000000000000 --- a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/detail_panel.js +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React, { Component, Fragment } from 'react'; -import { Route } from 'react-router-dom'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { - EuiCallOut, - EuiFlexGroup, - EuiFlexItem, - EuiFlyout, - EuiFlyoutBody, - EuiFlyoutFooter, - EuiFlyoutHeader, - EuiSpacer, - EuiTabs, - EuiTab, - EuiTitle, -} from '@elastic/eui'; -import { renderBadges } from '../../../../lib/render_badges'; -import { INDEX_OPEN } from '../../../../../../common/constants'; -import { - TAB_SUMMARY, - TAB_SETTINGS, - TAB_MAPPING, - TAB_STATS, - TAB_EDIT_SETTINGS, -} from '../../../../constants'; -import { IndexActionsContextMenu } from '../index_actions_context_menu'; -import { ShowJson } from './show_json'; -import { Summary } from './summary'; -import { EditSettingsJson } from './edit_settings_json'; - -const tabToHumanizedMap = { - [TAB_SUMMARY]: ( - - ), - [TAB_SETTINGS]: ( - - ), - [TAB_MAPPING]: ( - - ), - [TAB_STATS]: ( - - ), - [TAB_EDIT_SETTINGS]: ( - - ), -}; - -const tabs = [TAB_SUMMARY, TAB_SETTINGS, TAB_MAPPING, TAB_STATS, TAB_EDIT_SETTINGS]; - -export class DetailPanel extends Component { - renderTabs() { - const { panelType, indexName, index, openDetailPanel } = this.props; - return tabs.map((tab, i) => { - const isSelected = tab === panelType; - return ( - openDetailPanel({ panelType: tab, indexName })} - isSelected={isSelected} - data-test-subj={`detailPanelTab${isSelected ? 'Selected' : ''}`} - disabled={tab === TAB_STATS && index.status !== INDEX_OPEN} - key={i} - > - {tabToHumanizedMap[tab]} - - ); - }); - } - render() { - const { panelType, indexName, index, closeDetailPanel } = this.props; - if (!panelType) { - return null; - } - let component = null; - switch (panelType) { - case TAB_EDIT_SETTINGS: - component = ; - break; - case TAB_MAPPING: - case TAB_SETTINGS: - case TAB_STATS: - component = ; - break; - default: - component = ; - } - const content = index ? ( - - {component} - - - - ( - - } - /> - )} - /> - - - - - ) : ( - - - - } - color="danger" - iconType="cross" - > - - - - ); - return ( - - - -

- {indexName} - {renderBadges(index)} -

-
- {index ? {this.renderTabs()} : null} -
- {content} -
- ); - } -} diff --git a/x-pack/legacy/plugins/index_management/public/app/services/ui_metric.ts b/x-pack/legacy/plugins/index_management/public/app/services/ui_metric.ts deleted file mode 100644 index 4ea98fff1d70a..0000000000000 --- a/x-pack/legacy/plugins/index_management/public/app/services/ui_metric.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -import { UIM_APP_NAME } from '../../../common/constants'; -import { - createUiStatsReporter, - UiStatsMetricType, -} from '../../../../../../../src/legacy/core_plugins/ui_metric/public'; - -class UiMetricService { - track?: ReturnType; - - public init = (getReporter: typeof createUiStatsReporter): void => { - this.track = getReporter(UIM_APP_NAME); - }; - - public trackMetric = (type: 'loaded' | 'click' | 'count', eventName: string): void => { - if (!this.track) throw Error('UiMetricService not initialized.'); - return this.track(type as UiStatsMetricType, eventName); - }; -} - -export const uiMetricService = new UiMetricService(); diff --git a/x-pack/legacy/plugins/index_management/public/app/store/reducers/detail_panel.js b/x-pack/legacy/plugins/index_management/public/app/store/reducers/detail_panel.js deleted file mode 100644 index 9ba73a1c61b03..0000000000000 --- a/x-pack/legacy/plugins/index_management/public/app/store/reducers/detail_panel.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { handleActions } from 'redux-actions'; -import { - UIM_DETAIL_PANEL_SUMMARY_TAB, - UIM_DETAIL_PANEL_SETTINGS_TAB, - UIM_DETAIL_PANEL_MAPPING_TAB, - UIM_DETAIL_PANEL_STATS_TAB, - UIM_DETAIL_PANEL_EDIT_SETTINGS_TAB, -} from '../../../../common/constants'; -import { - TAB_SUMMARY, - TAB_SETTINGS, - TAB_MAPPING, - TAB_STATS, - TAB_EDIT_SETTINGS, -} from '../../constants'; -import { uiMetricService } from '../../services/ui_metric'; -import { openDetailPanel, closeDetailPanel } from '../actions/detail_panel'; -import { loadIndexDataSuccess } from '../actions/load_index_data'; -import { - updateIndexSettingsSuccess, - updateIndexSettingsError, -} from '../actions/update_index_settings'; -import { deleteIndicesSuccess } from '../actions/delete_indices'; - -const defaultState = {}; - -export const detailPanel = handleActions( - { - [deleteIndicesSuccess](state, action) { - const { indexNames } = action.payload; - const { indexName } = state; - if (indexNames.includes(indexName)) { - return {}; - } else { - return state; - } - }, - [openDetailPanel](state, action) { - const { panelType, indexName, title } = action.payload; - - const panelTypeToUiMetricMap = { - [TAB_SUMMARY]: UIM_DETAIL_PANEL_SUMMARY_TAB, - [TAB_SETTINGS]: UIM_DETAIL_PANEL_SETTINGS_TAB, - [TAB_MAPPING]: UIM_DETAIL_PANEL_MAPPING_TAB, - [TAB_STATS]: UIM_DETAIL_PANEL_STATS_TAB, - [TAB_EDIT_SETTINGS]: UIM_DETAIL_PANEL_EDIT_SETTINGS_TAB, - }; - - if (panelTypeToUiMetricMap[panelType]) { - uiMetricService.trackMetric('count', panelTypeToUiMetricMap[panelType]); - } - - return { - panelType: panelType || state.panelType || TAB_SUMMARY, - indexName, - title, - }; - }, - [closeDetailPanel]() { - return {}; - }, - [loadIndexDataSuccess](state, action) { - const { data } = action.payload; - const newState = { - ...state, - data, - }; - return newState; - }, - [updateIndexSettingsError](state, action) { - const { error } = action.payload; - const newState = { - ...state, - error, - }; - return newState; - }, - [updateIndexSettingsSuccess]() { - return {}; - }, - }, - defaultState -); diff --git a/x-pack/legacy/plugins/index_management/public/app/app.tsx b/x-pack/legacy/plugins/index_management/public/application/app.tsx similarity index 93% rename from x-pack/legacy/plugins/index_management/public/app/app.tsx rename to x-pack/legacy/plugins/index_management/public/application/app.tsx index 9ed824e184120..3b475f3baba04 100644 --- a/x-pack/legacy/plugins/index_management/public/app/app.tsx +++ b/x-pack/legacy/plugins/index_management/public/application/app.tsx @@ -11,9 +11,11 @@ import { IndexManagementHome } from './sections/home'; import { TemplateCreate } from './sections/template_create'; import { TemplateClone } from './sections/template_clone'; import { TemplateEdit } from './sections/template_edit'; -import { uiMetricService } from './services/ui_metric'; + +import { useServices } from './app_context'; export const App = () => { + const { uiMetricService } = useServices(); useEffect(() => uiMetricService.trackMetric('loaded', UIM_APP_LOAD), []); return ( diff --git a/x-pack/legacy/plugins/index_management/public/application/app_context.tsx b/x-pack/legacy/plugins/index_management/public/application/app_context.tsx new file mode 100644 index 0000000000000..12e0d362a2930 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/application/app_context.tsx @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { createContext, useContext } from 'react'; +import { CoreStart } from '../../../../../../src/core/public'; + +import { UsageCollectionSetup } from '../../../../../../src/plugins/usage_collection/public'; +import { IndexMgmtMetricsType } from '../types'; +import { UiMetricService, NotificationService, HttpService } from './services'; +import { ExtensionsService } from '../services'; + +const AppContext = createContext(undefined); + +export interface AppDependencies { + core: { + fatalErrors: CoreStart['fatalErrors']; + }; + plugins: { + usageCollection: UsageCollectionSetup; + }; + services: { + uiMetricService: UiMetricService; + extensionsService: ExtensionsService; + httpService: HttpService; + notificationService: NotificationService; + }; +} + +export const AppContextProvider = ({ + children, + value, +}: { + value: AppDependencies; + children: React.ReactNode; +}) => { + return {children}; +}; + +export const AppContextConsumer = AppContext.Consumer; + +export const useAppContext = () => { + const ctx = useContext(AppContext); + if (!ctx) { + throw new Error('"useAppContext" can only be called inside of AppContext.Provider!'); + } + return ctx; +}; + +export const useServices = () => useAppContext().services; diff --git a/x-pack/legacy/plugins/index_management/public/app/components/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/helpers/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/helpers/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/helpers/mappings_editor.helpers.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx b/x-pack/legacy/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/app/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx rename to x-pack/legacy/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/app/components/mappings_editor/_index.scss b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/_index.scss similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/_index.scss rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/_index.scss diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/_index.scss b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/_index.scss similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/_index.scss rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/_index.scss diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/code_block.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/code_block.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/code_block.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/code_block.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/configuration_form.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/configuration_form.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/configuration_form_schema.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form_schema.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/configuration_form_schema.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/configuration_form_schema.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/dynamic_mapping_section/dynamic_mapping_section.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/dynamic_mapping_section/dynamic_mapping_section.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/dynamic_mapping_section/dynamic_mapping_section.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/dynamic_mapping_section/dynamic_mapping_section.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/dynamic_mapping_section/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/dynamic_mapping_section/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/dynamic_mapping_section/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/dynamic_mapping_section/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/meta_field_section/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/meta_field_section/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/meta_field_section/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/meta_field_section/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/meta_field_section/meta_field_section.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/meta_field_section/meta_field_section.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/meta_field_section/meta_field_section.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/meta_field_section/meta_field_section.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/routing_section.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/routing_section.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/routing_section.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/routing_section.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/source_field_section/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/source_field_section/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/source_field_section/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/source_field_section/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/source_field_section/source_field_section.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/source_field_section/source_field_section.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/configuration_form/source_field_section/source_field_section.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/configuration_form/source_field_section/source_field_section.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/_index.scss b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/_index.scss similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/_index.scss rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/_index.scss diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/document_fields.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/document_fields.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/document_fields.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/document_fields.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/document_fields_header.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/document_fields_header.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/document_fields_header.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/document_fields_header.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/editor_toggle_controls.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/editor_toggle_controls.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/editor_toggle_controls.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/editor_toggle_controls.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/analyzer_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/analyzer_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/analyzer_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/analyzer_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/analyzer_parameter_selects.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/analyzer_parameter_selects.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/analyzer_parameter_selects.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/analyzer_parameter_selects.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/analyzers_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/analyzers_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/analyzers_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/analyzers_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/boost_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/boost_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/boost_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/boost_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/coerce_number_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/coerce_number_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/coerce_number_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/coerce_number_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/coerce_shape_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/coerce_shape_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/coerce_shape_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/coerce_shape_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/copy_to_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/copy_to_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/copy_to_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/copy_to_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/doc_values_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/doc_values_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/doc_values_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/doc_values_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/dynamic_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/dynamic_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/dynamic_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/dynamic_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/eager_global_ordinals_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/eager_global_ordinals_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/eager_global_ordinals_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/eager_global_ordinals_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/enabled_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/enabled_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/enabled_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/enabled_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/fielddata_frequency_filter_absolute.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/fielddata_frequency_filter_absolute.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/fielddata_frequency_filter_absolute.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/fielddata_frequency_filter_absolute.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/fielddata_frequency_filter_percentage.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/fielddata_frequency_filter_percentage.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/fielddata_frequency_filter_percentage.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/fielddata_frequency_filter_percentage.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/fielddata_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/fielddata_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/fielddata_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/fielddata_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/format_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/format_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/format_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/format_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/ignore_malformed.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/ignore_malformed.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/ignore_malformed.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/ignore_malformed.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/ignore_z_value_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/ignore_z_value_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/ignore_z_value_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/ignore_z_value_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/index_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/index_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/index_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/index_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/locale_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/locale_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/locale_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/locale_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/max_shingle_size_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/max_shingle_size_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/max_shingle_size_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/max_shingle_size_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/name_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/name_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/name_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/name_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/norms_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/norms_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/norms_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/norms_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/null_value_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/null_value_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/null_value_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/null_value_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/orientation_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/orientation_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/orientation_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/orientation_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/path_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/path_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/path_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/path_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/relations_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/relations_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/relations_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/relations_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/similarity_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/similarity_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/similarity_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/similarity_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/split_queries_on_whitespace_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/split_queries_on_whitespace_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/split_queries_on_whitespace_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/split_queries_on_whitespace_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/store_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/store_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/store_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/store_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/term_vector_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/term_vector_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/term_vector_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/term_vector_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/type_parameter.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/field_parameters/type_parameter.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/field_parameters/type_parameter.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/_field_list_item.scss b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/_field_list_item.scss similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/_field_list_item.scss rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/_field_list_item.scss diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/_index.scss b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/_index.scss similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/_index.scss rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/_index.scss diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/create_field.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/create_field.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/create_field.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/create_field.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/alias_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/alias_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/alias_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/alias_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/dense_vector_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/dense_vector_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/dense_vector_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/dense_vector_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/scaled_float_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/scaled_float_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/scaled_float_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/scaled_float_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/token_count_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/token_count_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/token_count_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/create_field/required_parameters_forms/token_count_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/delete_field_provider.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/delete_field_provider.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/delete_field_provider.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/delete_field_provider.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/_edit_field_form_row.scss b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/_edit_field_form_row.scss similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/_edit_field_form_row.scss rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/_edit_field_form_row.scss diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/_index.scss b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/_index.scss similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/_index.scss rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/_index.scss diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/advanced_parameters_section.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/advanced_parameters_section.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/advanced_parameters_section.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/advanced_parameters_section.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/basic_parameters_section.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/basic_parameters_section.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/basic_parameters_section.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/basic_parameters_section.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/edit_field.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/edit_field.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/edit_field.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/edit_field.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_container.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_container.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_container.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_container.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_form_row.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_form_row.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_form_row.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_form_row.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_header_form.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_header_form.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_header_form.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/edit_field_header_form.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/field_description_section.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/field_description_section.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/field_description_section.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/field_description_section.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/update_field_provider.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/update_field_provider.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/edit_field/update_field_provider.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/edit_field/update_field_provider.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/alias_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/alias_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/alias_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/alias_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/binary_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/binary_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/binary_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/binary_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/boolean_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/boolean_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/boolean_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/boolean_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/completion_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/completion_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/completion_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/completion_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/date_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/date_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/date_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/date_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/dense_vector_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/dense_vector_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/dense_vector_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/dense_vector_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/flattened_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/geo_point_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/geo_point_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/geo_point_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/geo_point_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/geo_shape_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/geo_shape_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/geo_shape_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/geo_shape_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/ip_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/ip_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/ip_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/ip_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/join_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/join_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/join_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/join_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/keyword_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/keyword_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/keyword_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/keyword_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/nested_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/nested_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/nested_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/nested_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/numeric_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/numeric_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/numeric_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/numeric_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/object_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/object_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/object_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/object_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/range_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/range_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/range_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/range_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/search_as_you_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/search_as_you_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/search_as_you_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/search_as_you_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/shape_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/shape_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/shape_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/shape_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/text_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/text_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/text_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/text_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/token_count_type.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/token_count_type.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/field_types/token_count_type.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/field_types/token_count_type.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/fields_list.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/fields_list.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/fields_list.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/fields_list.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/fields_list_item.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/fields_list_item.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/fields_list_item.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/fields_list_item.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/fields_list_item_container.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/fields_list_item_container.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/fields_list_item_container.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/fields_list_item_container.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/modal_confirmation_delete_fields.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/modal_confirmation_delete_fields.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields/modal_confirmation_delete_fields.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields/modal_confirmation_delete_fields.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields_json_editor.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields_json_editor.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields_json_editor.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields_json_editor.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields_tree_editor.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields_tree_editor.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/fields_tree_editor.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/fields_tree_editor.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/search_fields/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/search_fields/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/search_fields/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/search_fields/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/search_fields/search_result.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/search_fields/search_result.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/search_fields/search_result.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/search_fields/search_result.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/search_fields/search_result_item.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/search_fields/search_result_item.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/document_fields/search_fields/search_result_item.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/document_fields/search_fields/search_result_item.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/fields_tree.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/fields_tree.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/fields_tree.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/fields_tree.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_from_json_button.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_from_json_button.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_from_json_button.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_from_json_button.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.test.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/load_mappings/load_mappings_provider.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/load_mappings/load_mappings_provider.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/multiple_mappings_warning.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/multiple_mappings_warning.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/multiple_mappings_warning.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/multiple_mappings_warning.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/templates_form/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/templates_form/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/templates_form/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/templates_form/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/templates_form/templates_form.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/templates_form/templates_form.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/templates_form/templates_form.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/templates_form/templates_form.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/templates_form/templates_form_schema.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/templates_form/templates_form_schema.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/templates_form/templates_form_schema.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/templates_form/templates_form_schema.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/tree/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/tree/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/tree/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/tree/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/tree/tree.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/tree/tree.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/tree/tree.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/tree/tree.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/tree/tree_item.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/tree/tree_item.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/components/tree/tree_item.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/components/tree/tree_item.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/data_types_definition.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/data_types_definition.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/data_types_definition.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/default_values.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/default_values.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/default_values.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/default_values.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/field_options.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/field_options.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/field_options.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/field_options.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/field_options_i18n.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/field_options_i18n.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/field_options_i18n.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/field_options_i18n.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/mappings_editor.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/mappings_editor.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/mappings_editor.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/mappings_editor.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/parameters_definition.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/parameters_definition.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/constants/parameters_definition.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/constants/parameters_definition.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/index_settings_context.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/index_settings_context.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/index_settings_context.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/index_settings_context.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/error_reporter.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/error_reporter.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/error_reporter.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/error_reporter.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.test.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/extract_mappings_definition.test.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.test.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/extract_mappings_definition.test.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/extract_mappings_definition.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/extract_mappings_definition.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/extract_mappings_definition.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.test.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/mappings_validator.test.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.test.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/mappings_validator.test.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/mappings_validator.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/mappings_validator.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/mappings_validator.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/search_fields.test.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/search_fields.test.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/search_fields.test.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/search_fields.test.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/search_fields.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/search_fields.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/search_fields.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/search_fields.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/serializers.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/serializers.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/serializers.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/serializers.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/utils.test.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/utils.test.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/utils.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/utils.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/utils.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/utils.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/validators.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/validators.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/lib/validators.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/lib/validators.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/mappings_editor.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/mappings_editor.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/mappings_editor.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/mappings_state.tsx b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/mappings_state.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/mappings_state.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/mappings_state.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/reducer.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/reducer.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/reducer.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/reducer.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/shared_imports.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/shared_imports.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/shared_imports.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/types.ts b/x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/types.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/mappings_editor/types.ts rename to x-pack/legacy/plugins/index_management/public/application/components/mappings_editor/types.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/no_match/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/no_match/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/no_match/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/no_match/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/no_match/no_match.tsx b/x-pack/legacy/plugins/index_management/public/application/components/no_match/no_match.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/no_match/no_match.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/no_match/no_match.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/page_error/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/page_error/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/page_error/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/page_error/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/page_error/page_error_forbidden.tsx b/x-pack/legacy/plugins/index_management/public/application/components/page_error/page_error_forbidden.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/page_error/page_error_forbidden.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/page_error/page_error_forbidden.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/section_error.tsx b/x-pack/legacy/plugins/index_management/public/application/components/section_error.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/section_error.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/section_error.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/section_loading.tsx b/x-pack/legacy/plugins/index_management/public/application/components/section_loading.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/section_loading.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/section_loading.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_delete_modal.tsx b/x-pack/legacy/plugins/index_management/public/application/components/template_delete_modal.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_delete_modal.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/template_delete_modal.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/template_form/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/index.ts b/x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/index.ts rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_aliases.tsx b/x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_aliases.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_aliases.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_aliases.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_logistics.tsx b/x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_logistics.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_logistics.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_logistics.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_mappings.tsx b/x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_mappings.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_mappings.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_mappings.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_review.tsx b/x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_review.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_review.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_review.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_settings.tsx b/x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_settings.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/step_settings.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/step_settings.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/use_json_step.ts b/x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/use_json_step.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/steps/use_json_step.ts rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/steps/use_json_step.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/template_form.tsx b/x-pack/legacy/plugins/index_management/public/application/components/template_form/template_form.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/template_form.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/template_form.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/template_form_schemas.tsx b/x-pack/legacy/plugins/index_management/public/application/components/template_form/template_form_schemas.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/template_form_schemas.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/template_form_schemas.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/template_steps.tsx b/x-pack/legacy/plugins/index_management/public/application/components/template_form/template_steps.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/template_steps.tsx rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/template_steps.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/components/template_form/types.ts b/x-pack/legacy/plugins/index_management/public/application/components/template_form/types.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/components/template_form/types.ts rename to x-pack/legacy/plugins/index_management/public/application/components/template_form/types.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/constants/detail_panel_tabs.ts b/x-pack/legacy/plugins/index_management/public/application/constants/detail_panel_tabs.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/constants/detail_panel_tabs.ts rename to x-pack/legacy/plugins/index_management/public/application/constants/detail_panel_tabs.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/constants/index.ts b/x-pack/legacy/plugins/index_management/public/application/constants/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/constants/index.ts rename to x-pack/legacy/plugins/index_management/public/application/constants/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/constants/refresh_intervals.ts b/x-pack/legacy/plugins/index_management/public/application/constants/refresh_intervals.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/constants/refresh_intervals.ts rename to x-pack/legacy/plugins/index_management/public/application/constants/refresh_intervals.ts diff --git a/x-pack/legacy/plugins/index_management/public/application/index.tsx b/x-pack/legacy/plugins/index_management/public/application/index.tsx new file mode 100644 index 0000000000000..b9859903f1434 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/application/index.tsx @@ -0,0 +1,45 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { Provider } from 'react-redux'; +import { render, unmountComponentAtNode } from 'react-dom'; + +import { CoreStart } from '../../../../../../src/core/public'; + +import { AppContextProvider, AppDependencies } from './app_context'; +import { App } from './app'; +import { indexManagementStore } from './store'; + +export const renderApp = ( + elem: HTMLElement | null, + { core, dependencies }: { core: CoreStart; dependencies: AppDependencies } +) => { + if (!elem) { + return () => undefined; + } + + const { i18n } = core; + const { Context: I18nContext } = i18n; + const { services } = dependencies; + + render( + + + + + + + , + elem + ); + + return () => { + unmountComponentAtNode(elem); + }; +}; + +export { AppDependencies }; diff --git a/x-pack/legacy/plugins/index_management/public/app/lib/ace.js b/x-pack/legacy/plugins/index_management/public/application/lib/ace.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/lib/ace.js rename to x-pack/legacy/plugins/index_management/public/application/lib/ace.js diff --git a/x-pack/legacy/plugins/index_management/public/app/lib/edit_settings.js b/x-pack/legacy/plugins/index_management/public/application/lib/edit_settings.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/lib/edit_settings.js rename to x-pack/legacy/plugins/index_management/public/application/lib/edit_settings.js diff --git a/x-pack/legacy/plugins/index_management/public/app/lib/flatten_object.js b/x-pack/legacy/plugins/index_management/public/application/lib/flatten_object.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/lib/flatten_object.js rename to x-pack/legacy/plugins/index_management/public/application/lib/flatten_object.js diff --git a/x-pack/legacy/plugins/index_management/public/app/lib/flatten_panel_tree.js b/x-pack/legacy/plugins/index_management/public/application/lib/flatten_panel_tree.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/lib/flatten_panel_tree.js rename to x-pack/legacy/plugins/index_management/public/application/lib/flatten_panel_tree.js diff --git a/x-pack/legacy/plugins/index_management/public/app/lib/index_status_labels.js b/x-pack/legacy/plugins/index_management/public/application/lib/index_status_labels.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/lib/index_status_labels.js rename to x-pack/legacy/plugins/index_management/public/application/lib/index_status_labels.js diff --git a/x-pack/legacy/plugins/index_management/public/app/lib/manage_angular_lifecycle.ts b/x-pack/legacy/plugins/index_management/public/application/lib/manage_angular_lifecycle.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/lib/manage_angular_lifecycle.ts rename to x-pack/legacy/plugins/index_management/public/application/lib/manage_angular_lifecycle.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/lib/render_badges.js b/x-pack/legacy/plugins/index_management/public/application/lib/render_badges.js similarity index 83% rename from x-pack/legacy/plugins/index_management/public/app/lib/render_badges.js rename to x-pack/legacy/plugins/index_management/public/application/lib/render_badges.js index 175b88bd31f6c..fbca65fe5dba6 100644 --- a/x-pack/legacy/plugins/index_management/public/app/lib/render_badges.js +++ b/x-pack/legacy/plugins/index_management/public/application/lib/render_badges.js @@ -7,10 +7,10 @@ import React, { Fragment } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiBadge, EuiSearchBar } from '@elastic/eui'; -import { getBadgeExtensions } from '../../index_management_extensions'; -export const renderBadges = (index, filterChanged) => { + +export const renderBadges = (index, filterChanged, extensionsService) => { const badgeLabels = []; - getBadgeExtensions().forEach(({ matchIndex, label, color, filterExpression }) => { + extensionsService.badges.forEach(({ matchIndex, label, color, filterExpression }) => { if (matchIndex(index)) { const clickHandler = () => { filterChanged && diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/home.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/home/home.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/home.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/home/home.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index.ts b/x-pack/legacy/plugins/index_management/public/application/sections/home/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/detail_panel.container.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/detail_panel.container.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/detail_panel.container.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/detail_panel.container.js diff --git a/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/detail_panel.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/detail_panel.js new file mode 100644 index 0000000000000..e0128b1d51d02 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/detail_panel.js @@ -0,0 +1,167 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { Fragment } from 'react'; +import { Route } from 'react-router-dom'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { + EuiCallOut, + EuiFlexGroup, + EuiFlexItem, + EuiFlyout, + EuiFlyoutBody, + EuiFlyoutFooter, + EuiFlyoutHeader, + EuiSpacer, + EuiTabs, + EuiTab, + EuiTitle, +} from '@elastic/eui'; +import { renderBadges } from '../../../../lib/render_badges'; +import { INDEX_OPEN } from '../../../../../../common/constants'; +import { + TAB_SUMMARY, + TAB_SETTINGS, + TAB_MAPPING, + TAB_STATS, + TAB_EDIT_SETTINGS, +} from '../../../../constants'; +import { IndexActionsContextMenu } from '../index_actions_context_menu'; +import { ShowJson } from './show_json'; +import { Summary } from './summary'; +import { EditSettingsJson } from './edit_settings_json'; +import { useServices } from '../../../../app_context'; + +const tabToHumanizedMap = { + [TAB_SUMMARY]: ( + + ), + [TAB_SETTINGS]: ( + + ), + [TAB_MAPPING]: ( + + ), + [TAB_STATS]: ( + + ), + [TAB_EDIT_SETTINGS]: ( + + ), +}; + +const tabs = [TAB_SUMMARY, TAB_SETTINGS, TAB_MAPPING, TAB_STATS, TAB_EDIT_SETTINGS]; + +export const DetailPanel = ({ panelType, indexName, index, openDetailPanel, closeDetailPanel }) => { + const { extensionsService } = useServices(); + + const renderTabs = () => { + return tabs.map((tab, i) => { + const isSelected = tab === panelType; + return ( + openDetailPanel({ panelType: tab, indexName })} + isSelected={isSelected} + data-test-subj={`detailPanelTab${isSelected ? 'Selected' : ''}`} + disabled={tab === TAB_STATS && index.status !== INDEX_OPEN} + key={i} + > + {tabToHumanizedMap[tab]} + + ); + }); + }; + + if (!panelType) { + return null; + } + + let component = null; + switch (panelType) { + case TAB_EDIT_SETTINGS: + component = ; + break; + case TAB_MAPPING: + case TAB_SETTINGS: + case TAB_STATS: + component = ; + break; + default: + component = ; + } + + const content = index ? ( + + {component} + + + + ( + + } + /> + )} + /> + + + + + ) : ( + + + + } + color="danger" + iconType="cross" + > + + + + ); + + return ( + + + +

+ {indexName} + {renderBadges(index, undefined, extensionsService)} +

+
+ {index ? {renderTabs()} : null} +
+ {content} +
+ ); +}; diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/edit_settings_json/edit_settings_json.container.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/edit_settings_json/edit_settings_json.container.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/edit_settings_json/edit_settings_json.container.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/edit_settings_json/edit_settings_json.container.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/edit_settings_json/edit_settings_json.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/edit_settings_json/edit_settings_json.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/edit_settings_json/edit_settings_json.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/edit_settings_json/edit_settings_json.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/edit_settings_json/index.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/edit_settings_json/index.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/edit_settings_json/index.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/edit_settings_json/index.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/index.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/index.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/index.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/index.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/show_json/index.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/show_json/index.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/show_json/index.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/show_json/index.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/show_json/show_json.container.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/show_json/show_json.container.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/show_json/show_json.container.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/show_json/show_json.container.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/show_json/show_json.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/show_json/show_json.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/show_json/show_json.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/show_json/show_json.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/summary/index.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/summary/index.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/summary/index.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/summary/index.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/summary/summary.container.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/summary/summary.container.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/summary/summary.container.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/summary/summary.container.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/summary/summary.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/summary/summary.js similarity index 72% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/summary/summary.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/summary/summary.js index a49dc6079e3c5..e49b3c353931e 100644 --- a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/detail_panel/summary/summary.js +++ b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/detail_panel/summary/summary.js @@ -6,7 +6,6 @@ import React, { Fragment } from 'react'; import { i18n } from '@kbn/i18n'; -import { healthToColor } from '../../../../../services'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, @@ -19,7 +18,9 @@ import { EuiSpacer, EuiTitle, } from '@elastic/eui'; -import { getSummaryExtensions } from '../../../../../../index_management_extensions'; +import { healthToColor } from '../../../../../services'; +import { AppContextConsumer } from '../../../../../app_context'; + const getHeaders = () => { return { health: i18n.translate('xpack.idxMgmt.summary.headers.healthHeader', { @@ -53,9 +54,9 @@ const getHeaders = () => { }; export class Summary extends React.PureComponent { - getAdditionalContent() { + getAdditionalContent(extensionsService) { const { index } = this.props; - const extensions = getSummaryExtensions(); + const extensions = extensionsService.summaries; return extensions.map((summaryExtension, i) => { return ( @@ -65,6 +66,7 @@ export class Summary extends React.PureComponent { ); }); } + buildRows() { const { index } = this.props; const headers = getHeaders(); @@ -99,26 +101,36 @@ export class Summary extends React.PureComponent { } render() { - const { left, right } = this.buildRows(); - const additionalContent = this.getAdditionalContent(); return ( - - -

- -

-
- - - - {left} - - - {right} - - - {additionalContent} -
+ + {({ services }) => { + const { left, right } = this.buildRows(); + const additionalContent = this.getAdditionalContent(services.extensionsService); + + return ( + + +

+ +

+
+ + + + {left} + + + {right} + + + {additionalContent} +
+ ); + }} +
); } } diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index.ts b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_actions_context_menu/index.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_actions_context_menu/index.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_actions_context_menu/index.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_actions_context_menu/index.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.container.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.container.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.container.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.container.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js similarity index 91% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js index 5ed651e3125cf..8f794ce1ed612 100644 --- a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js +++ b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_actions_context_menu/index_actions_context_menu.js @@ -23,21 +23,9 @@ import { EuiCheckbox, } from '@elastic/eui'; -// We will be able to remove these after the NP migration is complete. -import { fatalError } from 'ui/notify'; -import { createUiStatsReporter } from '../../../../../../../../../../src/legacy/core_plugins/ui_metric/public'; -import { httpService } from '../../../../services/http'; -import { notificationService } from '../../../../services/notification'; - import { flattenPanelTree } from '../../../../lib/flatten_panel_tree'; import { INDEX_OPEN } from '../../../../../../common/constants'; -import { getActionExtensions } from '../../../../../index_management_extensions'; - -// We will be able to remove this after the NP migration is complete and we can just inject the -// NP fatalErrors service.. -const getNewPlatformCompatibleFatalErrorService = () => ({ - add: fatalError.bind(fatalError), -}); +import { AppContextConsumer } from '../../../../app_context'; export class IndexActionsContextMenu extends Component { constructor(props) { @@ -58,7 +46,11 @@ export class IndexActionsContextMenu extends Component { confirmAction = isActionConfirmed => { this.setState({ isActionConfirmed }); }; - panels() { + panels({ + core: { fatalErrors }, + services: { extensionsService, httpService, notificationService }, + plugins: { usageCollection }, + }) { const { closeIndices, openIndices, @@ -222,7 +214,7 @@ export class IndexActionsContextMenu extends Component { this.setState({ renderConfirmModal: this.renderConfirmDeleteModal }); }, }); - getActionExtensions().forEach(actionExtension => { + extensionsService.actions.forEach(actionExtension => { const actionExtensionDefinition = actionExtension({ indices, reloadIndices, @@ -231,12 +223,11 @@ export class IndexActionsContextMenu extends Component { // dependencies, but they're not available unless the app's "setup" lifecycle stage occurs. // Within the old platform, "setup" only occurs once the user actually visits the app. // Once ILM and IM have been moved out of legacy this hack won't be necessary. - createUiStatsReporter, + usageCollection, toasts: notificationService.toasts, - fatalErrors: getNewPlatformCompatibleFatalErrorService(), + fatalErrors, httpClient: httpService.httpClient, }); - if (actionExtensionDefinition) { const { buttonLabel, @@ -721,52 +712,61 @@ export class IndexActionsContextMenu extends Component { }; render() { - const { indexNames } = this.props; - const selectedIndexCount = indexNames.length; - const { - iconSide = 'right', - anchorPosition = 'rightUp', - label = i18n.translate('xpack.idxMgmt.indexActionsMenu.manageButtonLabel', { - defaultMessage: 'Manage {selectedIndexCount, plural, one {index} other {indices}}', - values: { selectedIndexCount }, - }), - iconType = 'arrowDown', - } = this.props; - const panels = this.panels(); - const button = ( - - {label} - - ); - return ( -
- {this.state.renderConfirmModal - ? this.state.renderConfirmModal(this.closeConfirmModal) - : null} - - - -
+ + {appDependencies => { + const { indexNames } = this.props; + const selectedIndexCount = indexNames.length; + const { + iconSide = 'right', + anchorPosition = 'rightUp', + label = i18n.translate('xpack.idxMgmt.indexActionsMenu.manageButtonLabel', { + defaultMessage: 'Manage {selectedIndexCount, plural, one {index} other {indices}}', + values: { selectedIndexCount }, + }), + iconType = 'arrowDown', + } = this.props; + + const panels = this.panels(appDependencies); + + const button = ( + + {label} + + ); + + return ( +
+ {this.state.renderConfirmModal + ? this.state.renderConfirmModal(this.closeConfirmModal) + : null} + + + +
+ ); + }} +
); } } diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_list.d.ts b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_list.d.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_list.d.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_list.d.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_list.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_list.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_list.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_list.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_table/index.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_table/index.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_table/index.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_table/index.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_table/index_table.container.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_table/index_table.container.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_table/index_table.container.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_table/index_table.container.js diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_table/index_table.js b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_table/index_table.js similarity index 62% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_table/index_table.js rename to x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_table/index_table.js index e043323c5b290..b659e2ec86a9b 100644 --- a/x-pack/legacy/plugins/index_management/public/app/sections/home/index_list/index_table/index_table.js +++ b/x-pack/legacy/plugins/index_management/public/application/sections/home/index_list/index_table/index_table.js @@ -38,12 +38,7 @@ import { import { UIM_SHOW_DETAILS_CLICK } from '../../../../../../common/constants'; import { REFRESH_RATE_INDEX_LIST } from '../../../../constants'; import { healthToColor } from '../../../../services'; -import { uiMetricService } from '../../../../services/ui_metric'; -import { - getBannerExtensions, - getFilterExtensions, - getToggleExtensions, -} from '../../../../../index_management_extensions'; +import { AppContextConsumer } from '../../../../app_context'; import { renderBadges } from '../../../../lib/render_badges'; import { NoMatch, PageErrorForbidden } from '../../../../components'; import { IndexActionsContextMenu } from '../index_actions_context_menu'; @@ -153,9 +148,9 @@ export class IndexTable extends Component { this.setState({ filterError: null }); } }; - getFilters = () => { + getFilters = extensionsService => { const { allIndices } = this.props; - return getFilterExtensions().reduce((accum, filterExtension) => { + return extensionsService.filters.reduce((accum, filterExtension) => { const filtersToAdd = filterExtension(allIndices); return [...accum, ...filtersToAdd]; }, []); @@ -218,7 +213,7 @@ export class IndexTable extends Component { }); } - buildRowCell(fieldName, value, index) { + buildRowCell(fieldName, value, index, appServices) { const { openDetailPanel, filterChanged } = this.props; if (fieldName === 'health') { return {value}; @@ -228,20 +223,20 @@ export class IndexTable extends Component { { - uiMetricService.trackMetric('click', UIM_SHOW_DETAILS_CLICK); + appServices.uiMetricService.trackMetric('click', UIM_SHOW_DETAILS_CLICK); openDetailPanel(value); }} > {value} - {renderBadges(index, filterChanged)} + {renderBadges(index, filterChanged, appServices.extensionsService)}
); } return value; } - buildRowCells(index) { + buildRowCells(index, appServices) { return Object.keys(HEADERS).map(fieldName => { const { name } = index; const value = index[fieldName]; @@ -255,7 +250,9 @@ export class IndexTable extends Component { data-test-subj={`indexTableCell-${fieldName}`} >
- {this.buildRowCell(fieldName, value, index)} + + {this.buildRowCell(fieldName, value, index, appServices)} +
); @@ -268,7 +265,7 @@ export class IndexTable extends Component { className={'indTable__cell--' + fieldName} header={fieldName} > - {this.buildRowCell(fieldName, value, index)} + {this.buildRowCell(fieldName, value, index, appServices)} ); }); @@ -310,9 +307,9 @@ export class IndexTable extends Component { ); } - renderBanners() { + renderBanners(extensionsService) { const { allIndices = [], filterChanged } = this.props; - return getBannerExtensions().map((bannerExtension, i) => { + return extensionsService.banners.map((bannerExtension, i) => { const bannerData = bannerExtension(allIndices); if (!bannerData) { return null; @@ -335,7 +332,8 @@ export class IndexTable extends Component { ); }); } - buildRows() { + + buildRows(appServices) { const { indices = [], detailPanelIndexName } = this.props; return indices.map(index => { const { name } = index; @@ -360,7 +358,7 @@ export class IndexTable extends Component { })} /> - {this.buildRowCells(index)} + {this.buildRowCells(index, appServices)} ); }); @@ -383,6 +381,7 @@ export class IndexTable extends Component { onItemSelectionChanged = selectedIndices => { this.setState({ selectedIndices }); }; + renderToggleControl({ name, label }) { const { toggleNameToVisibleMap, toggleChanged } = this.props; return ( @@ -397,6 +396,7 @@ export class IndexTable extends Component { ); } + render() { const { filter, @@ -434,145 +434,157 @@ export class IndexTable extends Component { } return ( - - - - - - - - - - - {(indicesLoading && allIndices.length === 0) || indicesError ? null : ( - - {getToggleExtensions().map(toggle => { - return this.renderToggleControl(toggle); - })} - - showSystemIndicesChanged(event.target.checked)} - label={ + + {({ services }) => { + const { extensionsService } = services; + + return ( + + + + + - } - /> + + + + + {(indicesLoading && allIndices.length === 0) || indicesError ? null : ( + + {extensionsService.toggles.map(toggle => { + return this.renderToggleControl(toggle); + })} + + showSystemIndicesChanged(event.target.checked)} + label={ + + } + /> + + + )} - )} - - - - {this.renderBanners()} - {indicesError && this.renderError()} - - {atLeastOneItemSelected ? ( - - ( - { - this.setState({ selectedIndicesMap: {} }); - }} - /> + + {this.renderBanners(extensionsService)} + {indicesError && this.renderError()} + + {atLeastOneItemSelected ? ( + + ( + { + this.setState({ selectedIndicesMap: {} }); + }} + /> + )} + /> + + ) : null} + {(indicesLoading && allIndices.length === 0) || indicesError ? null : ( + + + 0 + ? this.getFilters(extensionsService) + : null + } + defaultQuery={filter} + query={filter} + box={{ + incremental: true, + placeholder: i18n.translate( + 'xpack.idxMgmt.indexTable.systemIndicesSearchInputPlaceholder', + { + defaultMessage: 'Search', + } + ), + }} + aria-label={i18n.translate( + 'xpack.idxMgmt.indexTable.systemIndicesSearchIndicesAriaLabel', + { + defaultMessage: 'Search indices', + } + )} + data-test-subj="indexTableFilterInput" + onChange={this.onFilterChanged} + /> + + + { + loadIndices(); + }} + iconType="refresh" + data-test-subj="reloadIndicesButton" + > + + + + )} - /> - - ) : null} - {(indicesLoading && allIndices.length === 0) || indicesError ? null : ( - - - 0 ? this.getFilters() : null} - defaultQuery={filter} - query={filter} - box={{ - incremental: true, - placeholder: i18n.translate( - 'xpack.idxMgmt.indexTable.systemIndicesSearchInputPlaceholder', - { - defaultMessage: 'Search', - } - ), - }} - aria-label={i18n.translate( - 'xpack.idxMgmt.indexTable.systemIndicesSearchIndicesAriaLabel', - { - defaultMessage: 'Search indices', - } - )} - data-test-subj="indexTableFilterInput" - onChange={this.onFilterChanged} - /> - - - { - loadIndices(); - }} - iconType="refresh" - data-test-subj="reloadIndicesButton" - > - - - + + {this.renderFilterError()} + + {indices.length > 0 ? ( +
+ + + + + + + + + + + {this.buildHeader()} + + {this.buildRows(services)} + +
+ ) : ( + emptyState + )} + + {indices.length > 0 ? this.renderPager() : null}
- )} - - {this.renderFilterError()} - - {indices.length > 0 ? ( -
- - - - - - - - - - - {this.buildHeader()} - - {this.buildRows()} - -
- ) : ( - emptyState - )} - - {indices.length > 0 ? this.renderPager() : null} - + ); + }} + ); } } diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/index.ts b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/index.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/index.ts b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/index.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/index.ts b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/index.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/tab_aliases.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_aliases.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/tab_aliases.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_aliases.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/tab_mappings.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_mappings.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/tab_mappings.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_mappings.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/tab_settings.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_settings.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/tab_settings.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_settings.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/tab_summary.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/tabs/tab_summary.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/tabs/tab_summary.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/template_details.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/template_details.tsx similarity index 99% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/template_details.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/template_details.tsx index eaa0a331afcef..ced8bd97e744b 100644 --- a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_details/template_details.tsx +++ b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_details/template_details.tsx @@ -34,8 +34,8 @@ import { Template } from '../../../../../../common/types'; import { TemplateDeleteModal, SectionLoading, SectionError, Error } from '../../../../components'; import { loadIndexTemplate } from '../../../../services/api'; import { decodePath } from '../../../../services/routing'; -import { uiMetricService } from '../../../../services/ui_metric'; import { SendRequestResponse } from '../../../../../shared_imports'; +import { useServices } from '../../../../app_context'; import { TabSummary, TabMappings, TabSettings, TabAliases } from './tabs'; interface Props { @@ -101,6 +101,7 @@ export const TemplateDetails: React.FunctionComponent = ({ cloneTemplate, reload, }) => { + const { uiMetricService } = useServices(); const decodedTemplateName = decodePath(templateName); const { error, data: templateDetails, isLoading } = loadIndexTemplate(decodedTemplateName); // TS complains if we use destructuring here. Fixed in 3.6.0 (https://github.com/microsoft/TypeScript/pull/31711). diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_list.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_list.tsx similarity index 98% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_list.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_list.tsx index 550fa941e1984..71c32e2e0177f 100644 --- a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_list.tsx +++ b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_list.tsx @@ -20,7 +20,7 @@ import { SectionError, SectionLoading, Error } from '../../../components'; import { TemplateTable } from './template_table'; import { loadIndexTemplates } from '../../../services/api'; import { Template } from '../../../../../common/types'; -import { uiMetricService } from '../../../services/ui_metric'; +import { useServices } from '../../../app_context'; import { getTemplateEditLink, getTemplateListLink, @@ -39,6 +39,7 @@ export const TemplateList: React.FunctionComponent { + const { uiMetricService } = useServices(); const { error, isLoading, data: templates, sendRequest: reload } = loadIndexTemplates(); let content; diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_table/index.ts b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_table/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_table/index.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_table/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_table/template_table.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_table/template_table.tsx similarity index 98% rename from x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_table/template_table.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_table/template_table.tsx index 6070b25fb1ca2..72321ccc14888 100644 --- a/x-pack/legacy/plugins/index_management/public/app/sections/home/template_list/template_table/template_table.tsx +++ b/x-pack/legacy/plugins/index_management/public/application/sections/home/template_list/template_table/template_table.tsx @@ -11,7 +11,7 @@ import { EuiInMemoryTable, EuiIcon, EuiButton, EuiLink, EuiBasicTableColumn } fr import { TemplateListItem, Template } from '../../../../../../common/types'; import { BASE_PATH, UIM_TEMPLATE_SHOW_DETAILS_CLICK } from '../../../../../../common/constants'; import { TemplateDeleteModal } from '../../../../components'; -import { uiMetricService } from '../../../../services/ui_metric'; +import { useServices } from '../../../../app_context'; import { getTemplateDetailsLink } from '../../../../services/routing'; import { SendRequestResponse } from '../../../../../shared_imports'; @@ -28,6 +28,7 @@ export const TemplateTable: React.FunctionComponent = ({ editTemplate, cloneTemplate, }) => { + const { uiMetricService } = useServices(); const [selection, setSelection] = useState([]); const [templatesToDelete, setTemplatesToDelete] = useState>([]); diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/template_clone/index.ts b/x-pack/legacy/plugins/index_management/public/application/sections/template_clone/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/template_clone/index.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/template_clone/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/template_clone/template_clone.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/template_clone/template_clone.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/template_clone/template_clone.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/template_clone/template_clone.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/template_create/index.ts b/x-pack/legacy/plugins/index_management/public/application/sections/template_create/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/template_create/index.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/template_create/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/template_create/template_create.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/template_create/template_create.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/template_create/template_create.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/template_create/template_create.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/template_edit/index.ts b/x-pack/legacy/plugins/index_management/public/application/sections/template_edit/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/template_edit/index.ts rename to x-pack/legacy/plugins/index_management/public/application/sections/template_edit/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/sections/template_edit/template_edit.tsx b/x-pack/legacy/plugins/index_management/public/application/sections/template_edit/template_edit.tsx similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/sections/template_edit/template_edit.tsx rename to x-pack/legacy/plugins/index_management/public/application/sections/template_edit/template_edit.tsx diff --git a/x-pack/legacy/plugins/index_management/public/app/services/api.ts b/x-pack/legacy/plugins/index_management/public/application/services/api.ts similarity index 94% rename from x-pack/legacy/plugins/index_management/public/app/services/api.ts rename to x-pack/legacy/plugins/index_management/public/application/services/api.ts index 8030a7f29d4ee..642fd441b353a 100644 --- a/x-pack/legacy/plugins/index_management/public/app/services/api.ts +++ b/x-pack/legacy/plugins/index_management/public/application/services/api.ts @@ -34,10 +34,19 @@ import { import { TAB_SETTINGS, TAB_MAPPING, TAB_STATS } from '../constants'; -import { uiMetricService } from './ui_metric'; import { useRequest, sendRequest } from './use_request'; import { httpService } from './http'; +import { UiMetricService } from './ui_metric'; import { Template } from '../../../common/types'; +import { IndexMgmtMetricsType } from '../../types'; + +// Temporary hack to provide the uiMetricService instance to this file. +// TODO: Refactor and export an ApiService instance through the app dependencies context +let uiMetricService: UiMetricService; +export const setUiMetricService = (_uiMetricService: UiMetricService) => { + uiMetricService = _uiMetricService; +}; +// End hack export async function loadIndices() { const response = await httpService.httpClient.get(`${API_BASE_PATH}/indices`); diff --git a/x-pack/legacy/plugins/index_management/public/app/services/breadcrumbs.ts b/x-pack/legacy/plugins/index_management/public/application/services/breadcrumbs.ts similarity index 81% rename from x-pack/legacy/plugins/index_management/public/app/services/breadcrumbs.ts rename to x-pack/legacy/plugins/index_management/public/application/services/breadcrumbs.ts index d35f064a3bcc4..299491756560e 100644 --- a/x-pack/legacy/plugins/index_management/public/app/services/breadcrumbs.ts +++ b/x-pack/legacy/plugins/index_management/public/application/services/breadcrumbs.ts @@ -5,26 +5,25 @@ */ import { i18n } from '@kbn/i18n'; import { BASE_PATH } from '../../../common/constants'; -import { ChromeStart } from '../../../../../../../src/core/public'; +import { ManagementAppMountParams } from '../../../../../../../src/plugins/management/public'; + +type SetBreadcrumbs = ManagementAppMountParams['setBreadcrumbs']; class BreadcrumbService { - private chrome: ChromeStart | undefined; private breadcrumbs: { [key: string]: Array<{ text: string; href?: string; }>; } = { - management: [], home: [], }; + private setBreadcrumbsHandler?: SetBreadcrumbs; - public init(chrome: ChromeStart, managementBreadcrumb: any): void { - this.chrome = chrome; - this.breadcrumbs.management = [managementBreadcrumb]; + public setup(setBreadcrumbsHandler: SetBreadcrumbs): void { + this.setBreadcrumbsHandler = setBreadcrumbsHandler; this.breadcrumbs.home = [ - ...this.breadcrumbs.management, { text: i18n.translate('xpack.idxMgmt.breadcrumb.homeLabel', { defaultMessage: 'Index Management', @@ -72,6 +71,10 @@ class BreadcrumbService { } public setBreadcrumbs(type: string): void { + if (!this.setBreadcrumbsHandler) { + throw new Error(`BreadcrumbService#setup() must be called first!`); + } + const newBreadcrumbs = this.breadcrumbs[type] ? [...this.breadcrumbs[type]] : [...this.breadcrumbs.home]; @@ -88,9 +91,7 @@ class BreadcrumbService { href: undefined, }); - if (this.chrome) { - this.chrome.setBreadcrumbs(newBreadcrumbs); - } + this.setBreadcrumbsHandler(newBreadcrumbs); } } diff --git a/x-pack/legacy/plugins/index_management/public/app/services/documentation.ts b/x-pack/legacy/plugins/index_management/public/application/services/documentation.ts similarity index 99% rename from x-pack/legacy/plugins/index_management/public/app/services/documentation.ts rename to x-pack/legacy/plugins/index_management/public/application/services/documentation.ts index 9bf0d983df161..e0f261e586b1e 100644 --- a/x-pack/legacy/plugins/index_management/public/app/services/documentation.ts +++ b/x-pack/legacy/plugins/index_management/public/application/services/documentation.ts @@ -12,7 +12,7 @@ class DocumentationService { private esDocsBase: string = ''; private kibanaDocsBase: string = ''; - public init(docLinks: DocLinksStart): void { + public setup(docLinks: DocLinksStart): void { const { DOC_LINK_VERSION, ELASTIC_WEBSITE_URL } = docLinks; const docsBase = `${ELASTIC_WEBSITE_URL}guide/en`; diff --git a/x-pack/legacy/plugins/index_management/public/app/services/health_to_color.ts b/x-pack/legacy/plugins/index_management/public/application/services/health_to_color.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/services/health_to_color.ts rename to x-pack/legacy/plugins/index_management/public/application/services/health_to_color.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/services/http.ts b/x-pack/legacy/plugins/index_management/public/application/services/http.ts similarity index 86% rename from x-pack/legacy/plugins/index_management/public/app/services/http.ts rename to x-pack/legacy/plugins/index_management/public/application/services/http.ts index 34f5abe5983cc..a6973c263f00f 100644 --- a/x-pack/legacy/plugins/index_management/public/app/services/http.ts +++ b/x-pack/legacy/plugins/index_management/public/application/services/http.ts @@ -6,10 +6,10 @@ import { HttpSetup } from '../../../../../../../src/core/public'; -class HttpService { +export class HttpService { private client: any; - public init(httpClient: HttpSetup): void { + public setup(httpClient: HttpSetup): void { this.client = httpClient; } diff --git a/x-pack/legacy/plugins/index_management/public/app/services/index.ts b/x-pack/legacy/plugins/index_management/public/application/services/index.ts similarity index 82% rename from x-pack/legacy/plugins/index_management/public/app/services/index.ts rename to x-pack/legacy/plugins/index_management/public/application/services/index.ts index bb5c854e5d96c..78ff8cb5c314a 100644 --- a/x-pack/legacy/plugins/index_management/public/app/services/index.ts +++ b/x-pack/legacy/plugins/index_management/public/application/services/index.ts @@ -25,3 +25,7 @@ export { } from './api'; export { healthToColor } from './health_to_color'; export { sortTable } from './sort_table'; + +export { UiMetricService } from './ui_metric'; +export { HttpService } from './http'; +export { NotificationService } from './notification'; diff --git a/x-pack/legacy/plugins/index_management/public/app/services/navigation.ts b/x-pack/legacy/plugins/index_management/public/application/services/navigation.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/services/navigation.ts rename to x-pack/legacy/plugins/index_management/public/application/services/navigation.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/services/notification.ts b/x-pack/legacy/plugins/index_management/public/application/services/notification.ts similarity index 91% rename from x-pack/legacy/plugins/index_management/public/app/services/notification.ts rename to x-pack/legacy/plugins/index_management/public/application/services/notification.ts index 85558a7023491..0971ca77c004b 100644 --- a/x-pack/legacy/plugins/index_management/public/app/services/notification.ts +++ b/x-pack/legacy/plugins/index_management/public/application/services/notification.ts @@ -6,10 +6,10 @@ import { NotificationsStart } from '../../../../../../../src/core/public'; -class NotificationService { +export class NotificationService { private _toasts: any; - public init(notifications: NotificationsStart): void { + public setup(notifications: NotificationsStart): void { this._toasts = notifications.toasts; } diff --git a/x-pack/legacy/plugins/index_management/public/app/services/routing.ts b/x-pack/legacy/plugins/index_management/public/application/services/routing.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/services/routing.ts rename to x-pack/legacy/plugins/index_management/public/application/services/routing.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/services/sort_table.ts b/x-pack/legacy/plugins/index_management/public/application/services/sort_table.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/services/sort_table.ts rename to x-pack/legacy/plugins/index_management/public/application/services/sort_table.ts diff --git a/x-pack/legacy/plugins/index_management/public/application/services/ui_metric.ts b/x-pack/legacy/plugins/index_management/public/application/services/ui_metric.ts new file mode 100644 index 0000000000000..7c87ec9509085 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/application/services/ui_metric.ts @@ -0,0 +1,49 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { UiStatsMetricType } from '@kbn/analytics'; +import { UsageCollectionSetup } from '../../../../../../../src/plugins/usage_collection/public'; +import { IndexMgmtMetricsType } from '../../types'; + +let uiMetricService: UiMetricService; + +export class UiMetricService { + private appName: string; + private usageCollection: UsageCollectionSetup | undefined; + + constructor(appName: string) { + this.appName = appName; + } + + public setup(usageCollection: UsageCollectionSetup) { + this.usageCollection = usageCollection; + } + + private track(type: T, name: string) { + if (!this.usageCollection) { + throw Error('UiMetricService not initialized.'); + } + this.usageCollection.reportUiStats(this.appName, type as UiStatsMetricType, name); + } + + public trackMetric(type: T, eventName: string) { + return this.track(type, eventName); + } +} + +/** + * To minimize the refactor to migrate to NP where all deps should be explicitely declared + * we will export here the instance created in our plugin.ts setup() so other parts of the code can access it. + * + * TODO: Refactor the api.ts (convert it to a class with setup()) and detail_panel.ts (reducer) to explicitely declare their dependency on the UiMetricService + * @param instance UiMetricService instance from our plugin.ts setup() + */ +export const setUiMetricServiceInstance = (instance: UiMetricService) => { + uiMetricService = instance; +}; + +export const getUiMetricServiceInstance = () => { + return uiMetricService; +}; diff --git a/x-pack/legacy/plugins/index_management/public/app/services/use_request.ts b/x-pack/legacy/plugins/index_management/public/application/services/use_request.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/services/use_request.ts rename to x-pack/legacy/plugins/index_management/public/application/services/use_request.ts diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/clear_cache_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/clear_cache_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/clear_cache_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/clear_cache_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/clear_row_status.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/clear_row_status.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/clear_row_status.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/clear_row_status.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/close_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/close_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/close_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/close_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/delete_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/delete_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/delete_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/delete_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/detail_panel.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/detail_panel.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/detail_panel.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/detail_panel.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/edit_index_settings.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/edit_index_settings.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/edit_index_settings.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/edit_index_settings.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/extension_action.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/extension_action.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/extension_action.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/extension_action.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/flush_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/flush_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/flush_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/flush_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/forcemerge_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/forcemerge_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/forcemerge_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/forcemerge_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/freeze_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/freeze_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/freeze_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/freeze_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/index.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/index.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/index.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/index.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/load_index_data.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/load_index_data.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/load_index_data.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/load_index_data.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/load_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/load_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/load_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/load_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/open_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/open_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/open_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/open_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/refresh_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/refresh_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/refresh_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/refresh_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/reload_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/reload_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/reload_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/reload_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/table_state.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/table_state.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/table_state.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/table_state.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/unfreeze_indices.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/unfreeze_indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/unfreeze_indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/unfreeze_indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/actions/update_index_settings.js b/x-pack/legacy/plugins/index_management/public/application/store/actions/update_index_settings.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/actions/update_index_settings.js rename to x-pack/legacy/plugins/index_management/public/application/store/actions/update_index_settings.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/index.ts b/x-pack/legacy/plugins/index_management/public/application/store/index.ts similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/index.ts rename to x-pack/legacy/plugins/index_management/public/application/store/index.ts diff --git a/x-pack/legacy/plugins/index_management/public/application/store/reducers/detail_panel.js b/x-pack/legacy/plugins/index_management/public/application/store/reducers/detail_panel.js new file mode 100644 index 0000000000000..c38971a633954 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/application/store/reducers/detail_panel.js @@ -0,0 +1,89 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { handleActions } from 'redux-actions'; +import { + UIM_DETAIL_PANEL_SUMMARY_TAB, + UIM_DETAIL_PANEL_SETTINGS_TAB, + UIM_DETAIL_PANEL_MAPPING_TAB, + UIM_DETAIL_PANEL_STATS_TAB, + UIM_DETAIL_PANEL_EDIT_SETTINGS_TAB, +} from '../../../../common/constants'; +import { + TAB_SUMMARY, + TAB_SETTINGS, + TAB_MAPPING, + TAB_STATS, + TAB_EDIT_SETTINGS, +} from '../../constants'; +import { openDetailPanel, closeDetailPanel } from '../actions/detail_panel'; +import { loadIndexDataSuccess } from '../actions/load_index_data'; +import { + updateIndexSettingsSuccess, + updateIndexSettingsError, +} from '../actions/update_index_settings'; +import { deleteIndicesSuccess } from '../actions/delete_indices'; + +const defaultState = {}; + +export const getDetailPanelReducer = uiMetricService => + handleActions( + { + [deleteIndicesSuccess](state, action) { + const { indexNames } = action.payload; + const { indexName } = state; + if (indexNames.includes(indexName)) { + return {}; + } else { + return state; + } + }, + [openDetailPanel](state, action) { + const { panelType, indexName, title } = action.payload; + + const panelTypeToUiMetricMap = { + [TAB_SUMMARY]: UIM_DETAIL_PANEL_SUMMARY_TAB, + [TAB_SETTINGS]: UIM_DETAIL_PANEL_SETTINGS_TAB, + [TAB_MAPPING]: UIM_DETAIL_PANEL_MAPPING_TAB, + [TAB_STATS]: UIM_DETAIL_PANEL_STATS_TAB, + [TAB_EDIT_SETTINGS]: UIM_DETAIL_PANEL_EDIT_SETTINGS_TAB, + }; + + if (panelTypeToUiMetricMap[panelType]) { + uiMetricService.trackMetric('count', panelTypeToUiMetricMap[panelType]); + } + + return { + panelType: panelType || state.panelType || TAB_SUMMARY, + indexName, + title, + }; + }, + [closeDetailPanel]() { + return {}; + }, + [loadIndexDataSuccess](state, action) { + const { data } = action.payload; + const newState = { + ...state, + data, + }; + return newState; + }, + [updateIndexSettingsError](state, action) { + const { error } = action.payload; + const newState = { + ...state, + error, + }; + return newState; + }, + [updateIndexSettingsSuccess]() { + return {}; + }, + }, + defaultState + ); diff --git a/x-pack/legacy/plugins/index_management/public/app/store/store.d.ts b/x-pack/legacy/plugins/index_management/public/application/store/reducers/index.js similarity index 82% rename from x-pack/legacy/plugins/index_management/public/app/store/store.d.ts rename to x-pack/legacy/plugins/index_management/public/application/store/reducers/index.js index 4772f2124bfe0..ff2b94b0d36e9 100644 --- a/x-pack/legacy/plugins/index_management/public/app/store/store.d.ts +++ b/x-pack/legacy/plugins/index_management/public/application/store/reducers/index.js @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export declare function indexManagementStore(): any; +export { getReducer } from './index_management'; diff --git a/x-pack/legacy/plugins/index_management/public/app/store/reducers/index_management.js b/x-pack/legacy/plugins/index_management/public/application/store/reducers/index_management.js similarity index 63% rename from x-pack/legacy/plugins/index_management/public/app/store/reducers/index_management.js rename to x-pack/legacy/plugins/index_management/public/application/store/reducers/index_management.js index 14f270670c0d6..233e6f692ca70 100644 --- a/x-pack/legacy/plugins/index_management/public/app/store/reducers/index_management.js +++ b/x-pack/legacy/plugins/index_management/public/application/store/reducers/index_management.js @@ -5,14 +5,15 @@ */ import { combineReducers } from 'redux'; -import { detailPanel } from './detail_panel'; +import { getDetailPanelReducer } from './detail_panel'; import { indices } from './indices'; import { rowStatus } from './row_status'; import { tableState } from './table_state'; -export const indexManagement = combineReducers({ - indices, - rowStatus, - tableState, - detailPanel, -}); +export const getReducer = ({ uiMetricService }) => + combineReducers({ + indices, + rowStatus, + tableState, + detailPanel: getDetailPanelReducer(uiMetricService), + }); diff --git a/x-pack/legacy/plugins/index_management/public/app/store/reducers/indices.js b/x-pack/legacy/plugins/index_management/public/application/store/reducers/indices.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/reducers/indices.js rename to x-pack/legacy/plugins/index_management/public/application/store/reducers/indices.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/reducers/row_status.js b/x-pack/legacy/plugins/index_management/public/application/store/reducers/row_status.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/reducers/row_status.js rename to x-pack/legacy/plugins/index_management/public/application/store/reducers/row_status.js diff --git a/x-pack/legacy/plugins/index_management/public/app/store/reducers/table_state.js b/x-pack/legacy/plugins/index_management/public/application/store/reducers/table_state.js similarity index 100% rename from x-pack/legacy/plugins/index_management/public/app/store/reducers/table_state.js rename to x-pack/legacy/plugins/index_management/public/application/store/reducers/table_state.js diff --git a/x-pack/legacy/plugins/index_management/public/application/store/selectors/index.d.ts b/x-pack/legacy/plugins/index_management/public/application/store/selectors/index.d.ts new file mode 100644 index 0000000000000..999b11c5d6665 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/application/store/selectors/index.d.ts @@ -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; + * you may not use this file except in compliance with the Elastic License. + */ +import { ExtensionsService } from '../../../services'; + +export declare function setExtensionsService(extensionsService: ExtensionsService): any; diff --git a/x-pack/legacy/plugins/index_management/public/app/store/selectors/index.js b/x-pack/legacy/plugins/index_management/public/application/store/selectors/index.js similarity index 93% rename from x-pack/legacy/plugins/index_management/public/app/store/selectors/index.js rename to x-pack/legacy/plugins/index_management/public/application/store/selectors/index.js index 654e7276bbb08..3ddbf28651fa0 100644 --- a/x-pack/legacy/plugins/index_management/public/app/store/selectors/index.js +++ b/x-pack/legacy/plugins/index_management/public/application/store/selectors/index.js @@ -8,7 +8,15 @@ import { Pager, EuiSearchBar } from '@elastic/eui'; import { createSelector } from 'reselect'; import { indexStatusLabels } from '../../lib/index_status_labels'; import { sortTable } from '../../services'; -import { getToggleExtensions } from '../../../index_management_extensions'; + +// Temporary hack to provide the extensionsService instance to this file. +// TODO: Refactor and export all the app selectors through the app dependencies context + +let extensionsService; +export const setExtensionsService = _extensionsService => { + extensionsService = _extensionsService; +}; +// End hack export const getDetailPanelData = state => state.detailPanel.data; export const getDetailPanelError = state => state.detailPanel.error; @@ -46,7 +54,7 @@ export const hasSystemIndex = indexNames => { const defaultFilterFields = ['name']; const filterByToggles = (indices, toggleNameToVisibleMap) => { - const togglesByName = getToggleExtensions().reduce( + const togglesByName = extensionsService.toggles.reduce( (byName, toggle) => ({ ...byName, [toggle.name]: toggle, diff --git a/x-pack/legacy/plugins/index_management/public/application/store/store.d.ts b/x-pack/legacy/plugins/index_management/public/application/store/store.d.ts new file mode 100644 index 0000000000000..1568275badeee --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/application/store/store.d.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { AppDependencies } from '../app_context'; + +export declare function indexManagementStore(services: AppDependencies['services']): any; diff --git a/x-pack/legacy/plugins/index_management/public/app/store/store.js b/x-pack/legacy/plugins/index_management/public/application/store/store.js similarity index 71% rename from x-pack/legacy/plugins/index_management/public/app/store/store.js rename to x-pack/legacy/plugins/index_management/public/application/store/store.js index 3e80274a96960..e103ff0778be1 100644 --- a/x-pack/legacy/plugins/index_management/public/app/store/store.js +++ b/x-pack/legacy/plugins/index_management/public/application/store/store.js @@ -6,19 +6,18 @@ import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; -import { getToggleExtensions } from '../../index_management_extensions'; import { defaultTableState } from './reducers/table_state'; -import { indexManagement } from './reducers/'; +import { getReducer } from './reducers/'; -export function indexManagementStore() { +export function indexManagementStore(services) { const toggleNameToVisibleMap = {}; - getToggleExtensions().forEach(toggleExtension => { + services.extensionsService.toggles.forEach(toggleExtension => { toggleNameToVisibleMap[toggleExtension.name] = false; }); const initialState = { tableState: { ...defaultTableState, toggleNameToVisibleMap } }; const enhancers = [applyMiddleware(thunk)]; window.__REDUX_DEVTOOLS_EXTENSION__ && enhancers.push(window.__REDUX_DEVTOOLS_EXTENSION__()); - return createStore(indexManagement, initialState, compose(...enhancers)); + return createStore(getReducer(services), initialState, compose(...enhancers)); } diff --git a/x-pack/legacy/plugins/index_management/public/index.scss b/x-pack/legacy/plugins/index_management/public/index.scss index 7128e4a207ca1..0fbf8ea5036c5 100644 --- a/x-pack/legacy/plugins/index_management/public/index.scss +++ b/x-pack/legacy/plugins/index_management/public/index.scss @@ -10,7 +10,7 @@ // indChart__legend--small // indChart__legend-isLoading -@import './app/components/mappings_editor/index'; +@import './application/components/mappings_editor/index'; .indTable { // The index table is a bespoke table and can't make use of EuiBasicTable's width settings diff --git a/x-pack/legacy/plugins/index_management/public/index.ts b/x-pack/legacy/plugins/index_management/public/index.ts index 3003c4e909956..16e7bf21aee98 100644 --- a/x-pack/legacy/plugins/index_management/public/index.ts +++ b/x-pack/legacy/plugins/index_management/public/index.ts @@ -3,43 +3,19 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { npStart } from 'ui/new_platform'; +import { npSetup } from 'ui/new_platform'; -import { IndexMgmtPlugin } from './plugin'; -import { __LEGACYStart } from './legacy'; -import { - addSummaryExtension, - getSummaryExtensions, - addActionExtension, - getActionExtensions, - addBannerExtension, - getBannerExtensions, - addFilterExtension, - getFilterExtensions, - addToggleExtension, - getToggleExtensions, - addBadgeExtension, - getBadgeExtensions, -} from './index_management_extensions'; +import { IndexMgmtUIPlugin, IndexMgmtSetup } from './plugin'; + +/** @public */ +export { IndexMgmtSetup }; export const plugin = () => { - return new IndexMgmtPlugin(); + return new IndexMgmtUIPlugin(); }; -/** @public */ -export { - addSummaryExtension, - getSummaryExtensions, - addActionExtension, - getActionExtensions, - addBannerExtension, - getBannerExtensions, - addFilterExtension, - getFilterExtensions, - addToggleExtension, - getToggleExtensions, - addBadgeExtension, - getBadgeExtensions, -}; +// Temp. To be removed after moving to the "plugins" folder + +const { extensionsService } = plugin().setup(npSetup.core, npSetup.plugins); -plugin().start(npStart.core, npStart.plugins, __LEGACYStart); +export { extensionsService }; diff --git a/x-pack/legacy/plugins/index_management/public/index_management_extensions.ts b/x-pack/legacy/plugins/index_management/public/index_management_extensions.ts deleted file mode 100644 index 2f578e7c4a5a4..0000000000000 --- a/x-pack/legacy/plugins/index_management/public/index_management_extensions.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -import { i18n } from '@kbn/i18n'; - -const summaryExtensions: any[] = []; -export const addSummaryExtension = (summaryExtension: any) => { - summaryExtensions.push(summaryExtension); -}; - -export const getSummaryExtensions = () => { - return summaryExtensions; -}; - -const actionExtensions: any[] = []; -export const addActionExtension = (actionExtension: any) => { - actionExtensions.push(actionExtension); -}; - -export const getActionExtensions = () => { - return actionExtensions; -}; - -const bannerExtensions: any[] = []; -export const addBannerExtension = (actionExtension: any) => { - bannerExtensions.push(actionExtension); -}; - -export const getBannerExtensions = () => { - return bannerExtensions; -}; - -const filterExtensions: any[] = []; -export const addFilterExtension = (filterExtension: any) => { - filterExtensions.push(filterExtension); -}; - -export const getFilterExtensions = () => { - return filterExtensions; -}; - -const toggleExtensions: any[] = []; -export const addToggleExtension = (toggleExtension: any) => { - toggleExtensions.push(toggleExtension); -}; - -export const getToggleExtensions = () => { - return toggleExtensions; -}; - -const badgeExtensions = [ - { - matchIndex: (index: { isFrozen: boolean }) => { - return index.isFrozen; - }, - label: i18n.translate('xpack.idxMgmt.frozenBadgeLabel', { - defaultMessage: 'Frozen', - }), - filterExpression: 'isFrozen:true', - color: 'primary', - }, -]; - -export const addBadgeExtension = (badgeExtension: any) => { - badgeExtensions.push(badgeExtension); -}; - -export const getBadgeExtensions = () => { - return badgeExtensions; -}; diff --git a/x-pack/legacy/plugins/index_management/public/legacy.ts b/x-pack/legacy/plugins/index_management/public/legacy.ts deleted file mode 100644 index eee24feff5a67..0000000000000 --- a/x-pack/legacy/plugins/index_management/public/legacy.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -import { management, MANAGEMENT_BREADCRUMB } from 'ui/management'; -import { createUiStatsReporter } from '../../../../../src/legacy/core_plugins/ui_metric/public'; - -export interface LegacyStart { - management: { - getSection: typeof management.getSection; - constants: { - BREADCRUMB: typeof MANAGEMENT_BREADCRUMB; - }; - }; - uiMetric: { - createUiStatsReporter: typeof createUiStatsReporter; - }; -} - -export const __LEGACYStart = { - management: { - getSection: management.getSection.bind(management), - constants: { - BREADCRUMB: MANAGEMENT_BREADCRUMB, - }, - }, - uiMetric: { - createUiStatsReporter, - }, -}; diff --git a/x-pack/legacy/plugins/index_management/public/mocks.ts b/x-pack/legacy/plugins/index_management/public/mocks.ts new file mode 100644 index 0000000000000..7062e7bacace0 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/mocks.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { extensionsServiceMock } from './services/extensions_service.mock'; + +export { extensionsServiceMock } from './services/extensions_service.mock'; + +function createIdxManagementSetupMock() { + const mock = { + extensionsService: extensionsServiceMock, + }; + + return mock; +} + +export const indexManagementMock = { + createSetup: createIdxManagementSetupMock, +}; diff --git a/x-pack/legacy/plugins/index_management/public/plugin.ts b/x-pack/legacy/plugins/index_management/public/plugin.ts index 71ecdd7a1fbef..539324766cf95 100644 --- a/x-pack/legacy/plugins/index_management/public/plugin.ts +++ b/x-pack/legacy/plugins/index_management/public/plugin.ts @@ -3,32 +3,90 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { CoreStart } from '../../../../../src/core/public'; - -import { registerManagementSection } from './register_management_section'; -import { registerRoutes } from './register_routes'; -import { LegacyStart } from './legacy'; - -import { httpService } from './app/services/http'; -import { breadcrumbService } from './app/services/breadcrumbs'; -import { documentationService } from './app/services/documentation'; -import { notificationService } from './app/services/notification'; -import { uiMetricService } from './app/services/ui_metric'; - -export class IndexMgmtPlugin { - public start(core: CoreStart, plugins: {}, __LEGACY: LegacyStart) { - const { management, uiMetric } = __LEGACY; - const { http, chrome, docLinks, notifications } = core; - - // Initialize services - httpService.init(http); - breadcrumbService.init(chrome, management.constants.BREADCRUMB); - documentationService.init(docLinks); - notificationService.init(notifications); - uiMetricService.init(uiMetric.createUiStatsReporter); - - // Register management section and Angular route - registerManagementSection(management.getSection('elasticsearch')); - registerRoutes(core); +import { i18n } from '@kbn/i18n'; + +import { CoreSetup } from '../../../../../src/core/public'; +import { UsageCollectionSetup } from '../../../../../src/plugins/usage_collection/public'; +import { ManagementSetup } from '../../../../../src/plugins/management/public'; +import { UIM_APP_NAME } from '../common/constants'; + +import { AppDependencies } from './application'; +import { httpService } from './application/services/http'; +import { breadcrumbService } from './application/services/breadcrumbs'; +import { documentationService } from './application/services/documentation'; +import { notificationService } from './application/services/notification'; +import { UiMetricService } from './application/services/ui_metric'; + +import { setExtensionsService } from './application/store/selectors'; +import { setUiMetricService } from './application/services/api'; + +import { IndexMgmtMetricsType } from './types'; +import { ExtensionsService, ExtensionsSetup } from './services'; + +export interface IndexMgmtSetup { + extensionsService: ExtensionsSetup; +} + +interface PluginsDependencies { + usageCollection: UsageCollectionSetup; + management: ManagementSetup; +} + +export class IndexMgmtUIPlugin { + private uiMetricService = new UiMetricService(UIM_APP_NAME); + private extensionsService = new ExtensionsService(); + + constructor() { + // Temporary hack to provide the service instances in module files in order to avoid a big refactor + // For the selectors we should expose them through app dependencies and read them from there on each container component. + setExtensionsService(this.extensionsService); + setUiMetricService(this.uiMetricService); } + + public setup(coreSetup: CoreSetup, plugins: PluginsDependencies): IndexMgmtSetup { + const { http, notifications, getStartServices } = coreSetup; + const { usageCollection, management } = plugins; + + httpService.setup(http); + notificationService.setup(notifications); + this.uiMetricService.setup(usageCollection); + + management.sections.getSection('elasticsearch')!.registerApp({ + id: 'index_management', + title: i18n.translate('xpack.idxMgmt.appTitle', { defaultMessage: 'Index Management' }), + order: 1, + mount: async ({ element, setBreadcrumbs }) => { + const [core] = await getStartServices(); + const { docLinks, fatalErrors } = core; + + breadcrumbService.setup(setBreadcrumbs); + documentationService.setup(docLinks); + + const appDependencies: AppDependencies = { + core: { + fatalErrors, + }, + plugins: { + usageCollection, + }, + services: { + uiMetricService: this.uiMetricService, + extensionsService: this.extensionsService, + httpService, + notificationService, + }, + }; + + const { renderApp } = await import('./application'); + return renderApp(element, { core, dependencies: appDependencies }); + }, + }); + + return { + extensionsService: this.extensionsService.setup(), + }; + } + + public start() {} + public stop() {} } diff --git a/x-pack/legacy/plugins/index_management/public/register_management_section.ts b/x-pack/legacy/plugins/index_management/public/register_management_section.ts deleted file mode 100644 index f090b322583d2..0000000000000 --- a/x-pack/legacy/plugins/index_management/public/register_management_section.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { i18n } from '@kbn/i18n'; -import { BASE_PATH } from '../common/constants'; - -export const registerManagementSection = (esSection: { - register: (section: string, config: {}) => void; -}) => { - esSection.register('index_management', { - visible: true, - display: i18n.translate('xpack.idxMgmt.appTitle', { defaultMessage: 'Index Management' }), - order: 1, - url: `#${BASE_PATH}indices`, - }); -}; diff --git a/x-pack/legacy/plugins/index_management/public/register_routes.ts b/x-pack/legacy/plugins/index_management/public/register_routes.ts deleted file mode 100644 index 378a53cf65555..0000000000000 --- a/x-pack/legacy/plugins/index_management/public/register_routes.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ -import routes from 'ui/routes'; - -import { CoreStart } from '../../../../../src/core/public'; - -import { mountReactApp, unmountReactApp } from './app'; -import { REACT_ROOT_ID } from './app/constants'; -import { BASE_PATH } from '../common/constants'; - -import template from './index.html'; -import { manageAngularLifecycle } from './app/lib/manage_angular_lifecycle'; - -let elem: HTMLElement | null; - -export const registerRoutes = (core: CoreStart) => { - routes.when(`${BASE_PATH}:view?/:action?/:id?`, { - template, - controller: ($scope: any, $route: any) => { - // clean up previously rendered React app if one exists - // this happens because of React Router redirects - unmountReactApp(elem); - - $scope.$$postDigest(() => { - elem = document.getElementById(REACT_ROOT_ID); - mountReactApp(elem, { core }); - manageAngularLifecycle($scope, $route, elem); - }); - }, - }); -}; diff --git a/x-pack/legacy/plugins/index_management/public/services/extensions_service.mock.ts b/x-pack/legacy/plugins/index_management/public/services/extensions_service.mock.ts new file mode 100644 index 0000000000000..3075a114eedd1 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/services/extensions_service.mock.ts @@ -0,0 +1,31 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { ExtensionsService, ExtensionsSetup } from './extensions_service'; + +export type ExtensionsSetupMock = jest.Mocked; + +const createServiceMock = (): ExtensionsSetupMock => ({ + addAction: jest.fn(), + addBadge: jest.fn(), + addBanner: jest.fn(), + addFilter: jest.fn(), + addSummary: jest.fn(), + addToggle: jest.fn(), +}); + +const createMock = () => { + const mocked: jest.Mocked> = { + setup: jest.fn(), + }; + mocked.setup.mockReturnValue(createServiceMock()); + return mocked; +}; + +export const extensionsServiceMock = { + create: createMock, + createSetupContract: createServiceMock, +}; diff --git a/x-pack/legacy/plugins/index_management/public/services/extensions_service.ts b/x-pack/legacy/plugins/index_management/public/services/extensions_service.ts new file mode 100644 index 0000000000000..22e0546beff99 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/services/extensions_service.ts @@ -0,0 +1,97 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import { i18n } from '@kbn/i18n'; + +export interface ExtensionsSetup { + addSummary(summary: any): void; + addAction(action: any): void; + addBanner(banner: any): void; + addFilter(filter: any): void; + addBadge(badge: any): void; + addToggle(toggle: any): void; +} + +export class ExtensionsService { + private _summaries: any[] = []; + private _actions: any[] = []; + private _banners: any[] = []; + private _filters: any[] = []; + private _badges: any[] = [ + { + matchIndex: (index: { isFrozen: boolean }) => { + return index.isFrozen; + }, + label: i18n.translate('xpack.idxMgmt.frozenBadgeLabel', { + defaultMessage: 'Frozen', + }), + filterExpression: 'isFrozen:true', + color: 'primary', + }, + ]; + private _toggles: any[] = []; + private service?: ExtensionsSetup; + + public setup(): ExtensionsSetup { + this.service = { + addAction: this.addAction.bind(this), + addBadge: this.addBadge.bind(this), + addBanner: this.addBanner.bind(this), + addFilter: this.addFilter.bind(this), + addSummary: this.addSummary.bind(this), + addToggle: this.addToggle.bind(this), + }; + + return this.service; + } + + private addSummary(summary: any) { + this._summaries.push(summary); + } + + private addAction(action: any) { + this._actions.push(action); + } + + private addBanner(banner: any) { + this._banners.push(banner); + } + + private addFilter(filter: any) { + this._filters.push(filter); + } + + private addBadge(badge: any) { + this._badges.push(badge); + } + + private addToggle(toggle: any) { + this._toggles.push(toggle); + } + + public get summaries() { + return this._summaries; + } + + public get actions() { + return this._actions; + } + + public get banners() { + return this._banners; + } + + public get filters() { + return this._filters; + } + + public get badges() { + return this._badges; + } + + public get toggles() { + return this._toggles; + } +} diff --git a/x-pack/legacy/plugins/index_management/public/services/index.ts b/x-pack/legacy/plugins/index_management/public/services/index.ts new file mode 100644 index 0000000000000..e5dfabe1d1190 --- /dev/null +++ b/x-pack/legacy/plugins/index_management/public/services/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { ExtensionsService, ExtensionsSetup } from './extensions_service'; diff --git a/x-pack/legacy/plugins/index_management/public/app/store/reducers/index.js b/x-pack/legacy/plugins/index_management/public/types.ts similarity index 78% rename from x-pack/legacy/plugins/index_management/public/app/store/reducers/index.js rename to x-pack/legacy/plugins/index_management/public/types.ts index eeae581be9473..08fbf63450218 100644 --- a/x-pack/legacy/plugins/index_management/public/app/store/reducers/index.js +++ b/x-pack/legacy/plugins/index_management/public/types.ts @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -export { indexManagement } from './index_management'; +export type IndexMgmtMetricsType = 'loaded' | 'click' | 'count'; diff --git a/x-pack/legacy/plugins/rollup/public/legacy.ts b/x-pack/legacy/plugins/rollup/public/legacy.ts index 17597672a898e..64eb1f6436389 100644 --- a/x-pack/legacy/plugins/rollup/public/legacy.ts +++ b/x-pack/legacy/plugins/rollup/public/legacy.ts @@ -10,7 +10,7 @@ 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 { addBadgeExtension, addToggleExtension } from '../../index_management/public'; +import { extensionsService } from '../../index_management/public'; const plugin = new RollupPlugin(); @@ -20,8 +20,7 @@ export const setup = plugin.setup(npSetup.core, { aggTypeFilters, aggTypeFieldFilters, addSearchStrategy, - addBadgeExtension, - addToggleExtension, + 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 4dae078c90f57..90d7e2d9d0191 100644 --- a/x-pack/legacy/plugins/rollup/public/plugin.ts +++ b/x-pack/legacy/plugins/rollup/public/plugin.ts @@ -27,6 +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'; // @ts-ignore import { setEsBaseAndXPackBase, setHttp } from './crud_app/services'; import { setNotifications, setFatalErrors } from './kibana_services'; @@ -38,8 +39,7 @@ export interface RollupPluginSetupDependencies { aggTypeFieldFilters: AggTypeFieldFilters; addSearchStrategy: (searchStrategy: SearchStrategyProvider) => void; managementLegacy: ManagementSetupLegacy; - addBadgeExtension: (badgeExtension: any) => void; - addToggleExtension: (toggleExtension: any) => void; + indexManagementExtensions: IndexMgmtSetup['extensionsService']; }; home?: HomePublicPluginSetup; management: ManagementSetup; @@ -54,16 +54,15 @@ export class RollupPlugin implements Plugin { aggTypeFieldFilters, addSearchStrategy, managementLegacy, - addBadgeExtension, - addToggleExtension, + indexManagementExtensions, }, home, management, }: RollupPluginSetupDependencies ) { setFatalErrors(core.fatalErrors); - addBadgeExtension(rollupBadgeExtension); - addToggleExtension(rollupToggleExtension); + indexManagementExtensions.addBadge(rollupBadgeExtension); + indexManagementExtensions.addToggle(rollupToggleExtension); const isRollupIndexPatternsEnabled = core.uiSettings.get(CONFIG_ROLLUPS);