Split run and logs

This commit is contained in:
nemunaire 2021-05-02 16:26:23 +02:00
commit 539cbd68a9
4 changed files with 56 additions and 13 deletions

View file

@ -8,19 +8,39 @@ function getVersion() {
});
}
let current_job = null;
function runctnr() {
document.getElementById("btnlaunch").disabled = true;
document.getElementById("btnlaunchspinner").style.display = "inline-block";
fetch('/api/run')
.then(function(response) {
return response.json();
})
.then(function(data) {
current_job = data.jobid;
document.getElementById("jobid").textContent = current_job;
document.getElementById("started-alert").style.display = "block";
fetchLogs();
})
return false;
}
function fetchLogs() {
fetch('/api/jobs/' + current_job + '/logs')
.then(function(response) {
document.getElementById("btnlaunch").disabled = false;
document.getElementById("btnlaunchspinner").style.display = "none";
document.getElementById("started-alert").style.display = "none";
return response.text();
})
.then(function(logs) {
document.getElementById("logs").textContent = logs;
document.getElementById("logs-card").style.display = "block";
current_job = null;
})
return false;
}