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>
|
it's ID is <code id="jobid"></code>
|
||||||
</div>
|
</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;">
|
<div id="volumes-card" class="mb-3 card" style="display: none;">
|
||||||
<h5 class="card-header">
|
<h5 class="card-header">
|
||||||
Volumes
|
Volumes
|
||||||
|
@ -13,10 +13,15 @@ let current_job = null;
|
|||||||
function runctnr() {
|
function runctnr() {
|
||||||
document.getElementById("btnlaunch").disabled = true;
|
document.getElementById("btnlaunch").disabled = true;
|
||||||
document.getElementById("btnlaunchspinner").style.display = "inline-block";
|
document.getElementById("btnlaunchspinner").style.display = "inline-block";
|
||||||
|
document.getElementById("error-alert").style.display = "none";
|
||||||
|
|
||||||
fetch('/api/run')
|
fetch('/api/run')
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
|
if (response.status >= 200 && response.status <= 299) {
|
||||||
return response.json();
|
return response.json();
|
||||||
|
} else {
|
||||||
|
throw response;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
current_job = data.jobid;
|
current_job = data.jobid;
|
||||||
@ -26,6 +31,15 @@ function runctnr() {
|
|||||||
|
|
||||||
fetchLogs();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user