fix issues TUI display reliability
Build and Publish / Metadata (push) Successful in 10s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 2m0s

This commit is contained in:
mats committed 2026-09-24 11:11:29 +02:00
1 parent a96e95212a
commit f5015581a4
5 files changed
+84 -5

No files matched your search

+7
View File
@@ -34,6 +34,7 @@ type snapshotOptions struct {
Scanning bool
NextScanAt time.Time
Now time.Time
ScanError error
}
// Colors mirror the otel-ui design-system tokens (AGENTS.md) so the terminal
@@ -87,6 +88,9 @@ func renderBody(snap snapshot, o snapshotOptions, w, avail int) string {
case snap.Err != nil:
return statusPanel(w, min(avail, 5), colCritical, "SCAN FAILED", snap.Err.Error(),
"values are from "+fmtTime(snap.ScannedAt)+"; the display keeps the last good scan")
case o.ScanError != nil && len(snap.Issues) == 0:
return statusPanel(w, min(avail, 5), colCritical, "SCAN FAILED", o.ScanError.Error(),
"no successful scan yet; retrying automatically")
case len(snap.Issues) == 0:
sub := fmt.Sprintf("no issues firing · window %s–%s UTC · scanned %s",
snap.WindowStart.Format("15:04"), snap.WindowEnd.Format("15:04"), commas(snap.Events))
@@ -234,6 +238,9 @@ func renderHeader(snap snapshot, o snapshotOptions) string {
title := style(colAccent, true).Render(strings.ToUpper(o.Title))
left := []string{title}
if o.ScanError != nil {
left = append(left, style(colCritical, true).Render("SCAN FAILED"))
}
if !snap.WindowEnd.IsZero() {
left = append(left, style(colText3, false).Render(
fmt.Sprintf("%s–%s UTC", snap.WindowStart.Format("15:04"), snap.WindowEnd.Format("15:04"))))