|
@@ -1,14 +1,28 @@
|
|
|
export default {
|
|
|
state: {
|
|
|
+ sheet: null
|
|
|
},
|
|
|
|
|
|
mutations: {
|
|
|
+ 'SET_KIT_SHEET' (state, id) {
|
|
|
+ state.sheet = id
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
actions: {
|
|
|
async 'INIT_KIT' ({ state, commit, dispatch, getters }, payload) {
|
|
|
const ids = await dispatch('GET_ALL_NODES_IDS', 'kit')
|
|
|
return dispatch('GET_NODES', { ids, dataLevel: 'partial' })
|
|
|
+ },
|
|
|
+
|
|
|
+ async 'OPEN_KIT_NODE' ({ state, commit, dispatch }, id) {
|
|
|
+ commit('SET_KIT_SHEET', id)
|
|
|
+ commit('ADD_HISTORY_ENTRIES', [id])
|
|
|
+ return dispatch('GET_NODE', { id, dataLevel: 'full' })
|
|
|
+ },
|
|
|
+
|
|
|
+ 'CLOSE_KIT_NODE' ({ state, commit }) {
|
|
|
+ commit('SET_KIT_SHEET', null)
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -17,6 +31,11 @@ export default {
|
|
|
const kitIds = rootState.ids.kit
|
|
|
if (kitIds === undefined || rootState.nodes[kitIds[0]] === undefined) return
|
|
|
return kitIds.map(id => rootState.nodes[id])
|
|
|
+ },
|
|
|
+
|
|
|
+ sheet: (state, getters, rootState) => {
|
|
|
+ if (state.sheet === undefined || state.sheet === null) return state.sheet
|
|
|
+ return rootState.nodes[state.sheet]
|
|
|
}
|
|
|
}
|
|
|
}
|