Deprecation: Create explicit feature toggle to auto-migrate from graph panel (#79369)

This commit is contained in:
Nathan Marrs
2024-02-08 15:00:48 -07:00
committed by GitHub
parent ce57166c9a
commit 829672759c
9 changed files with 100 additions and 6 deletions

View File

@@ -44,7 +44,7 @@ import { getTimeSrv } from '../services/TimeSrv';
import { mergePanels, PanelMergeInfo } from '../utils/panelMerge';
import { DashboardMigrator } from './DashboardMigrator';
import { PanelModel, autoMigrateAngular } from './PanelModel';
import { PanelModel, autoMigrateAngular, explicitlyControlledMigrationPanels } from './PanelModel';
import { TimeModel } from './TimeModel';
import { deleteScopeVars, isOnTheSameGridRow } from './utils';
@@ -173,6 +173,12 @@ export class DashboardModel implements TimeModel {
if (options?.autoMigrateOldPanels || !config.angularSupportEnabled || config.featureToggles.autoMigrateOldPanels) {
for (const p of this.panelIterator()) {
const newType = autoMigrateAngular[p.type];
// Skip explicitly controlled panels
if (explicitlyControlledMigrationPanels.includes(p.type)) {
continue;
}
if (!p.autoMigrateFrom && newType) {
p.autoMigrateFrom = p.type;
p.type = newType;
@@ -180,6 +186,21 @@ export class DashboardModel implements TimeModel {
}
}
// Explicit handling of graph -> time series migration (and eventually others)
if (
options?.autoMigrateOldPanels ||
!config.angularSupportEnabled ||
config.featureToggles.autoMigrateOldPanels ||
config.featureToggles.autoMigrateGraphPanel
) {
for (const p of this.panelIterator()) {
if (!p.autoMigrateFrom && p.type === 'graph') {
p.autoMigrateFrom = p.type;
p.type = 'timeseries';
}
}
}
this.addBuiltInAnnotationQuery();
this.sortPanelsByGridPos();
this.panelsAffectedByVariableChange = null;