refactor(tui): replace # column with colored status dot
CI / lint (pull_request) Has been cancelled
CI / vulncheck (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled

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.
This commit is contained in:
2026-06-30 23:29:45 -04:00
parent 16f0c2eb66
commit 24b0cb05ba
2 changed files with 29 additions and 6 deletions
+21
View File
@@ -162,6 +162,27 @@ func (m Model) fmtRetries(site models.Site) string {
return s 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 { func (m Model) fmtStatus(status models.Status, paused bool, inMaint bool) string {
if paused { if paused {
return m.st.warnStyle.Render("◇ PAUSED") return m.st.warnStyle.Render("◇ PAUSED")
+8 -6
View File
@@ -34,7 +34,7 @@ type siteFormData struct {
type colKey int type colKey int
const ( const (
colNum colKey = iota colDot colKey = iota
colName colName
colType colType
colStatus colStatus
@@ -55,7 +55,7 @@ type columnDef struct {
} }
var siteColumns = []columnDef{ var siteColumns = []columnDef{
{colNum, "#", "#", 4, 4, 0}, {colDot, "", "", 3, 3, 0},
{colName, "NAME", "NAME", 0, 0, 0}, {colName, "NAME", "NAME", 0, 0, 0},
{colType, "TYPE", "TYPE", 10, 8, mediumBreakpoint}, {colType, "TYPE", "TYPE", 10, 8, mediumBreakpoint},
{colStatus, "STATUS", "STATUS", 10, 10, 0}, {colStatus, "STATUS", "STATUS", 10, 10, 0},
@@ -245,11 +245,12 @@ func (m Model) viewSitesTab() string {
if site.Type == "group" { if site.Type == "group" {
groupRows[i-start] = true groupRows[i-start] = true
icon := typeIcon("group", m.collapsed[site.ID]) icon := typeIcon("group", m.collapsed[site.ID])
inMaint := m.isMonitorInMaintenance(site.ID)
cells := map[colKey]string{ 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)), colName: m.zones.Mark(fmt.Sprintf("site-%d", i), icon+" "+limitStr(site.Name, nameW-4)),
colType: "group", 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("—"), colLatency: m.st.subtleStyle.Render("—"),
colUptime: m.groupUptime(site.ID), colUptime: m.groupUptime(site.ID),
colHistory: m.groupSparkline(site.ID, sparkWidth, rowBg), 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) spark = m.latencySparkline(hist.Latencies, hist.Statuses, sparkWidth, rowBg)
} }
inMaint := m.isMonitorInMaintenance(site.ID)
cells := map[colKey]string{ 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), colName: m.zones.Mark(fmt.Sprintf("site-%d", i), name),
colType: typeIcon(site.Type, false) + " " + site.Type, 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), colLatency: m.fmtLatency(site.Latency),
colUptime: m.fmtUptimeMaint(hist.Statuses, site.ID), colUptime: m.fmtUptimeMaint(hist.Statuses, site.ID),
colHistory: spark, colHistory: spark,