update port display for clarity

This commit is contained in:
uprightbass360
2025-11-26 15:37:41 -05:00
parent 5620fbae91
commit 251b5d8f9f

View File

@@ -263,9 +263,9 @@ func buildPortsTable(s *Snapshot) *TableNoCol {
table := NewTableNoCol() table := NewTableNoCol()
rows := [][]string{{"Port", "Number", "Reachable"}} rows := [][]string{{"Port", "Number", "Reachable"}}
for _, p := range s.Ports { for _, p := range s.Ports {
state := "down" state := "Closed"
if p.Reachable { if p.Reachable {
state = "up" state = "Open"
} }
rows = append(rows, []string{p.Name, p.Port, state}) rows = append(rows, []string{p.Name, p.Port, state})
} }
@@ -413,10 +413,10 @@ func renderSnapshot(s *Snapshot, selectedModule int) (*widgets.List, *ui.Grid) {
if portsTable.RowStyles == nil { if portsTable.RowStyles == nil {
portsTable.RowStyles = make(map[int]ui.Style) portsTable.RowStyles = make(map[int]ui.Style)
} }
if portsTable.Rows[i][2] == "up" { if portsTable.Rows[i][2] == "Open" {
portsTable.RowStyles[i] = ui.NewStyle(ui.ColorGreen) portsTable.RowStyles[i] = ui.NewStyle(ui.ColorGreen)
} else { } else {
portsTable.RowStyles[i] = ui.NewStyle(ui.ColorRed) portsTable.RowStyles[i] = ui.NewStyle(ui.ColorYellow)
} }
} }
modulesList := buildModulesList(s) modulesList := buildModulesList(s)