diff --git a/public/app/features/dashboard/dashboard_ctrl.ts b/public/app/features/dashboard/dashboard_ctrl.ts index 16b21306a4e..9266794d6e4 100644 --- a/public/app/features/dashboard/dashboard_ctrl.ts +++ b/public/app/features/dashboard/dashboard_ctrl.ts @@ -91,7 +91,7 @@ export class DashboardCtrl implements PanelContainer { ); //Consider navbar and submenu controls, padding and margin - let availableHeight = window.innerHeight - 80; + let availableHeight = window.innerHeight - 40; let availableRows = Math.floor(availableHeight / (GRID_CELL_HEIGHT + GRID_CELL_VMARGIN)); let scaleFactor = maxRows / availableRows; @@ -99,6 +99,8 @@ export class DashboardCtrl implements PanelContainer { panel.gridPos.y = Math.round(panel.gridPos.y / scaleFactor) || 1; panel.gridPos.h = Math.round(panel.gridPos.h / scaleFactor) || 1; }); + this.dashboard.meta.autofitpanels = true; + console.log(this.dashboard); } } diff --git a/public/app/features/dashboard/dashboard_model.ts b/public/app/features/dashboard/dashboard_model.ts index 976e4213920..23a43d80353 100644 --- a/public/app/features/dashboard/dashboard_model.ts +++ b/public/app/features/dashboard/dashboard_model.ts @@ -9,6 +9,7 @@ import sortByKeys from 'app/core/utils/sort_by_keys'; import { PanelModel } from './panel_model'; import { DashboardMigrator } from './dashboard_migration'; +import { tickStep } from '../../core/utils/ticks'; export class DashboardModel { id: any; @@ -591,6 +592,10 @@ export class DashboardModel { updateSubmenuVisibility() { this.meta.submenuEnabled = (() => { + if (this.meta.autofitpanels) { + return false; + } + if (this.links.length > 0) { return true; } diff --git a/public/app/features/dashboard/specs/dashboard_model.jest.ts b/public/app/features/dashboard/specs/dashboard_model.jest.ts index 6ac642cd58e..adbdd37c893 100644 --- a/public/app/features/dashboard/specs/dashboard_model.jest.ts +++ b/public/app/features/dashboard/specs/dashboard_model.jest.ts @@ -305,6 +305,19 @@ describe('DashboardModel', function() { }); }); + describe('updateSubmenuVisibility with autofitpanels enabled', function() { + var model; + + beforeEach(function() { + model = new DashboardModel({}, { autofitpanels: true }); + model.updateSubmenuVisibility(); + }); + + it('should not enable submmenu', function() { + expect(model.meta.submenuEnabled).toBe(false); + }); + }); + describe('updateSubmenuVisibility with hidden annotation toggle', function() { var dashboard;