From eb19afbfdff24b31698827659299755631d2c18f Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Mon, 9 May 2022 15:14:26 +0200 Subject: [PATCH] fix: migrate tools panel to temperature panel on gui init (#783) --- src/store/gui/actions.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/store/gui/actions.ts b/src/store/gui/actions.ts index 1802f94c..10a904f1 100644 --- a/src/store/gui/actions.ts +++ b/src/store/gui/actions.ts @@ -1,6 +1,6 @@ import Vue from 'vue' import { ActionTree } from 'vuex' -import { GuiState } from '@/store/gui/types' +import { GuiState, GuiStateLayoutoption } from '@/store/gui/types' import { RootState } from '@/store/types' import { getDefaultState } from './index' import { themeDir } from '@/store/variables' @@ -63,6 +63,36 @@ export const actions: ActionTree = { delete payload.value.dashboard.nonExpandPanels } + //update tools to temperatures panel from V2.1.x to V2.2.0 + if ('dashboard' in payload.value) { + const dashboard = payload.value.dashboard + const layouts = [ + 'mobileLayout', + 'tabletLayout1', + 'tabletLayout2', + 'desktopLayout1', + 'desktopLayout2', + 'widescreenLayout1', + 'widescreenLayout2', + 'widescreenLayout3', + ] + + layouts.forEach((layout) => { + if (layout in dashboard) { + const index = dashboard[layout].findIndex((entry: GuiStateLayoutoption) => entry.name === 'tools') + + if (index !== -1) { + dashboard[layout][index].name = 'temperature' + + dispatch('saveSetting', { + name: 'dashboard.' + layout, + value: dashboard[layout], + }) + } + } + }) + } + commit('setData', payload.value) },