diff --git a/public/app/plugins/panel/radialbar/GaugeMigrations.test.ts b/public/app/plugins/panel/radialbar/GaugeMigrations.test.ts index 55f879f1d80..0d518a1fda3 100644 --- a/public/app/plugins/panel/radialbar/GaugeMigrations.test.ts +++ b/public/app/plugins/panel/radialbar/GaugeMigrations.test.ts @@ -60,6 +60,35 @@ describe('Gauge Panel Migrations', () => { expect(result.sparkline).toBe(true); }); + it('does not overwrite new gauge for current version', () => { + const panel = { + id: 2, + options: { + reduceOptions: { + calcs: ['lastNotNull'], + }, + shape: 'circle', + gradient: 'auto', + sparkline: true, + }, + fieldConfig: { + defaults: { + color: { + mode: FieldColorModeId.Fixed, + fixedColor: 'blue', + }, + }, + overrides: [], + }, + pluginVersion: '12.4.0', + type: 'gauge', + } as Omit; + + const result = gaugePanelMigrationHandler(panel as PanelModel); + expect(result.sparkline).toBe(true); + expect(result.gradient).toBe('auto'); + }); + it('from 6.1.1', () => { const panel = { datasource: '-- Grafana --', diff --git a/public/app/plugins/panel/radialbar/GaugeMigrations.ts b/public/app/plugins/panel/radialbar/GaugeMigrations.ts index b5877ac9bf3..6e58efac5f5 100644 --- a/public/app/plugins/panel/radialbar/GaugeMigrations.ts +++ b/public/app/plugins/panel/radialbar/GaugeMigrations.ts @@ -39,6 +39,11 @@ export function gaugePanelMigrationHandler(panel: PanelModel): Partial< } export function shouldMigrateGauge(panel: PanelModel): boolean { + // Test for new gauge option + if (panel.options?.shape) { + return false; + } + const previousVersion = parseFloat(panel.pluginVersion ?? '8'); return previousVersion < 13; }