dashboard frontend: consume rfc3339 timestamps from the api
This commit is contained in:
parent
bac2c0a65e
commit
cafef519a9
5 changed files with 46 additions and 33 deletions
|
|
@ -18,6 +18,7 @@ import {
|
|||
appendLinkified,
|
||||
openStream, initServerWarnings,
|
||||
} from './common.js';
|
||||
import { epochSec } from './util.js';
|
||||
|
||||
(() => {
|
||||
NOTIF.bind();
|
||||
|
|
@ -92,7 +93,7 @@ import {
|
|||
const flow = $('msgflow');
|
||||
if (!flow) return;
|
||||
flow.replaceChildren();
|
||||
const tsFmt = (n) => new Date(n * 1000).toISOString().slice(11, 19);
|
||||
const tsFmt = (ts) => new Date(ts).toISOString().slice(11, 19);
|
||||
// Pulse the page banner whenever a broker event lands. The
|
||||
// `.banner` element lives in the dashboard's <footer> rather than
|
||||
// in the flow chrome — `pulseBanner` no-ops on /flow.html since
|
||||
|
|
@ -179,7 +180,7 @@ import {
|
|||
const recentSent = new Map(); // broker row id → { row, at }
|
||||
function rememberSent(ev, row) {
|
||||
if (ev.id == null || ev.id <= 0) return;
|
||||
recentSent.set(ev.id, { row, at: ev.at });
|
||||
recentSent.set(ev.id, { row, at: epochSec(ev.at) });
|
||||
// Bound the map — drop the oldest entries once it grows past a
|
||||
// page of un-collapsed sends (insertion order = oldest first).
|
||||
while (recentSent.size > 256) {
|
||||
|
|
@ -190,7 +191,7 @@ import {
|
|||
function collapseDelivered(ev) {
|
||||
if (ev.id == null || ev.id <= 0) return false;
|
||||
const s = recentSent.get(ev.id);
|
||||
if (!s || ev.at - s.at > COLLAPSE_SECS) return false;
|
||||
if (!s || epochSec(ev.at) - s.at > COLLAPSE_SECS) return false;
|
||||
const arrow = s.row.querySelector('.msg-arrow');
|
||||
if (arrow) arrow.textContent = '✓';
|
||||
// Re-style the row as delivered (green ✓) — the collapsed line now
|
||||
|
|
|
|||
Loading…
Reference in a new issue