added support for Level 0 and buttons for Level 1 and Level 2 re-executions

This commit is contained in:
dcore94 2023-02-02 12:42:03 +01:00
parent be2f797d38
commit 3f1bb41d5d
1 changed files with 26 additions and 1 deletions

View File

@ -92,6 +92,12 @@ class CCPExecutionHistory extends HTMLElement {
<path d="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z"></path>
</svg>
</button>
<button data-index="0" name="reexecute2" title="Level 2 re-execution" class="btn btn-info ccp-toolbar-button ccp-toolbar-button-small float-right m-1">
<svg enable-background="new 0 0 24 24" viewBox="0 0 24 24"><g><rect fill="none" height="24" width="24"/></g><g><path d="M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M12,18.5c-3.31,0-6-2.69-6-6h2c0,2.21,1.79,4,4,4 s4-1.79,4-4c0-2.24-1.85-4.09-4.16-3.99l1.57,1.57L12,11.5l-4-4l4-4l1.41,1.41l-1.6,1.6C15.28,6.4,18,9.18,18,12.5 C18,15.81,15.31,18.5,12,18.5z"/></g></svg>
</button>
<button data-index="0" name="reexecute1" title="Level 1 re-execution" class="btn btn-info ccp-toolbar-button ccp-toolbar-button-small float-right m-1">
<svg enable-background="new 0 0 24 24" viewBox="0 0 24 24"><g><rect fill="none" height="24" width="24"/><rect fill="none" height="24" width="24"/><rect fill="none" height="24" width="24"/></g><g><g/><path d="M12,5V1L7,6l5,5V7c3.31,0,6,2.69,6,6s-2.69,6-6,6s-6-2.69-6-6H4c0,4.42,3.58,8,8,8s8-3.58,8-8S16.42,5,12,5z"/></g></svg>
</button>
<button data-index="0" name="provo" title="Export to Prov-o document" class="btn btn-primary ccp-toolbar-button ccp-toolbar-button-small float-right m-1">
<svg viewBox="0 0 24 24"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M13 3H6v18h4v-6h3c3.31 0 6-2.69 6-6s-2.69-6-6-6zm.2 8H10V7h3.2c1.1 0 2 .9 2 2s-.9 2-2 2z"/></svg>
</button>
@ -263,6 +269,17 @@ class CCPExecutionHistory extends HTMLElement {
}).catch(err=>{ console.error(err)})
}
reexecute(id,level){
this.#boot.secureFetch(`${this.#serviceurl}/executions/${id}/level/${level}`, { method: "POST" })
.then(reply =>{
if (reply.status !== 200) {
throw "Unable to re-execute"
}
}).then(()=>{
alert("Re-execution is WIP. Stay tuned")
}).catch(err=>{ console.error(err)})
}
#execution_list_bss = {
template : "#EXECUTIOM_LIST_TEMPLATE",
target : "ul[name=ccp_execution_list]",
@ -335,6 +352,14 @@ class CCPExecutionHistory extends HTMLElement {
const id = ev.currentTarget.getAttribute("data-index")
this.export(id, "application/prov-o+xml", id + ".xml")
}
if(ev.target.getAttribute("name") === "reexecute1"){
const id = ev.currentTarget.getAttribute("data-index")
this.reexecute(id, 1)
}
if(ev.target.getAttribute("name") === "reexecute2"){
const id = ev.currentTarget.getAttribute("data-index")
this.reexecute(id, 2)
}
},
recurse : [
{