From 23f77df4b846e95c252458a90d7d62e6c4c224b2 Mon Sep 17 00:00:00 2001 From: dcore94 Date: Thu, 2 Feb 2023 20:03:06 +0100 Subject: [PATCH] added handler for level-1 re-execution --- ccp/js/executionhistorycontroller.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ccp/js/executionhistorycontroller.js b/ccp/js/executionhistorycontroller.js index ebace26..32ec473 100644 --- a/ccp/js/executionhistorycontroller.js +++ b/ccp/js/executionhistorycontroller.js @@ -183,15 +183,16 @@ class CCPExecutionHistory extends HTMLElement { if(reply.status === 200) return reply.json(); else throw `Unable to load execution ${id}` }).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++){ if(this.#data[i].id == exec.id){ this.#data[i] = exec 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() }).catch(err=>{ console.error(err)}) @@ -275,8 +276,10 @@ class CCPExecutionHistory extends HTMLElement { if (reply.status !== 200) { throw "Unable to re-execute" } - }).then(()=>{ - alert("Re-execution is WIP. Stay tuned") + return reply.json() + }).then(data=>{ + console.log(data) + this.refreshExecution(data.jobID) }).catch(err=>{ console.error(err)}) }