From 627dc45b4ba30253bafedf336bedee950664d362 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 17 Aug 2024 00:19:57 +0000 Subject: [PATCH] Update Recent popover to always render breadcrumbs with full length (#7735) Signed-off-by: Zhongnan Su (cherry picked from commit 389ad1b7ed8a32ea67b12918c56cb3c442fb0e63) Signed-off-by: github-actions[bot] --- .../ui/header/__snapshots__/header.test.tsx.snap | 3 ++- src/core/public/chrome/ui/header/header.tsx | 6 +++--- .../public/chrome/ui/header/header_breadcrumbs.tsx | 4 +++- src/core/public/chrome/ui/header/recent_items.tsx | 14 +++----------- 4 files changed, 11 insertions(+), 16 deletions(-) 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 82aa02fe79a0..32808a758a65 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 @@ -8591,7 +8591,6 @@ exports[`Header renders application header without title and breadcrumbs 1`] = ` } } buttonSize="s" - headerVariant="application" navLinks$={ BehaviorSubject { "_isScalar": false, @@ -8845,6 +8844,7 @@ exports[`Header renders application header without title and breadcrumbs 1`] = ` "thrownError": null, } } + renderFullLength={true} useUpdatedHeader={true} /> } @@ -17327,6 +17327,7 @@ exports[`Header renders page header with application title 1`] = ` "thrownError": null, } } + renderFullLength={true} useUpdatedHeader={true} /> } diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 9bffb2f0c406..da1aa287e029 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -208,12 +208,13 @@ export function Header({ /> ); - const renderBreadcrumbs = () => ( + const renderBreadcrumbs = (renderFullLength?: boolean) => ( ); @@ -354,8 +355,7 @@ export function Header({ navigateToUrl={application.navigateToUrl} navLinks$={observables.navLinks$} basePath={basePath} - headerVariant={headerVariant} - renderBreadcrumbs={renderBreadcrumbs()} + renderBreadcrumbs={renderBreadcrumbs(true)} buttonSize={useApplicationHeader ? 's' : 'xs'} /> diff --git a/src/core/public/chrome/ui/header/header_breadcrumbs.tsx b/src/core/public/chrome/ui/header/header_breadcrumbs.tsx index cac19ae160af..5361db221d10 100644 --- a/src/core/public/chrome/ui/header/header_breadcrumbs.tsx +++ b/src/core/public/chrome/ui/header/header_breadcrumbs.tsx @@ -41,6 +41,7 @@ interface Props { breadcrumbs$: Observable; breadcrumbsEnricher$: Observable; useUpdatedHeader?: boolean; + renderFullLength?: boolean; } export function HeaderBreadcrumbs({ @@ -48,6 +49,7 @@ export function HeaderBreadcrumbs({ breadcrumbs$, breadcrumbsEnricher$, useUpdatedHeader, + renderFullLength, }: Props) { const appTitle = useObservable(appTitle$, 'OpenSearch Dashboards'); const breadcrumbs = useObservable(breadcrumbs$, []); @@ -87,7 +89,7 @@ export function HeaderBreadcrumbs({ return ( Promise; basePath: HttpStart['basePath']; navLinks$: Rx.Observable; - headerVariant?: HeaderVariant; renderBreadcrumbs: React.JSX.Element; buttonSize?: EuiHeaderSectionItemButtonProps['size']; } @@ -41,7 +40,6 @@ export const RecentItems = ({ navigateToUrl, navLinks$, basePath, - headerVariant, renderBreadcrumbs, buttonSize = 's', }: Props) => { @@ -69,8 +67,6 @@ export const RecentItems = ({ setIsPopoverOpen(false); }; - const appendBreadcrumbs = Boolean(headerVariant === HeaderVariant.APPLICATION); - return ( - {appendBreadcrumbs ? ( - <> - {renderBreadcrumbs} - - - ) : null} + {renderBreadcrumbs} +

Recents