fix(tui): maint tab — bump MONITORS/STARTED/ENDS min widths, respect column width
CI / test (pull_request) Successful in 2m50s
CI / lint (pull_request) Failing after 1m1s
CI / vulncheck (pull_request) Successful in 56s

MONITORS min 13→15 (monitor names can be long, truncate to column width).
STARTED/ENDS min 10→14 (fits '18:30 May 28' = 12 chars + padding).
fmtMaintMonitorW truncates name to actual column width.
This commit is contained in:
2026-05-28 15:24:25 -04:00
parent eb61a0dd3c
commit 251c723fbd
+10 -5
View File
@@ -42,12 +42,16 @@ func fmtMaintType(t string) string {
} }
func fmtMaintMonitor(monitorID int, sites []models.Site) string { func fmtMaintMonitor(monitorID int, sites []models.Site) string {
return fmtMaintMonitorW(monitorID, sites, 18)
}
func fmtMaintMonitorW(monitorID int, sites []models.Site, maxW int) string {
if monitorID == 0 { if monitorID == 0 {
return "All" return "All"
} }
for _, s := range sites { for _, s := range sites {
if s.ID == monitorID { if s.ID == monitorID {
return limitStr(s.Name, 18) return limitStr(s.Name, maxW)
} }
} }
return fmt.Sprintf("#%d", monitorID) return fmt.Sprintf("#%d", monitorID)
@@ -97,13 +101,14 @@ func (m Model) viewMaintTab() string {
{"#", "#", 4, 4, false}, {"#", "#", 4, 4, false},
{"TITLE", "TITLE", 12, 28, true}, {"TITLE", "TITLE", 12, 28, true},
{"TYPE", "TYPE", 13, 14, false}, {"TYPE", "TYPE", 13, 14, false},
{"MON", "MONITORS", 13, 20, false}, {"MON", "MONITORS", 15, 22, false},
{"STATUS", "STATUS", 11, 12, false}, {"STATUS", "STATUS", 11, 12, false},
{"START", "STARTED", 10, 16, false}, {"START", "STARTED", 14, 16, false},
{"ENDS", "ENDS", 10, 16, false}, {"ENDS", "ENDS", 14, 16, false},
} }
headers, widths := m.computeTableLayout(cols, 0) headers, widths := m.computeTableLayout(cols, 0)
titleW := widths[1] titleW := widths[1]
monW := widths[3]
return m.renderTable( return m.renderTable(
headers, headers,
@@ -117,7 +122,7 @@ func (m Model) viewMaintTab() string {
strconv.Itoa(i + 1), strconv.Itoa(i + 1),
m.zones.Mark(fmt.Sprintf("maint-%d", i), limitStr(mw.Title, titleW-2)), m.zones.Mark(fmt.Sprintf("maint-%d", i), limitStr(mw.Title, titleW-2)),
fmtMaintType(mw.Type), fmtMaintType(mw.Type),
fmtMaintMonitor(mw.MonitorID, allSites), fmtMaintMonitorW(mw.MonitorID, allSites, monW-2),
fmtMaintStatus(mw), fmtMaintStatus(mw),
fmtMaintTime(mw.StartTime), fmtMaintTime(mw.StartTime),
fmtMaintTime(mw.EndTime), fmtMaintTime(mw.EndTime),