dev #1

Merged
alientim merged 145 commits from dev into main 2025-10-12 13:44:14 +02:00
Showing only changes of commit 9d50113c20 - Show all commits

View File

@@ -1,7 +1,10 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
<h2>Dashboard</h2> <h2 class="d-flex justify-content-between align-items-center">
Dashboard
<span id="dashboard-timer" class="badge bg-success">-- s</span>
</h2>
<div class="row row-cols-1 row-cols-md-6 g-3"> <div class="row row-cols-1 row-cols-md-6 g-3">
{% for d in devices %} {% for d in devices %}
<div class="col"> <div class="col">
@@ -24,5 +27,27 @@
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<script>
document.addEventListener("DOMContentLoaded", () => {
const intervalMinutes = {{ interval | int }};
const intervalMilliseconds = intervalMinutes * 60 * 1000;
let lastUpdateTime = Date.now(); // optional: vom letzten Refresh / Log-Eintrag
function updateDashboardTimer() {
const now = Date.now();
const elapsed = now - lastUpdateTime;
const remainingMs = intervalMilliseconds - (elapsed % intervalMilliseconds);
const remainingSec = Math.ceil(remainingMs / 1000);
document.getElementById("dashboard-timer").innerText = remainingSec + " s";
}
// Optional: reset timer beim manuellen Refresh
// lastUpdateTime = Date.now();
setInterval(updateDashboardTimer, 1000);
updateDashboardTimer(); // direkt beim Laden
});
</script>
{% endblock %} {% endblock %}