Skip to content

Commit

Permalink
Add a function to register all plugin Nav groups and categories
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Tackett <[email protected]>
  • Loading branch information
Adam Tackett committed Jun 27, 2024
1 parent 47e8578 commit 43ff505
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
3 changes: 3 additions & 0 deletions public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ import {
SetupDependencies,
} from './types';
import { TablesFlyout } from './components/event_analytics/explorer/datasources/tables_flyout';
import { registerAllPluginNavGroups } from './plugin_nav';

interface PublicConfig {
query_assist: {
Expand Down Expand Up @@ -346,6 +347,8 @@ export class ObservabilityPlugin
mount: appMountWithStartPage('integrations'),
});

registerAllPluginNavGroups(core);

core.application.register({
id: observabilityDataConnectionsID,
title: observabilityDataConnectionsTitle,
Expand Down
127 changes: 127 additions & 0 deletions public/plugin_nav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import {
observabilityApplicationsID,
observabilityIntegrationsID,
observabilityLogsID,
observabilityMetricsID,
observabilityNotebookID,
observabilityPanelsID,
observabilityTracesID,
} from '../common/constants/shared';
import { CoreSetup } from '../../../src/core/public';
import { AppPluginStartDependencies } from './types';
import { DEFAULT_NAV_GROUPS, DEFAULT_APP_CATEGORIES } from '../../../src/core/public';

export function registerAllPluginNavGroups(core: CoreSetup<AppPluginStartDependencies>) {
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [
{
id: observabilityApplicationsID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);

core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [
{
id: observabilityLogsID,
category: DEFAULT_APP_CATEGORIES.investigate,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS[`security-analytics`], [
{
id: observabilityLogsID,
category: DEFAULT_APP_CATEGORIES.investigate,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
{
id: observabilityLogsID,
category: DEFAULT_APP_CATEGORIES.investigate,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.search, [
{
id: observabilityLogsID,
category: DEFAULT_APP_CATEGORIES.analyzeSearch,
},
]);

core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [
{
id: observabilityMetricsID,
category: DEFAULT_APP_CATEGORIES.investigate,
},
]);

core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [
{
id: observabilityTracesID,
category: DEFAULT_APP_CATEGORIES.investigate,
},
]);

core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [
{
id: observabilityNotebookID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS[`security-analytics`], [
{
id: observabilityNotebookID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
{
id: observabilityNotebookID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);

core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [
{
id: observabilityPanelsID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS[`security-analytics`], [
{
id: observabilityPanelsID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
{
id: observabilityPanelsID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.search, [
{
id: observabilityPanelsID,
category: DEFAULT_APP_CATEGORIES.analyzeSearch,
},
]);

core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [
{
id: observabilityIntegrationsID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS[`security-analytics`], [
{
id: observabilityIntegrationsID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);
core.chrome.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
{
id: observabilityIntegrationsID,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
},
]);
}

0 comments on commit 43ff505

Please sign in to comment.