Timeseries Panel: Retain alerts when migrating from old graph (#36514)

Closes #36106
This commit is contained in:
kay delaney 2021-07-08 09:47:32 +01:00 committed by GitHub
parent 7df0010412
commit 8d66db09bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View File

@ -124,6 +124,7 @@ export interface PanelEditorProps<T = any> {
export interface PanelModel<TOptions = any> {
/** ID of the panel within the current dashboard */
id: number;
alert?: any;
/** Panel options */
options: TOptions;
/** Field options configuration */

View File

@ -2,6 +2,7 @@
exports[`Graph Migrations legend with multiple values 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -53,6 +54,7 @@ Object {
exports[`Graph Migrations legend with single value 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -79,6 +81,7 @@ Object {
exports[`Graph Migrations legend without values 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -103,6 +106,7 @@ Object {
exports[`Graph Migrations preserves colors from series overrides 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -157,6 +161,7 @@ Object {
exports[`Graph Migrations preserves series overrides using a regex alias 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -211,6 +216,7 @@ Object {
exports[`Graph Migrations simple bars 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -237,6 +243,7 @@ Object {
exports[`Graph Migrations stacking groups 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -322,6 +329,7 @@ Object {
exports[`Graph Migrations stacking simple 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -377,6 +385,7 @@ Object {
exports[`Graph Migrations stairscase 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -416,6 +425,7 @@ Object {
exports[`Graph Migrations stepped line 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {
@ -463,6 +473,7 @@ Object {
exports[`Graph Migrations twoYAxis 1`] = `
Object {
"alert": undefined,
"fieldConfig": Object {
"defaults": Object {
"custom": Object {

View File

@ -45,6 +45,7 @@ export const graphPanelChangedHandler: PanelTypeChangedHandler = (
fieldConfig: prevFieldConfig,
});
panel.fieldConfig = fieldConfig; // Mutates the incoming panel
panel.alert = prevOptions.angular.alert;
return options;
}