mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Disable submenu when autopanels is enabled
This commit is contained in:
parent
36c406eefb
commit
4b84a58575
@ -91,7 +91,7 @@ export class DashboardCtrl implements PanelContainer {
|
|||||||
);
|
);
|
||||||
|
|
||||||
//Consider navbar and submenu controls, padding and margin
|
//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 availableRows = Math.floor(availableHeight / (GRID_CELL_HEIGHT + GRID_CELL_VMARGIN));
|
||||||
let scaleFactor = maxRows / availableRows;
|
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.y = Math.round(panel.gridPos.y / scaleFactor) || 1;
|
||||||
panel.gridPos.h = Math.round(panel.gridPos.h / 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 { PanelModel } from './panel_model';
|
||||||
import { DashboardMigrator } from './dashboard_migration';
|
import { DashboardMigrator } from './dashboard_migration';
|
||||||
|
import { tickStep } from '../../core/utils/ticks';
|
||||||
|
|
||||||
export class DashboardModel {
|
export class DashboardModel {
|
||||||
id: any;
|
id: any;
|
||||||
@ -591,6 +592,10 @@ export class DashboardModel {
|
|||||||
|
|
||||||
updateSubmenuVisibility() {
|
updateSubmenuVisibility() {
|
||||||
this.meta.submenuEnabled = (() => {
|
this.meta.submenuEnabled = (() => {
|
||||||
|
if (this.meta.autofitpanels) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.links.length > 0) {
|
if (this.links.length > 0) {
|
||||||
return true;
|
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() {
|
describe('updateSubmenuVisibility with hidden annotation toggle', function() {
|
||||||
var dashboard;
|
var dashboard;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user