Skip to content

Commit

Permalink
[navigation]feat: replace analytics nav group with essentials (#7618)
Browse files Browse the repository at this point in the history
* feat: use essentials
* feat: fix home
* feat: change all use case name
* feat: use uppercase
* feat: reserve analytics id
* feat: update title

---------

Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
1 parent e947ade commit 7bcb949
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 78 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/7618.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Use essentials as the nav group name ([#7618](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7618))

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ describe('<CollapsibleNavGroupEnabled />', () => {
href: '',
},
{
id: 'link-in-analytics',
title: 'link-in-analytics',
id: 'link-in-essentials',
title: 'link-in-essentials',
baseUrl: '',
href: '',
},
Expand Down Expand Up @@ -180,12 +180,12 @@ describe('<CollapsibleNavGroupEnabled />', () => {
const props = mockProps({
isNavOpen: true,
navGroupsMap: {
[DEFAULT_NAV_GROUPS.analytics.id]: {
...DEFAULT_NAV_GROUPS.analytics,
[DEFAULT_NAV_GROUPS.essentials.id]: {
...DEFAULT_NAV_GROUPS.essentials,
navLinks: [
{
id: 'link-in-analytics',
title: 'link-in-analytics',
id: 'link-in-essentials',
title: 'link-in-essentials',
showInAllNavGroup: true,
},
],
Expand All @@ -209,12 +209,12 @@ describe('<CollapsibleNavGroupEnabled />', () => {
it('should show all use case by default and able to click see all', async () => {
const props = mockProps({
navGroupsMap: {
[DEFAULT_NAV_GROUPS.analytics.id]: {
...DEFAULT_NAV_GROUPS.analytics,
[DEFAULT_NAV_GROUPS.essentials.id]: {
...DEFAULT_NAV_GROUPS.essentials,
navLinks: [
{
id: 'link-in-analytics',
title: 'link-in-analytics',
id: 'link-in-essentials',
title: 'link-in-essentials',
showInAllNavGroup: true,
},
],
Expand All @@ -224,23 +224,23 @@ describe('<CollapsibleNavGroupEnabled />', () => {
const { container, getAllByTestId, getByTestId } = render(
<CollapsibleNavGroupEnabled {...props} isNavOpen />
);
fireEvent.click(getAllByTestId('collapsibleNavAppLink-link-in-analytics')[1]);
expect(getAllByTestId('collapsibleNavAppLink-link-in-analytics').length).toEqual(1);
fireEvent.click(getAllByTestId('collapsibleNavAppLink-link-in-essentials')[1]);
expect(getAllByTestId('collapsibleNavAppLink-link-in-essentials').length).toEqual(1);
expect(container).toMatchSnapshot();
fireEvent.click(getByTestId('back'));
expect(getAllByTestId('collapsibleNavAppLink-link-in-analytics').length).toEqual(2);
expect(getAllByTestId('collapsibleNavAppLink-link-in-essentials').length).toEqual(2);
});

it('should show all use case when current nav group is `all`', async () => {
const props = mockProps({
currentNavGroupId: ALL_USE_CASE_ID,
navGroupsMap: {
[DEFAULT_NAV_GROUPS.analytics.id]: {
...DEFAULT_NAV_GROUPS.analytics,
[DEFAULT_NAV_GROUPS.essentials.id]: {
...DEFAULT_NAV_GROUPS.essentials,
navLinks: [
{
id: 'link-in-analytics',
title: 'link-in-analytics',
id: 'link-in-essentials',
title: 'link-in-essentials',
showInAllNavGroup: true,
},
],
Expand All @@ -250,40 +250,40 @@ describe('<CollapsibleNavGroupEnabled />', () => {
const { container, getAllByTestId, getByTestId } = render(
<CollapsibleNavGroupEnabled {...props} isNavOpen />
);
fireEvent.click(getAllByTestId('collapsibleNavAppLink-link-in-analytics')[1]);
expect(getAllByTestId('collapsibleNavAppLink-link-in-analytics').length).toEqual(1);
fireEvent.click(getAllByTestId('collapsibleNavAppLink-link-in-essentials')[1]);
expect(getAllByTestId('collapsibleNavAppLink-link-in-essentials').length).toEqual(1);
expect(container).toMatchSnapshot();
fireEvent.click(getByTestId('back'));
expect(getAllByTestId('collapsibleNavAppLink-link-in-analytics').length).toEqual(2);
expect(getAllByTestId('collapsibleNavAppLink-link-in-essentials').length).toEqual(2);
});

it('should not show group if the nav link is hidden', async () => {
const props = mockProps({
currentNavGroupId: ALL_USE_CASE_ID,
navGroupsMap: {
[DEFAULT_NAV_GROUPS.analytics.id]: {
...DEFAULT_NAV_GROUPS.analytics,
[DEFAULT_NAV_GROUPS.essentials.id]: {
...DEFAULT_NAV_GROUPS.essentials,
navLinks: [
{
id: 'link-in-analytics-but-hidden',
title: 'link-in-analytics-but-hidden',
id: 'link-in-essentials-but-hidden',
title: 'link-in-essentials-but-hidden',
showInAllNavGroup: true,
},
],
},
},
navLinks: [
{
id: 'link-in-analytics-but-hidden',
id: 'link-in-essentials-but-hidden',
hidden: true,
title: 'link-in-analytics-but-hidden',
title: 'link-in-essentials-but-hidden',
baseUrl: '',
href: '',
},
],
});
const { queryAllByTestId } = render(<CollapsibleNavGroupEnabled {...props} isNavOpen />);
expect(queryAllByTestId('collapsibleNavAppLink-link-in-analytics-but-hidden').length).toEqual(
expect(queryAllByTestId('collapsibleNavAppLink-link-in-essentials-but-hidden').length).toEqual(
0
);
expect(queryAllByTestId('collapsibleNavAppLink-link-in-all').length).toEqual(1);
Expand Down
18 changes: 9 additions & 9 deletions src/core/utils/default_nav_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const defaultNavGroups = {
dataAdministration: {
id: 'dataAdministration',
title: i18n.translate('core.ui.group.dataAdministration.title', {
defaultMessage: 'data administration',
defaultMessage: 'Data administration',
}),
description: i18n.translate('core.ui.group.dataAdministration.description', {
defaultMessage: 'Apply policies or security on your data.',
Expand All @@ -23,7 +23,7 @@ const defaultNavGroups = {
settingsAndSetup: {
id: 'settingsAndSetup',
title: i18n.translate('core.ui.group.settingsAndSetup.title', {
defaultMessage: 'settings and setup',
defaultMessage: 'Settings and setup',
}),
description: i18n.translate('core.ui.group.settingsAndSetup.description', {
defaultMessage: 'Set up your cluster with index patterns.',
Expand All @@ -34,7 +34,7 @@ const defaultNavGroups = {
all: {
id: ALL_USE_CASE_ID,
title: i18n.translate('core.ui.group.all.title', {
defaultMessage: 'All use case',
defaultMessage: 'Analytics (All)',
}),
description: i18n.translate('core.ui.group.all.description', {
defaultMessage: 'This is a use case contains all the features.',
Expand Down Expand Up @@ -64,16 +64,16 @@ const defaultNavGroups = {
}),
order: 5000,
},
analytics: {
essentials: {
id: 'analytics',
title: i18n.translate('core.ui.group.analytics.title', {
defaultMessage: 'Analytics',
title: i18n.translate('core.ui.group.essential.title', {
defaultMessage: 'Essentials',
}),
description: i18n.translate('core.ui.group.analytics.description', {
description: i18n.translate('core.ui.group.essential.description', {
defaultMessage:
'Analyze data to derive insights, identify patterns and trends, and make data-driven decisions.',
}),
order: 6000,
order: 7000,
},
search: {
id: 'search',
Expand All @@ -84,7 +84,7 @@ const defaultNavGroups = {
defaultMessage:
"Quickly find and explore relevant information across your organization's data sources.",
}),
order: 7000,
order: 6000,
},
} as const;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export class DashboardPlugin
category: undefined,
},
]);
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.essentials, [
{
id: app.id,
order: 300,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data_source_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class DataSourceManagementPlugin
},
]);

core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.essentials, [
{
id: DSM_APP_ID_FOR_STANDARD_APPLICATION,
category: DEFAULT_APP_CATEGORIES.manage,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/discover/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export class DiscoverPlugin
},
]);

core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.essentials, [
{
id: PLUGIN_ID,
category: undefined,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/home/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class HomePublicPlugin
// Register sample data to all of the use cases in 2.16
[
DEFAULT_NAV_GROUPS.all,
DEFAULT_NAV_GROUPS.analytics,
DEFAULT_NAV_GROUPS.essentials,
DEFAULT_NAV_GROUPS['security-analytics'],
DEFAULT_NAV_GROUPS.observability,
DEFAULT_NAV_GROUPS.search,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/index_pattern_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class IndexPatternManagementPlugin
},
});

core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.essentials, [
{
id: IPM_APP_ID,
category: DEFAULT_APP_CATEGORIES.manage,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/saved_objects_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class SavedObjectsManagementPlugin
},
]);

core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.essentials, [
{
id: 'objects',
category: DEFAULT_APP_CATEGORIES.manage,
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/visualize/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,21 @@ export class VisualizePlugin
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.observability, [
{
id: visualizeAppId,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
category: DEFAULT_APP_CATEGORIES.visualizeAndReport,
order: 200,
},
]);
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS['security-analytics'], [
{
id: visualizeAppId,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
category: DEFAULT_APP_CATEGORIES.visualizeAndReport,
order: 200,
},
]);
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.analytics, [
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.essentials, [
{
id: visualizeAppId,
category: DEFAULT_APP_CATEGORIES.dashboardAndReport,
category: DEFAULT_APP_CATEGORIES.visualizeAndReport,
order: 200,
},
]);
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/workspace/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ export const WORKSPACE_USE_CASES = Object.freeze({
'management',
] as string[],
},
analytics: {
essentials: {
id: 'analytics',
title: i18n.translate('workspace.usecase.analytics.title', {
defaultMessage: 'Analytics',
title: i18n.translate('workspace.usecase.essentials.title', {
defaultMessage: 'Essentials',
}),
description: i18n.translate('workspace.usecase.analytics.description', {
description: i18n.translate('workspace.usecase.essentials.description', {
defaultMessage:
'Analyze data to derive insights, identify patterns and trends, and make data-driven decisions.',
}),
Expand Down
Loading

0 comments on commit 7bcb949

Please sign in to comment.