fix: migrate tools panel to temperature panel on gui init (#783)
This commit is contained in:
1 parent
63283cd9b4
commit
eb19afbfdf
1 file changed
+31
-1
@@ -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<GuiState, RootState> = {
|
||||
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)
|
||||
},
|
||||
|
||||
|
||||
Reference in new issue
Block a user