mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Use and add keybard shortcut
This commit is contained in:
parent
63fa9fdc6d
commit
1618b095c7
@ -15,7 +15,14 @@ export class KeybindingSrv {
|
|||||||
timepickerOpen = false;
|
timepickerOpen = false;
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
constructor(private $rootScope, private $location, private datasourceSrv, private timeSrv, private contextSrv) {
|
constructor(
|
||||||
|
private $rootScope,
|
||||||
|
private $location,
|
||||||
|
private datasourceSrv,
|
||||||
|
private timeSrv,
|
||||||
|
private contextSrv,
|
||||||
|
private $window
|
||||||
|
) {
|
||||||
// clear out all shortcuts on route change
|
// clear out all shortcuts on route change
|
||||||
$rootScope.$on('$routeChangeSuccess', () => {
|
$rootScope.$on('$routeChangeSuccess', () => {
|
||||||
Mousetrap.reset();
|
Mousetrap.reset();
|
||||||
@ -259,6 +266,13 @@ export class KeybindingSrv {
|
|||||||
this.bind('d v', () => {
|
this.bind('d v', () => {
|
||||||
appEvents.emit('toggle-view-mode');
|
appEvents.emit('toggle-view-mode');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Autofit panels
|
||||||
|
this.bind('d a', () => {
|
||||||
|
this.$location.search('autofitpanels', this.$location.search().autofitpanels ? null : true);
|
||||||
|
//Force reload
|
||||||
|
this.$window.location.href = this.$location.absUrl();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ export class DashboardCtrl implements PanelContainer {
|
|||||||
private unsavedChangesSrv,
|
private unsavedChangesSrv,
|
||||||
private dashboardViewStateSrv,
|
private dashboardViewStateSrv,
|
||||||
public playlistSrv,
|
public playlistSrv,
|
||||||
private panelLoader
|
private panelLoader,
|
||||||
|
private $location
|
||||||
) {
|
) {
|
||||||
// temp hack due to way dashboards are loaded
|
// temp hack due to way dashboards are loaded
|
||||||
// can't use controllerAs on route yet
|
// can't use controllerAs on route yet
|
||||||
@ -64,7 +65,7 @@ export class DashboardCtrl implements PanelContainer {
|
|||||||
this.dashboard = dashboard;
|
this.dashboard = dashboard;
|
||||||
this.dashboard.processRepeats();
|
this.dashboard.processRepeats();
|
||||||
|
|
||||||
if (window.location.search.search('autofitpanels') !== -1) {
|
if (this.$location.search().autofitpanels) {
|
||||||
let maxRows = Math.max(
|
let maxRows = Math.max(
|
||||||
...this.dashboard.panels.map(panel => {
|
...this.dashboard.panels.map(panel => {
|
||||||
return panel.gridPos.h + panel.gridPos.y;
|
return panel.gridPos.h + panel.gridPos.y;
|
||||||
|
Loading…
Reference in New Issue
Block a user