feat: add local time display for sync status in dashboard
Browse files- health-server.js +11 -0
health-server.js
CHANGED
|
@@ -128,6 +128,9 @@ function renderDashboard(data) {
|
|
| 128 |
value: toneBadge(syncStatus.toUpperCase(), syncTone),
|
| 129 |
detail: backupDetail,
|
| 130 |
tone: syncTone,
|
|
|
|
|
|
|
|
|
|
| 131 |
}),
|
| 132 |
renderTile({
|
| 133 |
title: "Keep Awake",
|
|
@@ -196,6 +199,14 @@ function renderDashboard(data) {
|
|
| 196 |
</section>
|
| 197 |
<footer><span class="live">Live</span> status - Health endpoint: <code>/health</code></footer>
|
| 198 |
</main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
</body>
|
| 200 |
</html>`;
|
| 201 |
}
|
|
|
|
| 128 |
value: toneBadge(syncStatus.toUpperCase(), syncTone),
|
| 129 |
detail: backupDetail,
|
| 130 |
tone: syncTone,
|
| 131 |
+
meta: data.sync?.timestamp
|
| 132 |
+
? `<span class="local-time" data-iso="${data.sync.timestamp}"></span>`
|
| 133 |
+
: "",
|
| 134 |
}),
|
| 135 |
renderTile({
|
| 136 |
title: "Keep Awake",
|
|
|
|
| 199 |
</section>
|
| 200 |
<footer><span class="live">Live</span> status - Health endpoint: <code>/health</code></footer>
|
| 201 |
</main>
|
| 202 |
+
<script>
|
| 203 |
+
document.querySelectorAll('.local-time').forEach(el => {
|
| 204 |
+
const date = new Date(el.getAttribute('data-iso'));
|
| 205 |
+
if (!isNaN(date)) {
|
| 206 |
+
el.textContent = 'At ' + date.toLocaleTimeString();
|
| 207 |
+
}
|
| 208 |
+
});
|
| 209 |
+
</script>
|
| 210 |
</body>
|
| 211 |
</html>`;
|
| 212 |
}
|