feat(tui): refine transaction flow with source/dest IPs and improved styling
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user