fix(qualys/dashboard): compteur base sur running_since DB (survit aux auto-refresh)

This commit is contained in:
Pierre & Lumière 2026-04-25 00:16:44 +00:00
parent 0ab4f2d8fa
commit 66558c4b46

View File

@ -22,12 +22,20 @@
<script>
setTimeout(function() { window.location.href = '/qualys/dashboard'; }, 15000);
(function() {
{% if running_since %}
var t0 = new Date("{{ running_since.isoformat() }}").getTime();
{% else %}
var t0 = Date.now();
{% endif %}
var el = document.getElementById('elapsed');
setInterval(function() {
function tick() {
var s = Math.floor((Date.now() - t0) / 1000);
if (el) el.textContent = '+' + s + 's';
}, 1000);
var m = Math.floor(s / 60);
var sec = s % 60;
if (el) el.textContent = '+' + (m > 0 ? m + 'm ' : '') + sec + 's';
}
tick();
setInterval(tick, 1000);
})();
</script>
{% elif msg == 'already_running' %}