Web Interface for Tags #104244
@ -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();
|
||||||
Sybren A. Stüvel
commented
This function is not called, and thus should be removed. This function is not called, and thus should be removed.
|
|||||||
|
this.updateTagInAPI(editedTag);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@ -128,6 +132,28 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateTagInAPI(tag) {
|
||||||
|
const { id: tagId, ...updatedTagData } = tag;
|
||||||
|
const api = new WorkerMgtApi(getAPIClient());
|
||||||
Sybren A. Stüvel
commented
Instead of trying to find the just-deleted tag, just call 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() {
|
deleteTag() {
|
||||||
if (!this.selectedTag) {
|
if (!this.selectedTag) {
|
||||||
Sybren A. Stüvel
commented
Not sure why this is implemented in a separate function, it could just all be part of the Not sure why this is implemented in a separate function, it could just all be part of the `onRowClick` event handler.
|
|||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user
This function is not called, and thus should be removed.