StatPanels: Fixes to palette color scheme is not cleared when loading panel (#31126)

This commit is contained in:
Torkel Ödegaard
2021-02-13 11:35:39 +01:00
committed by GitHub
parent 2dacc2c366
commit b3c32277dd
3 changed files with 27 additions and 6 deletions

View File

@@ -313,11 +313,12 @@ export class PanelModel implements DataConfigSource {
this.fieldConfig = restoreCustomOverrideRules(this.fieldConfig, prevOptions.fieldConfig);
}
applyPluginOptionDefaults(plugin: PanelPlugin) {
applyPluginOptionDefaults(plugin: PanelPlugin, isAfterPluginChange: boolean) {
const options = getPanelOptionsWithDefaults({
plugin,
currentOptions: this.options,
currentFieldConfig: this.fieldConfig,
isAfterPluginChange: isAfterPluginChange,
});
this.fieldConfig = options.fieldConfig;
@@ -336,7 +337,7 @@ export class PanelModel implements DataConfigSource {
}
}
this.applyPluginOptionDefaults(plugin);
this.applyPluginOptionDefaults(plugin, false);
this.resendLastResult();
}
@@ -389,7 +390,7 @@ export class PanelModel implements DataConfigSource {
// For some reason I need to rebind replace variables here, otherwise the viz repeater does not work
this.replaceVariables = this.replaceVariables.bind(this);
this.applyPluginOptionDefaults(newPlugin);
this.applyPluginOptionDefaults(newPlugin, true);
if (newPlugin.onPanelMigration) {
this.pluginVersion = getPluginVersion(newPlugin);