Skip to content

Commit

Permalink
[Workspace] fix breadcrumbs for workspace (opensearch-project#8303)
Browse files Browse the repository at this point in the history
* update breadcrumbs

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* Changeset file for PR opensearch-project#8303 created/updated

fix bootstrap error

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* make the workspace name not repsonsive that will not break into two rows

Signed-off-by: Hailong Cui <ihailong@amazon.com>

fix bootstrap error

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* fix failed unit test

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* link check

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* set overview page title to include itself use case name in all use case

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* hideTrailingSeparator for breadcrumbs in recently popover

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* update breadcrumbs for search overview

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* update overview page id

Signed-off-by: Hailong Cui <ihailong@amazon.com>

* Address review comments

Signed-off-by: Hailong Cui <ihailong@amazon.com>

---------

Signed-off-by: Hailong Cui <ihailong@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
  • Loading branch information
1 parent b8b563d commit 9369f37
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 @@ -156,7 +156,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 currentLeftControls = useObservableValue(application.currentLeftControls$);
const navControlsLeft = useObservable(observables.navControlsLeft$);
Expand Down Expand Up @@ -233,14 +232,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 @@ -474,7 +473,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 @@ -528,7 +527,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 9369f37

Please sign in to comment.