feat(tui): refine transaction flow with source/dest IPs and improved styling

This commit is contained in:
Jose Luis Montañes Ojados
2026-01-20 22:28:20 +01:00
parent c052cc72fb
commit 713903c463
2 changed files with 243 additions and 8 deletions

View File

@@ -1407,7 +1407,7 @@ func (m *Model) updateCallDetailView() {
arrow := "→"
arrowStyle := m.styles.ArrowOut
if len(flow.Packets) > 0 && pkt.SourceIP != flow.Packets[0].SourceIP {
arrow = "←"
// Keep arrow pointing right as we are showing Src -> Dst
arrowStyle = m.styles.ArrowIn
}
@@ -1440,10 +1440,27 @@ func (m *Model) updateCallDetailView() {
}
}
ts := pkt.Timestamp.Format("15:04:05.000")
// Resolve IPs and apply styles
srcLabel := m.networkMap.LabelForIP(pkt.SourceIP)
if srcNode := m.networkMap.FindByIP(pkt.SourceIP); srcNode != nil {
srcLabel = m.styleForNode(srcNode).Render(srcLabel)
}
dstLabel := m.networkMap.LabelForIP(pkt.DestIP)
if dstNode := m.networkMap.FindByIP(pkt.DestIP); dstNode != nil {
dstLabel = m.styleForNode(dstNode).Render(dstLabel)
}
// Use pre-calculated format
numStr := fmt.Sprintf(numFmt, i+1)
lineStr := fmt.Sprintf("%s [%s] %s %s", numStr, ts, arrowStyle.Render(arrow), summaryStyle.Render(pkt.Summary()))
if i == m.selectedPacketIndex {
numStr = m.styles.Active.Render("> " + numStr)
} else {
numStr = " " + numStr
}
lineStr := fmt.Sprintf("%s %s %s %s %s", numStr, srcLabel, arrowStyle.Render(arrow), dstLabel, summaryStyle.Render(pkt.Summary()))
if pkt.SDP != nil {
mediaIP := pkt.SDP.GetSDPMediaIP()
@@ -1457,11 +1474,6 @@ func (m *Model) updateCallDetailView() {
}
}
if i == m.selectedPacketIndex {
lineStr = m.styles.Active.Render("> " + lineStr)
} else {
lineStr = " " + lineStr
}
right.WriteString(lineStr + "\n")
}