Skip to content

Commit 4b8826e

Browse files
opensearch-trigger-bot[bot]github-actions[bot]opensearch-changeset-bot[bot]
authored
[navigation]fix: add sample data to left navigation (#7613) (#7615)
* feat: add sample data to left navigation * Changeset file for PR #7613 created/updated * feat: add sample data to left navigation --------- (cherry picked from commit 352d2e9) Signed-off-by: SuZhou-Joe <suzhou@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
1 parent 62b0238 commit 4b8826e

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

changelogs/fragments/7613.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fix:
2+
- [navigation] add sample data to left navigation ([#7613](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7613))

src/plugins/home/public/plugin.ts

+24-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ import { PLUGIN_ID, HOME_APP_BASE_PATH, IMPORT_SAMPLE_DATA_APP_ID } from '../com
6464
import { DataSourcePluginStart } from '../../data_source/public';
6565
import { workWithDataSection } from './application/components/homepage/sections/work_with_data';
6666
import { learnBasicsSection } from './application/components/homepage/sections/learn_basics';
67-
import { DEFAULT_NAV_GROUPS } from '../../../core/public';
67+
import { DEFAULT_NAV_GROUPS, DEFAULT_APP_CATEGORIES } from '../../../core/public';
6868
import {
6969
ContentManagementPluginSetup,
7070
ContentManagementPluginStart,
@@ -179,7 +179,9 @@ export class HomePublicPlugin
179179
title: i18n.translate('home.tutorialDirectory.featureCatalogueTitle', {
180180
defaultMessage: 'Add sample data',
181181
}),
182-
navLinkStatus: AppNavLinkStatus.hidden,
182+
navLinkStatus: core.chrome.navGroup.getNavGroupEnabled()
183+
? AppNavLinkStatus.visible
184+
: AppNavLinkStatus.hidden,
183185
mount: async (params: AppMountParameters) => {
184186
const [coreStart] = await core.getStartServices();
185187
setCommonService();
@@ -194,6 +196,26 @@ export class HomePublicPlugin
194196
});
195197
urlForwarding.forwardApp('home', 'home');
196198

199+
const configurationInfoForImportSampleData = {
200+
id: IMPORT_SAMPLE_DATA_APP_ID,
201+
title: i18n.translate('home.nav.sampleData.label', {
202+
defaultMessage: 'Sample data',
203+
}),
204+
order: 400,
205+
category: DEFAULT_APP_CATEGORIES.manage,
206+
};
207+
208+
// Register sample data to all of the use cases in 2.16
209+
[
210+
DEFAULT_NAV_GROUPS.all,
211+
DEFAULT_NAV_GROUPS.analytics,
212+
DEFAULT_NAV_GROUPS['security-analytics'],
213+
DEFAULT_NAV_GROUPS.observability,
214+
DEFAULT_NAV_GROUPS.search,
215+
].forEach((navGroup) =>
216+
core.chrome.navGroup.addNavLinksToGroup(navGroup, [configurationInfoForImportSampleData])
217+
);
218+
197219
const featureCatalogue = { ...this.featuresCatalogueRegistry.setup() };
198220

199221
featureCatalogue.register({

0 commit comments

Comments
 (0)