Dashboards: Add workaround for react-grid-layout rearrange bug (#57832) (#57836)

(cherry picked from commit e4d1d8d70c)

Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2022-10-29 23:46:46 +01:00
committed by GitHub
co-authored by kay delaney
parent 82430165ee
commit 2bfc106473
@@ -297,9 +297,17 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
return;
}
// Move all panels down by the height of the "add panel" widget.
// This is to work around an issue with react-grid-layout that can mess up the layout
// in certain configurations. (See https://github.com/react-grid-layout/react-grid-layout/issues/1787)
const addPanelWidgetHeight = 8;
for (const panel of dashboard.panelIterator()) {
panel.gridPos.y += addPanelWidgetHeight;
}
dashboard.addPanel({
type: 'add-panel',
gridPos: { x: 0, y: 0, w: 12, h: 8 },
gridPos: { x: 0, y: 0, w: 12, h: addPanelWidgetHeight },
title: 'Panel Title',
});