summaryrefslogtreecommitdiffstats
path: root/webapp/src/store
diff options
context:
space:
mode:
authorUdo Walter2018-09-18 02:25:24 +0200
committerUdo Walter2018-09-18 02:25:24 +0200
commit5895dfed00a6317652bd398afe70dacb3aa8dd5d (patch)
tree603158916a0cf7da3441d83a20b7d246d0c6b664 /webapp/src/store
parentadd ipxe config relation to groups and clients (diff)
downloadbas-5895dfed00a6317652bd398afe70dacb3aa8dd5d.tar.gz
bas-5895dfed00a6317652bd398afe70dacb3aa8dd5d.tar.xz
bas-5895dfed00a6317652bd398afe70dacb3aa8dd5d.zip
[groups] small bugfixes
Diffstat (limited to 'webapp/src/store')
-rw-r--r--webapp/src/store/groups.js30
1 files changed, 18 insertions, 12 deletions
diff --git a/webapp/src/store/groups.js b/webapp/src/store/groups.js
index 524fdc4..4d206de 100644
--- a/webapp/src/store/groups.js
+++ b/webapp/src/store/groups.js
@@ -19,6 +19,7 @@ export default {
setShowAll: (state, { index, value }) => { state.tabChain[index].tabShowAll = value },
deleteFromTabChain: (state, { index, count }) => { state.tabChain.splice(index, count) },
setTab: (state, { index, item }) => {
+ console.log(item)
if (state.tabChain.length > index + 1 && (state.tabChain[index].tabType !== item.tabType || state.tabChain[index].id !== item.id)) {
state.tabChain = state.tabChain.slice(0, index + 1)
}
@@ -85,24 +86,29 @@ export default {
},
saveGroup (context, { id, info, parentIds, tabIndex, callback }) {
axios.post('/api/groups/save', { id, info, parentIds }).then(res => {
- if (callback) callback(res.data.id)
- if (!id) context.commit('setTab', { index: tabIndex, item: { id: res.data.id, name: info.name, tabType: 'group' } })
- if (parentIds && tabIndex > 1 && !parentIds.includes(context.state.tabChain[tabIndex - 1].id)) {
- context.commit('deleteFromTabChain', { index: 1, count: tabIndex - 1 })
- context.commit('setActiveTab', 1)
+ if (res.data.id) {
+ console.log(res.data.id)
+ if (callback) callback(res.data.id)
+ context.commit('setTab', { index: tabIndex, item: { id: res.data.id, name: info.name, tabType: 'group' } })
+ if (parentIds && tabIndex > 1 && !parentIds.includes(context.state.tabChain[tabIndex - 1].id)) {
+ context.commit('deleteFromTabChain', { index: 1, count: tabIndex - 1 })
+ context.commit('setActiveTab', 1)
+ }
+ context.dispatch('reload')
}
- context.dispatch('reload')
})
},
saveClient (context, { id, info, groupIds, tabIndex, callback }) {
axios.post('/api/clients/save', { id, info, groupIds }).then(res => {
- if (callback) callback(res.data.id)
- if (!id) context.commit('setTab', { index: tabIndex, item: { id: res.data.id, name: info.name, tabType: 'client' } })
- if (groupIds && tabIndex > 1 && !groupIds.includes(context.state.tabChain[tabIndex - 1].id)) {
- context.commit('deleteFromTabChain', { index: 1, count: tabIndex - 1 })
- context.commit('setActiveTab', 1)
+ if (res.data.id) {
+ if (callback) callback(res.data.id)
+ context.commit('setTab', { index: tabIndex, item: { id: res.data.id, name: info.name, tabType: 'client' } })
+ if (groupIds && tabIndex > 1 && !groupIds.includes(context.state.tabChain[tabIndex - 1].id)) {
+ context.commit('deleteFromTabChain', { index: 1, count: tabIndex - 1 })
+ context.commit('setActiveTab', 1)
+ }
+ context.dispatch('reload')
}
- context.dispatch('reload')
})
},
deleteGroups (context, { selected }) {