Initial work on highlighting changed settings. Some refactoring to

simplify addition of new settings
This commit is contained in:
Henry Jameson 2020-10-01 01:43:07 +03:00
parent 0c0722a092
commit a463959a36
7 changed files with 161 additions and 111 deletions

View file

@ -74,18 +74,24 @@ export const instanceDefaultProperties = Object.entries(defaultState)
.map(([key, value]) => key)
const config = {
state: defaultState,
state: { ...defaultState },
getters: {
mergedConfig (state, getters, rootState, rootGetters) {
defaultConfig (state, getters, rootState, rootGetters) {
const { instance } = rootState
console.log('DC', instance.minimalScopesMode)
return {
...state,
...instanceDefaultProperties
.map(key => [key, state[key] === undefined
? instance[key]
: state[key]
])
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {})
...defaultState,
...Object.fromEntries(
instanceDefaultProperties.map(key => [key, instance[key]])
)
}
},
mergedConfig (state, getters, rootState, rootGetters) {
const { defaultConfig } = rootGetters
console.log('DC2', defaultConfig.hideISP)
return {
...defaultConfig,
...state
}
}
},