summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJannik Schönartz2019-10-16 21:16:14 +0200
committerJannik Schönartz2019-10-16 21:16:14 +0200
commit4752614c0105b864d00e97179b4b77ccbad89e2d (patch)
tree88f89882295efda36ea71292241e80922694e85e /webapp
parent[documentation] Add more information about the automatic registration & chang... (diff)
downloadbas-4752614c0105b864d00e97179b4b77ccbad89e2d.tar.gz
bas-4752614c0105b864d00e97179b4b77ccbad89e2d.tar.xz
bas-4752614c0105b864d00e97179b4b77ccbad89e2d.zip
[webapp/clients] Add the choice to select backends when deleting clients
[group/clients] Checkbox list of the clients in the permanently delete dialog [server/backendhelper] Only deletes from the selected backends (array with backendids)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/src/components/GroupModuleDialog.vue25
-rw-r--r--webapp/src/store/groups.js5
2 files changed, 26 insertions, 4 deletions
diff --git a/webapp/src/components/GroupModuleDialog.vue b/webapp/src/components/GroupModuleDialog.vue
index e9bb65d..41b98b5 100644
--- a/webapp/src/components/GroupModuleDialog.vue
+++ b/webapp/src/components/GroupModuleDialog.vue
@@ -45,7 +45,8 @@
"name": "Name",
"description": "Description",
"ip": "IP Address",
- "wake": "Wake up"
+ "wake": "Wake up",
+ "deleteInBackends": "Select the backends, where the clients will get deleted:"
},
"de": {
"title": {
@@ -92,7 +93,8 @@
"name": "Name",
"description": "Beschreibung",
"ip": "IP Adresse",
- "wake": "Aufwecken"
+ "wake": "Aufwecken",
+ "deleteInBackends": "Wähle die Backends, aus denen die Clients gelöscht werden:"
}
}
</i18n>
@@ -138,6 +140,19 @@
>
<div slot-scope="{ item }">[{{ item.id }}] {{ item.name }}</div>
</RecycleScroller>
+ <div v-if="action === 'delete' && dialog.info.type === 'client'">
+ <div class="select-backends">{{ $t('deleteInBackends') }}</div>
+ <template v-for="backend in backends">
+ <v-checkbox
+ :label="backend.name"
+ v-model="backend.selected"
+ :key="backend.id"
+ :value="backend.selected"
+ color="primary"
+ hide-details
+ ></v-checkbox>
+ </template>
+ </div>
</div>
</v-card-text>
@@ -183,6 +198,7 @@ export default {
},
computed: {
...mapState('groups', ['dialog', 'tabChain']),
+ ...mapState('backends', ['backends']),
headers () {
const lastColumn = this.dialog.info.type === 'client' ? 'ip' : 'description'
return [
@@ -227,6 +243,7 @@ export default {
if (this.dialog.info.action === 'select') this.selected = this.dialog.info.selected
else this.selected = []
if (this.$refs.cardtext) this.$nextTick(() => this.$refs.cardtext.dispatchEvent(new Event('scroll')))
+ if (this.dialog.info.type === 'client') this.$store.dispatch('backends/loadData')
}
}
}
@@ -262,6 +279,7 @@ export default {
})
}
if (this.action === 'add') data.selected = this.selected
+ if (this.action === 'delete') data.backends = this.backends
this.$store.dispatch('groups/' + actionMap[this.action][this.dialog.info.type], data)
this.setDialog({ show: false })
},
@@ -297,4 +315,7 @@ export default {
.selected-list {
padding: 30px;
}
+.select-backends {
+ margin-top: 20px;
+}
</style>
diff --git a/webapp/src/store/groups.js b/webapp/src/store/groups.js
index 2785468..7948e31 100644
--- a/webapp/src/store/groups.js
+++ b/webapp/src/store/groups.js
@@ -193,9 +193,10 @@ export default {
if (callback) callback()
})
},
- deleteClients (context, { selected, callback }) {
+ deleteClients (context, { selected, callback, backends }) {
const ids = selected.map(x => x.id)
- axios.post('/api/clients/?delete', { ids }).then(() => {
+ const backendIds = backends.filter(x => x.selected).map(x => x.id)
+ axios.post('/api/clients/?delete', { ids, backendIds }).then(() => {
const index = context.state.tabChain.length - 1
const item = context.state.tabChain[index]
if (item.tabType === 'client' && ids.includes(item.id)) context.commit('deleteFromTabChain', { index, count: 1 })