[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 3e7626cc96)
This commit is contained in:
Victor Marin
2025-03-18 13:46:38 +00:00
committed by GitHub
parent 4c88576d4b
commit c98bb442fd
@@ -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);
}