From 04127aee2e31e030de039e82d672af852afbfe6e Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Thu, 7 May 2020 16:14:09 -0600 Subject: [PATCH 1/6] Initial working version --- .../beats_management/public/application.tsx | 57 +++++++ .../navigation/breadcrumb/provider.tsx | 4 +- .../plugins/beats_management/public/index.tsx | 84 +++++------ .../beats_management/public/kbn_services.ts | 25 ++++ .../public/lib/adapters/elasticsearch/rest.ts | 6 +- .../lib/adapters/framework/adapter_types.ts | 24 +-- .../framework/kibana_framework_adapter.ts | 141 +++++------------- .../framework/testing_framework_adapter.ts | 8 - .../public/lib/compose/kibana.ts | 43 ++++-- .../public/lib/compose/memory.ts | 7 - .../beats_management/public/lib/framework.ts | 1 - .../plugins/beats_management/common/index.ts | 21 +++ x-pack/plugins/beats_management/kibana.json | 15 ++ .../plugins/beats_management/public/index.ts | 38 +++++ .../plugins/beats_management/server/index.ts | 23 +++ 15 files changed, 289 insertions(+), 208 deletions(-) create mode 100644 x-pack/legacy/plugins/beats_management/public/application.tsx create mode 100644 x-pack/legacy/plugins/beats_management/public/kbn_services.ts create mode 100644 x-pack/plugins/beats_management/common/index.ts create mode 100644 x-pack/plugins/beats_management/kibana.json create mode 100644 x-pack/plugins/beats_management/public/index.ts create mode 100644 x-pack/plugins/beats_management/server/index.ts diff --git a/x-pack/legacy/plugins/beats_management/public/application.tsx b/x-pack/legacy/plugins/beats_management/public/application.tsx new file mode 100644 index 0000000000000..0f557e9e566f2 --- /dev/null +++ b/x-pack/legacy/plugins/beats_management/public/application.tsx @@ -0,0 +1,57 @@ +/* + * 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 * as euiVars from '@elastic/eui/dist/eui_theme_light.json'; +import { i18n } from '@kbn/i18n'; +import React from 'react'; +import ReactDOM from 'react-dom'; +import { HashRouter } from 'react-router-dom'; +import { ThemeProvider } from 'styled-components'; +import { Provider as UnstatedProvider, Subscribe } from 'unstated'; +import { Background } from './components/layouts/background'; +import { BreadcrumbProvider } from './components/navigation/breadcrumb'; +import { Breadcrumb } from './components/navigation/breadcrumb/breadcrumb'; +import { BeatsContainer } from './containers/beats'; +import { TagsContainer } from './containers/tags'; +import { FrontendLibs } from './lib/types'; +import { AppRouter } from './router'; +import { services } from './kbn_services'; +import { ManagementAppMountParams } from '../../../../../src/plugins/management/public'; + +export const renderApp = ( + { basePath, element, setBreadcrumbs }: ManagementAppMountParams, + libs: FrontendLibs +) => { + ReactDOM.render( + + + + + + + {(beats: BeatsContainer, tags: TagsContainer) => ( + + + + + )} + + + + + + , + element + ); + + return () => { + ReactDOM.unmountComponentAtNode(element); + }; +}; diff --git a/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/provider.tsx b/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/provider.tsx index f15e08c2ca230..1dcceac5c710d 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/provider.tsx +++ b/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/provider.tsx @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ import React, { Component, ReactElement } from 'react'; -import chrome from 'ui/chrome'; import { Provider } from './context'; import { Breadcrumb } from './types'; +import { services } from '../../../kbn_services'; interface ComponentProps { useGlobalBreadcrumbs: boolean; @@ -64,7 +64,7 @@ export class BreadcrumbProvider extends Component{this.props.children}; } diff --git a/x-pack/legacy/plugins/beats_management/public/index.tsx b/x-pack/legacy/plugins/beats_management/public/index.tsx index cebefabe77cdc..35ea45ae6bcd1 100644 --- a/x-pack/legacy/plugins/beats_management/public/index.tsx +++ b/x-pack/legacy/plugins/beats_management/public/index.tsx @@ -4,54 +4,23 @@ * you may not use this file except in compliance with the Elastic License. */ -import * as euiVars from '@elastic/eui/dist/eui_theme_light.json'; import { i18n } from '@kbn/i18n'; -import React from 'react'; -import { HashRouter } from 'react-router-dom'; -import { ThemeProvider } from 'styled-components'; -import { I18nContext } from 'ui/i18n'; -import { Provider as UnstatedProvider, Subscribe } from 'unstated'; import { BASE_PATH } from '../common/constants'; -import { Background } from './components/layouts/background'; -import { BreadcrumbProvider } from './components/navigation/breadcrumb'; -import { Breadcrumb } from './components/navigation/breadcrumb/breadcrumb'; -import { BeatsContainer } from './containers/beats'; -import { TagsContainer } from './containers/tags'; -import { compose } from './lib/compose/kibana'; import { FrontendLibs } from './lib/types'; -import { AppRouter } from './router'; +import { compose } from './lib/compose/kibana'; -async function startApp(libs: FrontendLibs) { - libs.framework.renderUIAtPath( - BASE_PATH, - - - - - - - {(beats: BeatsContainer, tags: TagsContainer) => ( - - - - - )} - - - - - - , - libs.framework.versionGreaterThen('6.7.0') ? 'management' : 'self' - ); +import { setServices } from './kbn_services'; +import { ManagementSetup } from '../../../../../src/plugins/management/public'; +import { SecurityPluginSetup } from '../../../../plugins/security/public'; +import { CoreSetup } from '../../../../../src/core/public'; +import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; +import { LicensingPluginSetup } from '../../../../plugins/licensing/public'; +import { BeatsManagementConfigType } from '../../../../plugins/beats_management/common'; +async function startApp(libs: FrontendLibs, core: CoreSetup) { await libs.framework.waitUntilFrameworkReady(); - if (libs.framework.licenseIsAtLeast('standard')) { + if (true || libs.framework.licenseIsAtLeast('standard')) { libs.framework.registerManagementSection({ id: 'beats', name: i18n.translate('xpack.beatsManagement.centralManagementSectionLabel', { @@ -66,8 +35,39 @@ async function startApp(libs: FrontendLibs) { defaultMessage: 'Central Management', }), basePath: BASE_PATH, + async mount(params) { + const [coreStart, pluginsStart] = await core.getStartServices(); + setServices(coreStart, pluginsStart, params); + const { renderApp } = await import('./application'); + return renderApp(params, libs); + }, }); } } -startApp(compose()); +interface SetupDeps { + management: ManagementSetup; + licensing: LicensingPluginSetup; + security?: SecurityPluginSetup; +} + +interface StartDeps { + data: DataPublicPluginStart; +} + +export const bootstrap = ( + core: CoreSetup, + plugins: SetupDeps, + config: BeatsManagementConfigType, + version: string +) => { + startApp( + compose({ + core, + config, + version, + ...plugins, + }), + core + ); +}; diff --git a/x-pack/legacy/plugins/beats_management/public/kbn_services.ts b/x-pack/legacy/plugins/beats_management/public/kbn_services.ts new file mode 100644 index 0000000000000..2ff83b80e95c4 --- /dev/null +++ b/x-pack/legacy/plugins/beats_management/public/kbn_services.ts @@ -0,0 +1,25 @@ +/* + * 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 { CoreStart } from '../../../../../src/core/public'; +import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; +import { ManagementAppMountParams } from '../../../../../src/plugins/management/public'; + +export const services = { + I18nContext: (null as any) as CoreStart['i18n']['Context'], + setBreadcrumbs: (null as any) as ManagementAppMountParams['setBreadcrumbs'], + dataStart: (null as any) as DataPublicPluginStart, +}; + +export const setServices = ( + core: CoreStart, + plugins: { data: DataPublicPluginStart }, + params: ManagementAppMountParams +) => { + services.I18nContext = core.i18n.Context; + services.setBreadcrumbs = params.setBreadcrumbs; + services.dataStart = plugins.data; +}; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts b/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts index 06e6fac0d75c4..ed30c6fa36c75 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts +++ b/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts @@ -5,9 +5,9 @@ */ import { isEmpty } from 'lodash'; -import { npStart } from 'ui/new_platform'; import { ElasticsearchAdapter } from './adapter_types'; import { QuerySuggestion, esKuery } from '../../../../../../../../src/plugins/data/public'; +import { services } from '../../../kbn_services'; export class RestElasticsearchAdapter implements ElasticsearchAdapter { private cachedIndexPattern: any = null; @@ -35,7 +35,7 @@ export class RestElasticsearchAdapter implements ElasticsearchAdapter { const indexPattern = await this.getIndexPattern(); return ( - (await npStart.plugins.data.autocomplete.getQuerySuggestions({ + (await services.dataStart.autocomplete.getQuerySuggestions({ language: 'kuery', indexPatterns: [indexPattern], boolFilter: [], @@ -50,7 +50,7 @@ export class RestElasticsearchAdapter implements ElasticsearchAdapter { if (this.cachedIndexPattern) { return this.cachedIndexPattern; } - const res = await npStart.plugins.data.indexPatterns.getFieldsForWildcard({ + const res = await services.dataStart.indexPatterns.getFieldsForWildcard({ pattern: this.indexPatternName, }); if (isEmpty(res.fields)) { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts b/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts index 96b64e8171af5..aa9007cd9bc1b 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts +++ b/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts @@ -8,6 +8,7 @@ import * as t from 'io-ts'; import { LICENSES } from './../../../../common/constants/security'; +import { RegisterManagementAppArgs } from '../../../../../../../../src/plugins/management/public'; export interface FrameworkAdapter { // Instance vars @@ -16,11 +17,6 @@ export interface FrameworkAdapter { currentUser: FrameworkUser; // Methods waitUntilFrameworkReady(): Promise; - renderUIAtPath( - path: string, - component: React.ReactElement, - toController: 'management' | 'self' - ): void; registerManagementSection(settings: { id?: string; name: string; @@ -33,6 +29,7 @@ export interface FrameworkAdapter { basePath: string; visable?: boolean; order?: number; + mount: RegisterManagementAppArgs['mount']; }): void; } @@ -56,23 +53,6 @@ export const RuntimeFrameworkInfo = t.type({ export interface FrameworkInfo extends t.TypeOf {} -interface ManagementSection { - register( - sectionId: string, - options: { - visible: boolean; - display: string; - order: number; - url: string; - } - ): void; -} -export interface ManagementAPI { - getSection(sectionId: string): ManagementSection; - hasItem(sectionId: string): boolean; - register(sectionId: string, options: { display: string; icon: string; order: number }): void; -} - export const RuntimeFrameworkUser = t.interface( { username: t.string, diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts index b2cfd826e6207..f60851be84f00 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts @@ -7,24 +7,23 @@ /* eslint-disable max-classes-per-file */ import { IScope } from 'angular'; import { PathReporter } from 'io-ts/lib/PathReporter'; -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; -import { UIRoutes } from 'ui/routes'; import { isLeft } from 'fp-ts/lib/Either'; -import { npSetup } from 'ui/new_platform'; +import { first } from 'rxjs/operators'; import { SecurityPluginSetup } from '../../../../../../../plugins/security/public'; import { BufferedKibanaServiceCall, KibanaAdapterServiceRefs, KibanaUIConfig } from '../../types'; import { FrameworkAdapter, FrameworkInfo, FrameworkUser, - ManagementAPI, RuntimeFrameworkInfo, RuntimeFrameworkUser, } from './adapter_types'; -interface IInjector { - get(injectable: string): any; -} +import { + ManagementSetup, + RegisterManagementAppArgs, +} from '../../../../../../../../src/plugins/management/public'; +import { LicensingPluginSetup } from '../../../../../../../plugins/licensing/public'; +import { BeatsManagementConfigType } from '../../../../../../../plugins/beats_management/common'; export class KibanaFrameworkAdapter implements FrameworkAdapter { public get info() { @@ -43,11 +42,11 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { private shieldUser: FrameworkUser | null = null; constructor( private readonly PLUGIN_ID: string, - private readonly management: ManagementAPI, - private readonly routes: UIRoutes, + private readonly management: ManagementSetup, private readonly getBasePath: () => string, - private readonly onKibanaReady: () => Promise, - private readonly xpackInfoService: any | null, + private readonly licensing: LicensingPluginSetup, + private readonly securitySetup: SecurityPluginSetup | undefined, + private readonly config: BeatsManagementConfigType, public readonly version: string ) { this.adapterService = new KibanaAdapterServiceProvider(); @@ -60,30 +59,23 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { }; public async waitUntilFrameworkReady(): Promise { - await this.onKibanaReady(); - const xpackInfo: any = this.xpackInfoService; + const license = await this.licensing.license$.pipe(first()).toPromise(); let xpackInfoUnpacked: FrameworkInfo; try { xpackInfoUnpacked = { basePath: this.getBasePath(), license: { - type: xpackInfo ? xpackInfo.getLicense().type : 'oss', - expired: xpackInfo ? !xpackInfo.getLicense().isActive : false, - expiry_date_in_millis: - xpackInfo.getLicense().expiryDateInMillis !== undefined - ? xpackInfo.getLicense().expiryDateInMillis - : -1, + type: license.type ?? 'oss', + expired: !license.isActive, + expiry_date_in_millis: license.expiryDateInMillis ?? -1, }, security: { - enabled: xpackInfo - ? xpackInfo.get(`features.${this.PLUGIN_ID}.security.enabled`, false) - : false, - available: xpackInfo - ? xpackInfo.get(`features.${this.PLUGIN_ID}.security.available`, false) - : false, + enabled: license.getFeature('security').isEnabled, + available: license.getFeature('security').isAvailable, }, - settings: xpackInfo ? xpackInfo.get(`features.${this.PLUGIN_ID}.settings`) : {}, + // TODO: this really has nothing to do with licensing, but should be server config + settings: this.config, }; } catch (e) { throw new Error(`Unexpected data structure from xpackInfoService, ${JSON.stringify(e)}`); @@ -97,10 +89,8 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { } this.xpackInfo = xpackInfoUnpacked; - const securitySetup = ((npSetup.plugins as unknown) as { security?: SecurityPluginSetup }) - .security; try { - this.shieldUser = (await securitySetup?.authc.getCurrentUser()) || null; + this.shieldUser = (await this.securitySetup?.authc.getCurrentUser()) || null; const assertUser = RuntimeFrameworkUser.decode(this.shieldUser); if (isLeft(assertUser)) { @@ -113,41 +103,6 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { } } - public renderUIAtPath( - path: string, - component: React.ReactElement, - toController: 'management' | 'self' = 'self' - ) { - const adapter = this; - this.routes.when( - `${path}${[...Array(6)].map((e, n) => `/:arg${n}?`).join('')}`, // Hack because angular 1 does not support wildcards - { - template: - toController === 'self' - ? `<${this.PLUGIN_ID}>
` - : ` -
-
- `, - // eslint-disable-next-line max-classes-per-file - controller: ($scope: any, $route: any) => { - try { - $scope.$$postDigest(() => { - const elem = document.getElementById(`${this.PLUGIN_ID}ReactRoot`); - ReactDOM.render(component, elem); - adapter.manageAngularLifecycle($scope, $route, elem); - }); - $scope.$onInit = () => { - $scope.topNavMenu = []; - }; - } catch (e) { - throw new Error(`Error rendering Beats CM to the dom, ${e.message}`); - } - }, - } - ); - } - public registerManagementSection(settings: { id?: string; name: string; @@ -156,13 +111,12 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { }) { const sectionId = settings.id || this.PLUGIN_ID; - if (!this.management.hasItem(sectionId)) { - this.management.register(sectionId, { - display: settings.name, - icon: settings.iconName, - order: settings.order || 30, - }); - } + this.management.sections.register({ + id: sectionId, + title: settings.name, + euiIconType: settings.iconName, + order: settings.order || 30, + }); } public registerManagementUI(settings: { @@ -171,50 +125,23 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { basePath: string; visable?: boolean; order?: number; + mount: RegisterManagementAppArgs['mount']; }) { const sectionId = settings.sectionId || this.PLUGIN_ID; - if (!this.management.hasItem(sectionId)) { + const section = this.management.sections.getSection(sectionId); + + if (!section) { throw new Error( `registerManagementUI was called with a sectionId of ${sectionId}, and that is is not yet regestered as a section` ); } - const section = this.management.getSection(sectionId); - - section.register(sectionId, { - visible: settings.visable || true, - display: settings.name, + section.registerApp({ + id: sectionId, + title: settings.name, order: settings.order || 30, - url: `#${settings.basePath}`, - }); - } - - private manageAngularLifecycle($scope: any, $route: any, elem: any) { - const lastRoute = $route.current; - const deregister = $scope.$on('$locationChangeSuccess', () => { - const currentRoute = $route.current; - // if templates are the same we are on the same route - if (lastRoute.$$route.template === currentRoute.$$route.template) { - // this prevents angular from destroying scope - $route.current = lastRoute; - } else { - if (elem) { - ReactDOM.unmountComponentAtNode(elem); - elem.remove(); - } - } - }); - $scope.$on('$destroy', () => { - if (deregister) { - deregister(); - } - - // manually unmount component when scope is destroyed - if (elem) { - ReactDOM.unmountComponentAtNode(elem); - elem.remove(); - } + mount: settings.mount, }); } } diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts b/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts index 9045c7ded2ada..8e13bb0f099ad 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts +++ b/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts @@ -40,14 +40,6 @@ export class TestingFrameworkAdapter implements FrameworkAdapter { return; } - public renderUIAtPath( - path: string, - component: React.ReactElement, - toController: 'management' | 'self' = 'self' - ) { - throw new Error('not yet implamented'); - } - public registerManagementSection(settings: { id?: string; name: string; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/compose/kibana.ts b/x-pack/legacy/plugins/beats_management/public/lib/compose/kibana.ts index 2ebda89ba13fd..886d0b40031fe 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/compose/kibana.ts +++ b/x-pack/legacy/plugins/beats_management/public/lib/compose/kibana.ts @@ -5,13 +5,6 @@ */ import { camelCase } from 'lodash'; -// @ts-ignore not typed yet -import { xpackInfo } from 'plugins/xpack_main/services/xpack_info'; -import 'ui/autoload/all'; -import chrome from 'ui/chrome'; -// @ts-ignore not typed yet -import { management } from 'ui/management'; -import routes from 'ui/routes'; import { configBlockSchemas } from '../../../common/config_schemas'; import { translateConfigSchema } from '../../../common/config_schemas_translations_map'; import { INDEX_NAMES } from '../../../common/constants/index_names'; @@ -29,12 +22,30 @@ import { TagsLib } from '../tags'; import { FrontendLibs } from '../types'; import { PLUGIN } from './../../../common/constants/plugin'; import { FrameworkLib } from './../framework'; +import { ManagementSetup } from '../../../../../../../src/plugins/management/public'; +import { SecurityPluginSetup } from '../../../../../../plugins/security/public'; +import { CoreSetup } from '../../../../../../../src/core/public'; +import { LicensingPluginSetup } from '../../../../../../plugins/licensing/public'; +import { BeatsManagementConfigType } from '../../../../../../plugins/beats_management/common'; -// A super early spot in kibana loading that we can use to hook before most other things -const onKibanaReady = chrome.dangerouslyGetActiveInjector; +interface ComposeDeps { + core: CoreSetup; + management: ManagementSetup; + licensing: LicensingPluginSetup; + config: BeatsManagementConfigType; + version: string; + security?: SecurityPluginSetup; +} -export function compose(): FrontendLibs { - const api = new AxiosRestAPIAdapter(chrome.getXsrfToken(), chrome.getBasePath()); +export function compose({ + core, + management, + licensing, + config, + version, + security, +}: ComposeDeps): FrontendLibs { + const api = new AxiosRestAPIAdapter(version, core.http.basePath.get()); const esAdapter = new RestElasticsearchAdapter(INDEX_NAMES.BEATS); const elasticsearchLib = new ElasticsearchLib(esAdapter); const configBlocks = new ConfigBlocksLib( @@ -49,11 +60,11 @@ export function compose(): FrontendLibs { new KibanaFrameworkAdapter( camelCase(PLUGIN.ID), management, - routes, - chrome.getBasePath, - onKibanaReady, - xpackInfo, - chrome.getKibanaVersion() + core.http.basePath.get, + licensing, + security, + config, + version ) ); diff --git a/x-pack/legacy/plugins/beats_management/public/lib/compose/memory.ts b/x-pack/legacy/plugins/beats_management/public/lib/compose/memory.ts index b8ecb644ff1b0..b779cbfa35276 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/compose/memory.ts +++ b/x-pack/legacy/plugins/beats_management/public/lib/compose/memory.ts @@ -3,13 +3,6 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import 'ui/autoload/all'; -// @ts-ignore: path dynamic for kibana -import { management } from 'ui/management'; -// @ts-ignore: path dynamic for kibana -import { uiModules } from 'ui/modules'; -// @ts-ignore: path dynamic for kibana -import routes from 'ui/routes'; import { configBlockSchemas } from '../../../common/config_schemas'; import { translateConfigSchema } from '../../../common/config_schemas_translations_map'; // @ts-ignore: path dynamic for kibana diff --git a/x-pack/legacy/plugins/beats_management/public/lib/framework.ts b/x-pack/legacy/plugins/beats_management/public/lib/framework.ts index 141aa7168083d..57560e7279c92 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/framework.ts +++ b/x-pack/legacy/plugins/beats_management/public/lib/framework.ts @@ -10,7 +10,6 @@ import { FrameworkAdapter } from './adapters/framework/adapter_types'; export class FrameworkLib { public waitUntilFrameworkReady = this.adapter.waitUntilFrameworkReady.bind(this.adapter); - public renderUIAtPath = this.adapter.renderUIAtPath.bind(this.adapter); public registerManagementSection = this.adapter.registerManagementSection.bind(this.adapter); public registerManagementUI = this.adapter.registerManagementUI.bind(this.adapter); diff --git a/x-pack/plugins/beats_management/common/index.ts b/x-pack/plugins/beats_management/common/index.ts new file mode 100644 index 0000000000000..92ca870810ce8 --- /dev/null +++ b/x-pack/plugins/beats_management/common/index.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 { schema, TypeOf } from '@kbn/config-schema'; + +const DEFAULT_ENROLLMENT_TOKENS_TTL_S = 10 * 60; // 10 minutes + +export const beatsManagementConfigSchema = schema.object({ + enabled: schema.boolean({ defaultValue: true }), + defaultUserRoles: schema.arrayOf(schema.string(), { defaultValue: ['superuser'] }), + encryptionKey: schema.string({ defaultValue: 'xpack_beats_default_encryptionKey' }), + enrollmentTokensTtlInSeconds: schema.number({ + min: 1, + max: 10 * 60 * 14, // No more then 2 weeks for security reasons, + defaultValue: DEFAULT_ENROLLMENT_TOKENS_TTL_S, + }), +}); + +export type BeatsManagementConfigType = TypeOf; diff --git a/x-pack/plugins/beats_management/kibana.json b/x-pack/plugins/beats_management/kibana.json new file mode 100644 index 0000000000000..1b431216ef992 --- /dev/null +++ b/x-pack/plugins/beats_management/kibana.json @@ -0,0 +1,15 @@ +{ + "id": "beats_management", + "configPath": ["xpack", "beats_management"], + "ui": true, + "server": true, + "version": "kibana", + "requiredPlugins": [ + "data", + "licensing", + "management" + ], + "optionalPlugins": [ + "security" + ] +} diff --git a/x-pack/plugins/beats_management/public/index.ts b/x-pack/plugins/beats_management/public/index.ts new file mode 100644 index 0000000000000..4654c25ae1bb2 --- /dev/null +++ b/x-pack/plugins/beats_management/public/index.ts @@ -0,0 +1,38 @@ +/* + * 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 { CoreSetup, Plugin, PluginInitializerContext } from '../../../../src/core/public'; + +import { ManagementSetup } from '../../../../src/plugins/management/public'; +import { SecurityPluginSetup } from '../../security/public'; +import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; +import { LicensingPluginSetup } from '../../licensing/public'; + +import { bootstrap } from '../../../legacy/plugins/beats_management/public'; +import { BeatsManagementConfigType } from '../common'; + +interface SetupDeps { + management: ManagementSetup; + licensing: LicensingPluginSetup; + security?: SecurityPluginSetup; +} + +interface StartDeps { + data: DataPublicPluginStart; +} + +class BeatsManagementPlugin implements Plugin { + constructor(private readonly initContext: PluginInitializerContext) {} + + public setup(core: CoreSetup, plugins: SetupDeps) { + const config = this.initContext.config.get(); + bootstrap(core, plugins, config, this.initContext.env.packageInfo.version); + } + + public start() {} + public stop() {} +} + +export const plugin = (init: PluginInitializerContext) => new BeatsManagementPlugin(init); diff --git a/x-pack/plugins/beats_management/server/index.ts b/x-pack/plugins/beats_management/server/index.ts new file mode 100644 index 0000000000000..607fb0ab2725d --- /dev/null +++ b/x-pack/plugins/beats_management/server/index.ts @@ -0,0 +1,23 @@ +/* + * 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 { beatsManagementConfigSchema } from '../common'; + +export const config = { + schema: beatsManagementConfigSchema, + + exposeToBrowser: { + defaultUserRoles: true, + encryptionKey: true, + enrollmentTokensTtlInSeconds: true, + }, +}; + +export const plugin = () => ({ + setup() {}, + start() {}, + stop() {}, +}); From 2b0e90bc975146e5405ad3cd3ca10a619c3a828c Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Thu, 7 May 2020 16:36:06 -0600 Subject: [PATCH 2/6] Move files from legacy --- .../legacy/plugins/beats_management/index.ts | 5 -- .../public/lib/compose/memory.ts | 63 ------------------- .../beats_management/scripts/fake_env.ts | 3 +- .../lib/adapters/events/adapter_types.ts | 3 +- .../elasticsearch_beat_events_adapter.ts | 3 +- .../server/rest_api/beats/tag_assignment.ts | 3 +- .../beats_management/public/application.tsx | 2 +- .../beats_management/public/bootstrap.tsx} | 14 ++--- .../components/autocomplete_field/index.tsx | 2 +- .../autocomplete_field/suggestion_item.tsx | 2 +- .../public/components/config_list.tsx | 6 +- .../public/components/enroll_beats.tsx | 2 +- .../public/components/inputs/code_editor.tsx | 0 .../public/components/inputs/index.ts | 0 .../public/components/inputs/input.tsx | 0 .../public/components/inputs/multi_input.tsx | 0 .../components/inputs/password_input.tsx | 0 .../public/components/inputs/select.tsx | 0 .../public/components/layouts/background.tsx | 0 .../public/components/layouts/no_data.tsx | 0 .../public/components/layouts/primary.tsx | 0 .../public/components/layouts/walkthrough.tsx | 0 .../public/components/loading.tsx | 0 .../navigation/breadcrumb/breadcrumb.tsx | 2 +- .../navigation/breadcrumb/consumer.tsx | 0 .../navigation/breadcrumb/context.tsx | 0 .../components/navigation/breadcrumb/index.ts | 0 .../navigation/breadcrumb/provider.tsx | 0 .../navigation/breadcrumb/types.d.ts | 0 .../components/navigation/child_routes.tsx | 0 .../components/navigation/connected_link.tsx | 0 .../public/components/table/action_schema.ts | 0 .../table/controls/action_control.tsx | 0 .../public/components/table/controls/index.ts | 0 .../table/controls/option_control.tsx | 0 .../table/controls/tag_badge_list.tsx | 2 +- .../public/components/table/index.ts | 0 .../public/components/table/table.tsx | 4 +- .../components/table/table_type_configs.tsx | 5 +- .../tag/config_view/config_form.tsx | 5 +- .../components/tag/config_view/index.tsx | 6 +- .../public/components/tag/index.ts | 0 .../public/components/tag/tag_badge.tsx | 2 +- .../public/components/tag/tag_edit.tsx | 6 +- .../public/containers/beats.ts | 4 +- .../public/containers/tags.ts | 2 +- .../containers/with_kuery_autocompletion.tsx | 2 +- .../public/containers/with_url_state.tsx | 0 .../public/frontend_types.d.ts | 0 .../plugins/beats_management/public/index.ts | 2 +- .../beats_management/public/kbn_services.ts | 6 +- .../lib/__tests__/config_blocks.test.ts | 4 +- .../lib/adapters/beats/adapter_types.ts | 4 +- .../adapters/beats/memory_beats_adapter.ts | 4 +- .../lib/adapters/beats/rest_beats_adapter.ts | 4 +- .../configuration_blocks/adapter_types.ts | 7 ++- .../memory_config_blocks_adapter.ts | 7 ++- .../rest_config_blocks_adapter.ts | 4 +- .../adapters/elasticsearch/adapter_types.ts | 2 +- .../lib/adapters/elasticsearch/memory.ts | 2 +- .../public/lib/adapters/elasticsearch/rest.ts | 2 +- .../lib/adapters/framework/adapter_types.ts | 4 +- .../framework/kibana_framework_adapter.ts | 8 +-- .../framework/testing_framework_adapter.ts | 1 - .../lib/adapters/rest_api/adapter_types.ts | 0 .../rest_api/axios_rest_api_adapter.ts | 0 .../rest_api/node_axios_api_adapter.ts | 0 .../public/lib/adapters/tags/adapter_types.ts | 5 +- .../lib/adapters/tags/memory_tags_adapter.ts | 5 +- .../lib/adapters/tags/rest_tags_adapter.ts | 7 ++- .../lib/adapters/tokens/adapter_types.ts | 0 .../adapters/tokens/memory_tokens_adapter.ts | 0 .../adapters/tokens/rest_tokens_adapter.ts | 2 +- .../beats_management/public/lib/beats.ts | 4 +- .../public/lib/compose/kibana.ts | 18 +++--- .../public/lib/compose/scripts.ts | 4 +- .../public/lib/configuration_blocks.ts | 5 +- .../public/lib/elasticsearch.ts | 2 +- .../beats_management/public/lib/framework.ts | 5 +- .../beats_management/public/lib/tags.ts | 2 +- .../beats_management/public/lib/types.ts | 0 .../beats_management/public/pages/__404.tsx | 0 .../public/pages/beat/details.tsx | 12 ++-- .../public/pages/beat/index.tsx | 2 +- .../public/pages/beat/tags.tsx | 5 +- .../public/pages/error/enforce_security.tsx | 0 .../public/pages/error/invalid_license.tsx | 0 .../public/pages/error/no_access.tsx | 0 .../beats_management/public/pages/index.ts | 0 .../pages/overview/configuration_tags.tsx | 0 .../public/pages/overview/enrolled_beats.tsx | 5 +- .../public/pages/overview/index.tsx | 2 +- .../public/pages/tag/create.tsx | 7 ++- .../public/pages/tag/edit.tsx | 8 ++- .../public/pages/walkthrough/initial/beat.tsx | 0 .../pages/walkthrough/initial/finish.tsx | 2 +- .../pages/walkthrough/initial/index.tsx | 0 .../public/pages/walkthrough/initial/tag.tsx | 5 +- .../beats_management/public/router.tsx | 0 .../public/utils/random_eui_color.ts | 0 .../public/utils/typed_react.ts | 0 101 files changed, 151 insertions(+), 165 deletions(-) delete mode 100644 x-pack/legacy/plugins/beats_management/public/lib/compose/memory.ts rename x-pack/{legacy => }/plugins/beats_management/public/application.tsx (96%) rename x-pack/{legacy/plugins/beats_management/public/index.tsx => plugins/beats_management/public/bootstrap.tsx} (77%) rename x-pack/{legacy => }/plugins/beats_management/public/components/autocomplete_field/index.tsx (99%) rename x-pack/{legacy => }/plugins/beats_management/public/components/autocomplete_field/suggestion_item.tsx (97%) rename x-pack/{legacy => }/plugins/beats_management/public/components/config_list.tsx (91%) rename x-pack/{legacy => }/plugins/beats_management/public/components/enroll_beats.tsx (99%) rename x-pack/{legacy => }/plugins/beats_management/public/components/inputs/code_editor.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/inputs/index.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/inputs/input.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/inputs/multi_input.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/inputs/password_input.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/inputs/select.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/layouts/background.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/layouts/no_data.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/layouts/primary.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/layouts/walkthrough.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/loading.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx (94%) rename x-pack/{legacy => }/plugins/beats_management/public/components/navigation/breadcrumb/consumer.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/navigation/breadcrumb/context.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/navigation/breadcrumb/index.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/navigation/breadcrumb/provider.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/navigation/breadcrumb/types.d.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/navigation/child_routes.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/navigation/connected_link.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/table/action_schema.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/table/controls/action_control.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/table/controls/index.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/table/controls/option_control.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/table/controls/tag_badge_list.tsx (96%) rename x-pack/{legacy => }/plugins/beats_management/public/components/table/index.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/table/table.tsx (96%) rename x-pack/{legacy => }/plugins/beats_management/public/components/table/table_type_configs.tsx (98%) rename x-pack/{legacy => }/plugins/beats_management/public/components/tag/config_view/config_form.tsx (98%) rename x-pack/{legacy => }/plugins/beats_management/public/components/tag/config_view/index.tsx (94%) rename x-pack/{legacy => }/plugins/beats_management/public/components/tag/index.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/components/tag/tag_badge.tsx (93%) rename x-pack/{legacy => }/plugins/beats_management/public/components/tag/tag_edit.tsx (98%) rename x-pack/{legacy => }/plugins/beats_management/public/containers/beats.ts (93%) rename x-pack/{legacy => }/plugins/beats_management/public/containers/tags.ts (93%) rename x-pack/{legacy => }/plugins/beats_management/public/containers/with_kuery_autocompletion.tsx (96%) rename x-pack/{legacy => }/plugins/beats_management/public/containers/with_url_state.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/frontend_types.d.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/kbn_services.ts (76%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/__tests__/config_blocks.test.ts (95%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/beats/adapter_types.ts (84%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/beats/memory_beats_adapter.ts (94%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/beats/rest_beats_adapter.ts (92%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/configuration_blocks/adapter_types.ts (67%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/configuration_blocks/memory_config_blocks_adapter.ts (84%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/configuration_blocks/rest_config_blocks_adapter.ts (86%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/elasticsearch/adapter_types.ts (85%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/elasticsearch/memory.ts (91%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts (95%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts (92%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts (94%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts (98%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/rest_api/adapter_types.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/rest_api/axios_rest_api_adapter.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/rest_api/node_axios_api_adapter.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/tags/adapter_types.ts (82%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/tags/memory_tags_adapter.ts (91%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/tags/rest_tags_adapter.ts (90%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/tokens/adapter_types.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/tokens/memory_tokens_adapter.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/adapters/tokens/rest_tokens_adapter.ts (87%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/beats.ts (92%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/compose/kibana.ts (75%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/compose/scripts.ts (91%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/configuration_blocks.ts (97%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/elasticsearch.ts (96%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/framework.ts (94%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/tags.ts (93%) rename x-pack/{legacy => }/plugins/beats_management/public/lib/types.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/__404.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/beat/details.tsx (93%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/beat/index.tsx (98%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/beat/tags.tsx (94%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/error/enforce_security.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/error/invalid_license.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/error/no_access.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/index.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/overview/configuration_tags.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/overview/enrolled_beats.tsx (99%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/overview/index.tsx (97%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/tag/create.tsx (95%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/tag/edit.tsx (96%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/walkthrough/initial/beat.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/walkthrough/initial/finish.tsx (97%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/walkthrough/initial/index.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/pages/walkthrough/initial/tag.tsx (97%) rename x-pack/{legacy => }/plugins/beats_management/public/router.tsx (100%) rename x-pack/{legacy => }/plugins/beats_management/public/utils/random_eui_color.ts (100%) rename x-pack/{legacy => }/plugins/beats_management/public/utils/typed_react.ts (100%) diff --git a/x-pack/legacy/plugins/beats_management/index.ts b/x-pack/legacy/plugins/beats_management/index.ts index 3355bc9881811..b5399595fb782 100644 --- a/x-pack/legacy/plugins/beats_management/index.ts +++ b/x-pack/legacy/plugins/beats_management/index.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ import Joi from 'joi'; -import { resolve } from 'path'; import { PLUGIN } from './common/constants'; import { CONFIG_PREFIX } from './common/constants/plugin'; import { initServerWithKibana } from './server/kibana.index'; @@ -29,10 +28,6 @@ export function beats(kibana: any) { return new kibana.Plugin({ id: PLUGIN.ID, require: ['kibana', 'elasticsearch', 'xpack_main'], - publicDir: resolve(__dirname, 'public'), - uiExports: { - managementSections: ['plugins/beats_management'], - }, config: () => config, configPrefix: CONFIG_PREFIX, init(server: KibanaLegacyServer) { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/compose/memory.ts b/x-pack/legacy/plugins/beats_management/public/lib/compose/memory.ts deleted file mode 100644 index b779cbfa35276..0000000000000 --- a/x-pack/legacy/plugins/beats_management/public/lib/compose/memory.ts +++ /dev/null @@ -1,63 +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 { configBlockSchemas } from '../../../common/config_schemas'; -import { translateConfigSchema } from '../../../common/config_schemas_translations_map'; -// @ts-ignore: path dynamic for kibana -import { MemoryBeatsAdapter } from '../adapters/beats/memory_beats_adapter'; -import { KibanaFrameworkAdapter } from '../adapters/framework/kibana_framework_adapter'; -import { MemoryTagsAdapter } from '../adapters/tags/memory_tags_adapter'; -import { MemoryTokensAdapter } from '../adapters/tokens/memory_tokens_adapter'; -import { BeatsLib } from '../beats'; -import { ConfigBlocksLib } from '../configuration_blocks'; -import { FrameworkLib } from '../framework'; -import { TagsLib } from '../tags'; -import { FrontendLibs } from '../types'; -import { MemoryElasticsearchAdapter } from './../adapters/elasticsearch/memory'; -import { ElasticsearchLib } from './../elasticsearch'; -import { QuerySuggestion } from '../../../../../../../src/plugins/data/public'; - -const onKibanaReady = uiModules.get('kibana').run; - -export function compose( - mockIsKueryValid: (kuery: string) => boolean, - mockKueryToEsQuery: (kuery: string) => string, - suggestions: QuerySuggestion[] -): FrontendLibs { - const esAdapter = new MemoryElasticsearchAdapter( - mockIsKueryValid, - mockKueryToEsQuery, - suggestions - ); - const elasticsearchLib = new ElasticsearchLib(esAdapter); - - const configBlocks = new ConfigBlocksLib({} as any, translateConfigSchema(configBlockSchemas)); - const tags = new TagsLib(new MemoryTagsAdapter([]), elasticsearchLib); - const tokens = new MemoryTokensAdapter(); - const beats = new BeatsLib(new MemoryBeatsAdapter([]), elasticsearchLib); - - const pluginUIModule = uiModules.get('app/beats_management'); - - const framework = new FrameworkLib( - new KibanaFrameworkAdapter( - pluginUIModule, - management, - routes, - () => '', - onKibanaReady, - null, - '7.0.0' - ) - ); - const libs: FrontendLibs = { - framework, - elasticsearch: elasticsearchLib, - tags, - tokens, - beats, - configBlocks, - }; - return libs; -} diff --git a/x-pack/legacy/plugins/beats_management/scripts/fake_env.ts b/x-pack/legacy/plugins/beats_management/scripts/fake_env.ts index e2e31a218943a..fe8919f48ac10 100644 --- a/x-pack/legacy/plugins/beats_management/scripts/fake_env.ts +++ b/x-pack/legacy/plugins/beats_management/scripts/fake_env.ts @@ -9,7 +9,8 @@ import request from 'request'; import uuidv4 from 'uuid/v4'; import { configBlockSchemas } from '../common/config_schemas'; import { BeatTag } from '../common/domain_types'; -import { compose } from '../public/lib/compose/scripts'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { compose } from '../../../../plugins/beats_management/public/lib/compose/scripts'; const args = process.argv.slice(2); const chance = new Chance(); diff --git a/x-pack/legacy/plugins/beats_management/server/lib/adapters/events/adapter_types.ts b/x-pack/legacy/plugins/beats_management/server/lib/adapters/events/adapter_types.ts index 273584efb239b..4cb38bb3d057b 100644 --- a/x-pack/legacy/plugins/beats_management/server/lib/adapters/events/adapter_types.ts +++ b/x-pack/legacy/plugins/beats_management/server/lib/adapters/events/adapter_types.ts @@ -4,7 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ import { BeatEvent } from '../../../../common/domain_types'; -import { FrameworkUser } from '../../../../public/lib/adapters/framework/adapter_types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { FrameworkUser } from '../../../../../../../plugins/beats_management/public/lib/adapters/framework/adapter_types'; export interface BeatEventsAdapter { bulkInsert(user: FrameworkUser, beatId: string, events: BeatEvent[]): Promise; diff --git a/x-pack/legacy/plugins/beats_management/server/lib/adapters/events/elasticsearch_beat_events_adapter.ts b/x-pack/legacy/plugins/beats_management/server/lib/adapters/events/elasticsearch_beat_events_adapter.ts index 62759ce0f5215..b5056140c8b86 100644 --- a/x-pack/legacy/plugins/beats_management/server/lib/adapters/events/elasticsearch_beat_events_adapter.ts +++ b/x-pack/legacy/plugins/beats_management/server/lib/adapters/events/elasticsearch_beat_events_adapter.ts @@ -5,7 +5,8 @@ */ import { BeatEvent } from '../../../../common/domain_types'; -import { FrameworkUser } from '../../../../public/lib/adapters/framework/adapter_types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { FrameworkUser } from '../../../../../../../plugins/beats_management/public/lib/adapters/framework/adapter_types'; import { DatabaseAdapter } from '../database/adapter_types'; import { BeatEventsAdapter } from './adapter_types'; diff --git a/x-pack/legacy/plugins/beats_management/server/rest_api/beats/tag_assignment.ts b/x-pack/legacy/plugins/beats_management/server/rest_api/beats/tag_assignment.ts index 90ba4056d7c98..db19e5b6a7627 100644 --- a/x-pack/legacy/plugins/beats_management/server/rest_api/beats/tag_assignment.ts +++ b/x-pack/legacy/plugins/beats_management/server/rest_api/beats/tag_assignment.ts @@ -7,7 +7,8 @@ import Joi from 'joi'; import { REQUIRED_LICENSES } from '../../../common/constants/security'; import { ReturnTypeBulkAction } from '../../../common/return_types'; -import { BeatsTagAssignment } from '../../../public/lib/adapters/beats/adapter_types'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { BeatsTagAssignment } from '../../../../../../plugins/beats_management/public/lib/adapters/beats/adapter_types'; import { FrameworkRequest } from '../../lib/adapters/framework/adapter_types'; import { CMServerLibs } from '../../lib/types'; diff --git a/x-pack/legacy/plugins/beats_management/public/application.tsx b/x-pack/plugins/beats_management/public/application.tsx similarity index 96% rename from x-pack/legacy/plugins/beats_management/public/application.tsx rename to x-pack/plugins/beats_management/public/application.tsx index 0f557e9e566f2..b17031a61f435 100644 --- a/x-pack/legacy/plugins/beats_management/public/application.tsx +++ b/x-pack/plugins/beats_management/public/application.tsx @@ -19,7 +19,7 @@ import { TagsContainer } from './containers/tags'; import { FrontendLibs } from './lib/types'; import { AppRouter } from './router'; import { services } from './kbn_services'; -import { ManagementAppMountParams } from '../../../../../src/plugins/management/public'; +import { ManagementAppMountParams } from '../../../../src/plugins/management/public'; export const renderApp = ( { basePath, element, setBreadcrumbs }: ManagementAppMountParams, diff --git a/x-pack/legacy/plugins/beats_management/public/index.tsx b/x-pack/plugins/beats_management/public/bootstrap.tsx similarity index 77% rename from x-pack/legacy/plugins/beats_management/public/index.tsx rename to x-pack/plugins/beats_management/public/bootstrap.tsx index 35ea45ae6bcd1..ce5b6642773f4 100644 --- a/x-pack/legacy/plugins/beats_management/public/index.tsx +++ b/x-pack/plugins/beats_management/public/bootstrap.tsx @@ -5,17 +5,17 @@ */ import { i18n } from '@kbn/i18n'; -import { BASE_PATH } from '../common/constants'; +import { BASE_PATH } from '../../../legacy/plugins/beats_management/common/constants'; import { FrontendLibs } from './lib/types'; import { compose } from './lib/compose/kibana'; import { setServices } from './kbn_services'; -import { ManagementSetup } from '../../../../../src/plugins/management/public'; -import { SecurityPluginSetup } from '../../../../plugins/security/public'; -import { CoreSetup } from '../../../../../src/core/public'; -import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; -import { LicensingPluginSetup } from '../../../../plugins/licensing/public'; -import { BeatsManagementConfigType } from '../../../../plugins/beats_management/common'; +import { ManagementSetup } from '../../../../src/plugins/management/public'; +import { SecurityPluginSetup } from '../../security/public'; +import { CoreSetup } from '../../../../src/core/public'; +import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; +import { LicensingPluginSetup } from '../../licensing/public'; +import { BeatsManagementConfigType } from '../common'; async function startApp(libs: FrontendLibs, core: CoreSetup) { await libs.framework.waitUntilFrameworkReady(); diff --git a/x-pack/legacy/plugins/beats_management/public/components/autocomplete_field/index.tsx b/x-pack/plugins/beats_management/public/components/autocomplete_field/index.tsx similarity index 99% rename from x-pack/legacy/plugins/beats_management/public/components/autocomplete_field/index.tsx rename to x-pack/plugins/beats_management/public/components/autocomplete_field/index.tsx index 70b7bd3df0662..107cb987f2107 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/autocomplete_field/index.tsx +++ b/x-pack/plugins/beats_management/public/components/autocomplete_field/index.tsx @@ -13,7 +13,7 @@ import { import React from 'react'; import styled from 'styled-components'; -import { QuerySuggestion } from '../../../../../../../src/plugins/data/public'; +import { QuerySuggestion } from '../../../../../../src/plugins/data/public'; import { composeStateUpdaters } from '../../utils/typed_react'; import { SuggestionItem } from './suggestion_item'; diff --git a/x-pack/legacy/plugins/beats_management/public/components/autocomplete_field/suggestion_item.tsx b/x-pack/plugins/beats_management/public/components/autocomplete_field/suggestion_item.tsx similarity index 97% rename from x-pack/legacy/plugins/beats_management/public/components/autocomplete_field/suggestion_item.tsx rename to x-pack/plugins/beats_management/public/components/autocomplete_field/suggestion_item.tsx index 690d471b306ab..38f1f5b025532 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/autocomplete_field/suggestion_item.tsx +++ b/x-pack/plugins/beats_management/public/components/autocomplete_field/suggestion_item.tsx @@ -9,7 +9,7 @@ import { tint } from 'polished'; import React from 'react'; import styled from 'styled-components'; -import { QuerySuggestion } from '../../../../../../../src/plugins/data/public'; +import { QuerySuggestion } from '../../../../../../src/plugins/data/public'; interface SuggestionItemProps { isSelected?: boolean; diff --git a/x-pack/legacy/plugins/beats_management/public/components/config_list.tsx b/x-pack/plugins/beats_management/public/components/config_list.tsx similarity index 91% rename from x-pack/legacy/plugins/beats_management/public/components/config_list.tsx rename to x-pack/plugins/beats_management/public/components/config_list.tsx index 3ffd42c5201f9..9116f7a37ce92 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/config_list.tsx +++ b/x-pack/plugins/beats_management/public/components/config_list.tsx @@ -8,9 +8,9 @@ import { EuiBasicTable, EuiLink } from '@elastic/eui'; import { InjectedIntl, injectI18n } from '@kbn/i18n/react'; import React from 'react'; -import { configBlockSchemas } from '../../common/config_schemas'; -import { translateConfigSchema } from '../../common/config_schemas_translations_map'; -import { ConfigurationBlock } from '../../common/domain_types'; +import { configBlockSchemas } from '../../../../legacy/plugins/beats_management/common/config_schemas'; +import { translateConfigSchema } from '../../../../legacy/plugins/beats_management/common/config_schemas_translations_map'; +import { ConfigurationBlock } from '../../../../legacy/plugins/beats_management/common/domain_types'; interface ComponentProps { configs: { diff --git a/x-pack/legacy/plugins/beats_management/public/components/enroll_beats.tsx b/x-pack/plugins/beats_management/public/components/enroll_beats.tsx similarity index 99% rename from x-pack/legacy/plugins/beats_management/public/components/enroll_beats.tsx rename to x-pack/plugins/beats_management/public/components/enroll_beats.tsx index ee97198211b56..f7a8ea413531f 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/enroll_beats.tsx +++ b/x-pack/plugins/beats_management/public/components/enroll_beats.tsx @@ -20,7 +20,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { capitalize } from 'lodash'; import React from 'react'; -import { CMBeat } from '../../common/domain_types'; +import { CMBeat } from '../../../../legacy/plugins/beats_management/common/domain_types'; interface ComponentProps { /** Such as kibanas basePath, for use to generate command */ diff --git a/x-pack/legacy/plugins/beats_management/public/components/inputs/code_editor.tsx b/x-pack/plugins/beats_management/public/components/inputs/code_editor.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/inputs/code_editor.tsx rename to x-pack/plugins/beats_management/public/components/inputs/code_editor.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/inputs/index.ts b/x-pack/plugins/beats_management/public/components/inputs/index.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/inputs/index.ts rename to x-pack/plugins/beats_management/public/components/inputs/index.ts diff --git a/x-pack/legacy/plugins/beats_management/public/components/inputs/input.tsx b/x-pack/plugins/beats_management/public/components/inputs/input.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/inputs/input.tsx rename to x-pack/plugins/beats_management/public/components/inputs/input.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/inputs/multi_input.tsx b/x-pack/plugins/beats_management/public/components/inputs/multi_input.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/inputs/multi_input.tsx rename to x-pack/plugins/beats_management/public/components/inputs/multi_input.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/inputs/password_input.tsx b/x-pack/plugins/beats_management/public/components/inputs/password_input.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/inputs/password_input.tsx rename to x-pack/plugins/beats_management/public/components/inputs/password_input.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/inputs/select.tsx b/x-pack/plugins/beats_management/public/components/inputs/select.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/inputs/select.tsx rename to x-pack/plugins/beats_management/public/components/inputs/select.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/layouts/background.tsx b/x-pack/plugins/beats_management/public/components/layouts/background.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/layouts/background.tsx rename to x-pack/plugins/beats_management/public/components/layouts/background.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/layouts/no_data.tsx b/x-pack/plugins/beats_management/public/components/layouts/no_data.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/layouts/no_data.tsx rename to x-pack/plugins/beats_management/public/components/layouts/no_data.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/layouts/primary.tsx b/x-pack/plugins/beats_management/public/components/layouts/primary.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/layouts/primary.tsx rename to x-pack/plugins/beats_management/public/components/layouts/primary.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/layouts/walkthrough.tsx b/x-pack/plugins/beats_management/public/components/layouts/walkthrough.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/layouts/walkthrough.tsx rename to x-pack/plugins/beats_management/public/components/layouts/walkthrough.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/loading.tsx b/x-pack/plugins/beats_management/public/components/loading.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/loading.tsx rename to x-pack/plugins/beats_management/public/components/loading.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx b/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx similarity index 94% rename from x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx rename to x-pack/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx index efe5eb25a0ac1..66259fcb138c5 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx +++ b/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx @@ -5,7 +5,7 @@ */ import React, { Component } from 'react'; import { RouteProps } from 'react-router-dom'; -import { BASE_PATH } from '../../../../common/constants'; +import { BASE_PATH } from '../../../../../../legacy/plugins/beats_management/common/constants'; import { BreadcrumbConsumer } from './consumer'; import { Breadcrumb as BreadcrumbData, BreadcrumbContext } from './types'; diff --git a/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/consumer.tsx b/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/consumer.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/consumer.tsx rename to x-pack/plugins/beats_management/public/components/navigation/breadcrumb/consumer.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/context.tsx b/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/context.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/context.tsx rename to x-pack/plugins/beats_management/public/components/navigation/breadcrumb/context.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/index.ts b/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/index.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/index.ts rename to x-pack/plugins/beats_management/public/components/navigation/breadcrumb/index.ts diff --git a/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/provider.tsx b/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/provider.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/provider.tsx rename to x-pack/plugins/beats_management/public/components/navigation/breadcrumb/provider.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/types.d.ts b/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/types.d.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/navigation/breadcrumb/types.d.ts rename to x-pack/plugins/beats_management/public/components/navigation/breadcrumb/types.d.ts diff --git a/x-pack/legacy/plugins/beats_management/public/components/navigation/child_routes.tsx b/x-pack/plugins/beats_management/public/components/navigation/child_routes.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/navigation/child_routes.tsx rename to x-pack/plugins/beats_management/public/components/navigation/child_routes.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/navigation/connected_link.tsx b/x-pack/plugins/beats_management/public/components/navigation/connected_link.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/navigation/connected_link.tsx rename to x-pack/plugins/beats_management/public/components/navigation/connected_link.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/table/action_schema.ts b/x-pack/plugins/beats_management/public/components/table/action_schema.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/table/action_schema.ts rename to x-pack/plugins/beats_management/public/components/table/action_schema.ts diff --git a/x-pack/legacy/plugins/beats_management/public/components/table/controls/action_control.tsx b/x-pack/plugins/beats_management/public/components/table/controls/action_control.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/table/controls/action_control.tsx rename to x-pack/plugins/beats_management/public/components/table/controls/action_control.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/table/controls/index.ts b/x-pack/plugins/beats_management/public/components/table/controls/index.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/table/controls/index.ts rename to x-pack/plugins/beats_management/public/components/table/controls/index.ts diff --git a/x-pack/legacy/plugins/beats_management/public/components/table/controls/option_control.tsx b/x-pack/plugins/beats_management/public/components/table/controls/option_control.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/table/controls/option_control.tsx rename to x-pack/plugins/beats_management/public/components/table/controls/option_control.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/components/table/controls/tag_badge_list.tsx b/x-pack/plugins/beats_management/public/components/table/controls/tag_badge_list.tsx similarity index 96% rename from x-pack/legacy/plugins/beats_management/public/components/table/controls/tag_badge_list.tsx rename to x-pack/plugins/beats_management/public/components/table/controls/tag_badge_list.tsx index cd75f882186c2..19acb1441df4c 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/table/controls/tag_badge_list.tsx +++ b/x-pack/plugins/beats_management/public/components/table/controls/tag_badge_list.tsx @@ -13,7 +13,7 @@ import { EuiPopover, } from '@elastic/eui'; import React from 'react'; -import { TABLE_CONFIG } from '../../../../common/constants/table'; +import { TABLE_CONFIG } from '../../../../../../legacy/plugins/beats_management/common/constants/table'; import { TagBadge } from '../../tag/tag_badge'; import { AssignmentActionType } from '../index'; diff --git a/x-pack/legacy/plugins/beats_management/public/components/table/index.ts b/x-pack/plugins/beats_management/public/components/table/index.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/table/index.ts rename to x-pack/plugins/beats_management/public/components/table/index.ts diff --git a/x-pack/legacy/plugins/beats_management/public/components/table/table.tsx b/x-pack/plugins/beats_management/public/components/table/table.tsx similarity index 96% rename from x-pack/legacy/plugins/beats_management/public/components/table/table.tsx rename to x-pack/plugins/beats_management/public/components/table/table.tsx index 534da6541b683..ae158e9d03476 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/table/table.tsx +++ b/x-pack/plugins/beats_management/public/components/table/table.tsx @@ -8,8 +8,8 @@ import { EuiBasicTable, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eu import { i18n } from '@kbn/i18n'; import React from 'react'; import styled from 'styled-components'; -import { QuerySuggestion } from '../../../../../../../src/plugins/data/public'; -import { TABLE_CONFIG } from '../../../common/constants'; +import { QuerySuggestion } from '../../../../../../src/plugins/data/public'; +import { TABLE_CONFIG } from '../../../../../legacy/plugins/beats_management/common/constants'; import { AutocompleteField } from '../autocomplete_field/index'; import { ControlSchema } from './action_schema'; import { OptionControl } from './controls/option_control'; diff --git a/x-pack/legacy/plugins/beats_management/public/components/table/table_type_configs.tsx b/x-pack/plugins/beats_management/public/components/table/table_type_configs.tsx similarity index 98% rename from x-pack/legacy/plugins/beats_management/public/components/table/table_type_configs.tsx rename to x-pack/plugins/beats_management/public/components/table/table_type_configs.tsx index 6fff7574c39e6..65e0d19aa4770 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/table/table_type_configs.tsx +++ b/x-pack/plugins/beats_management/public/components/table/table_type_configs.tsx @@ -9,7 +9,10 @@ import { i18n } from '@kbn/i18n'; import { sortBy, uniq } from 'lodash'; import moment from 'moment'; import React from 'react'; -import { BeatTag, CMBeat } from '../../../common/domain_types'; +import { + BeatTag, + CMBeat, +} from '../../../../../legacy/plugins/beats_management/common/domain_types'; import { ConnectedLink } from '../navigation/connected_link'; import { TagBadge } from '../tag'; diff --git a/x-pack/legacy/plugins/beats_management/public/components/tag/config_view/config_form.tsx b/x-pack/plugins/beats_management/public/components/tag/config_view/config_form.tsx similarity index 98% rename from x-pack/legacy/plugins/beats_management/public/components/tag/config_view/config_form.tsx rename to x-pack/plugins/beats_management/public/components/tag/config_view/config_form.tsx index 11336f230c840..0469a62319813 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/tag/config_view/config_form.tsx +++ b/x-pack/plugins/beats_management/public/components/tag/config_view/config_form.tsx @@ -8,7 +8,10 @@ import { i18n } from '@kbn/i18n'; import Formsy from 'formsy-react'; import { get } from 'lodash'; import React from 'react'; -import { ConfigBlockSchema, ConfigurationBlock } from '../../../../common/domain_types'; +import { + ConfigBlockSchema, + ConfigurationBlock, +} from '../../../../../../legacy/plugins/beats_management/common/domain_types'; import { FormsyEuiCodeEditor, FormsyEuiFieldText, diff --git a/x-pack/legacy/plugins/beats_management/public/components/tag/config_view/index.tsx b/x-pack/plugins/beats_management/public/components/tag/config_view/index.tsx similarity index 94% rename from x-pack/legacy/plugins/beats_management/public/components/tag/config_view/index.tsx rename to x-pack/plugins/beats_management/public/components/tag/config_view/index.tsx index 20eb2b9c3fd0d..4390e73b6fc06 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/tag/config_view/index.tsx +++ b/x-pack/plugins/beats_management/public/components/tag/config_view/index.tsx @@ -22,9 +22,9 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { configBlockSchemas } from '../../../../common/config_schemas'; -import { translateConfigSchema } from '../../../../common/config_schemas_translations_map'; -import { ConfigurationBlock } from '../../../../common/domain_types'; +import { configBlockSchemas } from '../../../../../../legacy/plugins/beats_management/common/config_schemas'; +import { translateConfigSchema } from '../../../../../../legacy/plugins/beats_management/common/config_schemas_translations_map'; +import { ConfigurationBlock } from '../../../../../../legacy/plugins/beats_management/common/domain_types'; import { ConfigForm } from './config_form'; interface ComponentProps { diff --git a/x-pack/legacy/plugins/beats_management/public/components/tag/index.ts b/x-pack/plugins/beats_management/public/components/tag/index.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/components/tag/index.ts rename to x-pack/plugins/beats_management/public/components/tag/index.ts diff --git a/x-pack/legacy/plugins/beats_management/public/components/tag/tag_badge.tsx b/x-pack/plugins/beats_management/public/components/tag/tag_badge.tsx similarity index 93% rename from x-pack/legacy/plugins/beats_management/public/components/tag/tag_badge.tsx rename to x-pack/plugins/beats_management/public/components/tag/tag_badge.tsx index 7fa0231cf3409..5880871da9f13 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/tag/tag_badge.tsx +++ b/x-pack/plugins/beats_management/public/components/tag/tag_badge.tsx @@ -6,7 +6,7 @@ import { EuiBadge, EuiBadgeProps } from '@elastic/eui'; import React from 'react'; -import { TABLE_CONFIG } from '../../../common/constants'; +import { TABLE_CONFIG } from '../../../../../legacy/plugins/beats_management/common/constants'; type TagBadgeProps = EuiBadgeProps & { maxIdRenderSize?: number; diff --git a/x-pack/legacy/plugins/beats_management/public/components/tag/tag_edit.tsx b/x-pack/plugins/beats_management/public/components/tag/tag_edit.tsx similarity index 98% rename from x-pack/legacy/plugins/beats_management/public/components/tag/tag_edit.tsx rename to x-pack/plugins/beats_management/public/components/tag/tag_edit.tsx index 4912abec90682..5ea4b643fb5a2 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/tag/tag_edit.tsx +++ b/x-pack/plugins/beats_management/public/components/tag/tag_edit.tsx @@ -24,7 +24,11 @@ import { FormattedMessage } from '@kbn/i18n/react'; import 'brace/mode/yaml'; import 'brace/theme/github'; import React from 'react'; -import { BeatTag, CMBeat, ConfigurationBlock } from '../../../common/domain_types'; +import { + BeatTag, + CMBeat, + ConfigurationBlock, +} from '../../../../../legacy/plugins/beats_management/common/domain_types'; import { ConfigList } from '../config_list'; import { AssignmentActionType, BeatsTableType, Table, tagConfigActions } from '../table'; import { ConfigView } from './config_view'; diff --git a/x-pack/legacy/plugins/beats_management/public/containers/beats.ts b/x-pack/plugins/beats_management/public/containers/beats.ts similarity index 93% rename from x-pack/legacy/plugins/beats_management/public/containers/beats.ts rename to x-pack/plugins/beats_management/public/containers/beats.ts index 7340f6b56d6f6..1c2a337798b25 100644 --- a/x-pack/legacy/plugins/beats_management/public/containers/beats.ts +++ b/x-pack/plugins/beats_management/public/containers/beats.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ import { Container } from 'unstated'; -import { CMBeat } from './../../common/domain_types'; -import { BeatsTagAssignment } from './../../server/lib/adapters/beats/adapter_types'; +import { CMBeat } from '../../../../legacy/plugins/beats_management/common/domain_types'; +import { BeatsTagAssignment } from '../../../../legacy/plugins/beats_management/server/lib/adapters/beats/adapter_types'; import { FrontendLibs } from './../lib/types'; interface ContainerState { diff --git a/x-pack/legacy/plugins/beats_management/public/containers/tags.ts b/x-pack/plugins/beats_management/public/containers/tags.ts similarity index 93% rename from x-pack/legacy/plugins/beats_management/public/containers/tags.ts rename to x-pack/plugins/beats_management/public/containers/tags.ts index 08af22f7cf4cc..345d264878503 100644 --- a/x-pack/legacy/plugins/beats_management/public/containers/tags.ts +++ b/x-pack/plugins/beats_management/public/containers/tags.ts @@ -5,7 +5,7 @@ */ import { Container } from 'unstated'; -import { BeatTag } from '../../common/domain_types'; +import { BeatTag } from '../../../../legacy/plugins/beats_management/common/domain_types'; import { FrontendLibs } from '../lib/types'; interface ContainerState { diff --git a/x-pack/legacy/plugins/beats_management/public/containers/with_kuery_autocompletion.tsx b/x-pack/plugins/beats_management/public/containers/with_kuery_autocompletion.tsx similarity index 96% rename from x-pack/legacy/plugins/beats_management/public/containers/with_kuery_autocompletion.tsx rename to x-pack/plugins/beats_management/public/containers/with_kuery_autocompletion.tsx index 66d52b8dcc5dc..007f1f9535bc4 100644 --- a/x-pack/legacy/plugins/beats_management/public/containers/with_kuery_autocompletion.tsx +++ b/x-pack/plugins/beats_management/public/containers/with_kuery_autocompletion.tsx @@ -6,7 +6,7 @@ import React from 'react'; -import { QuerySuggestion } from '../../../../../../src/plugins/data/public'; +import { QuerySuggestion } from '../../../../../src/plugins/data/public'; import { FrontendLibs } from '../lib/types'; import { RendererFunction } from '../utils/typed_react'; diff --git a/x-pack/legacy/plugins/beats_management/public/containers/with_url_state.tsx b/x-pack/plugins/beats_management/public/containers/with_url_state.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/containers/with_url_state.tsx rename to x-pack/plugins/beats_management/public/containers/with_url_state.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/frontend_types.d.ts b/x-pack/plugins/beats_management/public/frontend_types.d.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/frontend_types.d.ts rename to x-pack/plugins/beats_management/public/frontend_types.d.ts diff --git a/x-pack/plugins/beats_management/public/index.ts b/x-pack/plugins/beats_management/public/index.ts index 4654c25ae1bb2..9a3d1a9dc0f53 100644 --- a/x-pack/plugins/beats_management/public/index.ts +++ b/x-pack/plugins/beats_management/public/index.ts @@ -10,7 +10,7 @@ import { SecurityPluginSetup } from '../../security/public'; import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; import { LicensingPluginSetup } from '../../licensing/public'; -import { bootstrap } from '../../../legacy/plugins/beats_management/public'; +import { bootstrap } from './bootstrap'; import { BeatsManagementConfigType } from '../common'; interface SetupDeps { diff --git a/x-pack/legacy/plugins/beats_management/public/kbn_services.ts b/x-pack/plugins/beats_management/public/kbn_services.ts similarity index 76% rename from x-pack/legacy/plugins/beats_management/public/kbn_services.ts rename to x-pack/plugins/beats_management/public/kbn_services.ts index 2ff83b80e95c4..ca5c63802aac5 100644 --- a/x-pack/legacy/plugins/beats_management/public/kbn_services.ts +++ b/x-pack/plugins/beats_management/public/kbn_services.ts @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ -import { CoreStart } from '../../../../../src/core/public'; -import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; -import { ManagementAppMountParams } from '../../../../../src/plugins/management/public'; +import { CoreStart } from '../../../../src/core/public'; +import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; +import { ManagementAppMountParams } from '../../../../src/plugins/management/public'; export const services = { I18nContext: (null as any) as CoreStart['i18n']['Context'], diff --git a/x-pack/legacy/plugins/beats_management/public/lib/__tests__/config_blocks.test.ts b/x-pack/plugins/beats_management/public/lib/__tests__/config_blocks.test.ts similarity index 95% rename from x-pack/legacy/plugins/beats_management/public/lib/__tests__/config_blocks.test.ts rename to x-pack/plugins/beats_management/public/lib/__tests__/config_blocks.test.ts index 6776fb0b6f5ad..6851020cdf97e 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/__tests__/config_blocks.test.ts +++ b/x-pack/plugins/beats_management/public/lib/__tests__/config_blocks.test.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { configBlockSchemas } from '../../../common/config_schemas'; -import { translateConfigSchema } from '../../../common/config_schemas_translations_map'; +import { configBlockSchemas } from '../../../../../legacy/plugins/beats_management/common/config_schemas'; +import { translateConfigSchema } from '../../../../../legacy/plugins/beats_management/common/config_schemas_translations_map'; import { ConfigBlocksLib } from '../configuration_blocks'; import { MemoryConfigBlocksAdapter } from './../adapters/configuration_blocks/memory_config_blocks_adapter'; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/beats/adapter_types.ts b/x-pack/plugins/beats_management/public/lib/adapters/beats/adapter_types.ts similarity index 84% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/beats/adapter_types.ts rename to x-pack/plugins/beats_management/public/lib/adapters/beats/adapter_types.ts index 815b80e55fa11..1366894f78ddb 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/beats/adapter_types.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/beats/adapter_types.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { CMBeat } from '../../../../common/domain_types'; -import { ReturnTypeBulkAction } from '../../../../common/return_types'; +import { CMBeat } from '../../../../../../legacy/plugins/beats_management/common/domain_types'; +import { ReturnTypeBulkAction } from '../../../../../../legacy/plugins/beats_management/common/return_types'; export interface CMBeatsAdapter { get(id: string): Promise; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/beats/memory_beats_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/beats/memory_beats_adapter.ts similarity index 94% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/beats/memory_beats_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/beats/memory_beats_adapter.ts index 319e37e226c9e..74fd07d5d3dff 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/beats/memory_beats_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/beats/memory_beats_adapter.ts @@ -5,8 +5,8 @@ */ import { omit } from 'lodash'; -import { CMBeat } from '../../../../common/domain_types'; -import { ReturnTypeBulkAction } from '../../../../common/return_types'; +import { CMBeat } from '../../../../../../legacy/plugins/beats_management/common/domain_types'; +import { ReturnTypeBulkAction } from '../../../../../../legacy/plugins/beats_management/common/return_types'; import { BeatsTagAssignment, CMBeatsAdapter } from './adapter_types'; export class MemoryBeatsAdapter implements CMBeatsAdapter { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/beats/rest_beats_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/beats/rest_beats_adapter.ts similarity index 92% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/beats/rest_beats_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/beats/rest_beats_adapter.ts index b2e11461007fd..880af83bfb3f2 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/beats/rest_beats_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/beats/rest_beats_adapter.ts @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { CMBeat } from '../../../../common/domain_types'; +import { CMBeat } from '../../../../../../legacy/plugins/beats_management/common/domain_types'; import { ReturnTypeBulkAction, ReturnTypeGet, ReturnTypeList, ReturnTypeUpdate, -} from '../../../../common/return_types'; +} from '../../../../../../legacy/plugins/beats_management/common/return_types'; import { RestAPIAdapter } from '../rest_api/adapter_types'; import { BeatsTagAssignment, CMBeatsAdapter } from './adapter_types'; export class RestBeatsAdapter implements CMBeatsAdapter { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/configuration_blocks/adapter_types.ts b/x-pack/plugins/beats_management/public/lib/adapters/configuration_blocks/adapter_types.ts similarity index 67% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/configuration_blocks/adapter_types.ts rename to x-pack/plugins/beats_management/public/lib/adapters/configuration_blocks/adapter_types.ts index e8e2d5cd6b430..413cf32529b2f 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/configuration_blocks/adapter_types.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/configuration_blocks/adapter_types.ts @@ -3,8 +3,11 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { ConfigurationBlock } from '../../../../common/domain_types'; -import { ReturnTypeBulkUpsert, ReturnTypeList } from '../../../../common/return_types'; +import { ConfigurationBlock } from '../../../../../../legacy/plugins/beats_management/common/domain_types'; +import { + ReturnTypeBulkUpsert, + ReturnTypeList, +} from '../../../../../../legacy/plugins/beats_management/common/return_types'; export interface FrontendConfigBlocksAdapter { upsert(blocks: ConfigurationBlock[]): Promise; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/configuration_blocks/memory_config_blocks_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/configuration_blocks/memory_config_blocks_adapter.ts similarity index 84% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/configuration_blocks/memory_config_blocks_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/configuration_blocks/memory_config_blocks_adapter.ts index b1405cfbf2e60..ab36c7fbbae0e 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/configuration_blocks/memory_config_blocks_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/configuration_blocks/memory_config_blocks_adapter.ts @@ -4,8 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ConfigurationBlock } from '../../../../common/domain_types'; -import { ReturnTypeBulkUpsert, ReturnTypeList } from '../../../../common/return_types'; +import { ConfigurationBlock } from '../../../../../../legacy/plugins/beats_management/common/domain_types'; +import { + ReturnTypeBulkUpsert, + ReturnTypeList, +} from '../../../../../../legacy/plugins/beats_management/common/return_types'; import { FrontendConfigBlocksAdapter } from './adapter_types'; export class MemoryConfigBlocksAdapter implements FrontendConfigBlocksAdapter { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/configuration_blocks/rest_config_blocks_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/configuration_blocks/rest_config_blocks_adapter.ts similarity index 86% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/configuration_blocks/rest_config_blocks_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/configuration_blocks/rest_config_blocks_adapter.ts index be501a5e951ba..640da59ea572d 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/configuration_blocks/rest_config_blocks_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/configuration_blocks/rest_config_blocks_adapter.ts @@ -4,12 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ConfigurationBlock } from '../../../../common/domain_types'; +import { ConfigurationBlock } from '../../../../../../legacy/plugins/beats_management/common/domain_types'; import { ReturnTypeBulkDelete, ReturnTypeBulkUpsert, ReturnTypeList, -} from '../../../../common/return_types'; +} from '../../../../../../legacy/plugins/beats_management/common/return_types'; import { RestAPIAdapter } from '../rest_api/adapter_types'; import { FrontendConfigBlocksAdapter } from './adapter_types'; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/adapter_types.ts b/x-pack/plugins/beats_management/public/lib/adapters/elasticsearch/adapter_types.ts similarity index 85% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/adapter_types.ts rename to x-pack/plugins/beats_management/public/lib/adapters/elasticsearch/adapter_types.ts index 6e4665fb130de..16339c8eac003 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/adapter_types.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/elasticsearch/adapter_types.ts @@ -3,7 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { QuerySuggestion } from '../../../../../../../../src/plugins/data/public'; +import { QuerySuggestion } from '../../../../../../../src/plugins/data/public'; export interface ElasticsearchAdapter { convertKueryToEsQuery: (kuery: string) => Promise; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/memory.ts b/x-pack/plugins/beats_management/public/lib/adapters/elasticsearch/memory.ts similarity index 91% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/memory.ts rename to x-pack/plugins/beats_management/public/lib/adapters/elasticsearch/memory.ts index fc4daf3df60b2..bda157cd7f12e 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/memory.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/elasticsearch/memory.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { QuerySuggestion } from '../../../../../../../../src/plugins/data/public'; +import { QuerySuggestion } from '../../../../../../../src/plugins/data/public'; import { ElasticsearchAdapter } from './adapter_types'; export class MemoryElasticsearchAdapter implements ElasticsearchAdapter { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts b/x-pack/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts similarity index 95% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts rename to x-pack/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts index ed30c6fa36c75..4473e015d9d74 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/elasticsearch/rest.ts @@ -6,7 +6,7 @@ import { isEmpty } from 'lodash'; import { ElasticsearchAdapter } from './adapter_types'; -import { QuerySuggestion, esKuery } from '../../../../../../../../src/plugins/data/public'; +import { QuerySuggestion, esKuery } from '../../../../../../../src/plugins/data/public'; import { services } from '../../../kbn_services'; export class RestElasticsearchAdapter implements ElasticsearchAdapter { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts similarity index 92% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts rename to x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts index aa9007cd9bc1b..a2db2d75fa4fd 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts @@ -7,8 +7,8 @@ /* eslint-disable @typescript-eslint/no-empty-interface */ import * as t from 'io-ts'; -import { LICENSES } from './../../../../common/constants/security'; -import { RegisterManagementAppArgs } from '../../../../../../../../src/plugins/management/public'; +import { LICENSES } from '../../../../../../legacy/plugins/beats_management/common/constants/security'; +import { RegisterManagementAppArgs } from '../../../../../../../src/plugins/management/public'; export interface FrameworkAdapter { // Instance vars diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts similarity index 94% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts index f60851be84f00..c299b746cf045 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts @@ -9,7 +9,7 @@ import { IScope } from 'angular'; import { PathReporter } from 'io-ts/lib/PathReporter'; import { isLeft } from 'fp-ts/lib/Either'; import { first } from 'rxjs/operators'; -import { SecurityPluginSetup } from '../../../../../../../plugins/security/public'; +import { SecurityPluginSetup } from '../../../../../security/public'; import { BufferedKibanaServiceCall, KibanaAdapterServiceRefs, KibanaUIConfig } from '../../types'; import { FrameworkAdapter, @@ -21,9 +21,9 @@ import { import { ManagementSetup, RegisterManagementAppArgs, -} from '../../../../../../../../src/plugins/management/public'; -import { LicensingPluginSetup } from '../../../../../../../plugins/licensing/public'; -import { BeatsManagementConfigType } from '../../../../../../../plugins/beats_management/common'; +} from '../../../../../../../src/plugins/management/public'; +import { LicensingPluginSetup } from '../../../../../licensing/public'; +import { BeatsManagementConfigType } from '../../../../common'; export class KibanaFrameworkAdapter implements FrameworkAdapter { public get info() { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts similarity index 98% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts index 8e13bb0f099ad..e22ed684fccbc 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import * as React from 'react'; import { FrameworkAdapter, FrameworkInfo, FrameworkUser } from './adapter_types'; export class TestingFrameworkAdapter implements FrameworkAdapter { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/rest_api/adapter_types.ts b/x-pack/plugins/beats_management/public/lib/adapters/rest_api/adapter_types.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/rest_api/adapter_types.ts rename to x-pack/plugins/beats_management/public/lib/adapters/rest_api/adapter_types.ts diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/rest_api/axios_rest_api_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/rest_api/axios_rest_api_adapter.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/rest_api/axios_rest_api_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/rest_api/axios_rest_api_adapter.ts diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/rest_api/node_axios_api_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/rest_api/node_axios_api_adapter.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/rest_api/node_axios_api_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/rest_api/node_axios_api_adapter.ts diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tags/adapter_types.ts b/x-pack/plugins/beats_management/public/lib/adapters/tags/adapter_types.ts similarity index 82% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/tags/adapter_types.ts rename to x-pack/plugins/beats_management/public/lib/adapters/tags/adapter_types.ts index 5030b1704b1d7..b0ddf0309232a 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tags/adapter_types.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/tags/adapter_types.ts @@ -3,7 +3,10 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ -import { BeatTag, CMBeat } from '../../../../common/domain_types'; +import { + BeatTag, + CMBeat, +} from '../../../../../../legacy/plugins/beats_management/common/domain_types'; export interface CMTagsAdapter { getTagsWithIds(tagIds: string[]): Promise; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tags/memory_tags_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/tags/memory_tags_adapter.ts similarity index 91% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/tags/memory_tags_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/tags/memory_tags_adapter.ts index e26c6c9eb8099..357790c34ee58 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tags/memory_tags_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/tags/memory_tags_adapter.ts @@ -4,7 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ -import { BeatTag, CMBeat } from '../../../../common/domain_types'; +import { + BeatTag, + CMBeat, +} from '../../../../../../legacy/plugins/beats_management/common/domain_types'; import { CMTagsAdapter } from './adapter_types'; export class MemoryTagsAdapter implements CMTagsAdapter { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tags/rest_tags_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/tags/rest_tags_adapter.ts similarity index 90% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/tags/rest_tags_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/tags/rest_tags_adapter.ts index 190c9e265463d..4f6852cb6a007 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tags/rest_tags_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/tags/rest_tags_adapter.ts @@ -5,13 +5,16 @@ */ import { uniq } from 'lodash'; -import { BeatTag, CMBeat } from '../../../../common/domain_types'; +import { + BeatTag, + CMBeat, +} from '../../../../../../legacy/plugins/beats_management/common/domain_types'; import { ReturnTypeBulkDelete, ReturnTypeBulkGet, ReturnTypeList, ReturnTypeUpsert, -} from '../../../../common/return_types'; +} from '../../../../../../legacy/plugins/beats_management/common/return_types'; import { RestAPIAdapter } from '../rest_api/adapter_types'; import { CMTagsAdapter } from './adapter_types'; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tokens/adapter_types.ts b/x-pack/plugins/beats_management/public/lib/adapters/tokens/adapter_types.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/tokens/adapter_types.ts rename to x-pack/plugins/beats_management/public/lib/adapters/tokens/adapter_types.ts diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tokens/memory_tokens_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/tokens/memory_tokens_adapter.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/tokens/memory_tokens_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/tokens/memory_tokens_adapter.ts diff --git a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tokens/rest_tokens_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/tokens/rest_tokens_adapter.ts similarity index 87% rename from x-pack/legacy/plugins/beats_management/public/lib/adapters/tokens/rest_tokens_adapter.ts rename to x-pack/plugins/beats_management/public/lib/adapters/tokens/rest_tokens_adapter.ts index 92cfcc935ad9b..7bdea96db0f2f 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/adapters/tokens/rest_tokens_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/tokens/rest_tokens_adapter.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ReturnTypeBulkCreate } from '../../../../common/return_types'; +import { ReturnTypeBulkCreate } from '../../../../../../legacy/plugins/beats_management/common/return_types'; import { RestAPIAdapter } from '../rest_api/adapter_types'; import { CMTokensAdapter } from './adapter_types'; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/beats.ts b/x-pack/plugins/beats_management/public/lib/beats.ts similarity index 92% rename from x-pack/legacy/plugins/beats_management/public/lib/beats.ts rename to x-pack/plugins/beats_management/public/lib/beats.ts index 5432a39953b84..a6cfe0b88dcf8 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/beats.ts +++ b/x-pack/plugins/beats_management/public/lib/beats.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { ReturnTypeBulkAction } from '../../common/return_types'; -import { CMBeat } from './../../common/domain_types'; +import { ReturnTypeBulkAction } from '../../../../legacy/plugins/beats_management/common/return_types'; +import { CMBeat } from '../../../../legacy/plugins/beats_management/common/domain_types'; import { BeatsTagAssignment, CMBeatsAdapter } from './adapters/beats/adapter_types'; import { ElasticsearchLib } from './elasticsearch'; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/compose/kibana.ts b/x-pack/plugins/beats_management/public/lib/compose/kibana.ts similarity index 75% rename from x-pack/legacy/plugins/beats_management/public/lib/compose/kibana.ts rename to x-pack/plugins/beats_management/public/lib/compose/kibana.ts index 886d0b40031fe..d750417640f8c 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/compose/kibana.ts +++ b/x-pack/plugins/beats_management/public/lib/compose/kibana.ts @@ -5,9 +5,9 @@ */ import { camelCase } from 'lodash'; -import { configBlockSchemas } from '../../../common/config_schemas'; -import { translateConfigSchema } from '../../../common/config_schemas_translations_map'; -import { INDEX_NAMES } from '../../../common/constants/index_names'; +import { configBlockSchemas } from '../../../../../legacy/plugins/beats_management/common/config_schemas'; +import { translateConfigSchema } from '../../../../../legacy/plugins/beats_management/common/config_schemas_translations_map'; +import { INDEX_NAMES } from '../../../../../legacy/plugins/beats_management/common/constants/index_names'; import { RestBeatsAdapter } from '../adapters/beats/rest_beats_adapter'; import { RestConfigBlocksAdapter } from '../adapters/configuration_blocks/rest_config_blocks_adapter'; import { RestElasticsearchAdapter } from '../adapters/elasticsearch/rest'; @@ -20,13 +20,13 @@ import { ConfigBlocksLib } from '../configuration_blocks'; import { ElasticsearchLib } from '../elasticsearch'; import { TagsLib } from '../tags'; import { FrontendLibs } from '../types'; -import { PLUGIN } from './../../../common/constants/plugin'; +import { PLUGIN } from '../../../../../legacy/plugins/beats_management/common/constants/plugin'; import { FrameworkLib } from './../framework'; -import { ManagementSetup } from '../../../../../../../src/plugins/management/public'; -import { SecurityPluginSetup } from '../../../../../../plugins/security/public'; -import { CoreSetup } from '../../../../../../../src/core/public'; -import { LicensingPluginSetup } from '../../../../../../plugins/licensing/public'; -import { BeatsManagementConfigType } from '../../../../../../plugins/beats_management/common'; +import { ManagementSetup } from '../../../../../../src/plugins/management/public'; +import { SecurityPluginSetup } from '../../../../security/public'; +import { CoreSetup } from '../../../../../../src/core/public'; +import { LicensingPluginSetup } from '../../../../licensing/public'; +import { BeatsManagementConfigType } from '../../../common'; interface ComposeDeps { core: CoreSetup; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/compose/scripts.ts b/x-pack/plugins/beats_management/public/lib/compose/scripts.ts similarity index 91% rename from x-pack/legacy/plugins/beats_management/public/lib/compose/scripts.ts rename to x-pack/plugins/beats_management/public/lib/compose/scripts.ts index 83129384a77df..093d618ba8d8b 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/compose/scripts.ts +++ b/x-pack/plugins/beats_management/public/lib/compose/scripts.ts @@ -4,8 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import { configBlockSchemas } from '../../../common/config_schemas'; -import { translateConfigSchema } from '../../../common/config_schemas_translations_map'; +import { configBlockSchemas } from '../../../../../legacy/plugins/beats_management/common/config_schemas'; +import { translateConfigSchema } from '../../../../../legacy/plugins/beats_management/common/config_schemas_translations_map'; import { RestBeatsAdapter } from '../adapters/beats/rest_beats_adapter'; import { RestConfigBlocksAdapter } from '../adapters/configuration_blocks/rest_config_blocks_adapter'; import { MemoryElasticsearchAdapter } from '../adapters/elasticsearch/memory'; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/configuration_blocks.ts b/x-pack/plugins/beats_management/public/lib/configuration_blocks.ts similarity index 97% rename from x-pack/legacy/plugins/beats_management/public/lib/configuration_blocks.ts rename to x-pack/plugins/beats_management/public/lib/configuration_blocks.ts index c3b21b5df5175..ffb431da1f43e 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/configuration_blocks.ts +++ b/x-pack/plugins/beats_management/public/lib/configuration_blocks.ts @@ -6,7 +6,10 @@ import yaml from 'js-yaml'; import { get, has, omit, set } from 'lodash'; -import { ConfigBlockSchema, ConfigurationBlock } from '../../common/domain_types'; +import { + ConfigBlockSchema, + ConfigurationBlock, +} from '../../../../legacy/plugins/beats_management/common/domain_types'; import { FrontendConfigBlocksAdapter } from './adapters/configuration_blocks/adapter_types'; export class ConfigBlocksLib { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/elasticsearch.ts b/x-pack/plugins/beats_management/public/lib/elasticsearch.ts similarity index 96% rename from x-pack/legacy/plugins/beats_management/public/lib/elasticsearch.ts rename to x-pack/plugins/beats_management/public/lib/elasticsearch.ts index 82576bff2cbfd..a9ca69c44c97d 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/elasticsearch.ts +++ b/x-pack/plugins/beats_management/public/lib/elasticsearch.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { QuerySuggestion } from '../../../../../../src/plugins/data/public'; +import { QuerySuggestion } from '../../../../../src/plugins/data/public'; import { ElasticsearchAdapter } from './adapters/elasticsearch/adapter_types'; interface HiddenFields { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/framework.ts b/x-pack/plugins/beats_management/public/lib/framework.ts similarity index 94% rename from x-pack/legacy/plugins/beats_management/public/lib/framework.ts rename to x-pack/plugins/beats_management/public/lib/framework.ts index 57560e7279c92..c850bdd8bc0ee 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/framework.ts +++ b/x-pack/plugins/beats_management/public/lib/framework.ts @@ -5,7 +5,10 @@ */ import { difference, get } from 'lodash'; -import { LICENSES, LicenseType } from '../../common/constants/security'; +import { + LICENSES, + LicenseType, +} from '../../../../legacy/plugins/beats_management/common/constants/security'; import { FrameworkAdapter } from './adapters/framework/adapter_types'; export class FrameworkLib { diff --git a/x-pack/legacy/plugins/beats_management/public/lib/tags.ts b/x-pack/plugins/beats_management/public/lib/tags.ts similarity index 93% rename from x-pack/legacy/plugins/beats_management/public/lib/tags.ts rename to x-pack/plugins/beats_management/public/lib/tags.ts index 86562be3ff989..2d67edf7e347e 100644 --- a/x-pack/legacy/plugins/beats_management/public/lib/tags.ts +++ b/x-pack/plugins/beats_management/public/lib/tags.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import uuidv4 from 'uuid/v4'; -import { BeatTag, CMBeat } from '../../common/domain_types'; +import { BeatTag, CMBeat } from '../../../../legacy/plugins/beats_management/common/domain_types'; import { CMTagsAdapter } from './adapters/tags/adapter_types'; import { ElasticsearchLib } from './elasticsearch'; diff --git a/x-pack/legacy/plugins/beats_management/public/lib/types.ts b/x-pack/plugins/beats_management/public/lib/types.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/lib/types.ts rename to x-pack/plugins/beats_management/public/lib/types.ts diff --git a/x-pack/legacy/plugins/beats_management/public/pages/__404.tsx b/x-pack/plugins/beats_management/public/pages/__404.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/pages/__404.tsx rename to x-pack/plugins/beats_management/public/pages/__404.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/pages/beat/details.tsx b/x-pack/plugins/beats_management/public/pages/beat/details.tsx similarity index 93% rename from x-pack/legacy/plugins/beats_management/public/pages/beat/details.tsx rename to x-pack/plugins/beats_management/public/pages/beat/details.tsx index 3952b44f82561..6fae3a5efc71f 100644 --- a/x-pack/legacy/plugins/beats_management/public/pages/beat/details.tsx +++ b/x-pack/plugins/beats_management/public/pages/beat/details.tsx @@ -19,10 +19,14 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react'; import { get } from 'lodash'; import React from 'react'; -import { configBlockSchemas } from '../../../common/config_schemas'; -import { translateConfigSchema } from '../../../common/config_schemas_translations_map'; -import { TABLE_CONFIG } from '../../../common/constants'; -import { BeatTag, CMBeat, ConfigurationBlock } from '../../../common/domain_types'; +import { configBlockSchemas } from '../../../../../legacy/plugins/beats_management/common/config_schemas'; +import { translateConfigSchema } from '../../../../../legacy/plugins/beats_management/common/config_schemas_translations_map'; +import { TABLE_CONFIG } from '../../../../../legacy/plugins/beats_management/common/constants'; +import { + BeatTag, + CMBeat, + ConfigurationBlock, +} from '../../../../../legacy/plugins/beats_management/common/domain_types'; import { Breadcrumb } from '../../components/navigation/breadcrumb'; import { ConnectedLink } from '../../components/navigation/connected_link'; import { TagBadge } from '../../components/tag'; diff --git a/x-pack/legacy/plugins/beats_management/public/pages/beat/index.tsx b/x-pack/plugins/beats_management/public/pages/beat/index.tsx similarity index 98% rename from x-pack/legacy/plugins/beats_management/public/pages/beat/index.tsx rename to x-pack/plugins/beats_management/public/pages/beat/index.tsx index 80590febc95be..bea84377d2ab8 100644 --- a/x-pack/legacy/plugins/beats_management/public/pages/beat/index.tsx +++ b/x-pack/plugins/beats_management/public/pages/beat/index.tsx @@ -17,7 +17,7 @@ import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react'; import moment from 'moment'; import React from 'react'; import { Redirect, Route, Switch } from 'react-router-dom'; -import { CMBeat } from '../../../common/domain_types'; +import { CMBeat } from '../../../../../legacy/plugins/beats_management/common/domain_types'; import { PrimaryLayout } from '../../components/layouts/primary'; import { Breadcrumb } from '../../components/navigation/breadcrumb'; import { ChildRoutes } from '../../components/navigation/child_routes'; diff --git a/x-pack/legacy/plugins/beats_management/public/pages/beat/tags.tsx b/x-pack/plugins/beats_management/public/pages/beat/tags.tsx similarity index 94% rename from x-pack/legacy/plugins/beats_management/public/pages/beat/tags.tsx rename to x-pack/plugins/beats_management/public/pages/beat/tags.tsx index 672c0d89bb002..5a65473b25a24 100644 --- a/x-pack/legacy/plugins/beats_management/public/pages/beat/tags.tsx +++ b/x-pack/plugins/beats_management/public/pages/beat/tags.tsx @@ -7,7 +7,10 @@ import { EuiGlobalToastList } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { BeatTag, CMBeat } from '../../../common/domain_types'; +import { + BeatTag, + CMBeat, +} from '../../../../../legacy/plugins/beats_management/common/domain_types'; import { Breadcrumb } from '../../components/navigation/breadcrumb'; import { BeatDetailTagsTable, Table } from '../../components/table'; import { FrontendLibs } from '../../lib/types'; diff --git a/x-pack/legacy/plugins/beats_management/public/pages/error/enforce_security.tsx b/x-pack/plugins/beats_management/public/pages/error/enforce_security.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/pages/error/enforce_security.tsx rename to x-pack/plugins/beats_management/public/pages/error/enforce_security.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/pages/error/invalid_license.tsx b/x-pack/plugins/beats_management/public/pages/error/invalid_license.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/pages/error/invalid_license.tsx rename to x-pack/plugins/beats_management/public/pages/error/invalid_license.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/pages/error/no_access.tsx b/x-pack/plugins/beats_management/public/pages/error/no_access.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/pages/error/no_access.tsx rename to x-pack/plugins/beats_management/public/pages/error/no_access.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/pages/index.ts b/x-pack/plugins/beats_management/public/pages/index.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/pages/index.ts rename to x-pack/plugins/beats_management/public/pages/index.ts diff --git a/x-pack/legacy/plugins/beats_management/public/pages/overview/configuration_tags.tsx b/x-pack/plugins/beats_management/public/pages/overview/configuration_tags.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/pages/overview/configuration_tags.tsx rename to x-pack/plugins/beats_management/public/pages/overview/configuration_tags.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/pages/overview/enrolled_beats.tsx b/x-pack/plugins/beats_management/public/pages/overview/enrolled_beats.tsx similarity index 99% rename from x-pack/legacy/plugins/beats_management/public/pages/overview/enrolled_beats.tsx rename to x-pack/plugins/beats_management/public/pages/overview/enrolled_beats.tsx index 635b9f03e8b38..5151f501ddba1 100644 --- a/x-pack/legacy/plugins/beats_management/public/pages/overview/enrolled_beats.tsx +++ b/x-pack/plugins/beats_management/public/pages/overview/enrolled_beats.tsx @@ -19,7 +19,10 @@ import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react'; import { flatten, sortBy } from 'lodash'; import moment from 'moment'; import React from 'react'; -import { BeatTag, CMBeat } from '../../../common/domain_types'; +import { + BeatTag, + CMBeat, +} from '../../../../../legacy/plugins/beats_management/common/domain_types'; import { EnrollBeat } from '../../components/enroll_beats'; import { Breadcrumb } from '../../components/navigation/breadcrumb'; import { BeatsTableType, Table } from '../../components/table'; diff --git a/x-pack/legacy/plugins/beats_management/public/pages/overview/index.tsx b/x-pack/plugins/beats_management/public/pages/overview/index.tsx similarity index 97% rename from x-pack/legacy/plugins/beats_management/public/pages/overview/index.tsx rename to x-pack/plugins/beats_management/public/pages/overview/index.tsx index 57b007753491c..4df1a7d065469 100644 --- a/x-pack/legacy/plugins/beats_management/public/pages/overview/index.tsx +++ b/x-pack/plugins/beats_management/public/pages/overview/index.tsx @@ -16,7 +16,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; import { Subscribe } from 'unstated'; -import { CMBeat } from '../../../common/domain_types'; +import { CMBeat } from '../../../../../legacy/plugins/beats_management/common/domain_types'; import { PrimaryLayout } from '../../components/layouts/primary'; import { ChildRoutes } from '../../components/navigation/child_routes'; import { BeatsContainer } from '../../containers/beats'; diff --git a/x-pack/legacy/plugins/beats_management/public/pages/tag/create.tsx b/x-pack/plugins/beats_management/public/pages/tag/create.tsx similarity index 95% rename from x-pack/legacy/plugins/beats_management/public/pages/tag/create.tsx rename to x-pack/plugins/beats_management/public/pages/tag/create.tsx index 326c529af3c61..65fe8bf5d52c1 100644 --- a/x-pack/legacy/plugins/beats_management/public/pages/tag/create.tsx +++ b/x-pack/plugins/beats_management/public/pages/tag/create.tsx @@ -12,8 +12,11 @@ import 'brace/mode/yaml'; import 'brace/theme/github'; import { isEqual } from 'lodash'; import React from 'react'; -import { UNIQUENESS_ENFORCING_TYPES } from '../../../common/constants/configuration_blocks'; -import { BeatTag, ConfigurationBlock } from '../../../common/domain_types'; +import { UNIQUENESS_ENFORCING_TYPES } from '../../../../../legacy/plugins/beats_management/common/constants/configuration_blocks'; +import { + BeatTag, + ConfigurationBlock, +} from '../../../../../legacy/plugins/beats_management/common/domain_types'; import { PrimaryLayout } from '../../components/layouts/primary'; import { TagEdit } from '../../components/tag'; import { AppPageProps } from '../../frontend_types'; diff --git a/x-pack/legacy/plugins/beats_management/public/pages/tag/edit.tsx b/x-pack/plugins/beats_management/public/pages/tag/edit.tsx similarity index 96% rename from x-pack/legacy/plugins/beats_management/public/pages/tag/edit.tsx rename to x-pack/plugins/beats_management/public/pages/tag/edit.tsx index 553128df76baa..918ae0bb6fcb2 100644 --- a/x-pack/legacy/plugins/beats_management/public/pages/tag/edit.tsx +++ b/x-pack/plugins/beats_management/public/pages/tag/edit.tsx @@ -10,8 +10,12 @@ import 'brace/mode/yaml'; import 'brace/theme/github'; import { flatten } from 'lodash'; import React from 'react'; -import { UNIQUENESS_ENFORCING_TYPES } from '../../../common/constants'; -import { BeatTag, CMBeat, ConfigurationBlock } from '../../../common/domain_types'; +import { UNIQUENESS_ENFORCING_TYPES } from '../../../../../legacy/plugins/beats_management/common/constants'; +import { + BeatTag, + CMBeat, + ConfigurationBlock, +} from '../../../../../legacy/plugins/beats_management/common/domain_types'; import { PrimaryLayout } from '../../components/layouts/primary'; import { TagEdit } from '../../components/tag'; import { AppPageProps } from '../../frontend_types'; diff --git a/x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/beat.tsx b/x-pack/plugins/beats_management/public/pages/walkthrough/initial/beat.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/beat.tsx rename to x-pack/plugins/beats_management/public/pages/walkthrough/initial/beat.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/finish.tsx b/x-pack/plugins/beats_management/public/pages/walkthrough/initial/finish.tsx similarity index 97% rename from x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/finish.tsx rename to x-pack/plugins/beats_management/public/pages/walkthrough/initial/finish.tsx index 93489f5223ef8..71f0b8161131f 100644 --- a/x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/finish.tsx +++ b/x-pack/plugins/beats_management/public/pages/walkthrough/initial/finish.tsx @@ -6,7 +6,7 @@ import { EuiButton, EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiPageContent } from '@elastic/eui'; import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react'; import React from 'react'; -import { CMBeat } from '../../../../common/domain_types'; +import { CMBeat } from '../../../../../../legacy/plugins/beats_management/common/domain_types'; import { AppPageProps } from '../../../frontend_types'; interface PageState { diff --git a/x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/index.tsx b/x-pack/plugins/beats_management/public/pages/walkthrough/initial/index.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/index.tsx rename to x-pack/plugins/beats_management/public/pages/walkthrough/initial/index.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/tag.tsx b/x-pack/plugins/beats_management/public/pages/walkthrough/initial/tag.tsx similarity index 97% rename from x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/tag.tsx rename to x-pack/plugins/beats_management/public/pages/walkthrough/initial/tag.tsx index 8dc3afeb06c6b..525873e1dd64b 100644 --- a/x-pack/legacy/plugins/beats_management/public/pages/walkthrough/initial/tag.tsx +++ b/x-pack/plugins/beats_management/public/pages/walkthrough/initial/tag.tsx @@ -9,7 +9,10 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { isEqual } from 'lodash'; import React, { Component } from 'react'; import uuidv4 from 'uuid/v4'; -import { BeatTag, ConfigurationBlock } from '../../../../common/domain_types'; +import { + BeatTag, + ConfigurationBlock, +} from '../../../../../../legacy/plugins/beats_management/common/domain_types'; import { TagEdit } from '../../../components/tag/tag_edit'; import { AppPageProps } from '../../../frontend_types'; interface PageState { diff --git a/x-pack/legacy/plugins/beats_management/public/router.tsx b/x-pack/plugins/beats_management/public/router.tsx similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/router.tsx rename to x-pack/plugins/beats_management/public/router.tsx diff --git a/x-pack/legacy/plugins/beats_management/public/utils/random_eui_color.ts b/x-pack/plugins/beats_management/public/utils/random_eui_color.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/utils/random_eui_color.ts rename to x-pack/plugins/beats_management/public/utils/random_eui_color.ts diff --git a/x-pack/legacy/plugins/beats_management/public/utils/typed_react.ts b/x-pack/plugins/beats_management/public/utils/typed_react.ts similarity index 100% rename from x-pack/legacy/plugins/beats_management/public/utils/typed_react.ts rename to x-pack/plugins/beats_management/public/utils/typed_react.ts From 5f540a358a690bae86c86a90fc5baf199ce82e85 Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Sun, 10 May 2020 10:43:38 -0600 Subject: [PATCH 3/6] Fix routing and breadcrumbs --- .../beats_management/common/constants/index.ts | 2 +- .../beats_management/public/application.tsx | 2 +- .../beats_management/public/bootstrap.tsx | 3 ++- .../navigation/breadcrumb/breadcrumb.tsx | 2 +- .../lib/adapters/framework/adapter_types.ts | 5 +++-- .../framework/kibana_framework_adapter.ts | 18 +++++++----------- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/x-pack/legacy/plugins/beats_management/common/constants/index.ts b/x-pack/legacy/plugins/beats_management/common/constants/index.ts index 31fa84906cd38..5f9ae815e34d4 100644 --- a/x-pack/legacy/plugins/beats_management/common/constants/index.ts +++ b/x-pack/legacy/plugins/beats_management/common/constants/index.ts @@ -9,4 +9,4 @@ export { INDEX_NAMES } from './index_names'; export { PLUGIN } from './plugin'; export { LICENSES, REQUIRED_LICENSES, REQUIRED_ROLES } from './security'; export { TABLE_CONFIG } from './table'; -export const BASE_PATH = '/management/beats_management'; +export const BASE_PATH = '/management/beats/beats_management'; diff --git a/x-pack/plugins/beats_management/public/application.tsx b/x-pack/plugins/beats_management/public/application.tsx index b17031a61f435..bf450e9c7a5e3 100644 --- a/x-pack/plugins/beats_management/public/application.tsx +++ b/x-pack/plugins/beats_management/public/application.tsx @@ -28,7 +28,7 @@ export const renderApp = ( ReactDOM.render( - + diff --git a/x-pack/plugins/beats_management/public/bootstrap.tsx b/x-pack/plugins/beats_management/public/bootstrap.tsx index ce5b6642773f4..678b4b7638634 100644 --- a/x-pack/plugins/beats_management/public/bootstrap.tsx +++ b/x-pack/plugins/beats_management/public/bootstrap.tsx @@ -20,7 +20,7 @@ import { BeatsManagementConfigType } from '../common'; async function startApp(libs: FrontendLibs, core: CoreSetup) { await libs.framework.waitUntilFrameworkReady(); - if (true || libs.framework.licenseIsAtLeast('standard')) { + if (libs.framework.licenseIsAtLeast('standard')) { libs.framework.registerManagementSection({ id: 'beats', name: i18n.translate('xpack.beatsManagement.centralManagementSectionLabel', { @@ -31,6 +31,7 @@ async function startApp(libs: FrontendLibs, core: CoreSetup) { libs.framework.registerManagementUI({ sectionId: 'beats', + appId: 'beats_management', name: i18n.translate('xpack.beatsManagement.centralManagementLinkLabel', { defaultMessage: 'Central Management', }), diff --git a/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx b/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx index 66259fcb138c5..13a0003b5ebdf 100644 --- a/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx +++ b/x-pack/plugins/beats_management/public/components/navigation/breadcrumb/breadcrumb.tsx @@ -53,7 +53,7 @@ export const Breadcrumb: React.FC = ({ title, path, parentBread {context => ( diff --git a/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts index a2db2d75fa4fd..2ae152dc969ed 100644 --- a/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts @@ -18,13 +18,14 @@ export interface FrameworkAdapter { // Methods waitUntilFrameworkReady(): Promise; registerManagementSection(settings: { - id?: string; + id: string; name: string; iconName: string; order?: number; }): void; registerManagementUI(settings: { - sectionId?: string; + sectionId: string; + appId: string; name: string; basePath: string; visable?: boolean; diff --git a/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts index c299b746cf045..5e11df228ccb0 100644 --- a/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts @@ -74,7 +74,6 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { enabled: license.getFeature('security').isEnabled, available: license.getFeature('security').isAvailable, }, - // TODO: this really has nothing to do with licensing, but should be server config settings: this.config, }; } catch (e) { @@ -104,15 +103,13 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { } public registerManagementSection(settings: { - id?: string; + id: string; name: string; iconName: string; order?: number; }) { - const sectionId = settings.id || this.PLUGIN_ID; - this.management.sections.register({ - id: sectionId, + id: settings.id, title: settings.name, euiIconType: settings.iconName, order: settings.order || 30, @@ -120,25 +117,24 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { } public registerManagementUI(settings: { - sectionId?: string; + sectionId: string; + appId: string; name: string; basePath: string; visable?: boolean; order?: number; mount: RegisterManagementAppArgs['mount']; }) { - const sectionId = settings.sectionId || this.PLUGIN_ID; - - const section = this.management.sections.getSection(sectionId); + const section = this.management.sections.getSection(settings.sectionId); if (!section) { throw new Error( - `registerManagementUI was called with a sectionId of ${sectionId}, and that is is not yet regestered as a section` + `registerManagementUI was called with a sectionId of ${settings.sectionId}, and that is is not yet regestered as a section` ); } section.registerApp({ - id: sectionId, + id: settings.appId, title: settings.name, order: settings.order || 30, mount: settings.mount, From d6f416e5a59ef7d74220c413416c2a7a635ffc97 Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Sun, 10 May 2020 13:59:10 -0600 Subject: [PATCH 4/6] Fix i18nrc --- x-pack/.i18nrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 7c464d44d5761..7ac27dd47ad64 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -7,7 +7,7 @@ "xpack.alerting": "plugins/alerting", "xpack.alertingBuiltins": "plugins/alerting_builtins", "xpack.apm": ["legacy/plugins/apm", "plugins/apm"], - "xpack.beatsManagement": "legacy/plugins/beats_management", + "xpack.beatsManagement": ["legacy/plugins/beats_management", "plugins/beats_management"], "xpack.canvas": "plugins/canvas", "xpack.dashboard": "plugins/dashboard_enhanced", "xpack.crossClusterReplication": "plugins/cross_cluster_replication", From 3a2f86d1a7db4be880600601703e420484e69655 Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Tue, 12 May 2020 12:21:50 -0600 Subject: [PATCH 5/6] Remove unused parameters --- .../public/lib/adapters/framework/adapter_types.ts | 2 -- .../public/lib/adapters/framework/kibana_framework_adapter.ts | 2 -- 2 files changed, 4 deletions(-) diff --git a/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts b/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts index 2ae152dc969ed..3c0c724d3d87b 100644 --- a/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/framework/adapter_types.ts @@ -27,8 +27,6 @@ export interface FrameworkAdapter { sectionId: string; appId: string; name: string; - basePath: string; - visable?: boolean; order?: number; mount: RegisterManagementAppArgs['mount']; }): void; diff --git a/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts index 5e11df228ccb0..d061e2f35809b 100644 --- a/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/framework/kibana_framework_adapter.ts @@ -120,8 +120,6 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter { sectionId: string; appId: string; name: string; - basePath: string; - visable?: boolean; order?: number; mount: RegisterManagementAppArgs['mount']; }) { From c25f6ae06d847e51979d002c7a1dec034b5be174 Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Tue, 12 May 2020 13:35:37 -0600 Subject: [PATCH 6/6] Fix type errors --- x-pack/plugins/beats_management/public/bootstrap.tsx | 2 -- .../lib/adapters/framework/testing_framework_adapter.ts | 8 +------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/x-pack/plugins/beats_management/public/bootstrap.tsx b/x-pack/plugins/beats_management/public/bootstrap.tsx index 678b4b7638634..ecca9da052fea 100644 --- a/x-pack/plugins/beats_management/public/bootstrap.tsx +++ b/x-pack/plugins/beats_management/public/bootstrap.tsx @@ -5,7 +5,6 @@ */ import { i18n } from '@kbn/i18n'; -import { BASE_PATH } from '../../../legacy/plugins/beats_management/common/constants'; import { FrontendLibs } from './lib/types'; import { compose } from './lib/compose/kibana'; @@ -35,7 +34,6 @@ async function startApp(libs: FrontendLibs, core: CoreSetup) { name: i18n.translate('xpack.beatsManagement.centralManagementLinkLabel', { defaultMessage: 'Central Management', }), - basePath: BASE_PATH, async mount(params) { const [coreStart, pluginsStart] = await core.getStartServices(); setServices(coreStart, pluginsStart, params); diff --git a/x-pack/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts b/x-pack/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts index e22ed684fccbc..56f428ff0b927 100644 --- a/x-pack/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts +++ b/x-pack/plugins/beats_management/public/lib/adapters/framework/testing_framework_adapter.ts @@ -48,13 +48,7 @@ export class TestingFrameworkAdapter implements FrameworkAdapter { throw new Error('not yet implamented'); } - public registerManagementUI(settings: { - sectionId?: string; - name: string; - basePath: string; - visable?: boolean; - order?: number; - }) { + public registerManagementUI(settings: { sectionId?: string; name: string; order?: number }) { throw new Error('not yet implamented'); } }