From 330970cce9f2aa420cb224d6bb38ddca0a8469f7 Mon Sep 17 00:00:00 2001 From: you Date: Fri, 24 Apr 2026 15:26:53 +0000 Subject: [PATCH] feat(ui): show separate Last Status and Last Packet columns for observers - observers.js: rename 'Last Seen' column to 'Last Status', add 'Last Packet' column with a warning badge when no packets observed or packets lag behind status by >10min - observer-detail.js: add 'Last Status Update' and 'Last Packet Observation' stat cards with relative + absolute timestamps --- public/observer-detail.js | 8 ++++++++ public/observers.js | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/public/observer-detail.js b/public/observer-detail.js index fb2fc4a1..640d74e3 100644 --- a/public/observer-detail.js +++ b/public/observer-detail.js @@ -150,6 +150,14 @@
First Seen
${obs.first_seen ? new Date(obs.first_seen).toLocaleDateString() : 'โ€”'}
+
+
Last Status Update
+
${obs.last_seen ? timeAgo(obs.last_seen) + '
' + new Date(obs.last_seen).toLocaleString() + '' : 'โ€”'}
+
+
+
Last Packet Observation
+
${obs.last_packet_at ? timeAgo(obs.last_packet_at) + '
' + new Date(obs.last_packet_at).toLocaleString() + '' : 'never'}
+
ID: ${obs.id} diff --git a/public/observers.js b/public/observers.js index 3619eaf7..3a46ecef 100644 --- a/public/observers.js +++ b/public/observers.js @@ -75,6 +75,17 @@ return { cls: 'health-red', label: 'Offline' }; } + function packetBadge(o) { + if (!o.last_packet_at) return '๐Ÿ“กโš  never'; + const pktAgo = Date.now() - new Date(o.last_packet_at).getTime(); + const statusAgo = o.last_seen ? Date.now() - new Date(o.last_seen).getTime() : Infinity; + const gap = pktAgo - statusAgo; + if (gap > 600000) { + return `๐Ÿ“กโš  ${timeAgo(o.last_packet_at)}`; + } + return timeAgo(o.last_packet_at); + } + function uptimeStr(firstSeen) { if (!firstSeen) return 'โ€”'; const ms = Date.now() - new Date(firstSeen).getTime(); @@ -123,7 +134,7 @@
- + ${filtered.map(o => { @@ -134,6 +145,7 @@ +
Observer status and statistics
StatusNameRegionLast SeenStatusNameRegionLast StatusLast Packet PacketsPackets/HourUptime
${o.name || o.id} ${o.iata ? `${o.iata}` : 'โ€”'} ${timeAgo(o.last_seen)}${packetBadge(o)} ${(o.packet_count || 0).toLocaleString()} ${sparkBar(o.packetsLastHour || 0, maxPktsHr)} ${uptimeStr(o.first_seen)}