Display run error in ui
This commit is contained in:
parent
af96f82831
commit
bb86563ed9
2 changed files with 20 additions and 1 deletions
|
|
@ -13,10 +13,15 @@ let current_job = null;
|
|||
function runctnr() {
|
||||
document.getElementById("btnlaunch").disabled = true;
|
||||
document.getElementById("btnlaunchspinner").style.display = "inline-block";
|
||||
document.getElementById("error-alert").style.display = "none";
|
||||
|
||||
fetch('/api/run')
|
||||
.then(function(response) {
|
||||
return response.json();
|
||||
if (response.status >= 200 && response.status <= 299) {
|
||||
return response.json();
|
||||
} else {
|
||||
throw response;
|
||||
}
|
||||
})
|
||||
.then(function(data) {
|
||||
current_job = data.jobid;
|
||||
|
|
@ -26,6 +31,15 @@ function runctnr() {
|
|||
|
||||
fetchLogs();
|
||||
})
|
||||
.catch(function(error) {
|
||||
error.json().then(json => {
|
||||
document.getElementById("errortxt").textContent = json.error;
|
||||
document.getElementById("error-alert").style.display = "block";
|
||||
})
|
||||
|
||||
document.getElementById("btnlaunch").disabled = false;
|
||||
document.getElementById("btnlaunchspinner").style.display = "none";
|
||||
})
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue