Fix node detail Recent Activity — fetch health data for real packet list

Desktop detail panel was only showing adverts as 'Recent Activity'.
Now fetches /health endpoint too and displays all recent packets
(adverts, channel msgs, DMs) with type icons and Analyze links.
This commit is contained in:
you
2026-03-18 22:55:22 +00:00
parent cc8118b85a
commit 4aeeab5df7
+8 -3
View File
@@ -295,7 +295,11 @@
panel.innerHTML = '<div class="text-center text-muted" style="padding:40px">Loading…</div>';
try {
const data = await api('/nodes/' + encodeURIComponent(pubkey));
const [data, healthData] = await Promise.all([
api('/nodes/' + encodeURIComponent(pubkey)),
api('/nodes/' + encodeURIComponent(pubkey) + '/health').catch(() => null)
]);
data.healthData = healthData;
renderDetail(panel, data);
} catch (e) {
panel.innerHTML = `<div class="text-muted">Error: ${e.message}</div>`;
@@ -305,6 +309,7 @@
function renderDetail(panel, data) {
const n = data.node;
const adverts = data.recentAdverts || [];
const recent = data.healthData?.recentPackets || [];
const roleColor = ROLE_COLORS[n.role] || '#6b7280';
const hasLoc = n.lat != null && n.lon != null;
const nodeUrl = location.origin + '#/nodes/' + encodeURIComponent(n.public_key);
@@ -337,9 +342,9 @@
</div>
<div class="node-detail-section">
<h4>Recent Activity (${adverts.length})</h4>
<h4>Recent Activity (${recent.length})</h4>
<div id="advertTimeline">
${adverts.length ? adverts.map(a => {
${recent.length ? recent.map(a => {
let decoded;
try { decoded = JSON.parse(a.decoded_json); } catch {}
const pType = PAYLOAD_TYPES[a.payload_type] || 'Packet';