feat(tui): add state change history view with outage duration #55

Merged
lerko merged 5 commits from feat/state-history-view into main 2026-06-04 16:44:32 +00:00
Owner

Summary

  • Full-screen scrollable state change history view, accessible via [h] from detail panel
  • Computes and displays outage duration for each DOWN→UP recovery transition
  • Event density sparkline at top reveals flapping periods at a glance
  • Summary footer: total events, outage count, average outage duration
  • Vim-style navigation (j/k/g/G/pgup/pgdown) + mouse scroll

Visual

Detail panel (enhanced):

  STATE CHANGES
  DOWN → UP   3h ago   outage 12m
  UP → DOWN   3h ago   connection refused
  [h] History

History view:

  STATE HISTORY: My API Server                             [q] Back
  ────────────────────────────────────────────────────────────────────
  ·····▂···▁·····▅···▁·····                        ← event density
  ────────────────────────────────────────────────────────────────────
  TIME              TRANSITION       DURATION    REASON
  2026-06-03 14:22  DOWN → UP        outage 8m
  2026-06-03 14:14  UP → DOWN                    connection refused
  ────────────────────────────────────────────────────────────────────
  4 events │ 2 outages │ avg outage 1h 4m

Test plan

  • go build ./... passes
  • go test ./... — all pass, 0 regressions
  • 12 new test cases: TestComputeOutageDuration, TestComputeHistoryStats, TestStateChangeSparkline
  • Manual TUI: open detail panel, verify outage durations, press [h], scroll history, verify sparkline
## Summary - Full-screen scrollable state change history view, accessible via `[h]` from detail panel - Computes and displays outage duration for each DOWN→UP recovery transition - Event density sparkline at top reveals flapping periods at a glance - Summary footer: total events, outage count, average outage duration - Vim-style navigation (j/k/g/G/pgup/pgdown) + mouse scroll ## Visual **Detail panel (enhanced):** ``` STATE CHANGES DOWN → UP 3h ago outage 12m UP → DOWN 3h ago connection refused [h] History ``` **History view:** ``` STATE HISTORY: My API Server [q] Back ──────────────────────────────────────────────────────────────────── ·····▂···▁·····▅···▁····· ← event density ──────────────────────────────────────────────────────────────────── TIME TRANSITION DURATION REASON 2026-06-03 14:22 DOWN → UP outage 8m 2026-06-03 14:14 UP → DOWN connection refused ──────────────────────────────────────────────────────────────────── 4 events │ 2 outages │ avg outage 1h 4m ``` ## Test plan - [x] `go build ./...` passes - [x] `go test ./...` — all pass, 0 regressions - [x] 12 new test cases: `TestComputeOutageDuration`, `TestComputeHistoryStats`, `TestStateChangeSparkline` - [x] Manual TUI: open detail panel, verify outage durations, press `[h]`, scroll history, verify sparkline
lerko added 1 commit 2026-06-03 23:50:37 +00:00
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
bc661f5207
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
lerko added 1 commit 2026-06-04 00:22:43 +00:00
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
1d1f5d0ee4
- 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)
lerko added 1 commit 2026-06-04 16:23:07 +00:00
fix(monitor): trigger immediate recheck after site config edit
CI / test (pull_request) Successful in 2m32s
CI / lint (pull_request) Successful in 1m1s
CI / vulncheck (pull_request) Successful in 51s
eb9546c97e
Monitor goroutine slept for the full check interval after a config
edit, so hostname/URL changes wouldn't take effect until the next
scheduled check. Added per-site recheck channel that wakes the
goroutine immediately when UpdateSiteConfig is called.
lerko added 1 commit 2026-06-04 16:34:12 +00:00
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
5b39be8eb2
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.
lerko added 1 commit 2026-06-04 16:36:26 +00:00
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
9e15b369d3
The detail panel footer showed [e] Edit but handleDetailKey had no
case for it. Route to handleEditItem() like the dashboard does.
lerko merged commit 9e15b369d3 into main 2026-06-04 16:44:32 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lerkolabs/uptop#55