From f8ee97d6b85d01c322e1204898e41786d50ac632 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Wed, 29 Mar 2023 17:28:02 +0200 Subject: [PATCH] make edit and execute buttons optional --- ccp/js/methodlistcontroller.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ccp/js/methodlistcontroller.js b/ccp/js/methodlistcontroller.js index 771953d..6ee5d13 100644 --- a/ccp/js/methodlistcontroller.js +++ b/ccp/js/methodlistcontroller.js @@ -120,17 +120,16 @@ class CCPMethodList extends HTMLElement{ } connectedCallback(){ - + this.#allowedit = this.getAttribute("allow-edit") === "true" + this.#allowexecute = this.getAttribute("allow-execute") === "true" } fetchProcesses(){ console.log("Calling fetch processes") this.#boot.secureFetch(this.#serviceurl + "/methods"). then(resp=>{ - console.log("Received resp for processes ", resp.status) return resp.json() }).then(data=>{ - console.log("Processes parsed to json", data) this.#data = data this.updateList() return this.fetchInfrastructures() @@ -327,7 +326,11 @@ class CCPMethodList extends HTMLElement{ }, { target: "button[name=executable]", - apply : (e,d)=>{ e.style.display = d.executable ? "revert" : "none" } + apply : (e,d)=>{ e.style.display = d.executable && this.#allowexecute ? "revert" : "none" } + }, + { + target: "button[name=edit]", + apply : (e,d)=>{ e.style.display = this.#allowedit ? "revert" : "none" } }, { target : "span[name=author]",