From 655c80d34e4feb5d7ef85102b2183fee889b5185 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Mon, 10 Jul 2023 15:31:34 +0200 Subject: [PATCH] distinguish shared from non shared methods --- ccp/js/methodlistcontroller.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ccp/js/methodlistcontroller.js b/ccp/js/methodlistcontroller.js index e459787..15d2c8b 100644 --- a/ccp/js/methodlistcontroller.js +++ b/ccp/js/methodlistcontroller.js @@ -332,6 +332,10 @@ class CCPMethodList extends HTMLElement{ }).catch(err=>{ alert(err)}) } + isShared(process){ + return 0 < process.metadata.filter(md=>{ return md.role === "context" && mt.title === this.#boot.context}) + } + isAuthor(m){ const href = `${this.#boot.url}/admin/realms/${this.#boot.realm}/users/${this.#boot.subject}` const found = m.metadata.filter(md=>{return md.role === "author" && md.href === href}) @@ -447,7 +451,16 @@ class CCPMethodList extends HTMLElement{ }, { target: "button[name=publish]", - apply : (e,d)=>{ e.style.display = this.isAuthor(d) ? "revert" : "none" } + apply : (e,d)=>{ + if(this.isShared(d)){ + const span = document.createElement("span") + span.classList.add("bg-warning") + span.textContent = "shared" + e.replaceWith(span) + }else if(!this.isAuthor(d)){ + e.parentElement.removeChild(e) + } + } }, { target : "span[name=author]",