Commit 4b84a585 by Tobias Skarhed Committed by Torkel Ödegaard

Disable submenu when autopanels is enabled

parent 36c406ee
......@@ -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);
}
}
......
......@@ -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;
}
......
......@@ -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;
......
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