Compare commits

1 Commits

Author SHA1 Message Date
lerko bcb2678a20 refactor(tui): consistent chrome across all views
CI / test (pull_request) Successful in 2m42s
CI / lint (pull_request) Successful in 56s
CI / vulncheck (pull_request) Successful in 41s
- Extract divider() and emptyState() helpers to format.go
- All empty states now use bordered box with accent color
- Detail and alert detail panels get header/section dividers
- SLA label width 14→16 to match detail/alert panels
- Logs key hints moved from content to dashboard footer
- History/SLA panels use shared divider helper
2026-06-04 15:08:29 -04:00
6 changed files with 11 additions and 17 deletions
+2 -2
View File
@@ -413,7 +413,7 @@ func runServe(args []string) {
sshSrv := startSSHServer(*port, s, eng, kc) sshSrv := startSSHServer(*port, s, eng, kc)
if isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd()) { if isatty.IsTerminal(os.Stdout.Fd()) || isatty.IsCygwinTerminal(os.Stdout.Fd()) {
p := tea.NewProgram(tui.InitialModel(true, s, eng, version), tea.WithAltScreen(), tea.WithMouseCellMotion()) p := tea.NewProgram(tui.InitialModel(true, s, eng), tea.WithAltScreen(), tea.WithMouseCellMotion())
if _, err := p.Run(); err != nil { if _, err := p.Run(); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err) fmt.Fprintf(os.Stderr, "error: %v\n", err)
} }
@@ -449,7 +449,7 @@ func startSSHServer(port int, db store.Store, eng *monitor.Engine, kc *keyCache)
}), }),
wish.WithMiddleware( wish.WithMiddleware(
bm.Middleware(func(s ssh.Session) (tea.Model, []tea.ProgramOption) { bm.Middleware(func(s ssh.Session) (tea.Model, []tea.ProgramOption) {
return tui.InitialModel(false, db, eng, version), []tea.ProgramOption{tea.WithAltScreen(), tea.WithMouseCellMotion()} return tui.InitialModel(false, db, eng), []tea.ProgramOption{tea.WithAltScreen(), tea.WithMouseCellMotion()}
}), }),
), ),
) )
+2 -2
View File
@@ -131,9 +131,9 @@ func (m Model) groupSparkline(groupID int, width int) string {
} }
for _, up := range aggregated { for _, up := range aggregated {
if up { if up {
sb.WriteString(specialStyle.Render("")) sb.WriteString(specialStyle.Render(""))
} else { } else {
sb.WriteString(dangerStyle.Render("")) sb.WriteString(dangerStyle.Render(""))
} }
} }
return sb.String() return sb.String()
+4 -4
View File
@@ -78,13 +78,13 @@ func (m Model) computeLayout() tableLayout {
if nameW < 13 { if nameW < 13 {
nameW = 13 nameW = 13
} }
if nameW > 35 { if nameW > 40 {
nameW = 35 nameW = 40
} }
sparkW := avail - nameW sparkW := avail - nameW
if sparkW < 15 { if sparkW < 10 {
sparkW = 15 sparkW = 10
} }
widths[1] = nameW widths[1] = nameW
-3
View File
@@ -66,9 +66,6 @@ func (m Model) renderTable(headers []string, items int, buildRows func(start, en
if styleOverride != nil { if styleOverride != nil {
if s := styleOverride(row, col); s != nil { if s := styleOverride(row, col); s != nil {
style := *s style := *s
if row%2 == 1 {
style = style.Background(tableZebraStyle.GetBackground())
}
if isSelected { if isSelected {
style = tableSelectedStyle.Foreground(s.GetForeground()) style = tableSelectedStyle.Foreground(s.GetForeground())
} }
+1 -3
View File
@@ -138,10 +138,9 @@ type Model struct {
// demoMode renders a stable status dot instead of the animated pulse so // demoMode renders a stable status dot instead of the animated pulse so
// screenshots/recordings don't capture the spinner mid-frame. Set via UPTOP_DEMO=1. // screenshots/recordings don't capture the spinner mid-frame. Set via UPTOP_DEMO=1.
demoMode bool demoMode bool
version string
} }
func InitialModel(isAdmin bool, s store.Store, eng *monitor.Engine, version string) Model { func InitialModel(isAdmin bool, s store.Store, eng *monitor.Engine) Model {
vpLogs := viewport.New(100, 20) vpLogs := viewport.New(100, 20)
vpLogs.SetContent("Waiting for logs...") vpLogs.SetContent("Waiting for logs...")
z := zone.New() z := zone.New()
@@ -173,7 +172,6 @@ func InitialModel(isAdmin bool, s store.Store, eng *monitor.Engine, version stri
theme: theme, theme: theme,
themeIndex: themeIdx, themeIndex: themeIdx,
demoMode: os.Getenv("UPTOP_DEMO") == "1", demoMode: os.Getenv("UPTOP_DEMO") == "1",
version: version,
} }
} }
+2 -3
View File
@@ -275,10 +275,9 @@ func (m Model) renderFooter(stats dashboardStats) string {
keys = "[T]Theme [Tab]Switch [q]Quit" keys = "[T]Theme [Tab]Switch [q]Quit"
} }
ver := subtleStyle.Render("v" + m.version) footer := "\n" + statusLine + " " + subtleStyle.Render(keys)
footer := "\n" + statusLine + " " + subtleStyle.Render(keys) + " " + ver
if m.filterText != "" && m.currentTab == 0 { if m.filterText != "" && m.currentTab == 0 {
footer = "\n" + subtleStyle.Render(fmt.Sprintf("filter: %s", m.filterText)) + " " + statusLine + " " + subtleStyle.Render(keys) + " " + ver footer = "\n" + subtleStyle.Render(fmt.Sprintf("filter: %s", m.filterText)) + " " + statusLine + " " + subtleStyle.Render(keys)
} }
return footer return footer
} }