chore(tui): visual polish — detail sections, column headers, alert detail (#37)
## Summary Bundled remaining UX polish items from the screenshot review. ### Changes **Detail panel sections (#5)** - Fields grouped into ENDPOINT, TIMING, HTTP, CONFIG sections with subtle headers - Matches existing PROBE RESULTS and STATE CHANGES section pattern - Cleaner visual hierarchy without box-drawing clutter **Omit unconfigured fields (#6)** - Timeout hidden when 0 (unconfigured) - Method hidden when default GET - AcceptedCodes shows "200-299" explicitly when empty **Column header (#7)** - `LATENCY` → `LAT` (design short, never truncate — htop/btop pattern) **Alert detail view (#8)** - `i` key on Alerts tab opens full detail panel - Shows: type, health status, last sent time, send/fail counts, last error - Full config key:value pairs (untruncated) - Keybinding: `[i/Esc] Back [e] Edit [t] Test [q] Quit` ### Files (3) - `internal/tui/tab_sites.go` — section headers, field omission, LAT header - `internal/tui/tab_alerts.go` — viewAlertDetailPanel() - `internal/tui/tui.go` — stateAlertDetail, key handler, render routing Reviewed-on: lerko/uptop#37
This commit was merged in pull request #37.
This commit is contained in:
@@ -15,6 +15,12 @@ var (
|
||||
|
||||
type StyleOverride func(row, col int) *lipgloss.Style
|
||||
|
||||
const wideBreakpoint = 120
|
||||
|
||||
func (m Model) isWide() bool {
|
||||
return m.termWidth >= wideBreakpoint
|
||||
}
|
||||
|
||||
func (m Model) renderTable(headers []string, items int, buildRows func(start, end int) [][]string, colWidths []int, styleOverride StyleOverride) string {
|
||||
if items == 0 {
|
||||
return ""
|
||||
@@ -28,7 +34,16 @@ func (m Model) renderTable(headers []string, items int, buildRows func(start, en
|
||||
selectedVisual := m.cursor - m.tableOffset
|
||||
rows := buildRows(m.tableOffset, end)
|
||||
|
||||
tableWidth := m.termWidth - chromePadH - 2
|
||||
colTotal := 0
|
||||
for _, w := range colWidths {
|
||||
colTotal += w
|
||||
}
|
||||
borderOverhead := 2 + len(colWidths) - 1
|
||||
tableWidth := colTotal + borderOverhead
|
||||
maxWidth := m.termWidth - chromePadH - 2
|
||||
if tableWidth > maxWidth {
|
||||
tableWidth = maxWidth
|
||||
}
|
||||
if tableWidth < 40 {
|
||||
tableWidth = 40
|
||||
}
|
||||
@@ -41,7 +56,11 @@ func (m Model) renderTable(headers []string, items int, buildRows func(start, en
|
||||
Rows(rows...).
|
||||
StyleFunc(func(row, col int) lipgloss.Style {
|
||||
if row == table.HeaderRow {
|
||||
return tableHeaderStyle
|
||||
h := tableHeaderStyle
|
||||
if col < len(colWidths) && colWidths[col] > 0 {
|
||||
h = h.Width(colWidths[col]).MaxWidth(colWidths[col])
|
||||
}
|
||||
return h
|
||||
}
|
||||
isSelected := row == selectedVisual
|
||||
if styleOverride != nil {
|
||||
@@ -51,7 +70,7 @@ func (m Model) renderTable(headers []string, items int, buildRows func(start, en
|
||||
style = tableSelectedStyle.Foreground(s.GetForeground())
|
||||
}
|
||||
if col < len(colWidths) && colWidths[col] > 0 {
|
||||
style = style.Width(colWidths[col])
|
||||
style = style.Width(colWidths[col]).MaxWidth(colWidths[col])
|
||||
}
|
||||
return style
|
||||
}
|
||||
@@ -64,7 +83,7 @@ func (m Model) renderTable(headers []string, items int, buildRows func(start, en
|
||||
base = tableSelectedStyle
|
||||
}
|
||||
if col < len(colWidths) && colWidths[col] > 0 {
|
||||
base = base.Width(colWidths[col])
|
||||
base = base.Width(colWidths[col]).MaxWidth(colWidths[col])
|
||||
}
|
||||
return base
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user