Web Interface for Tags #104244

Merged
Sybren A. Stüvel merged 30 commits from Evelinealy/flamenco:tag-interface into main 2023-09-04 13:06:10 +02:00
Showing only changes of commit 6228879ae8 - Show all commits

View File

@ -91,6 +91,10 @@ export default {
this.tabulator.on("tableBuilt", () => {

This function is not called, and thus should be removed.

This function is not called, and thus should be removed.
this.fetchTags();
});
this.tabulator.on("cellEdited", (cell) => {
const editedTag = cell.getRow().getData();

This function is not called, and thus should be removed.

This function is not called, and thus should be removed.
this.updateTagInAPI(editedTag);
});
},
methods: {
@ -128,6 +132,28 @@ export default {
});
},
updateTagInAPI(tag) {
const { id: tagId, ...updatedTagData } = tag;
const api = new WorkerMgtApi(getAPIClient());

Instead of trying to find the just-deleted tag, just call this.fetchTags().

This is all temporary code, and that it should be removed once the SocketIO broadcasting of tag changes is implemented.

Instead of trying to find the just-deleted tag, just call `this.fetchTags()`. This is all temporary code, and that it should be removed once the SocketIO broadcasting of tag changes is implemented.
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() {
if (!this.selectedTag) {

Not sure why this is implemented in a separate function, it could just all be part of the onRowClick event handler.

Not sure why this is implemented in a separate function, it could just all be part of the `onRowClick` event handler.
return;