refactor(tui): status icons, clean STATUS column, relative time
- STATUS column shows icon + clean state only (▲ UP, ▼ DOWN, ◆ LATE,
◆ STALE, ◇ PAUSED, ◼ MAINT, ○ PENDING). Error classification
(DNS/TLS/TMO) removed from STATUS — stays in NAME inline hint.
- Detail panel Last Check shows relative time ("12s ago") instead of
absolute timestamp.
- Extract shared fmtTimeAgo() to format.go, consolidate duplicate
formatters in tab_alerts.go and tab_nodes.go.
This commit was merged in pull request #62.
This commit is contained in:
+12
-17
@@ -55,32 +55,27 @@ func TestSiteOrder(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFmtStatus_ErrorCategory(t *testing.T) {
|
||||
func TestFmtStatus(t *testing.T) {
|
||||
tests := []struct {
|
||||
status string
|
||||
paused bool
|
||||
inMaint bool
|
||||
cat ErrorCategory
|
||||
wantSub string
|
||||
}{
|
||||
{"DOWN", false, false, ErrCatDNS, "DOWN:DNS"},
|
||||
{"DOWN", false, false, ErrCatTLS, "DOWN:TLS"},
|
||||
{"DOWN", false, false, ErrCatHTTP, "DOWN:HTTP"},
|
||||
{"DOWN", false, false, ErrCatTCP, "DOWN:TCP"},
|
||||
{"DOWN", false, false, ErrCatTimeout, "DOWN:TMO"},
|
||||
{"DOWN", false, false, ErrCatICMP, "DOWN:ICMP"},
|
||||
{"DOWN", false, false, ErrCatPrivate, "DOWN:PRIV"},
|
||||
{"DOWN", false, false, ErrCatUnknown, "DOWN"},
|
||||
{"UP", false, false, ErrCatUnknown, "UP"},
|
||||
{"SSL EXP", false, false, ErrCatUnknown, "SSL EXP"},
|
||||
{"DOWN", true, false, ErrCatDNS, "PAUSED"},
|
||||
{"DOWN", false, true, ErrCatDNS, "MAINT"},
|
||||
{"DOWN", false, false, "▼ DOWN"},
|
||||
{"UP", false, false, "▲ UP"},
|
||||
{"SSL EXP", false, false, "▼ SSL EXP"},
|
||||
{"LATE", false, false, "◆ LATE"},
|
||||
{"STALE", false, false, "◆ STALE"},
|
||||
{"PENDING", false, false, "○ PENDING"},
|
||||
{"DOWN", true, false, "◇ PAUSED"},
|
||||
{"DOWN", false, true, "◼ MAINT"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
got := fmtStatus(tt.status, tt.paused, tt.inMaint, tt.cat)
|
||||
got := fmtStatus(tt.status, tt.paused, tt.inMaint)
|
||||
if !containsPlain(got, tt.wantSub) {
|
||||
t.Errorf("fmtStatus(%q, paused=%v, maint=%v, %q): %q missing %q",
|
||||
tt.status, tt.paused, tt.inMaint, tt.cat, got, tt.wantSub)
|
||||
t.Errorf("fmtStatus(%q, paused=%v, maint=%v): %q missing %q",
|
||||
tt.status, tt.paused, tt.inMaint, got, tt.wantSub)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user