adjusted tooltip and added action for publishing method to context
This commit is contained in:
parent
782d8b0c89
commit
7344eaedd9
|
@ -83,6 +83,9 @@ class CCPMethodList extends HTMLElement{
|
|||
</button>`
|
||||
: ``
|
||||
}
|
||||
<button data-index="0" name="publish" title="Publish to VRE" class="btn btn-warning ccp-toolbar-button ccp-toolbar-button-small">
|
||||
<svg style="fill:black" viewBox="0 -960 960 960"><path d="M727-80q-47.5 0-80.75-33.346Q613-146.693 613-194.331q0-6.669 1.5-16.312T619-228L316-404q-15 17-37 27.5T234-366q-47.5 0-80.75-33.25T120-480q0-47.5 33.25-80.75T234-594q23 0 44 9t38 26l303-174q-3-7.071-4.5-15.911Q613-757.75 613-766q0-47.5 33.25-80.75T727-880q47.5 0 80.75 33.25T841-766q0 47.5-33.25 80.75T727-652q-23.354 0-44.677-7.5T646-684L343-516q2 8 3.5 18.5t1.5 17.741q0 7.242-1.5 15Q345-457 343-449l303 172q15-14 35-22.5t46-8.5q47.5 0 80.75 33.25T841-194q0 47.5-33.25 80.75T727-80Zm.035-632Q750-712 765.5-727.535q15.5-15.535 15.5-38.5T765.465-804.5q-15.535-15.5-38.5-15.5T688.5-804.465q-15.5 15.535-15.5 38.5t15.535 38.465q15.535 15.5 38.5 15.5Zm-493 286Q257-426 272.5-441.535q15.5-15.535 15.5-38.5T272.465-518.5q-15.535-15.5-38.5-15.5T195.5-518.465q-15.5 15.535-15.5 38.5t15.535 38.465q15.535 15.5 38.5 15.5Zm493 286Q750-140 765.5-155.535q15.5-15.535 15.5-38.5T765.465-232.5q-15.535-15.5-38.5-15.5T688.5-232.465q-15.5 15.535-15.5 38.5t15.535 38.465q15.535 15.5 38.5 15.5ZM727-766ZM234-480Zm493 286Z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="m-0 p-0 small" name="description"></p>
|
||||
|
@ -300,7 +303,7 @@ class CCPMethodList extends HTMLElement{
|
|||
toArchive(id){
|
||||
this.#boot.secureFetch(`${this.#serviceurl}/methods/${id}/archive`, { method: "POST" })
|
||||
.then(reply =>{
|
||||
if (reply.status !== 200) {
|
||||
if (!reply.ok) {
|
||||
throw "Unable to archive"
|
||||
}
|
||||
}).catch(err=>{ alert(err)})
|
||||
|
@ -310,7 +313,7 @@ class CCPMethodList extends HTMLElement{
|
|||
if(url){
|
||||
this.#boot.secureFetch(`${this.#serviceurl}/methods/archive?url=${url}`)
|
||||
.then(reply =>{
|
||||
if (reply.status !== 200) {
|
||||
if (!reply.ok) {
|
||||
throw "Unable to fetch from archive"
|
||||
}
|
||||
return reply.text()
|
||||
|
@ -320,6 +323,21 @@ class CCPMethodList extends HTMLElement{
|
|||
}
|
||||
}
|
||||
|
||||
publish(id){
|
||||
this.#boot.secureFetch(`${this.#serviceurl}/methods/${id}/publish`, { method: "POST" })
|
||||
.then(reply =>{
|
||||
if (!reply.ok) {
|
||||
throw `Unable to archive (${reply.status})`
|
||||
}
|
||||
}).catch(err=>{ alert(err)})
|
||||
}
|
||||
|
||||
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})
|
||||
return found.length > 0
|
||||
}
|
||||
|
||||
#process_list_bss = {
|
||||
template : "#PROCESS_LIST_TEMPLATE",
|
||||
target : "ul[name=process_category_list]",
|
||||
|
@ -380,7 +398,7 @@ class CCPMethodList extends HTMLElement{
|
|||
{
|
||||
target : "li.ccp-process",
|
||||
"in" : (e,d)=>this.#filtered[d],
|
||||
apply : (e,d)=>{ e.alt = e.title = d.title },
|
||||
apply : (e,d)=>{ e.alt = e.title = `${d.title} (${d.id})` },
|
||||
on_click : ev=>{
|
||||
const id = ev.currentTarget.bss_input.data.id
|
||||
if(ev.target.getAttribute("name") === "export_method"){
|
||||
|
@ -395,6 +413,10 @@ class CCPMethodList extends HTMLElement{
|
|||
if(confirm("Please confirm archiving of method to workspace?")){
|
||||
this.toArchive(id)
|
||||
}
|
||||
}else if(ev.target.getAttribute("name") === "publish"){
|
||||
if(confirm("Please confirm publication of method to VRE?")){
|
||||
this.publish(id)
|
||||
}
|
||||
}
|
||||
},
|
||||
on_dragstart : ev=>{
|
||||
|
@ -423,6 +445,10 @@ class CCPMethodList extends HTMLElement{
|
|||
target: "button[name=edit]",
|
||||
apply : (e,d)=>{ e.style.display = this.#allowedit ? "revert" : "none" }
|
||||
},
|
||||
{
|
||||
target: "button[name=publish]",
|
||||
apply : (e,d)=>{ e.style.display = this.isAuthor(d) ? "revert" : "none" }
|
||||
},
|
||||
{
|
||||
target : "span[name=author]",
|
||||
"in" : (e,d)=>d.metadata.filter(md=>md.role === "author"),
|
||||
|
|
Loading…
Reference in New Issue