@@ -143,18 +143,20 @@ func getTop() tview.Primitive {
143143 // enrichment: TODO: replace with dropdowns or popup
144144 enrichmentTextView := tview .NewTextView ().SetText (getEnrichmentText ())
145145 enrichmentRow := tview .NewFlex ().SetDirection (tview .FlexColumn ).
146- AddItem (enrichmentTextView , 0 , 1 , false ).
147- AddItem (tview .NewButton ("←" ).SetSelectedFunc (func () {
148- enrichment .prev ()
149- enrichmentTextView .SetText (getEnrichmentText ())
150- updateScreen ()
151- }), 5 , 0 , false ).
152- AddItem (tview .NewButton ("→" ).SetSelectedFunc (func () {
153- enrichment .next ()
154- enrichmentTextView .SetText (getEnrichmentText ())
155- updateScreen ()
156- }), 5 , 0 , false )
157-
146+ AddItem (enrichmentTextView , 0 , 1 , false )
147+ if display .getCurrentItem ().name != rawDisplay {
148+ enrichmentRow .
149+ AddItem (tview .NewButton ("←" ).SetSelectedFunc (func () {
150+ enrichment .prev ()
151+ enrichmentTextView .SetText (getEnrichmentText ())
152+ updateScreen ()
153+ }), 5 , 0 , false ).
154+ AddItem (tview .NewButton ("→" ).SetSelectedFunc (func () {
155+ enrichment .next ()
156+ enrichmentTextView .SetText (getEnrichmentText ())
157+ updateScreen ()
158+ }), 5 , 0 , false )
159+ }
158160 flexView .AddItem (enrichmentRow , 0 , 1 , false )
159161
160162 return flexView
@@ -235,6 +237,9 @@ func getBottom() tview.Primitive {
235237}
236238
237239func getEnrichmentText () string {
240+ if display .getCurrentItem ().name == rawDisplay {
241+ return "Enrichment: n/a\n "
242+ }
238243 return fmt .Sprintf ("Enrichment: %s\n " , enrichment .getCurrentItem ().name )
239244}
240245
@@ -310,47 +315,54 @@ func updateTable() {
310315 return
311316 }
312317
313- // main field, always show the end time
314- cols := []string {
315- "EndTime" ,
316- }
317-
318- // enrichment fields
319- if enrichment .getCurrentItem ().name != noOptions {
320- cols = append (cols , enrichment .getCurrentItem ().ids ... )
318+ cols := []string {}
319+ if display .getCurrentItem ().name == rawDisplay {
320+ cols = append (cols ,
321+ rawDisplay ,
322+ )
321323 } else {
322- // TODO: add a new flag in the config to identify these as default non enriched fields
324+ // main field, always show the end time
323325 cols = append (cols ,
324- "SrcAddr" ,
325- "SrcPort" ,
326- "DstAddr" ,
327- "DstPort" ,
326+ "EndTime" ,
328327 )
329- }
330328
331- // append interfaces and their directions between enrichment and features
332- // this is useful for pkt drop, udns etc
333- cols = append (cols ,
334- "Interfaces" ,
335- "IfDirections" ,
336- )
337-
338- // standard / feature fields
339- if display .getCurrentItem ().name != standardDisplay {
340- for _ , col := range cfg .Columns {
341- if col .Field != "" && slices .Contains (display .getCurrentItem ().ids , col .Feature ) {
342- cols = append (cols , col .ID )
343- }
329+ // enrichment fields
330+ if enrichment .getCurrentItem ().name != noOptions {
331+ cols = append (cols , enrichment .getCurrentItem ().ids ... )
332+ } else {
333+ // TODO: add a new flag in the config to identify these as default non enriched fields
334+ cols = append (cols ,
335+ "SrcAddr" ,
336+ "SrcPort" ,
337+ "DstAddr" ,
338+ "DstPort" ,
339+ )
344340 }
345- } else {
346- // TODO: add a new flag in the config to identify these as default feature fields
341+
342+ // append interfaces and their directions between enrichment and features
343+ // this is useful for pkt drop, udns etc
347344 cols = append (cols ,
348- "FlowDirection" ,
349- "Proto" ,
350- "Dscp" ,
351- "Bytes" ,
352- "Packets" ,
345+ "Interfaces" ,
346+ "IfDirections" ,
353347 )
348+
349+ // standard / feature fields
350+ if display .getCurrentItem ().name != standardDisplay {
351+ for _ , col := range cfg .Columns {
352+ if col .Field != "" && slices .Contains (display .getCurrentItem ().ids , col .Feature ) {
353+ cols = append (cols , col .ID )
354+ }
355+ }
356+ } else {
357+ // TODO: add a new flag in the config to identify these as default feature fields
358+ cols = append (cols ,
359+ "FlowDirection" ,
360+ "Proto" ,
361+ "Dscp" ,
362+ "Bytes" ,
363+ "Packets" ,
364+ )
365+ }
354366 }
355367
356368 // lastFlows may change during the render so we make a copy first
0 commit comments