srv/poe_manager/templates/logs.html aktualisiert
This commit is contained in:
@@ -6,16 +6,21 @@
|
|||||||
<div id="log-box" class="border p-3 bg-light" style="height:500px; overflow:auto; white-space: pre-wrap; font-family: monospace;"></div>
|
<div id="log-box" class="border p-3 bg-light" style="height:500px; overflow:auto; white-space: pre-wrap; font-family: monospace;"></div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
let lastUpdateTime = 0;
|
||||||
function fetchLog() {
|
function fetchLog() {
|
||||||
|
const now = Date.now() / 1000;
|
||||||
|
if (now - lastUpdateTime < 300) return;
|
||||||
fetch("{{ url_for('get_log') }}")
|
fetch("{{ url_for('get_log') }}")
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
document.getElementById("log-box").innerText = data;
|
const box = document.getElementById("log-box");
|
||||||
let box = document.getElementById("log-box");
|
box.innerText = data;
|
||||||
box.scrollTop = box.scrollHeight;
|
box.scrollTop = box.scrollHeight;
|
||||||
});
|
lastUpdateTime = now;
|
||||||
|
})
|
||||||
|
.catch(err => console.error("Fehler beim Laden der Logs:", err));
|
||||||
}
|
}
|
||||||
setInterval(fetchLog, 3000);
|
setInterval(fetchLog, 5000);
|
||||||
fetchLog();
|
fetchLog();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user