Dynamic dashboards: Detect changes in rows, tabs and autogrid (#103080)

* Detect changes in rows tabs grid

* also add auto grid item

* fix lint issue
pull/103274/head
Oscar Kilhed 9 months ago committed by GitHub
parent 856dcfd6fe
commit 2afeebec28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 43
      public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.ts

@ -15,6 +15,10 @@ import {
} from '@grafana/scenes';
import { createWorker } from 'app/features/dashboard-scene/saving/createDetectChangesWorker';
import { ConditionalRenderingData } from '../conditional-rendering/ConditionalRenderingData';
import { ConditionalRenderingGroup } from '../conditional-rendering/ConditionalRenderingGroup';
import { ConditionalRenderingInterval } from '../conditional-rendering/ConditionalRenderingInterval';
import { ConditionalRenderingVariable } from '../conditional-rendering/ConditionalRenderingVariable';
import { DashboardAnnotationsDataLayer } from '../scene/DashboardAnnotationsDataLayer';
import { DashboardControls } from '../scene/DashboardControls';
import { DashboardScene, PERSISTED_PROPS } from '../scene/DashboardScene';
@ -22,6 +26,12 @@ import { LibraryPanelBehavior } from '../scene/LibraryPanelBehavior';
import { VizPanelLinks } from '../scene/PanelLinks';
import { PanelTimeRange } from '../scene/PanelTimeRange';
import { DashboardGridItem } from '../scene/layout-default/DashboardGridItem';
import { AutoGridItem } from '../scene/layout-responsive-grid/ResponsiveGridItem';
import { AutoGridLayoutManager } from '../scene/layout-responsive-grid/ResponsiveGridLayoutManager';
import { RowItem } from '../scene/layout-rows/RowItem';
import { RowsLayoutManager } from '../scene/layout-rows/RowsLayoutManager';
import { TabItem } from '../scene/layout-tabs/TabItem';
import { TabsLayoutManager } from '../scene/layout-tabs/TabsLayoutManager';
import { isSceneVariableInstance } from '../settings/variables/utils';
import { DashboardChangeInfo } from './shared';
@ -117,6 +127,39 @@ export class DashboardSceneChangeTracker {
if (isSceneVariableInstance(payload.changedObject)) {
return true;
}
if (payload.changedObject instanceof RowsLayoutManager) {
return true;
}
if (payload.changedObject instanceof RowItem) {
return true;
}
if (payload.changedObject instanceof TabsLayoutManager) {
return true;
}
if (payload.changedObject instanceof TabItem) {
return true;
}
if (payload.changedObject instanceof AutoGridLayoutManager) {
return true;
}
if (payload.changedObject instanceof AutoGridItem) {
return true;
}
if (payload.changedObject instanceof ConditionalRenderingVariable) {
return true;
}
if (payload.changedObject instanceof ConditionalRenderingInterval) {
return true;
}
if (payload.changedObject instanceof ConditionalRenderingGroup) {
return true;
}
if (payload.changedObject instanceof ConditionalRenderingData) {
return true;
}
return false;
}

Loading…
Cancel
Save