mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-04-29 14:41:43 +02:00
feat: add remove functionality to tag view, add confirm alert
This commit is contained in:
parent
543ddf540e
commit
1b3a12a4dc
@ -46,13 +46,11 @@
|
||||
};
|
||||
|
||||
function removeTag(tag, tagType) {
|
||||
if (confirm("Are you sure you want to completely remove this tag?\n\n" + tagType + ':' + tag.name)) {
|
||||
pendingChange = tagType;
|
||||
removeTagMutation({tagIds: [tag.id] }).subscribe(
|
||||
(res) => {
|
||||
if (res.fetching === false && !res.error) {
|
||||
// console.log('Removed:', res.data.removeTagFromList)
|
||||
// console.log('Targets:', tagType, tagmap[tagType])
|
||||
// console.log('Filter:', tagmap[tagType].filter((t) => !res.data.removeTagFromList.includes(t.id)))
|
||||
tagmap[tagType] = tagmap[tagType].filter((t) => !res.data.removeTagFromList.includes(t.id));
|
||||
if (tagmap[tagType].length === 0) {
|
||||
delete tagmap[tagType]
|
||||
@ -64,6 +62,7 @@
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
|
Loading…
x
Reference in New Issue
Block a user