From faf22076af857da7c8928bb59b092a30abf43f2e Mon Sep 17 00:00:00 2001 From: Adam Tackett <105462877+TackAdam@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:55:20 -0700 Subject: [PATCH] [Bug] Trace Analytics bugfix for breadcrumbs and id pathing (#2037) * bugfix ids and breadcrumbs Signed-off-by: Adam Tackett * remove comments Signed-off-by: Adam Tackett * quick fix Signed-off-by: Adam Tackett --------- Signed-off-by: Adam Tackett Co-authored-by: Adam Tackett --- .../components/services/service_view.tsx | 6 +++-- .../components/traces/trace_view.tsx | 6 +++-- public/components/trace_analytics/home.tsx | 26 ++++++++++++------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/public/components/trace_analytics/components/services/service_view.tsx b/public/components/trace_analytics/components/services/service_view.tsx index efb0273437..356f17ea1d 100644 --- a/public/components/trace_analytics/components/services/service_view.tsx +++ b/public/components/trace_analytics/components/services/service_view.tsx @@ -104,12 +104,14 @@ export function ServiceView(props: ServiceViewProps) { useEffect(() => { if (page !== 'serviceFlyout') setNavBreadCrumbs( - [props.parentBreadcrumb], [ + props.parentBreadcrumb, { text: 'Trace analytics', - href: '#/', + href: '#/services', }, + ], + [ { text: 'Services', href: '#/services', diff --git a/public/components/trace_analytics/components/traces/trace_view.tsx b/public/components/trace_analytics/components/traces/trace_view.tsx index 8a226e0c4f..bfe75e67a6 100644 --- a/public/components/trace_analytics/components/traces/trace_view.tsx +++ b/public/components/trace_analytics/components/traces/trace_view.tsx @@ -233,12 +233,14 @@ export function TraceView(props: TraceViewProps) { useEffect(() => { setNavBreadCrumbs( - [props.parentBreadcrumb], [ + props.parentBreadcrumb, { text: 'Trace analytics', - href: '#/', + href: '#/services', }, + ], + [ { text: 'Traces', href: '#/traces', diff --git a/public/components/trace_analytics/home.tsx b/public/components/trace_analytics/home.tsx index da691d9cf5..2843c945c5 100644 --- a/public/components/trace_analytics/home.tsx +++ b/public/components/trace_analytics/home.tsx @@ -123,7 +123,7 @@ export const Home = (props: HomeProps) => { let defaultRoute = props.defaultRoute ?? '/services'; const currentHash = window.location.hash.split('#')[1] || ''; - if (currentHash === '/traces' || currentHash === '/services') { + if (currentHash.startsWith('/traces') || currentHash.startsWith('/services')) { defaultRoute = currentHash; } @@ -196,10 +196,14 @@ export const Home = (props: HomeProps) => { }, [mode]); const serviceBreadcrumbs = [ - { - text: 'Trace analytics', - href: '#/services', - }, + ...(!isNavGroupEnabled + ? [ + { + text: 'Trace analytics', + href: '#/services', + }, + ] + : []), { text: 'Services', href: '#/services', @@ -207,10 +211,14 @@ export const Home = (props: HomeProps) => { ]; const traceBreadcrumbs = [ - { - text: 'Trace analytics', - href: '#/services', - }, + ...(!isNavGroupEnabled + ? [ + { + text: 'Trace analytics', + href: '#/services', + }, + ] + : []), { text: 'Traces', href: '#/traces',