Fix: Tag Interface Delete Button #104256
@ -3,12 +3,19 @@
|
|||||||
<h2 class="column-title">Tag Details</h2>
|
<h2 class="column-title">Tag Details</h2>
|
||||||
|
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<button @click="createTag">Create Tag</button>
|
<button @click="fetchTags">Refresh</button>
|
||||||
<button @click="deleteTag" :disabled="tags.length === 0">
|
<button @click="deleteTag" :disabled="tags.length === 0">
|
||||||
Delete Tag
|
Delete Tag
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="action-buttons">
|
||||||
|
<form @submit="createTag">
|
||||||
|
<input type="text" name="newtagname" v-model="newTagName" placeholder="New Tag Name">
|
||||||
|
<button type="submit">Create Tag</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Table to display tags -->
|
<!-- Table to display tags -->
|
||||||
<table v-if="tags.length > 0" class="tag-table">
|
<table v-if="tags.length > 0" class="tag-table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -98,6 +105,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import { useWorkers } from "@/stores/workers";
|
import { useWorkers } from "@/stores/workers";
|
||||||
import { useNotifs } from "@/stores/notifications";
|
import { useNotifs } from "@/stores/notifications";
|
||||||
|
import { WorkerMgtApi } from '@/manager-api';
|
||||||
|
import { WorkerTag } from '@/manager-api';
|
||||||
|
import { getAPIClient } from "@/api-client";
|
||||||
import TabItem from "@/components/TabItem.vue";
|
import TabItem from "@/components/TabItem.vue";
|
||||||
import TabsWrapper from "@/components/TabsWrapper.vue";
|
import TabsWrapper from "@/components/TabsWrapper.vue";
|
||||||
|
|
||||||
@ -110,19 +120,23 @@ export default {
|
|||||||
return {
|
return {
|
||||||
tags: [],
|
tags: [],
|
||||||
selectedTag: null,
|
selectedTag: null,
|
||||||
|
newTagName: "",
|
||||||
|
workers: useWorkers(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchTags();
|
this.fetchTags();
|
||||||
|
|
||||||
|
const api = new WorkerMgtApi(getAPIClient());
|
||||||
|
window.api = api;
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
fetchTags() {
|
fetchTags() {
|
||||||
useWorkers()
|
this.workers.refreshTags()
|
||||||
dr.sybren marked this conversation as resolved
Outdated
|
|||||||
.refreshTags()
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.tags = useWorkers().tags;
|
this.tags = this.workers.tags;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
const errorMsg = JSON.stringify(error);
|
const errorMsg = JSON.stringify(error);
|
||||||
@ -130,9 +144,18 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
createTag() {
|
createTag(event) {
|
||||||
const newTag = { name: "name", description: "this is a test field" };
|
event.preventDefault();
|
||||||
this.tags.push(newTag);
|
|
||||||
|
const api = new WorkerMgtApi(getAPIClient());
|
||||||
|
const newTag = new WorkerTag(this.newTagName);
|
||||||
|
|
||||||
|
api.createWorkerTag(newTag)
|
||||||
|
.then(this.fetchTags)
|
||||||
|
.catch((error) => {
|
||||||
|
const errorMsg = JSON.stringify(error);
|
||||||
|
useNotifs().add(`Error: ${errorMsg}`);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteTag() {
|
deleteTag() {
|
||||||
|
Loading…
Reference in New Issue
Block a user
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).