Skip to content

Commit 33cc7d2

Browse files
github-actions[bot]Adam Tackett
andcommitted
Add a function to register all plugin Nav groups and categories (#406)
Signed-off-by: Adam Tackett <[email protected]> Co-authored-by: Adam Tackett <[email protected]> (cherry picked from commit 40cfcf1) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent a1a1ed9 commit 33cc7d2

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

public/plugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
SearchRelevancePluginSetup,
1414
SearchRelevancePluginStart,
1515
} from './types';
16+
import { registerAllPluginNavGroups } from './plugin_nav';
1617

1718
export interface SearchRelevancePluginSetupDependencies {
1819
dataSource: DataSourcePluginSetup;
@@ -44,7 +45,7 @@ export class SearchRelevancePlugin
4445
return renderApp(coreStart, depsStart as AppPluginStartDependencies, params, dataSourceManagement);
4546
},
4647
});
47-
48+
registerAllPluginNavGroups(core);
4849
// Return methods that should be available to other plugins
4950
return {
5051
getGreeting() {

public/plugin_nav.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { CoreSetup } from '../../../src/core/public';
7+
import { SearchRelevancePluginSetup } from './types';
8+
import { PLUGIN_ID } from '../common';
9+
import { DEFAULT_NAV_GROUPS, DEFAULT_APP_CATEGORIES, AppCategory } from '../../../src/core/public';
10+
import { i18n } from "@osd/i18n";
11+
12+
const searchRelevance_category: Record<string, AppCategory & { group?: AppCategory }> = {
13+
evaluateSearch: {
14+
id: "evaluateSearch",
15+
label: i18n.translate("core.ui.indexesNavList.label", {
16+
defaultMessage: "Evaluate search",
17+
}),
18+
order: 3000,
19+
},
20+
};
21+
22+
export function registerAllPluginNavGroups(core: CoreSetup<SearchRelevancePluginSetup>) {
23+
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.search, [
24+
{
25+
id: PLUGIN_ID,
26+
category: searchRelevance_category.evaluateSearch,//change to Evaluate Search
27+
},
28+
]);
29+
}

0 commit comments

Comments
 (0)