Commit 36c406ee by Tobias Skarhed Committed by Torkel Ödegaard

Extract to own method

parent 1618b095
...@@ -65,6 +65,24 @@ export class DashboardCtrl implements PanelContainer { ...@@ -65,6 +65,24 @@ export class DashboardCtrl implements PanelContainer {
this.dashboard = dashboard; this.dashboard = dashboard;
this.dashboard.processRepeats(); this.dashboard.processRepeats();
this.autofitPanels();
this.unsavedChangesSrv.init(dashboard, this.$scope);
// TODO refactor ViewStateSrv
this.$scope.dashboard = dashboard;
this.dashboardViewState = this.dashboardViewStateSrv.create(this.$scope);
this.keybindingSrv.setupDashboardBindings(this.$scope, dashboard);
this.dashboard.updateSubmenuVisibility();
this.setWindowTitleAndTheme();
this.$scope.appEvent('dashboard-initialized', dashboard);
})
.catch(this.onInitFailed.bind(this, 'Dashboard init failed', true));
}
autofitPanels() {
if (this.$location.search().autofitpanels) { if (this.$location.search().autofitpanels) {
let maxRows = Math.max( let maxRows = Math.max(
...this.dashboard.panels.map(panel => { ...this.dashboard.panels.map(panel => {
...@@ -82,21 +100,6 @@ export class DashboardCtrl implements PanelContainer { ...@@ -82,21 +100,6 @@ export class DashboardCtrl implements PanelContainer {
panel.gridPos.h = Math.round(panel.gridPos.h / scaleFactor) || 1; panel.gridPos.h = Math.round(panel.gridPos.h / scaleFactor) || 1;
}); });
} }
this.unsavedChangesSrv.init(dashboard, this.$scope);
// TODO refactor ViewStateSrv
this.$scope.dashboard = dashboard;
this.dashboardViewState = this.dashboardViewStateSrv.create(this.$scope);
this.keybindingSrv.setupDashboardBindings(this.$scope, dashboard);
this.dashboard.updateSubmenuVisibility();
this.setWindowTitleAndTheme();
this.$scope.appEvent('dashboard-initialized', dashboard);
})
.catch(this.onInitFailed.bind(this, 'Dashboard init failed', true));
} }
onInitFailed(msg, fatal, err) { onInitFailed(msg, fatal, err) {
......
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