From 24b0cb05ba0ad1bd52b733393bb2eda5640dea03 Mon Sep 17 00:00:00 2001 From: Tyler Koenig Date: Tue, 30 Jun 2026 23:29:45 -0400 Subject: [PATCH] refactor(tui): replace # column with colored status dot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drop the row-number column and add a colored status dot as the first column. Dot uses the same icon/color as the existing status indicators (▲ green for up, ▼ red for down, ◼ purple for maint, etc). Matches the maint strip visual pattern. Status text column retained for explicit label. --- internal/tui/format.go | 21 +++++++++++++++++++++ internal/tui/tab_sites.go | 14 ++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/internal/tui/format.go b/internal/tui/format.go index 31f0881..7d51f9e 100644 --- a/internal/tui/format.go +++ b/internal/tui/format.go @@ -162,6 +162,27 @@ func (m Model) fmtRetries(site models.Site) string { return s } +func (m Model) fmtStatusDot(status models.Status, paused bool, inMaint bool) string { + if paused { + return m.st.warnStyle.Render("◇") + } + if inMaint { + return m.st.maintStyle.Render("◼") + } + switch status { + case models.StatusDown, models.StatusSSLExp: + return m.st.dangerStyle.Render("▼") + case models.StatusLate: + return m.st.warnStyle.Render("◆") + case models.StatusStale: + return m.st.staleStyle.Render("◆") + case models.StatusPending: + return m.st.subtleStyle.Render("○") + default: + return m.st.specialStyle.Render("▲") + } +} + func (m Model) fmtStatus(status models.Status, paused bool, inMaint bool) string { if paused { return m.st.warnStyle.Render("◇ PAUSED") diff --git a/internal/tui/tab_sites.go b/internal/tui/tab_sites.go index 16493b2..376c6e7 100644 --- a/internal/tui/tab_sites.go +++ b/internal/tui/tab_sites.go @@ -34,7 +34,7 @@ type siteFormData struct { type colKey int const ( - colNum colKey = iota + colDot colKey = iota colName colType colStatus @@ -55,7 +55,7 @@ type columnDef struct { } var siteColumns = []columnDef{ - {colNum, "#", "#", 4, 4, 0}, + {colDot, "", "", 3, 3, 0}, {colName, "NAME", "NAME", 0, 0, 0}, {colType, "TYPE", "TYPE", 10, 8, mediumBreakpoint}, {colStatus, "STATUS", "STATUS", 10, 10, 0}, @@ -245,11 +245,12 @@ func (m Model) viewSitesTab() string { if site.Type == "group" { groupRows[i-start] = true icon := typeIcon("group", m.collapsed[site.ID]) + inMaint := m.isMonitorInMaintenance(site.ID) cells := map[colKey]string{ - colNum: strconv.Itoa(i + 1), + colDot: m.fmtStatusDot(site.Status, site.Paused, inMaint), colName: m.zones.Mark(fmt.Sprintf("site-%d", i), icon+" "+limitStr(site.Name, nameW-4)), colType: "group", - colStatus: m.fmtStatus(site.Status, site.Paused, m.isMonitorInMaintenance(site.ID)), + colStatus: m.fmtStatus(site.Status, site.Paused, inMaint), colLatency: m.st.subtleStyle.Render("—"), colUptime: m.groupUptime(site.ID), colHistory: m.groupSparkline(site.ID, sparkWidth, rowBg), @@ -293,11 +294,12 @@ func (m Model) viewSitesTab() string { spark = m.latencySparkline(hist.Latencies, hist.Statuses, sparkWidth, rowBg) } + inMaint := m.isMonitorInMaintenance(site.ID) cells := map[colKey]string{ - colNum: strconv.Itoa(i + 1), + colDot: m.fmtStatusDot(site.Status, site.Paused, inMaint), colName: m.zones.Mark(fmt.Sprintf("site-%d", i), name), colType: typeIcon(site.Type, false) + " " + site.Type, - colStatus: m.fmtStatus(site.Status, site.Paused, m.isMonitorInMaintenance(site.ID)), + colStatus: m.fmtStatus(site.Status, site.Paused, inMaint), colLatency: m.fmtLatency(site.Latency), colUptime: m.fmtUptimeMaint(hist.Statuses, site.ID), colHistory: spark,