diff --git a/public/plugin.ts b/public/plugin.ts index c7e18f4b..553bc082 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import { i18n } from '@osd/i18n'; import { AppMountParameters, CoreSetup, @@ -14,15 +15,14 @@ import { ReportsDashboardsPluginStart, AppPluginStartDependencies, } from './types'; -import { i18n } from '@osd/i18n'; import './components/context_menu/context_menu'; import { PLUGIN_ID, PLUGIN_NAME } from '../common'; import { uiSettingsService } from './components/utils/settings_service'; import { applicationService } from './components/utils/application_service'; +import { registerAllPluginNavGroups } from './plugin_nav'; export class ReportsDashboardsPlugin - implements Plugin -{ + implements Plugin { public setup(core: CoreSetup): ReportsDashboardsPluginSetup { uiSettingsService.init(core.uiSettings, core.http); // Register an application into the side navigation menu @@ -52,7 +52,7 @@ export class ReportsDashboardsPlugin ); }, }); - + registerAllPluginNavGroups(core); // Return methods that should be available to other plugins return {}; } @@ -62,5 +62,5 @@ export class ReportsDashboardsPlugin return {}; } - public stop() {} + public stop() { } } diff --git a/public/plugin_nav.tsx b/public/plugin_nav.tsx new file mode 100644 index 00000000..df1f3b57 --- /dev/null +++ b/public/plugin_nav.tsx @@ -0,0 +1,33 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { CoreSetup } from '../../../src/core/public'; +import { ReportsDashboardsPluginSetup } from './types'; +import { PLUGIN_ID } from '../common'; +import { DEFAULT_NAV_GROUPS, DEFAULT_APP_CATEGORIES } from '../../../src/core/public'; + +export function registerAllPluginNavGroups(core: CoreSetup) { + core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [ + { + id: PLUGIN_ID, + category: DEFAULT_APP_CATEGORIES.visualizeAndReport, + order: 300, + }, + ]); + core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS[`security-analytics`], [ + { + id: PLUGIN_ID, + category: DEFAULT_APP_CATEGORIES.visualizeAndReport, + order: 300, + }, + ]); + core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.search, [ + { + id: PLUGIN_ID, + category: DEFAULT_APP_CATEGORIES.analyzeSearch, + order: 300, + }, + ]); +} \ No newline at end of file