distinguish shared from non shared methods

This commit is contained in:
dcore94 2023-07-10 15:31:34 +02:00
parent b0fa8c5405
commit 655c80d34e
1 changed files with 14 additions and 1 deletions

View File

@ -332,6 +332,10 @@ class CCPMethodList extends HTMLElement{
}).catch(err=>{ alert(err)}) }).catch(err=>{ alert(err)})
} }
isShared(process){
return 0 < process.metadata.filter(md=>{ return md.role === "context" && mt.title === this.#boot.context})
}
isAuthor(m){ isAuthor(m){
const href = `${this.#boot.url}/admin/realms/${this.#boot.realm}/users/${this.#boot.subject}` 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}) 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]", 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]", target : "span[name=author]",