From 06e48cb86962da673f3e680699fbe9072a0ebc0c Mon Sep 17 00:00:00 2001 From: Peter Holmberg Date: Thu, 26 Nov 2020 13:27:50 +0100 Subject: [PATCH] Fix: Migrate Panel edit uiState percentage strings to number (#29412) --- .../SplitPaneWrapper.tsx | 0 .../dashboard/components/PanelEditor/PanelEditor.tsx | 2 +- .../dashboard/components/PanelEditor/state/reducers.ts | 10 +++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) rename public/app/core/components/{ThreePaneSplit => SplitPaneWrapper}/SplitPaneWrapper.tsx (100%) diff --git a/public/app/core/components/ThreePaneSplit/SplitPaneWrapper.tsx b/public/app/core/components/SplitPaneWrapper/SplitPaneWrapper.tsx similarity index 100% rename from public/app/core/components/ThreePaneSplit/SplitPaneWrapper.tsx rename to public/app/core/components/SplitPaneWrapper/SplitPaneWrapper.tsx diff --git a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx index fb767f6313478..9e39cb1f5588f 100644 --- a/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx +++ b/public/app/features/dashboard/components/PanelEditor/PanelEditor.tsx @@ -18,7 +18,7 @@ import { OptionsPaneContent } from './OptionsPaneContent'; import { DashNavButton } from 'app/features/dashboard/components/DashNav/DashNavButton'; import { SubMenuItems } from 'app/features/dashboard/components/SubMenu/SubMenuItems'; 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 { DashboardPanel } from '../../dashgrid/DashboardPanel'; diff --git a/public/app/features/dashboard/components/PanelEditor/state/reducers.ts b/public/app/features/dashboard/components/PanelEditor/state/reducers.ts index da757ecca4fd7..a6d6741cc0b9b 100644 --- a/public/app/features/dashboard/components/PanelEditor/state/reducers.ts +++ b/public/app/features/dashboard/components/PanelEditor/state/reducers.ts @@ -37,6 +37,14 @@ export interface 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 { getPanel: () => new PanelModel({}), getSourcePanel: () => new PanelModel({}), @@ -50,7 +58,7 @@ export const initialState = (): PanelEditorState => { isOpen: false, ui: { ...DEFAULT_PANEL_EDITOR_UI_STATE, - ...store.getObject(PANEL_EDITOR_UI_STATE_STORAGE_KEY, DEFAULT_PANEL_EDITOR_UI_STATE), + ...migratedState, }, }; };