From ad02113d993fe52c42faebff10c23e66ed48e05a Mon Sep 17 00:00:00 2001 From: Jonas Plum Date: Thu, 20 Jan 2022 10:59:57 +0100 Subject: [PATCH] Improve Job UI (#28) --- ui/src/views/JobList.vue | 71 +++++++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 12 deletions(-) diff --git a/ui/src/views/JobList.vue b/ui/src/views/JobList.vue index dd9d8c4..bb1185f 100644 --- a/ui/src/views/JobList.vue +++ b/ui/src/views/JobList.vue @@ -1,15 +1,52 @@ @@ -18,7 +55,6 @@ import Vue from "vue"; import {JobResponse} from "@/client"; import {API} from "@/services/api"; -import List from "../components/List.vue"; interface State { jobs: Array; @@ -26,10 +62,15 @@ interface State { export default Vue.extend({ name: "JobList", - components: {List}, + components: {}, data: (): State => ({ jobs: [], }), + computed: { + canWrite: function (): boolean { + return this.hasRole("admin:job:write"); + }, + }, methods: { loadJobs() { API.listJobs().then((response) => { @@ -38,6 +79,12 @@ export default Vue.extend({ } }); }, + hasRole: function (s: string): boolean { + if (this.$store.state.user.roles) { + return this.lodash.includes(this.$store.state.user.roles, s); + } + return false; + } }, mounted() { this.loadJobs();