mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
initial work to add shortcut to toggle legend - generic
This commit is contained in:
@@ -34,6 +34,7 @@ export class HelpCtrl {
|
|||||||
{ keys: ['p', 's'], description: 'Open Panel Share Modal' },
|
{ keys: ['p', 's'], description: 'Open Panel Share Modal' },
|
||||||
{ keys: ['p', 'd'], description: 'Duplicate Panel' },
|
{ keys: ['p', 'd'], description: 'Duplicate Panel' },
|
||||||
{ keys: ['p', 'r'], description: 'Remove Panel' },
|
{ keys: ['p', 'r'], description: 'Remove Panel' },
|
||||||
|
{ keys: ['p', 'l'], description: 'Toggle panel legend' },
|
||||||
],
|
],
|
||||||
'Time Range': [
|
'Time Range': [
|
||||||
{ keys: ['t', 'z'], description: 'Zoom out time range' },
|
{ keys: ['t', 'z'], description: 'Zoom out time range' },
|
||||||
|
|||||||
@@ -242,6 +242,18 @@ export class KeybindingSrv {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// toggle panel legend
|
||||||
|
this.bind('p l', () => {
|
||||||
|
if (dashboard.meta.focusPanelId) {
|
||||||
|
const panelInfo = dashboard.getPanelInfoById(dashboard.meta.focusPanelId);
|
||||||
|
if (panelInfo.panel.legend) {
|
||||||
|
const panelRef = dashboard.getPanelById(dashboard.meta.focusPanelId);
|
||||||
|
panelRef.legend.show = !panelRef.legend.show;
|
||||||
|
panelRef.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// collapse all rows
|
// collapse all rows
|
||||||
this.bind('d shift+c', () => {
|
this.bind('d shift+c', () => {
|
||||||
dashboard.collapseRows();
|
dashboard.collapseRows();
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class GraphCtrl extends MetricsPanelCtrl {
|
|||||||
|
|
||||||
onInitPanelActions(actions) {
|
onInitPanelActions(actions) {
|
||||||
actions.push({ text: 'Export CSV', click: 'ctrl.exportCsv()' });
|
actions.push({ text: 'Export CSV', click: 'ctrl.exportCsv()' });
|
||||||
actions.push({ text: 'Toggle legend', click: 'ctrl.toggleLegend()' });
|
actions.push({ text: 'Toggle legend', click: 'ctrl.toggleLegend()', shortcut: 'p l' });
|
||||||
}
|
}
|
||||||
|
|
||||||
issueQueries(datasource) {
|
issueQueries(datasource) {
|
||||||
|
|||||||
Reference in New Issue
Block a user