diff --git a/changelogs/fragments/8140.yml b/changelogs/fragments/8140.yml new file mode 100644 index 000000000000..10b904e18356 --- /dev/null +++ b/changelogs/fragments/8140.yml @@ -0,0 +1,2 @@ +feat: +- [navigation] Adjust the appearances of the left navigation menu and the landing page ([#8140](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8140)) \ No newline at end of file diff --git a/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav_group_enabled.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav_group_enabled.test.tsx.snap index b3a010659c21..dbe7ac3f0d96 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav_group_enabled.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav_group_enabled.test.tsx.snap @@ -22,6 +22,7 @@ exports[` should render correctly 1`] = `
should render correctly 1`] = ` class="euiSideNav euiSideNav-isOpenMobile" >
should render correctly 1`] = ` title="link-in-all" >
link-in-all
@@ -59,7 +61,7 @@ exports[` should render correctly 1`] = `
should render correctly 1`] = ` title="Observability" > @@ -100,7 +102,8 @@ exports[` should render correctly 1`] = ` title="link-in-observability" >
link-in-observability
@@ -131,7 +134,8 @@ exports[` should render correctly 1`] = ` class="euiTextColor euiTextColor--success" >
See all...
@@ -144,7 +148,7 @@ exports[` should render correctly 1`] = `
should render correctly 1`] = ` title="Essentials" > @@ -185,7 +189,8 @@ exports[` should render correctly 1`] = ` title="link-in-essentials" >
link-in-essentials
@@ -216,7 +221,8 @@ exports[` should render correctly 1`] = ` class="euiTextColor euiTextColor--success" >
See all...
@@ -289,6 +295,7 @@ exports[` should show all use case by default and
should show all use case by default and class="euiSideNav euiSideNav-isOpenMobile" >
should show all use case by default and title="link-in-essentials" >
link-in-essentials
@@ -362,6 +370,7 @@ exports[` should show all use case when current na
should show all use case when current na class="euiSideNav euiSideNav-isOpenMobile" >
should show all use case when current na title="link-in-essentials" >
link-in-essentials
diff --git a/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav_groups.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav_groups.test.tsx.snap index 3d923a49dd80..c428f7f774b8 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav_groups.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/collapsible_nav_groups.test.tsx.snap @@ -9,7 +9,7 @@ exports[` should render correctly 1`] = ` class="euiSideNav euiSideNav-isOpenMobile" >
should render correctly 1`] = ` >
should render correctly 1`] = ` title="category-1" > @@ -118,7 +120,7 @@ exports[` should render correctly 1`] = ` > -
-

- title1 -

-
+
render with complex navLinks 1`] = ` id="generated-idTitle" > -
-

- title2 -

-
+
render with complex navLinks 1`] = ` id="generated-idTitle" > -
-

- title3 -

-
+
render with complex navLinks 1`] = ` id="generated-idTitle" > -
-

- title4 -

-
+
-
-
render with complex navLinks 1`] = ` id="generated-idTitle" > -
-

- title5 -

-
+
-
-
-
render with complex navLinks 1`] = ` class="euiSpacer euiSpacer--m" />
render with complex navLinks 1`] = ` id="generated-idTitle" > -
-

- title1 -

-
+
render with complex navLinks 1`] = ` id="generated-idTitle" > -
-

- title2 -

-
+
render with complex navLinks 1`] = ` id="generated-idTitle" > -
-

- title3 -

-
+
render with complex navLinks 1`] = ` id="generated-idTitle" > -
-

- title4 -

-
+
-
-
render with complex navLinks 1`] = ` id="generated-idTitle" > -
-

- title5 -

-
+
-
-
-
', () => { }); it('render with complex navLinks', () => { - const { container, getAllByTestId } = render( + const { container } = render( ', () => { /> ); expect(container).toMatchSnapshot(); - expect(getAllByTestId('landingPageRow_1').length).toEqual(2); }); it('click item', () => { diff --git a/src/plugins/management/public/components/feature_cards/feature_cards.tsx b/src/plugins/management/public/components/feature_cards/feature_cards.tsx index d308f185d602..4c28ea9036d4 100644 --- a/src/plugins/management/public/components/feature_cards/feature_cards.tsx +++ b/src/plugins/management/public/components/feature_cards/feature_cards.tsx @@ -30,26 +30,20 @@ export const FeatureCards = ({ pageDescription, navigationUI: { HeaderControl }, }: FeatureCardsProps) => { - const itemsPerRow = 4; const groupedCardForDisplay = useMemo(() => { - const grouped: Array<{ category?: AppCategory; navLinks: ChromeNavLink[][] }> = []; + const grouped: Array<{ category?: AppCategory; navLinks: ChromeNavLink[] }> = []; // The navLinks has already been sorted based on link / category's order, // so it is safe to group the links here. navLinks.forEach((link) => { let lastGroup = grouped.length ? grouped[grouped.length - 1] : undefined; if (!lastGroup || lastGroup.category?.id !== link.category?.id) { - lastGroup = { category: link.category, navLinks: [[]] }; + lastGroup = { category: link.category, navLinks: [] }; grouped.push(lastGroup); } - const lastRow = lastGroup.navLinks[lastGroup.navLinks.length - 1]; - if (lastRow.length < itemsPerRow) { - lastRow.push(link); - } else { - lastGroup.navLinks.push([link]); - } + lastGroup.navLinks.push(link); }); return grouped; - }, [itemsPerRow, navLinks]); + }, [navLinks]); if (!navLinks.length) { return null; } @@ -72,30 +66,23 @@ export const FeatureCards = ({ )} - {group.navLinks.map((row, rowIndex) => { - return ( - - {Array.from({ length: itemsPerRow }).map((item, itemIndexInRow) => { - const link = row[itemIndexInRow]; - const content = link ? ( - navigateToApp(link.id)} - titleSize="xs" - /> - ) : null; - return ( - - {content} - - ); - })} - - ); - })} + + {group.navLinks.map((link, index) => { + return ( + + navigateToApp(link.id)} + titleSize="xs" + style={{ maxWidth: 240 }} + /> + + ); + })} +
))}