Skip to content

Commit

Permalink
[navigation]fix: add sample data to left navigation (#7613)
Browse files Browse the repository at this point in the history
* feat: add sample data to left navigation

Signed-off-by: SuZhou-Joe <[email protected]>

* Changeset file for PR #7613 created/updated

* feat: add sample data to left navigation

Signed-off-by: SuZhou-Joe <[email protected]>

---------

Signed-off-by: SuZhou-Joe <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 352d2e9)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 62b0238 commit 137b103
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/7613.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [navigation] add sample data to left navigation ([#7613](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7613))
26 changes: 24 additions & 2 deletions src/plugins/home/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import { PLUGIN_ID, HOME_APP_BASE_PATH, IMPORT_SAMPLE_DATA_APP_ID } from '../com
import { DataSourcePluginStart } from '../../data_source/public';
import { workWithDataSection } from './application/components/homepage/sections/work_with_data';
import { learnBasicsSection } from './application/components/homepage/sections/learn_basics';
import { DEFAULT_NAV_GROUPS } from '../../../core/public';
import { DEFAULT_NAV_GROUPS, DEFAULT_APP_CATEGORIES } from '../../../core/public';
import {
ContentManagementPluginSetup,
ContentManagementPluginStart,
Expand Down Expand Up @@ -179,7 +179,9 @@ export class HomePublicPlugin
title: i18n.translate('home.tutorialDirectory.featureCatalogueTitle', {
defaultMessage: 'Add sample data',
}),
navLinkStatus: AppNavLinkStatus.hidden,
navLinkStatus: core.chrome.navGroup.getNavGroupEnabled()
? AppNavLinkStatus.visible
: AppNavLinkStatus.hidden,
mount: async (params: AppMountParameters) => {
const [coreStart] = await core.getStartServices();
setCommonService();
Expand All @@ -194,6 +196,26 @@ export class HomePublicPlugin
});
urlForwarding.forwardApp('home', 'home');

const configurationInfoForImportSampleData = {
id: IMPORT_SAMPLE_DATA_APP_ID,
title: i18n.translate('home.nav.sampleData.label', {
defaultMessage: 'Sample data',
}),
order: 400,
category: DEFAULT_APP_CATEGORIES.manage,
};

// Register sample data to all of the use cases in 2.16
[
DEFAULT_NAV_GROUPS.all,
DEFAULT_NAV_GROUPS.analytics,
DEFAULT_NAV_GROUPS['security-analytics'],
DEFAULT_NAV_GROUPS.observability,
DEFAULT_NAV_GROUPS.search,
].forEach((navGroup) =>
core.chrome.navGroup.addNavLinksToGroup(navGroup, [configurationInfoForImportSampleData])
);

const featureCatalogue = { ...this.featuresCatalogueRegistry.setup() };

featureCatalogue.register({
Expand Down

0 comments on commit 137b103

Please sign in to comment.