Fix: Migrate Panel edit uiState percentage strings to number (#29412)

pull/29413/head
Peter Holmberg 5 years ago committed by GitHub
parent bec3fbea47
commit 06e48cb869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      public/app/core/components/SplitPaneWrapper/SplitPaneWrapper.tsx
  2. 2
      public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx
  3. 10
      public/app/features/dashboard/components/PanelEditor/state/reducers.ts

@ -18,7 +18,7 @@ import { OptionsPaneContent } from './OptionsPaneContent';
import { DashNavButton } from 'app/features/dashboard/components/DashNav/DashNavButton'; import { DashNavButton } from 'app/features/dashboard/components/DashNav/DashNavButton';
import { SubMenuItems } from 'app/features/dashboard/components/SubMenu/SubMenuItems'; import { SubMenuItems } from 'app/features/dashboard/components/SubMenu/SubMenuItems';
import { BackButton } from 'app/core/components/BackButton/BackButton'; import { BackButton } from 'app/core/components/BackButton/BackButton';
import { SplitPaneWrapper } from 'app/core/components/ThreePaneSplit/SplitPaneWrapper'; import { SplitPaneWrapper } from 'app/core/components/SplitPaneWrapper/SplitPaneWrapper';
import { SaveDashboardModalProxy } from '../SaveDashboard/SaveDashboardModalProxy'; import { SaveDashboardModalProxy } from '../SaveDashboard/SaveDashboardModalProxy';
import { DashboardPanel } from '../../dashgrid/DashboardPanel'; import { DashboardPanel } from '../../dashgrid/DashboardPanel';

@ -37,6 +37,14 @@ export interface PanelEditorState {
} }
export const initialState = (): PanelEditorState => { export const initialState = (): PanelEditorState => {
const storedUiState = store.getObject(PANEL_EDITOR_UI_STATE_STORAGE_KEY, DEFAULT_PANEL_EDITOR_UI_STATE);
let migratedState = { ...storedUiState };
if (typeof storedUiState.rightPaneSize === 'string') {
migratedState = { ...storedUiState, rightPaneSize: parseFloat(storedUiState.rightPaneSize) / 100 };
}
return { return {
getPanel: () => new PanelModel({}), getPanel: () => new PanelModel({}),
getSourcePanel: () => new PanelModel({}), getSourcePanel: () => new PanelModel({}),
@ -50,7 +58,7 @@ export const initialState = (): PanelEditorState => {
isOpen: false, isOpen: false,
ui: { ui: {
...DEFAULT_PANEL_EDITOR_UI_STATE, ...DEFAULT_PANEL_EDITOR_UI_STATE,
...store.getObject(PANEL_EDITOR_UI_STATE_STORAGE_KEY, DEFAULT_PANEL_EDITOR_UI_STATE), ...migratedState,
}, },
}; };
}; };

Loading…
Cancel
Save