From 53112dea71073c5466369e7ac30f723e4aa63371 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:05:59 +0800 Subject: [PATCH] [Workspace] fix breadcrumbs for workspace (#8303) (#8384) * update breadcrumbs * Changeset file for PR #8303 created/updated fix bootstrap error * make the workspace name not repsonsive that will not break into two rows fix bootstrap error * fix failed unit test * link check * set overview page title to include itself use case name in all use case * hideTrailingSeparator for breadcrumbs in recently popover * update breadcrumbs for search overview * update overview page id * Address review comments --------- (cherry picked from commit 9369f373503f1aa1123f33b052dd980688c0ca71) Signed-off-by: Hailong Cui Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> --- .lycheeignore | 2 +- changelogs/fragments/8303.yml | 2 + .../nav_group/nav_group_service.test.ts | 4 +- .../chrome/nav_group/nav_group_service.ts | 9 +- .../header/__snapshots__/header.test.tsx.snap | 206 +----------------- .../header_breadcrumbs.test.tsx.snap | 8 + src/core/public/chrome/ui/header/header.tsx | 9 +- .../ui/header/header_breadcrumbs.test.tsx | 38 +--- .../chrome/ui/header/header_breadcrumbs.tsx | 39 ++-- .../content_management/public/constants.ts | 5 +- .../search_use_case_app.test.tsx | 49 ++--- .../usecase_overview/search_use_case_app.tsx | 23 +- .../components/workspace_detail_app.tsx | 26 +-- .../workspace_name/workspace_name.test.tsx | 33 +++ .../workspace_name/workspace_name.tsx | 32 +++ .../workspace_use_case_overview_app.tsx | 3 +- src/plugins/workspace/public/plugin.ts | 2 +- src/plugins/workspace/public/utils.test.ts | 129 +++-------- src/plugins/workspace/public/utils.ts | 98 +++------ 19 files changed, 227 insertions(+), 490 deletions(-) create mode 100644 changelogs/fragments/8303.yml create mode 100644 src/plugins/workspace/public/components/workspace_name/workspace_name.test.tsx create mode 100644 src/plugins/workspace/public/components/workspace_name/workspace_name.tsx diff --git a/.lycheeignore b/.lycheeignore index 8364fed558ee..82348e6f047c 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -90,4 +90,4 @@ https://www.quandl.com/api/v1/datasets/ https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi http:/adomas.org/javascript-mouse-wheel/ site.com -https://sites.google.com/site/murmurhash +http://sites.google.com/site/murmurhash/ diff --git a/changelogs/fragments/8303.yml b/changelogs/fragments/8303.yml new file mode 100644 index 000000000000..9c644863ee41 --- /dev/null +++ b/changelogs/fragments/8303.yml @@ -0,0 +1,2 @@ +fix: +- [Workspace] prepend workspace name and icon to breadcrumbs ([#8303](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8303)) \ No newline at end of file diff --git a/src/core/public/chrome/nav_group/nav_group_service.test.ts b/src/core/public/chrome/nav_group/nav_group_service.test.ts index 1cda022e7501..d3918bdeec3d 100644 --- a/src/core/public/chrome/nav_group/nav_group_service.test.ts +++ b/src/core/public/chrome/nav_group/nav_group_service.test.ts @@ -599,8 +599,8 @@ describe('ChromeNavGroupService#start()', () => { const breadcrumbs = [{ text: 'test' }]; const enrichedBreadcrumbs = breadcrumbsEnricher$.getValue()?.(breadcrumbs); - // home -> bar-group -> test - expect(enrichedBreadcrumbs).toHaveLength(3); + // bar-group -> test + expect(enrichedBreadcrumbs).toHaveLength(2); // reset current nav group chromeNavGroupServiceStart.setCurrentNavGroup(undefined); diff --git a/src/core/public/chrome/nav_group/nav_group_service.ts b/src/core/public/chrome/nav_group/nav_group_service.ts index 23e7d5ed7940..e3911d219ee0 100644 --- a/src/core/public/chrome/nav_group/nav_group_service.ts +++ b/src/core/public/chrome/nav_group/nav_group_service.ts @@ -12,7 +12,6 @@ import { WorkspacesStart, } from 'opensearch-dashboards/public'; import { map, switchMap, takeUntil } from 'rxjs/operators'; -import { i18n } from '@osd/i18n'; import { IUiSettingsClient } from '../../ui_settings'; import { fulfillRegistrationLinksToChromeNavLinks, @@ -348,13 +347,7 @@ export class ChromeNavGroupService { } }, }; - const homeBreadcrumb: ChromeBreadcrumb = { - text: i18n.translate('core.breadcrumbs.homeTitle', { defaultMessage: 'Home' }), - onClick: () => { - navigateToApp('home'); - }, - }; - return [homeBreadcrumb, navGroupBreadcrumb, ...breadcrumbs]; + return [navGroupBreadcrumb, ...breadcrumbs]; } async stop() { diff --git a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap index a500b1f1ff88..e275e0b3d3a1 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap @@ -916,45 +916,7 @@ exports[`Header handles visibility and lock changes 1`] = ` "closed": false, "hasError": false, "isStopped": false, - "observers": Array [ - Subscriber { - "_parentOrParents": null, - "_subscriptions": Array [ - SubjectSubscription { - "_parentOrParents": [Circular], - "_subscriptions": null, - "closed": false, - "subject": [Circular], - "subscriber": [Circular], - }, - ], - "closed": false, - "destination": SafeSubscriber { - "_complete": undefined, - "_context": [Circular], - "_error": undefined, - "_next": [Function], - "_parentOrParents": null, - "_parentSubscriber": [Circular], - "_subscriptions": null, - "closed": false, - "destination": Object { - "closed": true, - "complete": [Function], - "error": [Function], - "next": [Function], - }, - "isStopped": false, - "syncErrorThrowable": false, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - "isStopped": false, - "syncErrorThrowable": true, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - ], + "observers": Array [], "thrownError": null, } } @@ -9299,45 +9261,7 @@ exports[`Header renders application header without title and breadcrumbs 1`] = ` "closed": false, "hasError": false, "isStopped": false, - "observers": Array [ - Subscriber { - "_parentOrParents": null, - "_subscriptions": Array [ - SubjectSubscription { - "_parentOrParents": [Circular], - "_subscriptions": null, - "closed": false, - "subject": [Circular], - "subscriber": [Circular], - }, - ], - "closed": false, - "destination": SafeSubscriber { - "_complete": undefined, - "_context": [Circular], - "_error": undefined, - "_next": [Function], - "_parentOrParents": null, - "_parentSubscriber": [Circular], - "_subscriptions": null, - "closed": false, - "destination": Object { - "closed": true, - "complete": [Function], - "error": [Function], - "next": [Function], - }, - "isStopped": false, - "syncErrorThrowable": false, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - "isStopped": false, - "syncErrorThrowable": true, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - ], + "observers": Array [], "thrownError": null, } } @@ -10885,7 +10809,7 @@ exports[`Header renders application header without title and breadcrumbs 1`] = ` "thrownError": null, } } - dropHomeFromBreadcrumb={false} + hideTrailingSeparator={true} renderFullLength={true} useUpdatedHeader={true} /> @@ -12119,45 +12043,7 @@ exports[`Header renders condensed header 1`] = ` "closed": false, "hasError": false, "isStopped": false, - "observers": Array [ - Subscriber { - "_parentOrParents": null, - "_subscriptions": Array [ - SubjectSubscription { - "_parentOrParents": [Circular], - "_subscriptions": null, - "closed": false, - "subject": [Circular], - "subscriber": [Circular], - }, - ], - "closed": false, - "destination": SafeSubscriber { - "_complete": undefined, - "_context": [Circular], - "_error": undefined, - "_next": [Function], - "_parentOrParents": null, - "_parentSubscriber": [Circular], - "_subscriptions": null, - "closed": false, - "destination": Object { - "closed": true, - "complete": [Function], - "error": [Function], - "next": [Function], - }, - "isStopped": false, - "syncErrorThrowable": false, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - "isStopped": false, - "syncErrorThrowable": true, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - ], + "observers": Array [], "thrownError": null, } } @@ -18173,45 +18059,7 @@ exports[`Header renders page header with application title 1`] = ` "closed": false, "hasError": false, "isStopped": false, - "observers": Array [ - Subscriber { - "_parentOrParents": null, - "_subscriptions": Array [ - SubjectSubscription { - "_parentOrParents": [Circular], - "_subscriptions": null, - "closed": false, - "subject": [Circular], - "subscriber": [Circular], - }, - ], - "closed": false, - "destination": SafeSubscriber { - "_complete": undefined, - "_context": [Circular], - "_error": undefined, - "_next": [Function], - "_parentOrParents": null, - "_parentSubscriber": [Circular], - "_subscriptions": null, - "closed": false, - "destination": Object { - "closed": true, - "complete": [Function], - "error": [Function], - "next": [Function], - }, - "isStopped": false, - "syncErrorThrowable": false, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - "isStopped": false, - "syncErrorThrowable": true, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - ], + "observers": Array [], "thrownError": null, } } @@ -19871,7 +19719,7 @@ exports[`Header renders page header with application title 1`] = ` "thrownError": null, } } - dropHomeFromBreadcrumb={false} + hideTrailingSeparator={true} renderFullLength={true} useUpdatedHeader={true} /> @@ -20217,7 +20065,7 @@ exports[`Header renders page header with application title 1`] = ` "thrownError": null, } } - dropHomeFromBreadcrumb={false} + hideTrailingSeparator={false} renderFullLength={false} useUpdatedHeader={true} > @@ -21783,45 +21631,7 @@ exports[`Header toggles primary navigation menu when clicked 1`] = ` "closed": false, "hasError": false, "isStopped": false, - "observers": Array [ - Subscriber { - "_parentOrParents": null, - "_subscriptions": Array [ - SubjectSubscription { - "_parentOrParents": [Circular], - "_subscriptions": null, - "closed": false, - "subject": [Circular], - "subscriber": [Circular], - }, - ], - "closed": false, - "destination": SafeSubscriber { - "_complete": undefined, - "_context": [Circular], - "_error": undefined, - "_next": [Function], - "_parentOrParents": null, - "_parentSubscriber": [Circular], - "_subscriptions": null, - "closed": false, - "destination": Object { - "closed": true, - "complete": [Function], - "error": [Function], - "next": [Function], - }, - "isStopped": false, - "syncErrorThrowable": false, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - "isStopped": false, - "syncErrorThrowable": true, - "syncErrorThrown": false, - "syncErrorValue": null, - }, - ], + "observers": Array [], "thrownError": null, } } diff --git a/src/core/public/chrome/ui/header/__snapshots__/header_breadcrumbs.test.tsx.snap b/src/core/public/chrome/ui/header/__snapshots__/header_breadcrumbs.test.tsx.snap index e6ac818d9b6a..76146d50d72c 100644 --- a/src/core/public/chrome/ui/header/__snapshots__/header_breadcrumbs.test.tsx.snap +++ b/src/core/public/chrome/ui/header/__snapshots__/header_breadcrumbs.test.tsx.snap @@ -1,5 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`EuiSimplifiedBreadcrumbs renders updates to the breadcrumbs$ observable 1`] = ` +