From 5f540a358a690bae86c86a90fc5baf199ce82e85 Mon Sep 17 00:00:00 2001 From: Josh Dover Date: Sun, 10 May 2020 10:43:38 -0600 Subject: [PATCH] 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 31fa84906cd3..5f9ae815e34d 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 b17031a61f43..bf450e9c7a5e 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 ce5b6642773f..678b4b763863 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 66259fcb138c..13a0003b5ebd 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 a2db2d75fa4f..2ae152dc969e 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 c299b746cf04..5e11df228ccb 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,