Display run error in ui
This commit is contained in:
parent
af96f82831
commit
bb86563ed9
@ -23,6 +23,11 @@
|
||||
it's ID is <code id="jobid"></code>
|
||||
</div>
|
||||
|
||||
<div id="error-alert" class="alert alert-danger" style="display: none;">
|
||||
<strong>An error occurs:</strong>
|
||||
<span id="errortxt"></span>
|
||||
</div>
|
||||
|
||||
<div id="volumes-card" class="mb-3 card" style="display: none;">
|
||||
<h5 class="card-header">
|
||||
Volumes
|
||||
|
@ -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 New Issue
Block a user