fix(tui): track selection by site ID + q means back everywhere #113

Merged
lerko merged 1 commits from fix/tui-cursor-navigation into main 2026-06-12 00:16:43 +00:00
Owner

Summary

Two TUI behavior fixes from the review-findings backlog.

1. Cursor tracks site ID instead of position
The site list re-sorts every tick (status changes move items). Previously m.cursor was a positional index — when a site changed status, the selection silently jumped to whatever now occupied that position. Now selectedID is stored alongside the cursor; after each refresh+sort, the cursor resolves back to the same site.

2. q = back in all sub-views

  • Detail view: q returns to dashboard (was: quit app)
  • Alert detail: q returns to dashboard (was: quit app)
  • History/SLA: q already returned to detail (unchanged)
  • Dashboard: q still quits (the only place it should)
  • ctrl+c always quits from anywhere (unchanged)

Help bars updated: detail shows [q/Esc] Back instead of [q] Quit. Alert detail same.

Test plan

  • go test -count=1 ./... — all pass
  • golangci-lint — 0 issues
## Summary Two TUI behavior fixes from the review-findings backlog. **1. Cursor tracks site ID instead of position** The site list re-sorts every tick (status changes move items). Previously `m.cursor` was a positional index — when a site changed status, the selection silently jumped to whatever now occupied that position. Now `selectedID` is stored alongside the cursor; after each refresh+sort, the cursor resolves back to the same site. **2. q = back in all sub-views** - Detail view: `q` returns to dashboard (was: quit app) - Alert detail: `q` returns to dashboard (was: quit app) - History/SLA: `q` already returned to detail (unchanged) - Dashboard: `q` still quits (the only place it should) - `ctrl+c` always quits from anywhere (unchanged) Help bars updated: detail shows `[q/Esc] Back` instead of `[q] Quit`. Alert detail same. ## Test plan - [x] `go test -count=1 ./...` — all pass - [x] `golangci-lint` — 0 issues
lerko added 1 commit 2026-06-12 00:07:14 +00:00
fix(tui): track selection by site ID + q means back everywhere
CI / test (pull_request) Successful in 2m5s
CI / lint (pull_request) Successful in 1m26s
CI / vulncheck (pull_request) Successful in 1m2s
fa56f47f96
Cursor tracked by site ID instead of positional index. When the
list re-sorts every tick (sites change status), the selection stays
on the same monitor instead of silently jumping to whatever now
occupies that index position.

q now means "back" in detail, history, SLA, and alert-detail views
— consistent with muscle memory from navigating deeper views.
Only the dashboard q quits the app. ctrl+c always quits from
anywhere.
lerko merged commit fa56f47f96 into main 2026-06-12 00:16:43 +00:00
lerko deleted branch fix/tui-cursor-navigation 2026-06-12 00:16:44 +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#113