mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboard scenes: Remove panel menu options that are dashboard editing activities when not in edit mode. (#84156)
* remove panel menu options that are dasbhoard editing activities when the dashboard is not in edit mode * remove corresponding keybindings when not in edit mode * add keyboard shortcuts but inactivate them when not in edit mode * Add tests; fix tests
This commit is contained in:
@@ -120,7 +120,9 @@ export function setupKeyboardShortcuts(scene: DashboardScene) {
|
||||
keybindings.addBinding({
|
||||
key: 'p r',
|
||||
onTrigger: withFocusedPanel(scene, (vizPanel: VizPanel) => {
|
||||
onRemovePanel(scene, vizPanel);
|
||||
if (scene.state.isEditing) {
|
||||
onRemovePanel(scene, vizPanel);
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
@@ -128,7 +130,9 @@ export function setupKeyboardShortcuts(scene: DashboardScene) {
|
||||
keybindings.addBinding({
|
||||
key: 'p d',
|
||||
onTrigger: withFocusedPanel(scene, (vizPanel: VizPanel) => {
|
||||
scene.duplicatePanel(vizPanel);
|
||||
if (scene.state.isEditing) {
|
||||
scene.duplicatePanel(vizPanel);
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user