From 122a4bd4a45f01c3e2145d00013baad0e2a89257 Mon Sep 17 00:00:00 2001 From: Tim Eertmoed Date: Wed, 8 Oct 2025 20:27:40 +0200 Subject: [PATCH] srv/poe_manager/templates/index.html aktualisiert --- srv/poe_manager/templates/index.html | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/srv/poe_manager/templates/index.html b/srv/poe_manager/templates/index.html index 1f839b5..2c19ca9 100644 --- a/srv/poe_manager/templates/index.html +++ b/srv/poe_manager/templates/index.html @@ -46,7 +46,7 @@ document.addEventListener("DOMContentLoaded", () => { function updateTimer() { const now = Date.now(); const elapsed = now - lastUpdateTime; - const remainingMs = intervalMilliseconds - (elapsed % intervalMilliseconds); + const remainingMs = Math.max(intervalMilliseconds - elapsed, 0); const remainingSec = Math.ceil(remainingMs / 1000); document.getElementById("dashboard-timer").innerText = `Nächste Prüfung in ${remainingSec} Sekunden`; @@ -56,19 +56,14 @@ document.addEventListener("DOMContentLoaded", () => { fetch("{{ url_for('get_log') }}") .then(response => response.text()) .then(data => { - const lines = data.split("\n").filter(line => !line.includes("ist erreichbar!")); - let lastSepIndex = -1; - for (let i = lines.length - 1; i >= 0; i--) { - if (lines[i].startsWith("--------------------------------------------------------------------")) { - lastSepIndex = i; - break; + const lines = data.split("\n").map(l => l.trim()).filter(Boolean); + if (lines.length > 0) { + const lastLine = lines[lines.length - 1]; + const match = lastLine.match(/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/); + if (match) { + lastUpdateTime = parseLogTimestamp(match[1]); } } - if (lastSepIndex >= 0 && lastSepIndex + 1 < lines.length) { - const firstLine = lines[lastSepIndex + 1]; - const match = firstLine.match(/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/); - if (match) lastUpdateTime = parseLogTimestamp(match[1]); - } }) .catch(err => console.error("Fehler beim Laden der Logs:", err)); }