diff --git a/ccp/js/methodlistcontroller.js b/ccp/js/methodlistcontroller.js index e459787..f287eaa 100644 --- a/ccp/js/methodlistcontroller.js +++ b/ccp/js/methodlistcontroller.js @@ -83,7 +83,7 @@ class CCPMethodList extends HTMLElement{ ` : `` } - @@ -332,6 +332,10 @@ class CCPMethodList extends HTMLElement{ }).catch(err=>{ alert(err)}) } + isShared(process){ + return 0 < process.metadata.filter(md=>{ return md.role === "context" && md.title === this.#boot.context}).length + } + 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}) @@ -414,7 +418,7 @@ class CCPMethodList extends HTMLElement{ this.toArchive(id) } }else if(ev.target.getAttribute("name") === "publish"){ - if(confirm("Please confirm publication of method to VRE?")){ + if(confirm("Please confirm publication of method to Vlab?")){ this.publish(id) } } @@ -447,7 +451,17 @@ 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("badge") + span.classList.add("badge-warning") + span.textContent = "shared" + e.replaceWith(span) + }else if(!this.isAuthor(d)){ + e.parentElement.removeChild(e) + } + } }, { target : "span[name=author]",