feat(dash): scrollbars on scrolling panels, with click-and-drag - #92
Conversation
Job output was forwarded verbatim, so carriage-return progress redraws (pip/tqdm/huggingface) accumulated into one long horizontal line. Keep only the segment after the last CR at ingest, and show an animated braille spinner plus the parsed percentage in the running-job header, driven by a per-tick counter on the ~250ms repaint loop. Adds a pure `ui::spinner` module (frame + percent parsing) with unit tests and a CR-collapse test. Signed-off-by: Michael Roy <michael.roy@amd.com>
Panels gave no sign when content overflowed. Add reusable `panel::vertical_scrollbar` / `horizontal_scrollbar` helpers (no-op when content fits, else draw a bar and return the shrunk content rect) and wire them into the job console (V+H), the LOGS dock, bench detail, chat transcript, and the list managers. Scrollbars are also click-and-drag: each drawn bar records a hit-test handle; a click on a track jumps to that position and arms a drag that keeps tracking the pointer until release (inverting the tail-anchored dock). Also clamps the job console's horizontal offset against the widest line. Stacked on the progress-spinner branch (shared job-console render path). Signed-off-by: Michael Roy <michael.roy@amd.com>
rominf
left a comment
There was a problem hiding this comment.
LGTM. Shared scrollbar helper (no duplicated math), correct clamping (saturating_sub; div-by-zero guarded by max_pos == 0 / span <= 1 early returns), proportional offset math, no panics. Verified drag-when-bar-disappears, DockLogs tail-anchored inversion, and last-track-cell → max_pos mapping against the included unit tests.
Two minor notes:
- Horizontal drag clamps to
content_w - vbody.widthwhile the keyboard allows one extra column (content_w - 1) — a 1-cell inconsistency in max horizontal offset worth aligning. - The manager-list scrollbars (engine/config/runtime/services/update/automations, folder_browser) render but aren't hit-tested (no
record_scrollbar) and trackselectedrather than the scroll offset — looks intentional for this PR's scope, but the mix of grabbable/non-grabbable bars is a UX rough edge worth a note in the description.
Approving.
|
🔴 Automated review · pr-review-watcher · 2162f28 SummaryAdds reusable vertical/horizontal scrollbar helpers and wires them into the job console, LOGS dock, bench detail, chat transcript, and the seven list managers, with click-and-drag hit-testing for the first four. Verdict: Approve — this is a clean, well-tested change. Verified: 🚫 Blocking (must fix before merge)None. Non-blocking
|
Integrate parent PR #91 (braille progress spinner in the job console), now merged to main as 63b5864, with PR #92's scrollbar + click-and-drag support. Sole conflict in crates/rocm-dash-tui/src/ui/job_console.rs was the draw_job_console doc comment: kept #92's line documenting the returned scrollbar handles. The function body composes both behaviors — the running-job spinner/percentage header (#91) and the vertical/horizontal scrollbar rendering that returns Vec<ScrollbarHandle> for mouse hit-testing (#92). The ui/mod.rs callsite (auto-merged) passes tick_count and records the returned handles for drag hit-testing. Signed-off-by: Michael Roy <michael.roy@amd.com>
Final refresh: bring PR #92 up to main 8308450 (adds #104 decouple vLLM Prometheus scraping from enable_docker, and #97 discover served model for the configured chat endpoint). Clean auto-merge with no conflicts — merge-tree predicted clean and only crates/rocm-dash-tui/src/app/mod.rs was auto-merged (the #97 chat-endpoint change; scrollbar hit-testing code untouched). The scrollbar + braille spinner feature is unchanged: job_console.rs, ui/panel.rs and ui/spinner.rs are byte-identical to the prior branch head. Signed-off-by: Michael Roy <michael.roy@amd.com>
What
Panels gave no visual sign when their content overflowed, and there was no way to grab a scrollbar with the mouse.
panel::vertical_scrollbar/horizontal_scrollbarhelpers: no-op when content fits, otherwise draw a bar and return the shrunk content rect.Excluded on purpose: the list managers' bars are drag-to-jump-selection would be awkward (they're driven by
ListStateselection), so those show a bar but aren't draggable. Easy follow-on.Tests
panel::tests: no-op-when-fits, shrink-on-overflow (V and H).app::tests: proportional position mapping, full grab → drag → release cycle, dock inversion.--test-threads=1), clippy-D warningsclean.Notes
Part 2 of 3. Stacked on #91 (both touch the
draw_job_consolesignature / call site) — please merge #91 first, then this retargets tomain.