chore(tui): visual polish — detail sections, column headers, alert detail #37

Merged
lerko merged 20 commits from chore/ux-polish into main 2026-05-28 20:40:29 +00:00
Showing only changes of commit 251c723fbd - Show all commits
+10 -5
View File
@@ -42,12 +42,16 @@ func fmtMaintType(t string) 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 {
return "All"
}
for _, s := range sites {
if s.ID == monitorID {
return limitStr(s.Name, 18)
return limitStr(s.Name, maxW)
}
}
return fmt.Sprintf("#%d", monitorID)
@@ -97,13 +101,14 @@ func (m Model) viewMaintTab() string {
{"#", "#", 4, 4, false},
{"TITLE", "TITLE", 12, 28, true},
{"TYPE", "TYPE", 13, 14, false},
{"MON", "MONITORS", 13, 20, false},
{"MON", "MONITORS", 15, 22, false},
{"STATUS", "STATUS", 11, 12, false},
{"START", "STARTED", 10, 16, false},
{"ENDS", "ENDS", 10, 16, false},
{"START", "STARTED", 14, 16, false},
{"ENDS", "ENDS", 14, 16, false},
}
headers, widths := m.computeTableLayout(cols, 0)
titleW := widths[1]
monW := widths[3]
return m.renderTable(
headers,
@@ -117,7 +122,7 @@ func (m Model) viewMaintTab() string {
strconv.Itoa(i + 1),
m.zones.Mark(fmt.Sprintf("maint-%d", i), limitStr(mw.Title, titleW-2)),
fmtMaintType(mw.Type),
fmtMaintMonitor(mw.MonitorID, allSites),
fmtMaintMonitorW(mw.MonitorID, allSites, monW-2),
fmtMaintStatus(mw),
fmtMaintTime(mw.StartTime),
fmtMaintTime(mw.EndTime),