Skip to content

Commit

Permalink
[Workspace] fix breadcrumbs for workspace (#8303) (#8384)
Browse files Browse the repository at this point in the history
* 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 9369f37)

Signed-off-by: Hailong Cui <[email protected]>
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>
  • Loading branch information
3 people authored Sep 30, 2024
1 parent 3b9a448 commit 53112de
Show file tree
Hide file tree
Showing 19 changed files with 227 additions and 490 deletions.
2 changes: 1 addition & 1 deletion .lycheeignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
2 changes: 2 additions & 0 deletions changelogs/fragments/8303.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [Workspace] prepend workspace name and icon to breadcrumbs ([#8303](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8303))
4 changes: 2 additions & 2 deletions src/core/public/chrome/nav_group/nav_group_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 1 addition & 8 deletions src/core/public/chrome/nav_group/nav_group_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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() {
Expand Down
206 changes: 8 additions & 198 deletions src/core/public/chrome/ui/header/__snapshots__/header.test.tsx.snap

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

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

9 changes: 4 additions & 5 deletions src/core/public/chrome/ui/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export function Header({
const [isNavOpen, setIsNavOpen] = useState(false);
const sidecarConfig = useObservable(observables.sidecarConfig$, undefined);
const breadcrumbs = useObservable(observables.breadcrumbs$, []);
const currentWorkspace = useObservable(observables.currentWorkspace$, undefined);

const sidecarPaddingStyle = useMemo(() => {
return getOsdSidecarPaddingStyle(sidecarConfig);
Expand Down Expand Up @@ -216,14 +215,14 @@ export function Header({
/>
);

const renderBreadcrumbs = (renderFullLength?: boolean, dropHomeFromBreadcrumb?: boolean) => (
const renderBreadcrumbs = (renderFullLength?: boolean, hideTrailingSeparator?: boolean) => (
<HeaderBreadcrumbs
appTitle$={observables.appTitle$}
breadcrumbs$={observables.breadcrumbs$}
breadcrumbsEnricher$={observables.breadcrumbsEnricher$}
useUpdatedHeader={useUpdatedHeader}
renderFullLength={renderFullLength}
dropHomeFromBreadcrumb={dropHomeFromBreadcrumb}
hideTrailingSeparator={hideTrailingSeparator}
/>
);

Expand Down Expand Up @@ -494,7 +493,7 @@ export function Header({
recentlyAccessed$={observables.recentlyAccessed$}
workspaceList$={observables.workspaceList$}
navigateToUrl={application.navigateToUrl}
renderBreadcrumbs={renderBreadcrumbs(true, false)}
renderBreadcrumbs={renderBreadcrumbs(true, true)}
buttonSize={useApplicationHeader ? 's' : 'xs'}
/>
</EuiHeaderSectionItem>
Expand Down Expand Up @@ -548,7 +547,7 @@ export function Header({

<EuiHeaderSection grow={false}>{renderRecentItems()}</EuiHeaderSection>

{renderBreadcrumbs(false, !!currentWorkspace)}
{renderBreadcrumbs(false, false)}
</EuiHeader>

{/* Secondary header */}
Expand Down
Loading

0 comments on commit 53112de

Please sign in to comment.