47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
function getVersion() {
|
|
fetch('/api/version')
|
|
.then(function(response) {
|
|
return response.json();
|
|
})
|
|
.then(function(version) {
|
|
document.getElementById("version").innerHTML = "v" + version.version;
|
|
});
|
|
}
|
|
|
|
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;
|
|
})
|
|
}
|