Skip to content
Snippets Groups Projects
Commit 3f92506f authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Confirm delete modal: added warning message when some of the selected nodes are not deletable

parent 0348f4e5
No related branches found
No related tags found
No related merge requests found
Pipeline #2093 passed
......@@ -117,12 +117,19 @@ export default {
this.$store.dispatch('startAsyncRecallJob');
},
deleteNodes() {
let deletableCheckboxes = document.querySelectorAll('#nodes input.deletable:checked');
let paths = [];
for (let i = 0; i < deletableCheckboxes.length; i++) {
paths.push(deletableCheckboxes[i].getAttribute('data-node'));
let selectedNodesCheckboxes = document.querySelectorAll('#nodes input:checked');
let paths = [], unDeletablePaths = [];
for (let i = 0; i < selectedNodesCheckboxes.length; i++) {
let checkbox = selectedNodesCheckboxes[i];
let dataNode = checkbox.getAttribute('data-node');
if(checkbox.classList.contains('deletable')) {
paths.push(dataNode);
} else {
unDeletablePaths.push(dataNode);
}
}
this.$store.commit('setNodesToDelete', paths);
this.$store.commit('setSelectedUndeletableNodes', unDeletablePaths);
this.$bvModal.show('confirm-delete-modal');
}
}
......
......@@ -11,6 +11,14 @@
<li v-for="node in nodesToDelete" :key="node">{{node}}</li>
</ul>
</p>
<div v-if="selectedUndeletableNodes.length > 0">
<p><strong>Warning</strong>: following selected nodes can't be deleted and will be ignored:</p>
<p>
<ul>
<li v-for="node in selectedUndeletableNodes" :key="node">{{node}}</li>
</ul>
</p>
</div>
</b-modal>
</template>
......@@ -18,7 +26,8 @@
export default {
name: 'ConfirmDeleteModal',
computed: {
nodesToDelete() { return this.$store.state.nodesToDelete }
nodesToDelete() { return this.$store.state.nodesToDelete },
selectedUndeletableNodes() { return this.$store.state.selectedUndeletableNodes }
},
methods: {
reset() {
......
......@@ -33,6 +33,7 @@ export default new Vuex.Store({
lastJobsCheckTime: null,
user: 'anonymous',
nodesToDelete: [],
selectedUndeletableNodes: [],
writable: false,
nodeToShare: {
path: null,
......@@ -78,6 +79,9 @@ export default new Vuex.Store({
setNodesToDelete(state, paths) {
updateArray(state.nodesToDelete, paths);
},
setSelectedUndeletableNodes(state, paths) {
updateArray(state.selectedUndeletableNodes, paths);
},
setWritable(state, value) {
state.writable = value;
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment