Spaces:
Building
Building
feat: add local time display for sync status in dashboard
Browse files- health-server.js +11 -0
health-server.js
CHANGED
|
@@ -196,6 +196,9 @@ function renderDashboard(data) {
|
|
| 196 |
value: toneBadge(syncStatus.toUpperCase(), syncTone),
|
| 197 |
detail: backupDetail,
|
| 198 |
tone: syncTone,
|
|
|
|
|
|
|
|
|
|
| 199 |
}),
|
| 200 |
renderTile({
|
| 201 |
title: "Keep Awake",
|
|
@@ -262,6 +265,14 @@ function renderDashboard(data) {
|
|
| 262 |
</section>
|
| 263 |
<footer><span class="live">Live</span> status - Health endpoint: <code>/health</code></footer>
|
| 264 |
</main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
</body>
|
| 266 |
</html>`;
|
| 267 |
}
|
|
|
|
| 196 |
value: toneBadge(syncStatus.toUpperCase(), syncTone),
|
| 197 |
detail: backupDetail,
|
| 198 |
tone: syncTone,
|
| 199 |
+
meta: data.sync?.timestamp
|
| 200 |
+
? `<span class="local-time" data-iso="${data.sync.timestamp}"></span>`
|
| 201 |
+
: "",
|
| 202 |
}),
|
| 203 |
renderTile({
|
| 204 |
title: "Keep Awake",
|
|
|
|
| 265 |
</section>
|
| 266 |
<footer><span class="live">Live</span> status - Health endpoint: <code>/health</code></footer>
|
| 267 |
</main>
|
| 268 |
+
<script>
|
| 269 |
+
document.querySelectorAll('.local-time').forEach(el => {
|
| 270 |
+
const date = new Date(el.getAttribute('data-iso'));
|
| 271 |
+
if (!isNaN(date)) {
|
| 272 |
+
el.textContent = 'At ' + date.toLocaleTimeString();
|
| 273 |
+
}
|
| 274 |
+
});
|
| 275 |
+
</script>
|
| 276 |
</body>
|
| 277 |
</html>`;
|
| 278 |
}
|