mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelOverrides: Only filter out override properties that do not exist (#87904)
This commit is contained in:
parent
8e5ce99f72
commit
fe991a9a7b
@ -317,7 +317,7 @@ describe('getPanelOptionsWithDefaults', () => {
|
||||
`);
|
||||
});
|
||||
|
||||
it('should remove custom overrides that no longer exist', () => {
|
||||
it('should remove custom override properties that no longer exist', () => {
|
||||
const result = runScenario({
|
||||
defaults: {},
|
||||
overrides: [
|
||||
@ -342,8 +342,8 @@ describe('getPanelOptionsWithDefaults', () => {
|
||||
],
|
||||
});
|
||||
|
||||
expect(result.fieldConfig.overrides.length).toBe(1);
|
||||
expect(result.fieldConfig.overrides[0].properties[0].id).toBe('custom.customProp');
|
||||
expect(result.fieldConfig.overrides.length).toBe(2);
|
||||
expect(result.fieldConfig.overrides[0].properties.length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -99,16 +99,14 @@ export function filterFieldConfigOverrides(
|
||||
overrides: ConfigOverrideRule[],
|
||||
condition: (value: DynamicConfigValue) => boolean
|
||||
): ConfigOverrideRule[] {
|
||||
return overrides
|
||||
.map((x) => {
|
||||
const properties = x.properties.filter(condition);
|
||||
return overrides.map((x) => {
|
||||
const properties = x.properties.filter(condition);
|
||||
|
||||
return {
|
||||
...x,
|
||||
properties,
|
||||
};
|
||||
})
|
||||
.filter((x) => x.properties.length > 0);
|
||||
return {
|
||||
...x,
|
||||
properties,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function cleanProperties(obj: object, parentPath: string, fieldConfigRegistry: FieldConfigOptionsRegistry) {
|
||||
|
Loading…
Reference in New Issue
Block a user