PanelEdit: Fixed timing and state related issues (#22131)

* PanelEdit: Fixed timing and state related issues

* Added unit test and changed some logic

* Fixed id logic

* Updated snapshots

* Update public/app/features/dashboard/state/PanelModel.ts

Co-Authored-By: Dominik Prokop <dominik.prokop@grafana.com>

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
This commit is contained in:
Torkel Ödegaard
2020-02-13 16:06:45 +01:00
committed by GitHub
parent 9c55500cc0
commit 70b0ec65b3
13 changed files with 139 additions and 37 deletions

View File

@@ -3,7 +3,7 @@ import { getBackendSrv } from '@grafana/runtime';
import { createSuccessNotification } from 'app/core/copy/appNotification';
// Actions
import { loadPluginDashboards } from '../../plugins/state/actions';
import { loadDashboardPermissions, dashboardPanelTypeChanged } from './reducers';
import { loadDashboardPermissions, panelModelAndPluginReady } from './reducers';
import { notifyApp } from 'app/core/actions';
import { loadPanelPlugin } from 'app/features/plugins/state/actions';
// Types
@@ -122,6 +122,8 @@ export function initDashboardPanel(panel: PanelModel): ThunkResult<void> {
if (!panel.plugin) {
panel.pluginLoaded(plugin);
}
dispatch(panelModelAndPluginReady({ panelId: panel.id, plugin }));
};
}
@@ -139,6 +141,7 @@ export function changePanelPlugin(panel: PanelModel, pluginId: string): ThunkRes
}
panel.changePlugin(plugin);
dispatch(dashboardPanelTypeChanged({ panelId: panel.id, pluginId }));
dispatch(panelModelAndPluginReady({ panelId: panel.id, plugin }));
};
}