Commit Graph

5 Commits

Author SHA1 Message Date
lerko 9e15b369d3 fix(tui): wire up [e] edit key in detail panel
CI / test (pull_request) Successful in 2m38s
CI / lint (pull_request) Successful in 56s
CI / vulncheck (pull_request) Successful in 46s
CI / test (push) Successful in 2m40s
CI / lint (push) Successful in 56s
CI / vulncheck (push) Successful in 51s
The detail panel footer showed [e] Edit but handleDetailKey had no
case for it. Route to handleEditItem() like the dashboard does.
2026-06-04 12:36:24 -04:00
lerko 5b39be8eb2 fix(tui): broken tick chain after form/dialog + retries off-by-one
CI / test (pull_request) Successful in 2m43s
CI / lint (pull_request) Successful in 56s
CI / vulncheck (pull_request) Successful in 51s
Update() routed form and confirm-delete states before handling
time.Time ticks, so those handlers swallowed the tick command and
permanently broke the refresh loop. After opening any form or
delete dialog, the TUI stopped auto-refreshing until restarted.

Move time.Time and WindowSizeMsg handling before state dispatch
so ticks always fire regardless of view state.

Also fix fmtRetries off-by-one: FailureCount=1 displayed as 0/N
instead of 1/N due to an erroneous subtract-one.
2026-06-04 12:34:10 -04:00
lerko 1d1f5d0ee4 fix(tui): resolve staticcheck lint errors in history view
CI / test (pull_request) Successful in 2m39s
CI / lint (pull_request) Successful in 51s
CI / vulncheck (pull_request) Successful in 51s
- Replace deprecated LineUp/LineDown/HalfViewUp/HalfViewDown with
  ScrollUp/ScrollDown/HalfPageUp/HalfPageDown
- Use tagged switch for mouse button dispatch
- Use fmt.Fprintf instead of WriteString(Sprintf)
2026-06-03 20:22:41 -04:00
lerko bc661f5207 feat(tui): add state change history view with outage duration
CI / test (pull_request) Successful in 2m30s
CI / lint (pull_request) Failing after 51s
CI / vulncheck (pull_request) Successful in 46s
Full-screen scrollable history view accessible via [h] from detail
panel. Shows all state transitions with computed outage durations,
event density sparkline for flapping detection, and summary stats.

- Detail panel STATE CHANGES now shows outage duration per recovery
- Event density sparkline highlights flapping periods
- Summary footer: event count, outage count, avg outage duration
- Vim-style navigation (j/k/g/G) + mouse scroll in history view
2026-06-03 19:49:10 -04:00
lerko 5d362fdbe6 refactor(tui): decompose god files into single-concern modules
CI / test (pull_request) Successful in 2m34s
CI / lint (pull_request) Successful in 56s
CI / vulncheck (pull_request) Successful in 51s
CI / test (push) Successful in 2m32s
CI / lint (push) Successful in 56s
CI / vulncheck (push) Successful in 51s
tui.go (1032→164) and tab_sites.go (993→482) violated "small functions"
and "testable in isolation" standards. Extracted 6 new files by concern:

- format.go: pure formatting functions (fmtLatency, fmtUptime, etc.)
- sparkline.go: sparkline rendering (latency, heartbeat, group)
- update.go: Update method decomposed into 15 named handlers
- view_dashboard.go: View, dashboard composition, tab bar, footer
- view_detail.go: site detail panel
- data.go: data refresh with extracted sortSitesForDisplay/filterSites

Added 17 unit tests for the newly-testable pure functions covering
format, sparkline, sort ordering, and filter logic. No behavioral
changes — strict move-and-extract refactor.
2026-06-02 21:06:30 -04:00