mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
prevOptions should be optional
This commit is contained in:
parent
d8595e9f4e
commit
f9fb1210e9
@ -32,7 +32,7 @@ export type PanelMigrationHook<TOptions = any> = (options: Partial<TOptions>) =>
|
|||||||
export type PanelTypeChangedHook<TOptions = any> = (
|
export type PanelTypeChangedHook<TOptions = any> = (
|
||||||
options: Partial<TOptions>,
|
options: Partial<TOptions>,
|
||||||
prevPluginId: string,
|
prevPluginId: string,
|
||||||
prevOptions: any
|
prevOptions?: any
|
||||||
) => Partial<TOptions>;
|
) => Partial<TOptions>;
|
||||||
|
|
||||||
export class ReactPanelPlugin<TOptions = any> {
|
export class ReactPanelPlugin<TOptions = any> {
|
||||||
|
@ -11,13 +11,15 @@ const optionsToKeep = ['valueOptions', 'stat', 'maxValue', 'maxValue', 'threshol
|
|||||||
export const singleStatBaseOptionsCheck = (
|
export const singleStatBaseOptionsCheck = (
|
||||||
options: Partial<SingleStatBaseOptions>,
|
options: Partial<SingleStatBaseOptions>,
|
||||||
prevPluginId: string,
|
prevPluginId: string,
|
||||||
prevOptions: any
|
prevOptions?: any
|
||||||
) => {
|
) => {
|
||||||
optionsToKeep.forEach(v => {
|
if (prevOptions) {
|
||||||
if (prevOptions.hasOwnProperty(v)) {
|
optionsToKeep.forEach(v => {
|
||||||
options[v] = cloneDeep(prevOptions.display);
|
if (prevOptions.hasOwnProperty(v)) {
|
||||||
}
|
options[v] = cloneDeep(prevOptions.display);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
return options;
|
return options;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user