From 458f6bdb87f5f8df00a0a35bdf2e888483dd552a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 27 Apr 2020 17:32:35 +0200 Subject: [PATCH] PanelEditor: Fixed issue with PanelModel change plugin type (#23949) --- public/app/features/dashboard/state/PanelModel.test.ts | 5 +++++ public/app/features/dashboard/state/PanelModel.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/public/app/features/dashboard/state/PanelModel.test.ts b/public/app/features/dashboard/state/PanelModel.test.ts index bd0c872e6b6..204d0242576 100644 --- a/public/app/features/dashboard/state/PanelModel.test.ts +++ b/public/app/features/dashboard/state/PanelModel.test.ts @@ -214,10 +214,15 @@ describe('PanelModel', () => { }); }); + model.editSourceId = 1001; model.changePlugin(newPlugin); model.alert = { id: 2 }; }); + it('should keep editSourceId', () => { + expect(model.editSourceId).toBe(1001); + }); + it('should apply next panel option defaults', () => { expect(model.getOptions().showThresholdLabels).toBeFalsy(); expect(model.getOptions().showThresholds).toBeUndefined(); diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index 405f563f340..c92df8b4c1b 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -84,6 +84,7 @@ const mustKeepProps: { [str: string]: boolean } = { queryRunner: true, transformations: true, fieldConfig: true, + editSourceId: true, }; const defaults: any = {