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:
@@ -1,7 +1,6 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -66,15 +65,5 @@ func fmtNodeStatus(lastSeen time.Time) string {
|
||||
}
|
||||
|
||||
func fmtNodeLastSeen(t time.Time) string {
|
||||
if t.IsZero() {
|
||||
return subtleStyle.Render("never")
|
||||
}
|
||||
ago := time.Since(t)
|
||||
if ago < time.Minute {
|
||||
return fmt.Sprintf("%ds ago", int(ago.Seconds()))
|
||||
}
|
||||
if ago < time.Hour {
|
||||
return fmt.Sprintf("%dm ago", int(ago.Minutes()))
|
||||
}
|
||||
return fmt.Sprintf("%dh ago", int(ago.Hours()))
|
||||
return fmtTimeAgo(t)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user