From c98bb442fd21706cb235e25a6333619037b338ef Mon Sep 17 00:00:00 2001 From: Victor Marin <36818606+mdvictor@users.noreply.github.com> Date: Tue, 18 Mar 2025 15:46:38 +0200 Subject: [PATCH] [release-11.5.3] Dashboards: Fix missing `v/e/i` keybindings to return back to dashboard (#102365) Dashboards: Fix missing `v/e/i` keybindings to return back to dashboard (#101876) readd keybindings to return from edit/view/inspect modes (cherry picked from commit 3e7626cc96c91af4b168514a778f4fbab5b3281d) --- .../dashboard-scene/scene/keyboardShortcuts.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts index 57e8c73b0b2..c88a12788d9 100644 --- a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts +++ b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts @@ -43,7 +43,13 @@ export function setupKeyboardShortcuts(scene: DashboardScene) { keybindings.addBinding({ key: 'v', onTrigger: withFocusedPanel(scene, (vizPanel: VizPanel) => { - if (!scene.state.viewPanelScene) { + if (scene.state.viewPanelScene) { + locationService.push( + locationUtil.getUrlForPartial(locationService.getLocation(), { + viewPanel: undefined, + }) + ); + } else { const url = locationUtil.stripBaseFromUrl(getViewPanelUrl(vizPanel)); locationService.push(url); } @@ -178,7 +184,13 @@ export function setupKeyboardShortcuts(scene: DashboardScene) { const sceneRoot = vizPanel.getRoot(); if (sceneRoot instanceof DashboardScene) { const panelId = getPanelIdForVizPanel(vizPanel); - if (!scene.state.editPanel) { + if (scene.state.editPanel) { + locationService.push( + locationUtil.getUrlForPartial(locationService.getLocation(), { + editPanel: undefined, + }) + ); + } else { const url = locationUtil.stripBaseFromUrl(getEditPanelUrl(panelId)); locationService.push(url); }