mirror of
https://github.com/grafana/grafana.git
synced 2024-11-24 09:50:29 -06:00
PanelEditor: Fixes issue where panel edit would show the panel plugin options of the previous edit panel (#59861)
* PanelEditor: Fixes issues with panel edit state cleanup * Removed console log * Fixed test
This commit is contained in:
parent
5d6bdc60b1
commit
50c4430661
@ -471,7 +471,7 @@ export function getBasicAndGradientStyles(props: Props): BasicAndGradientStyles
|
||||
};
|
||||
|
||||
const emptyBar: CSSProperties = {
|
||||
background: `rgba(${theme.isDark ? '255,255,255' : '0,0,0'}, 0.07)`,
|
||||
background: theme.colors.background.secondary,
|
||||
flexGrow: 1,
|
||||
display: 'flex',
|
||||
borderRadius: '3px',
|
||||
|
@ -24,12 +24,10 @@ describe('panelEditor actions', () => {
|
||||
.givenThunk(initPanelEditor)
|
||||
.whenThunkIsDispatched(sourcePanel, dashboard);
|
||||
|
||||
expect(dispatchedActions.length).toBe(2);
|
||||
expect(dispatchedActions[0].type).toBe(panelModelAndPluginReady.type);
|
||||
|
||||
expect(dispatchedActions[1].payload.sourcePanel).toBe(sourcePanel);
|
||||
expect(dispatchedActions[1].payload.panel).not.toBe(sourcePanel);
|
||||
expect(dispatchedActions[1].payload.panel.id).toBe(sourcePanel.id);
|
||||
expect(dispatchedActions.length).toBe(1);
|
||||
expect(dispatchedActions[0].payload.sourcePanel).toBe(sourcePanel);
|
||||
expect(dispatchedActions[0].payload.panel).not.toBe(sourcePanel);
|
||||
expect(dispatchedActions[0].payload.panel.id).toBe(sourcePanel.id);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { pick } from 'lodash';
|
||||
|
||||
import store from 'app/core/store';
|
||||
import { cleanUpPanelState, initPanelState } from 'app/features/panel/state/actions';
|
||||
import { cleanUpPanelState } from 'app/features/panel/state/actions';
|
||||
import { panelModelAndPluginReady } from 'app/features/panel/state/reducers';
|
||||
import { ThunkResult } from 'app/types';
|
||||
|
||||
@ -20,8 +20,6 @@ export function initPanelEditor(sourcePanel: PanelModel, dashboard: DashboardMod
|
||||
return async (dispatch) => {
|
||||
const panel = dashboard.initEditPanel(sourcePanel);
|
||||
|
||||
await dispatch(initPanelState(panel));
|
||||
|
||||
dispatch(
|
||||
updateEditorInitState({
|
||||
panel,
|
||||
|
@ -109,6 +109,8 @@ const pluginsSlice = createSlice({
|
||||
state.tableViewEnabled = !state.tableViewEnabled;
|
||||
},
|
||||
closeEditor: (state) => {
|
||||
state.getPanel = () => new PanelModel({});
|
||||
state.getSourcePanel = () => new PanelModel({});
|
||||
state.isOpen = false;
|
||||
state.initDone = false;
|
||||
state.isVizPickerOpen = false;
|
||||
|
Loading…
Reference in New Issue
Block a user