mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Exit to dashboard when deleting panel from panel view / edit view (#29032)
* Dashboards: Exit to dashboard when deleting panel from panel view / edit view Closes #11941 * Remove ability to delete panel when viewing/editing
This commit is contained in:
parent
717827725f
commit
a246a26a2f
@ -272,7 +272,7 @@ export class KeybindingSrv {
|
||||
this.bind('p r', () => {
|
||||
const panelId = dashboard.meta.focusPanelId;
|
||||
|
||||
if (panelId && dashboard.canEditPanelById(panelId)) {
|
||||
if (panelId && dashboard.canEditPanelById(panelId) && !(dashboard.panelInView || dashboard.panelInEdit)) {
|
||||
appEvents.emit(CoreEvents.removePanel, panelId);
|
||||
dashboard.meta.focusPanelId = 0;
|
||||
}
|
||||
|
@ -151,16 +151,6 @@ describe('getPanelMenu', () => {
|
||||
"text": "More...",
|
||||
"type": "submenu",
|
||||
},
|
||||
Object {
|
||||
"text": "",
|
||||
"type": "divider",
|
||||
},
|
||||
Object {
|
||||
"iconClassName": "trash-alt",
|
||||
"onClick": [Function],
|
||||
"shortcut": "p r",
|
||||
"text": "Remove",
|
||||
},
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
@ -197,7 +197,7 @@ export function getPanelMenu(
|
||||
});
|
||||
}
|
||||
|
||||
if (dashboard.canEditPanel(panel) && !panel.isEditing) {
|
||||
if (dashboard.canEditPanel(panel) && !panel.isEditing && !panel.isViewing) {
|
||||
menu.push({ type: 'divider', text: '' });
|
||||
|
||||
menu.push({
|
||||
|
@ -39,6 +39,7 @@ export const removePanel = (dashboard: DashboardModel, panel: PanelModel, ask: b
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
dashboard.removePanel(panel);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user