dashboard: live cache-age indicator
The web server's dashboardStats now reports how stale its shared cache
snapshot is — data.cache = { enabled, ttlMs, ageMs }, using the age of the
oldest dataset feeding the view (OLT-STATE, plus ONU-STATE under detailed
scan). cache.js gains ageOf(key).
The dashboard renders a live-ticking badge from it (renderCacheBadge):
- within TTL -> "◷ cached Ns ago" (info)
- past TTL -> same, warn-coloured (next load will refetch)
- no cache -> "● live" (Electron app, or PFW_CACHE_TTL_SECONDS=0)
The Dashboard Refresh button now sends fresh:true to bypass the cache and
reset the age; the detailed-stats toggle and auto-loads use the cache.
Shared renderer change, so the Electron app shows "live" (it sends no cache
field). Verified offscreen over HTTP: cached / stale / live states render
with the right text + colour.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
6ee1d37a79
commit
c2206ad5a7
6 changed files with 84 additions and 5 deletions
|
|
@ -492,6 +492,20 @@ button.danger:hover:not(:disabled) {
|
|||
}
|
||||
.dash-toggle { text-transform: none; letter-spacing: 0; color: var(--fg-dim); font-size: 12px; }
|
||||
|
||||
/* Cache-age badge in the dashboard header. Colour comes from a status-*
|
||||
class set in JS (info = within TTL, warn = stale, ok = live/no cache). */
|
||||
.dash-cache {
|
||||
font-size: 11px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
letter-spacing: 0.3px;
|
||||
padding: 3px 9px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid currentColor;
|
||||
white-space: nowrap;
|
||||
cursor: default;
|
||||
}
|
||||
.dash-cache:empty { display: none; }
|
||||
|
||||
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
|
||||
.tile {
|
||||
background: linear-gradient(180deg, rgba(33, 200, 255, 0.07), transparent 70%), var(--bg-elev);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue