Fix: Tag Interface Delete Button #104256

Manually merged
Sybren A. Stüvel merged 39 commits from Evelinealy/flamenco:tag-interface into main 2023-11-02 16:13:14 +01:00
Showing only changes of commit 6228879ae8 - Show all commits

View File

@ -91,6 +91,10 @@ export default {
this.tabulator.on("tableBuilt", () => { this.tabulator.on("tableBuilt", () => {
this.fetchTags(); this.fetchTags();
}); });
this.tabulator.on("cellEdited", (cell) => {
const editedTag = cell.getRow().getData();
this.updateTagInAPI(editedTag);
});
}, },
methods: { methods: {
@ -128,6 +132,28 @@ export default {
}); });
}, },
updateTagInAPI(tag) {
const { id: tagId, ...updatedTagData } = tag;
const api = new WorkerMgtApi(getAPIClient());
dr.sybren marked this conversation as resolved Outdated

Add this column to the end, so that it has the same layout as the job blocklist (there the is on the right as well).

Add this column to the end, so that it has the same layout as the job blocklist (there the ❌ is on the right as well).
api
.updateWorkerTag(tagId, updatedTagData)
.then(() => {
// Update the local state with the edited data without requiring a page refresh
this.tags = this.tags.map((tag) => {
if (tag.id === tagId) {
return { ...tag, ...updatedTagData };
}
return tag;
});
console.log("Tag updated successfully");
})
.catch((error) => {
const errorMsg = JSON.stringify(error);
useNotifs().add(`Error: ${errorMsg}`);
});
},
deleteTag() { deleteTag() {
if (!this.selectedTag) { if (!this.selectedTag) {
return; return;