Skip to content

Commit

Permalink
[Navigation] Register all plugins to NavGroups (#369)
Browse files Browse the repository at this point in the history
* Add a function to register all plugin Nav groups and categories

Signed-off-by: Adam Tackett <[email protected]>

* Updated addNavLinkGroups path

Signed-off-by: Adam Tackett <[email protected]>

* Add always show to analytics group

Signed-off-by: Adam Tackett <[email protected]>

* Adjust dashboardsAndReport rename and lint errors

Signed-off-by: Adam Tackett <[email protected]>

* Add groups and remove analytics

Signed-off-by: Adam Tackett <[email protected]>

* Fix lint error

Signed-off-by: Adam Tackett <[email protected]>

---------

Signed-off-by: Adam Tackett <[email protected]>
Co-authored-by: Adam Tackett <[email protected]>
  • Loading branch information
TackAdam and Adam Tackett authored Jul 18, 2024
1 parent 985e623 commit cc1b533
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
10 changes: 5 additions & 5 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { i18n } from '@osd/i18n';
import {
AppMountParameters,
CoreSetup,
Expand All @@ -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<ReportsDashboardsPluginSetup, ReportsDashboardsPluginStart>
{
implements Plugin<ReportsDashboardsPluginSetup, ReportsDashboardsPluginStart> {
public setup(core: CoreSetup): ReportsDashboardsPluginSetup {
uiSettingsService.init(core.uiSettings, core.http);
// Register an application into the side navigation menu
Expand Down Expand Up @@ -52,7 +52,7 @@ export class ReportsDashboardsPlugin
);
},
});

registerAllPluginNavGroups(core);
// Return methods that should be available to other plugins
return {};
}
Expand All @@ -62,5 +62,5 @@ export class ReportsDashboardsPlugin
return {};
}

public stop() {}
public stop() { }
}
33 changes: 33 additions & 0 deletions public/plugin_nav.tsx
Original file line number Diff line number Diff line change
@@ -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<ReportsDashboardsPluginSetup>) {
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,
},
]);
}

0 comments on commit cc1b533

Please sign in to comment.