diff --git a/public/app/features/dashboard/components/HelpWizard/SupportSnapshotService.ts b/public/app/features/dashboard/components/HelpWizard/SupportSnapshotService.ts index 6b4f8ac38b5..f18b8261ea4 100644 --- a/public/app/features/dashboard/components/HelpWizard/SupportSnapshotService.ts +++ b/public/app/features/dashboard/components/HelpWizard/SupportSnapshotService.ts @@ -83,14 +83,12 @@ export class SupportSnapshotService extends StateManagerBase { // expect configRev to be reset to 0 as it was saved expect(sourcePanel.hasChanged).toEqual(false); }); - - it('should apply changes when leaving panel edit with angular panel', async () => { - const sourcePanel = new PanelModel({ id: 12, type: 'graph' }); - sourcePanel.plugin = getPanelPlugin({}); - sourcePanel.plugin.angularPanelCtrl = {}; - - const dashboard = createDashboardModelFixture({ - panels: [{ id: 12, type: 'graph' }], - }); - - const panel = dashboard.initEditPanel(sourcePanel); - - const state: PanelEditorState = { - ...initialState(), - getPanel: () => panel, - getSourcePanel: () => sourcePanel, - }; - - // not using panel.setProperty here to simulate any prop change done from angular - panel.title = 'Changed title'; - - await thunkTester({ - panelEditor: state, - panels: {}, - dashboard: { - getModel: () => dashboard, - }, - }) - .givenThunk(exitPanelEditor) - .whenThunkIsDispatched(); - - expect(sourcePanel.isAngularPlugin()).toBe(true); - expect(sourcePanel.title).toEqual('Changed title'); - expect(sourcePanel.configRev).toEqual(1); - }); }); describe('skipPanelUpdate', () => { diff --git a/public/app/features/dashboard/components/PanelEditor/state/actions.ts b/public/app/features/dashboard/components/PanelEditor/state/actions.ts index f1313156cb0..940b6a02998 100644 --- a/public/app/features/dashboard/components/PanelEditor/state/actions.ts +++ b/public/app/features/dashboard/components/PanelEditor/state/actions.ts @@ -161,7 +161,7 @@ export function exitPanelEditor(): ThunkResult { } function hasPanelChangedInPanelEdit(panel: PanelModel) { - return panel.hasChanged || panel.hasSavedPanelEditChange || panel.isAngularPlugin(); + return panel.hasChanged || panel.hasSavedPanelEditChange; } export function updatePanelEditorUIState(uiState: Partial): ThunkResult { diff --git a/public/app/features/dashboard/state/PanelModel.test.ts b/public/app/features/dashboard/state/PanelModel.test.ts index b8d11c01258..f6ccb6b7cd6 100644 --- a/public/app/features/dashboard/state/PanelModel.test.ts +++ b/public/app/features/dashboard/state/PanelModel.test.ts @@ -464,7 +464,7 @@ describe('PanelModel', () => { it('should call react onPanelTypeChanged', () => { expect(onPanelTypeChanged.mock.calls.length).toBe(1); expect(onPanelTypeChanged.mock.calls[0][1]).toBe('table'); - expect(onPanelTypeChanged.mock.calls[0][2].angular).toBeDefined(); + expect(onPanelTypeChanged.mock.calls[0][2].angular).not.toBeDefined(); }); it('getQueryRunner() should return same instance after changing to another react panel', () => { diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index a13208e15e1..7e67a270ed4 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -509,7 +509,8 @@ export class PanelModel implements DataConfigSource, IPanelModel { const oldOptions = this.getOptionsToRemember(); const prevFieldConfig = this.fieldConfig; const oldPluginId = this.type; - const wasAngular = this.isAngularPlugin() || Boolean(autoMigrateAngular[oldPluginId]); + const angularId = this.autoMigrateFrom || oldPluginId; + const wasAngular = Boolean(autoMigrateAngular[angularId]); this.cachedPluginOptions[oldPluginId] = { properties: oldOptions, fieldConfig: prevFieldConfig, @@ -618,12 +619,6 @@ export class PanelModel implements DataConfigSource, IPanelModel { return this.title && this.title.length > 0; } - isAngularPlugin(): boolean { - return ( - (this.plugin && this.plugin.angularPanelCtrl) !== undefined || (this.plugin?.meta?.angular?.detected ?? false) - ); - } - destroy() { this.events.removeAllListeners();