From 8dd46377067ae7241e0f55dffc760cbb769fbf69 Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:44:57 +0200 Subject: [PATCH] [v11.4.x] Panel inspect: Fix inspect keyboard shortcut when grafana served from subpath (#99373) Panel inspect: Fix inspect keyboard shortcut when grafana served from subpath (#99366) * Panel inspect: Fix inspect keyboard shortcut when grafana served from a subpath * Add e2e test (cherry picked from commit 51b4ac50aab7ce14e7317358fb811d717eb8a143) Co-authored-by: Dominik Prokop --- e2e/dashboards-suite/dashboard-keybindings.spec.ts | 8 ++++++++ .../features/dashboard-scene/scene/keyboardShortcuts.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/e2e/dashboards-suite/dashboard-keybindings.spec.ts b/e2e/dashboards-suite/dashboard-keybindings.spec.ts index a7ab42cf7e8..42070f1ebc4 100644 --- a/e2e/dashboards-suite/dashboard-keybindings.spec.ts +++ b/e2e/dashboards-suite/dashboard-keybindings.spec.ts @@ -21,4 +21,12 @@ describe('Dashboard keybindings', () => { e2e.components.Panels.Panel.title('server = A, pod = Bob').should('be.visible'); e2e.components.Panels.Panel.title('server = B, pod = Bob').should('be.visible'); }); + + it('should open panel inspect', () => { + e2e.flows.openDashboard({ uid: 'edediimbjhdz4b/a-tall-dashboard' }); + e2e.components.Panels.Panel.title('Panel #1').type('i'); + e2e.components.PanelInspector.Json.content().should('be.visible'); + cy.get('body').type('{esc}'); + e2e.components.PanelInspector.Json.content().should('not.exist'); + }); }); diff --git a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts index e9399c8feb4..0e4604f78f1 100644 --- a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts +++ b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts @@ -100,7 +100,7 @@ export function setupKeyboardShortcuts(scene: DashboardScene) { keybindings.addBinding({ key: 'i', onTrigger: withFocusedPanel(scene, async (vizPanel: VizPanel) => { - locationService.push(getInspectUrl(vizPanel)); + locationService.push(locationUtil.stripBaseFromUrl(getInspectUrl(vizPanel))); }), });