From 47aae7f1f2aca5e4f2cd90ac7ed105d5cd186deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 2 Nov 2016 17:03:14 +0100 Subject: [PATCH] ux(dashboard): added more shortcusts to v/edit panel, #6442 --- public/app/core/services/keybindingSrv.ts | 8 ++++++++ public/app/features/dashboard/row/add_panel.ts | 1 + public/app/features/dashboard/row/row_ctrl.ts | 1 + public/app/features/dashboard/viewStateSrv.js | 7 +++++++ 4 files changed, 17 insertions(+) diff --git a/public/app/core/services/keybindingSrv.ts b/public/app/core/services/keybindingSrv.ts index 787e93d0043..cd188719c58 100644 --- a/public/app/core/services/keybindingSrv.ts +++ b/public/app/core/services/keybindingSrv.ts @@ -105,6 +105,14 @@ export class KeybindingSrv { } }); + this.bind('v', () => { + if (dashboard.meta.focusPanelId) { + this.$rootScope.appEvent('panel-change-view', { + fullscreen: true, edit: null, panelId: dashboard.meta.focusPanelId + }); + } + }); + this.bind('d', () => { if (dashboard.meta.focusPanelId && dashboard.meta.canEdit) { var panelInfo = dashboard.getPanelInfoById(dashboard.meta.focusPanelId); diff --git a/public/app/features/dashboard/row/add_panel.ts b/public/app/features/dashboard/row/add_panel.ts index c5790cd7291..b85e33e09c6 100644 --- a/public/app/features/dashboard/row/add_panel.ts +++ b/public/app/features/dashboard/row/add_panel.ts @@ -93,6 +93,7 @@ export class AddPanelCtrl { isNew: true, }; + this.rowCtrl.dropView = 0; this.dashboard.addPanel(panel, this.row); this.$timeout(() => { this.$rootScope.$broadcast('render'); diff --git a/public/app/features/dashboard/row/row_ctrl.ts b/public/app/features/dashboard/row/row_ctrl.ts index 7756140505d..f1169157ccc 100644 --- a/public/app/features/dashboard/row/row_ctrl.ts +++ b/public/app/features/dashboard/row/row_ctrl.ts @@ -70,6 +70,7 @@ export class DashRowCtrl { } } + this.dropView = 0; this.row.panelSpanChanged(); this.$timeout(() => { this.$rootScope.$broadcast('render'); diff --git a/public/app/features/dashboard/viewStateSrv.js b/public/app/features/dashboard/viewStateSrv.js index 6a70de5ad63..466b7389007 100644 --- a/public/app/features/dashboard/viewStateSrv.js +++ b/public/app/features/dashboard/viewStateSrv.js @@ -83,6 +83,13 @@ function (angular, _, $) { }; DashboardViewState.prototype.update = function(state) { + // implement toggle logic + if (this.state.fullscreen && state.fullscreen) { + if (this.state.edit === state.edit) { + state.fullscreen = !state.fullscreen; + } + } + // remember if editStateChanged this.editStateChanged = state.edit !== this.state.edit;