Commit 34f1611d by Marcus Efraimsson

dashboards: fix keyboard shortcut for expand/collapse rows

parent 609f3c1c
...@@ -213,16 +213,12 @@ export class KeybindingSrv { ...@@ -213,16 +213,12 @@ export class KeybindingSrv {
// collapse all rows // collapse all rows
this.bind('d shift+c', () => { this.bind('d shift+c', () => {
for (let row of dashboard.rows) { dashboard.collapseRows();
row.collapse = true;
}
}); });
// expand all rows // expand all rows
this.bind('d shift+e', () => { this.bind('d shift+e', () => {
for (let row of dashboard.rows) { dashboard.expandRows();
row.collapse = false;
}
}); });
this.bind('d n', e => { this.bind('d n', e => {
......
...@@ -524,6 +524,34 @@ export class DashboardModel { ...@@ -524,6 +524,34 @@ export class DashboardModel {
this.removePanel(row); this.removePanel(row);
} }
expandRows() {
for (let i = 0; i < this.panels.length; i++) {
var panel = this.panels[i];
if (panel.type !== 'row') {
continue;
}
if (panel.collapsed) {
this.toggleRow(panel);
}
}
}
collapseRows() {
for (let i = 0; i < this.panels.length; i++) {
var panel = this.panels[i];
if (panel.type !== 'row') {
continue;
}
if (!panel.collapsed) {
this.toggleRow(panel);
}
}
}
setPanelFocus(id) { setPanelFocus(id) {
this.meta.focusPanelId = id; this.meta.focusPanelId = id;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment