diff --git a/.betterer.results b/.betterer.results index 959b2106020..c9fced3fc55 100644 --- a/.betterer.results +++ b/.betterer.results @@ -5055,7 +5055,7 @@ exports[`better eslint`] = { [21, 38, 3, "Unexpected any. Specify a different type.", "193409811"], [21, 59, 3, "Unexpected any. Specify a different type.", "193409811"] ], - "public/app/features/dashboard/dashgrid/DashboardGrid.tsx:3771579139": [ + "public/app/features/dashboard/dashgrid/DashboardGrid.tsx:25656274": [ [79, 22, 3, "Unexpected any. Specify a different type.", "193409811"], [189, 40, 3, "Unexpected any. Specify a different type.", "193409811"], [189, 53, 3, "Unexpected any. Specify a different type.", "193409811"], @@ -5282,7 +5282,7 @@ exports[`better eslint`] = { [1137, 40, 3, "Unexpected any. Specify a different type.", "193409811"], [1137, 48, 3, "Unexpected any. Specify a different type.", "193409811"] ], - "public/app/features/dashboard/state/PanelModel.test.ts:1787146930": [ + "public/app/features/dashboard/state/PanelModel.test.ts:4035235685": [ [29, 11, 92, "Do not use any type assertions.", "2976372744"], [34, 5, 3, "Unexpected any. Specify a different type.", "193409811"], [52, 15, 3, "Unexpected any. Specify a different type.", "193409811"], @@ -5295,12 +5295,12 @@ exports[`better eslint`] = { [373, 28, 3, "Unexpected any. Specify a different type.", "193409811"], [376, 80, 25, "Do not use any type assertions.", "2825799852"], [376, 102, 3, "Unexpected any. Specify a different type.", "193409811"], - [453, 49, 81, "Do not use any type assertions.", "1932069967"], - [454, 32, 15, "Do not use any type assertions.", "1703404951"], - [490, 25, 293, "Do not use any type assertions.", "3989849883"], - [492, 21, 213, "Do not use any type assertions.", "2695721884"] + [459, 49, 81, "Do not use any type assertions.", "1932069967"], + [460, 32, 15, "Do not use any type assertions.", "1703404951"], + [496, 25, 293, "Do not use any type assertions.", "3989849883"], + [498, 21, 213, "Do not use any type assertions.", "2695721884"] ], - "public/app/features/dashboard/state/PanelModel.ts:3953810869": [ + "public/app/features/dashboard/state/PanelModel.ts:2979822970": [ [112, 16, 3, "Unexpected any. Specify a different type.", "193409811"], [131, 10, 3, "Unexpected any. Specify a different type.", "193409811"], [145, 15, 3, "Unexpected any. Specify a different type.", "193409811"], @@ -5319,17 +5319,17 @@ exports[`better eslint`] = { [223, 7, 11, "Do not use any type assertions.", "3816020039"], [223, 15, 3, "Unexpected any. Specify a different type.", "193409811"], [285, 17, 3, "Unexpected any. Specify a different type.", "193409811"], - [367, 21, 11, "Do not use any type assertions.", "3816020039"], - [367, 29, 3, "Unexpected any. Specify a different type.", "193409811"], - [380, 7, 11, "Do not use any type assertions.", "3816020039"], - [380, 15, 3, "Unexpected any. Specify a different type.", "193409811"], - [431, 14, 11, "Do not use any type assertions.", "3816020039"], - [431, 22, 3, "Unexpected any. Specify a different type.", "193409811"], - [451, 16, 3, "Unexpected any. Specify a different type.", "193409811"], - [462, 22, 3, "Unexpected any. Specify a different type.", "193409811"], - [510, 22, 18, "Do not use any type assertions.", "1060162663"], - [593, 38, 3, "Unexpected any. Specify a different type.", "193409811"], - [652, 14, 3, "Unexpected any. Specify a different type.", "193409811"] + [369, 21, 11, "Do not use any type assertions.", "3816020039"], + [369, 29, 3, "Unexpected any. Specify a different type.", "193409811"], + [382, 7, 11, "Do not use any type assertions.", "3816020039"], + [382, 15, 3, "Unexpected any. Specify a different type.", "193409811"], + [433, 14, 11, "Do not use any type assertions.", "3816020039"], + [433, 22, 3, "Unexpected any. Specify a different type.", "193409811"], + [453, 16, 3, "Unexpected any. Specify a different type.", "193409811"], + [464, 22, 3, "Unexpected any. Specify a different type.", "193409811"], + [512, 22, 18, "Do not use any type assertions.", "1060162663"], + [595, 38, 3, "Unexpected any. Specify a different type.", "193409811"], + [654, 14, 3, "Unexpected any. Specify a different type.", "193409811"] ], "public/app/features/dashboard/state/TimeModel.ts:2763994651": [ [3, 8, 3, "Unexpected any. Specify a different type.", "193409811"], diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx index 7c0cdf48a22..2f273302107 100644 --- a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx @@ -100,7 +100,7 @@ export class DashboardGridUnconnected extends PureComponent { onLayoutChange = (newLayout: ReactGridLayout.Layout[]) => { for (const newPos of newLayout) { - this.panelMap[newPos.i!].updateGridPos(newPos); + this.panelMap[newPos.i!].updateGridPos(newPos, this.state.isLayoutInitialized); } this.props.dashboard.sortPanelsByGridPos(); diff --git a/public/app/features/dashboard/state/PanelModel.test.ts b/public/app/features/dashboard/state/PanelModel.test.ts index c58f9dc8f5d..f867d85d9f3 100644 --- a/public/app/features/dashboard/state/PanelModel.test.ts +++ b/public/app/features/dashboard/state/PanelModel.test.ts @@ -436,17 +436,23 @@ describe('PanelModel', () => { }); describe('updateGridPos', () => { - it('Should not cause configRev if no change', () => { + it('Should not have changes if no change', () => { model.gridPos = { w: 1, h: 1, x: 1, y: 2 }; model.updateGridPos({ w: 1, h: 1, x: 1, y: 2 }); expect(model.hasChanged).toBe(false); }); - it('Should not cause configRev if gridPos is different', () => { + it('Should have changes if gridPos is different', () => { model.gridPos = { w: 1, h: 1, x: 1, y: 2 }; model.updateGridPos({ w: 10, h: 1, x: 1, y: 2 }); expect(model.hasChanged).toBe(true); }); + + it('Should not have changes if not manually updated', () => { + model.gridPos = { w: 1, h: 1, x: 1, y: 2 }; + model.updateGridPos({ w: 10, h: 1, x: 1, y: 2 }, false); + expect(model.hasChanged).toBe(false); + }); }); describe('destroy', () => { diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index 52badec1b66..d6208f74f94 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -304,7 +304,7 @@ export class PanelModel implements DataConfigSource, IPanelModel { this.isViewing = isViewing; } - updateGridPos(newPos: GridPos) { + updateGridPos(newPos: GridPos, manuallyUpdated = true) { if ( newPos.x === this.gridPos.x && newPos.y === this.gridPos.y && @@ -318,7 +318,9 @@ export class PanelModel implements DataConfigSource, IPanelModel { this.gridPos.y = newPos.y; this.gridPos.w = newPos.w; this.gridPos.h = newPos.h; - this.configRev++; + if (manuallyUpdated) { + this.configRev++; + } } runAllPanelQueries(