added handler for level-1 re-execution

This commit is contained in:
dcore94 2023-02-02 20:03:06 +01:00
parent 3f1bb41d5d
commit 23f77df4b8
1 changed files with 9 additions and 6 deletions

View File

@ -183,15 +183,16 @@ class CCPExecutionHistory extends HTMLElement {
if(reply.status === 200) return reply.json(); if(reply.status === 200) return reply.json();
else throw `Unable to load execution ${id}` else throw `Unable to load execution ${id}`
}).then(data=>{ }).then(data=>{
const exec = data[0] //this may occur for timing issues since workflow start is async
const exec = data.length === 0 ? { id : id} : data[0]
for(var i=0; i < this.#data.length; i++){ for(var i=0; i < this.#data.length; i++){
if(this.#data[i].id == exec.id){ if(this.#data[i].id == exec.id){
this.#data[i] = exec this.#data[i] = exec
break break
} }
if(i === this.#data.length){
this.#data = data.concat(this.#data)
} }
if(i === this.#data.length){
this.#data = [exec].concat(this.#data)
} }
this.updateList() this.updateList()
}).catch(err=>{ console.error(err)}) }).catch(err=>{ console.error(err)})
@ -275,8 +276,10 @@ class CCPExecutionHistory extends HTMLElement {
if (reply.status !== 200) { if (reply.status !== 200) {
throw "Unable to re-execute" throw "Unable to re-execute"
} }
}).then(()=>{ return reply.json()
alert("Re-execution is WIP. Stay tuned") }).then(data=>{
console.log(data)
this.refreshExecution(data.jobID)
}).catch(err=>{ console.error(err)}) }).catch(err=>{ console.error(err)})
} }