From c6975e06d241e31295ec55327c641d73d483dcf9 Mon Sep 17 00:00:00 2001 From: Oscar Kilhed Date: Tue, 7 May 2024 14:02:52 +0200 Subject: [PATCH] Dashboard scenes: Fix view panel breadcrum when going to edit from view single panel (#87411) Fix view panel breadcrum when going to edit from view panel --- public/app/features/dashboard-scene/scene/DashboardScene.tsx | 3 ++- public/app/features/dashboard-scene/utils/urlBuilders.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard-scene/scene/DashboardScene.tsx b/public/app/features/dashboard-scene/scene/DashboardScene.tsx index 3358f3f696c..c267b3cc5b5 100644 --- a/public/app/features/dashboard-scene/scene/DashboardScene.tsx +++ b/public/app/features/dashboard-scene/scene/DashboardScene.tsx @@ -44,7 +44,7 @@ import { historySrv } from '../settings/version-history'; import { DashboardModelCompatibilityWrapper } from '../utils/DashboardModelCompatibilityWrapper'; import { dashboardSceneGraph, getLibraryVizPanelFromVizPanel } from '../utils/dashboardSceneGraph'; import { djb2Hash } from '../utils/djb2Hash'; -import { getDashboardUrl } from '../utils/urlBuilders'; +import { getDashboardUrl, getViewPanelUrl } from '../utils/urlBuilders'; import { NEW_PANEL_HEIGHT, NEW_PANEL_WIDTH, @@ -418,6 +418,7 @@ export class DashboardScene extends SceneObjectBase { pageNav = { text: 'View panel', parentItem: pageNav, + url: getViewPanelUrl(viewPanelScene.state.panelRef.resolve()), }; } diff --git a/public/app/features/dashboard-scene/utils/urlBuilders.ts b/public/app/features/dashboard-scene/utils/urlBuilders.ts index fc334be29fb..a7b328bab72 100644 --- a/public/app/features/dashboard-scene/utils/urlBuilders.ts +++ b/public/app/features/dashboard-scene/utils/urlBuilders.ts @@ -83,7 +83,10 @@ export function getDashboardUrl(options: DashboardUrlOptions) { } export function getViewPanelUrl(vizPanel: VizPanel) { - return locationUtil.getUrlForPartial(locationService.getLocation(), { viewPanel: vizPanel.state.key }); + return locationUtil.getUrlForPartial(locationService.getLocation(), { + viewPanel: vizPanel.state.key, + editPanel: undefined, + }); } export function getEditPanelUrl(panelId: number) {