mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
NewPanelEditor: Angular panel options, and angular component state to redux major change (#22448)
* NewPanelEdit: Added angular options to new panel editor and started looking and angular component state * Moved angular component state to redux * Close to working 100% * Think everything is working * AlertTab: Alert tab now gets angularComponent from redux * Fixed panel menu access to angular panel component * Added new tests * Fixed unit test * Fixed strict null errors * Fixed typescript issues * fixed issues
This commit is contained in:
@@ -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, panelModelAndPluginReady } from './reducers';
|
||||
import { loadDashboardPermissions, panelModelAndPluginReady, setPanelAngularComponent } from './reducers';
|
||||
import { notifyApp } from 'app/core/actions';
|
||||
import { loadPanelPlugin } from 'app/features/plugins/state/actions';
|
||||
// Types
|
||||
@@ -134,12 +134,20 @@ export function changePanelPlugin(panel: PanelModel, pluginId: string): ThunkRes
|
||||
return;
|
||||
}
|
||||
|
||||
let plugin = getStore().plugins.panels[pluginId];
|
||||
const store = getStore();
|
||||
let plugin = store.plugins.panels[pluginId];
|
||||
|
||||
if (!plugin) {
|
||||
plugin = await dispatch(loadPanelPlugin(pluginId));
|
||||
}
|
||||
|
||||
// clean up angular component (scope / ctrl state)
|
||||
const angularComponent = store.dashboard.panels[panel.id].angularComponent;
|
||||
if (angularComponent) {
|
||||
angularComponent.destroy();
|
||||
dispatch(setPanelAngularComponent({ panelId: panel.id, angularComponent: null }));
|
||||
}
|
||||
|
||||
panel.changePlugin(plugin);
|
||||
|
||||
dispatch(panelModelAndPluginReady({ panelId: panel.id, plugin }));
|
||||
|
||||
Reference in New Issue
Block a user