mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Modifying the dashboard grid to not unnecessarily set appStatus.dirty (#9307)
This commit is contained in:
parent
f432698c27
commit
083d564a7c
1 changed files with 17 additions and 15 deletions
|
@ -36,20 +36,6 @@ app.directive('dashboardGrid', function ($compile, Notifier) {
|
|||
function init() {
|
||||
$el.addClass('gridster');
|
||||
|
||||
// See issue https://github.com/elastic/kibana/issues/2138 and the
|
||||
// subsequent fix for why we need to sort here. Short story is that
|
||||
// gridster can fail to render widgets in the correct order, depending
|
||||
// on the specific order of the panels.
|
||||
// See https://github.com/ducksboard/gridster.js/issues/147
|
||||
// for some additional back story.
|
||||
$state.panels.sort((a, b) => {
|
||||
if (a.row === b.row) {
|
||||
return a.col - b.col;
|
||||
} else {
|
||||
return a.row - b.row;
|
||||
}
|
||||
});
|
||||
|
||||
gridster = $el.gridster({
|
||||
max_cols: COLS,
|
||||
min_cols: COLS,
|
||||
|
@ -85,7 +71,23 @@ app.directive('dashboardGrid', function ($compile, Notifier) {
|
|||
const added = _.difference(panels, currentPanels);
|
||||
|
||||
if (removed.length) removed.forEach(removePanel);
|
||||
if (added.length) added.forEach(addPanel);
|
||||
if (added.length) {
|
||||
// See issue https://github.com/elastic/kibana/issues/2138 and the
|
||||
// subsequent fix for why we need to sort here. Short story is that
|
||||
// gridster can fail to render widgets in the correct order, depending
|
||||
// on the specific order of the panels.
|
||||
// See https://github.com/ducksboard/gridster.js/issues/147
|
||||
// for some additional back story.
|
||||
added.sort((a, b) => {
|
||||
if (a.row === b.row) {
|
||||
return a.col - b.col;
|
||||
} else {
|
||||
return a.row - b.row;
|
||||
}
|
||||
});
|
||||
|
||||
added.forEach(addPanel);
|
||||
};
|
||||
|
||||
// ensure that every panel can be serialized now that we are done
|
||||
$state.panels.forEach(makePanelSerializeable);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue