diff --git a/public/index.html b/public/index.html index 7988ada..22d4c55 100644 --- a/public/index.html +++ b/public/index.html @@ -84,7 +84,7 @@ - + diff --git a/public/packets.js b/public/packets.js index 97edb6d..9e33c7d 100644 --- a/public/packets.js +++ b/public/packets.js @@ -855,9 +855,20 @@ let html = ''; for (const p of displayPackets) { const isExpanded = expandedHashes.has(p.hash); - const groupRegion = p.observer_id ? (observers.find(o => o.id === p.observer_id)?.iata || '') : ''; + // When observer filter is active, use first matching child's data for header + let headerObserverId = p.observer_id; + let headerPathJson = p.path_json; + if (filters.observer && p._children?.length) { + const obsIds = new Set(filters.observer.split(',')); + const match = p._children.find(c => obsIds.has(String(c.observer_id))); + if (match) { + headerObserverId = match.observer_id; + headerPathJson = match.path_json; + } + } + const groupRegion = headerObserverId ? (observers.find(o => o.id === headerObserverId)?.iata || '') : ''; let groupPath = []; - try { groupPath = JSON.parse(p.path_json || '[]'); } catch {} + try { groupPath = JSON.parse(headerPathJson || '[]'); } catch {} const groupPathStr = renderPath(groupPath); const groupTypeName = payloadTypeName(p.payload_type); const groupTypeClass = payloadTypeColor(p.payload_type); @@ -870,7 +881,7 @@ ${truncate(p.hash || '—', 8)} ${groupSize ? groupSize + 'B' : '—'} ${p.payload_type != null ? `${groupTypeName}` : '—'} - ${isSingle ? truncate(obsName(p.observer_id), 16) : truncate(obsName(p.observer_id), 10) + (p.observer_count > 1 ? ' +' + (p.observer_count - 1) : '')} + ${isSingle ? truncate(obsName(headerObserverId), 16) : truncate(obsName(headerObserverId), 10) + (p.observer_count > 1 ? ' +' + (p.observer_count - 1) : '')} ${groupPathStr} ${p.observation_count > 1 ? '👁 ' + p.observation_count + '' : (isSingle ? '' : p.count)} ${getDetailPreview((() => { try { return JSON.parse(p.decoded_json || '{}'); } catch { return {}; } })())}