From 1c14c85b9768c8b2b9dde44cef1f48db82090982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 30 Sep 2024 12:19:24 +0200 Subject: [PATCH] Dashboards: Fixes view & edit keyboard shortcuts when grafana is behind a subpath (#93955) DashboardScene: Fixes view & edit keyboard shortcuts when grafana is behind a subpath --- .../features/dashboard-scene/scene/keyboardShortcuts.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts index 10fc2feac74..e9399c8feb4 100644 --- a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts +++ b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts @@ -1,4 +1,4 @@ -import { SetPanelAttentionEvent } from '@grafana/data'; +import { locationUtil, SetPanelAttentionEvent } from '@grafana/data'; import { config, locationService } from '@grafana/runtime'; import { sceneGraph, VizPanel } from '@grafana/scenes'; import appEvents from 'app/core/app_events'; @@ -43,7 +43,8 @@ export function setupKeyboardShortcuts(scene: DashboardScene) { key: 'v', onTrigger: withFocusedPanel(scene, (vizPanel: VizPanel) => { if (!scene.state.viewPanelScene) { - locationService.push(getViewPanelUrl(vizPanel)); + const url = locationUtil.stripBaseFromUrl(getViewPanelUrl(vizPanel)); + locationService.push(url); } }), }); @@ -173,7 +174,8 @@ export function setupKeyboardShortcuts(scene: DashboardScene) { if (sceneRoot instanceof DashboardScene) { const panelId = getPanelIdForVizPanel(vizPanel); if (!scene.state.editPanel) { - locationService.push(getEditPanelUrl(panelId)); + const url = locationUtil.stripBaseFromUrl(getEditPanelUrl(panelId)); + locationService.push(url); } } }),