Schema v2: Persist only relevant field config when transforming to save model (#104197)

pull/103855/head
Dominik Prokop 3 months ago committed by GitHub
parent d6dbc0a421
commit 98e737cb5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      public/app/features/dashboard-scene/serialization/transformSceneToSaveModelSchemaV2.test.ts
  2. 7
      public/app/features/dashboard-scene/serialization/transformSceneToSaveModelSchemaV2.ts

@ -232,7 +232,13 @@ describe('transformSceneToSaveModelSchemaV2', () => {
description: 'Test Description',
hoverHeader: true,
hoverHeaderOffset: 10,
fieldConfig: { defaults: {}, overrides: [] },
fieldConfig: {
defaults: {
mappings: [],
max: undefined,
},
overrides: [],
},
displayMode: 'transparent',
pluginVersion: '7.0.0',
$timeRange: new SceneTimeRange({

@ -200,7 +200,12 @@ export function vizPanelToSchemaV2(
min,
max,
color,
}).filter(([_, value]) => value !== undefined)
}).filter(([_, value]) => {
if (Array.isArray(value)) {
return value.length > 0;
}
return value !== undefined;
})
);
const vizFieldConfig: FieldConfigSource = {

Loading…
Cancel
Save