Browse Source

En cours de développement

master
mls-361 9 months ago
parent
commit
c7748b337d
  1. 4
      internal/gui/layout.go
  2. 36
      internal/gui/static/js/dashboard.js

4
internal/gui/layout.go

@ -59,8 +59,8 @@ func buildPage(app components.Application, name string, content g.Node) g.Node {
Class("navbar"),
navbarLink(app.Name(), "/", "home", name),
navbarLink("dashboard", "/gui/dashboard", "number of jobs and workflows per status", name),
navbarLink("jobs", "/gui/search/jobs", "search for jobs", name),
navbarLink("workflows", "/gui/search/workflows", "search for workflows", name),
navbarLink("jobs", "/gui/job/list", "search for jobs", name),
navbarLink("workflows", "/gui/workflow/list", "search for workflows", name),
),
),
),

36
internal/gui/static/js/dashboard.js

@ -7,31 +7,25 @@
(function() {
const dashboard = document.getElementById("dashboard");
var interval;
window.onload = function(event) {
interval = window.setInterval(
window.addEventListener("load", function(e) {
window.setInterval(
function() {
if (window.closed) {
window.clearInterval(interval);
} else {
fetch("/gui/dashboard/update").then(function(response) {
if (response.ok) {
response.text().then(function(html) {
dashboard.innerHTML = html;
});
} else {
$.showError("Fetch error: invalid network response"); //////////////////////////////////////
}
})
.catch(function(error) {
$.showError("Fetch error: " + error.message); //////////////////////////////////////////////////
});
}
fetch("/gui/dashboard/update").then(function(response) {
if (response.ok) {
response.text().then(function(html) {
dashboard.innerHTML = html;
});
} else if (!window.closed) {
$.showError("Fetch error: invalid network response"); //////////////////////////////////////////
}
})
.catch(function(error) {
$.showError("Fetch error: " + error.message); //////////////////////////////////////////////////////
});
},
3000
);
};
});
})();
/*

Loading…
Cancel
Save