Add elapsed time display to spinners#4697
Add elapsed time display to spinners#4697anton-107 wants to merge 1 commit intossh-connect-ux-spinnersfrom
Conversation
9b4dc5d to
f5a32d5
Compare
Add TrackElapsedTime() method to the spinner that shows a running MM:SS stopwatch next to the spinner message. The time updates on every spinner tick (200ms). Enable it for all SSH connect spinners so users can see how long each step has been running. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
284aa8e to
c8eceee
Compare
|
Commit: c8eceee
16 interesting tests: 7 SKIP, 6 RECOVERED, 3 flaky
Top 22 slowest tests (at least 2 minutes):
|
| return m.spinner.View() | ||
| if !m.startTime.IsZero() { | ||
| elapsed := time.Since(m.startTime) | ||
| result += fmt.Sprintf(" %02d:%02d", int(elapsed.Minutes()), int(elapsed.Seconds())%60) |
There was a problem hiding this comment.
What happens if there is no suffix yet?
| spinner bubblespinner.Model | ||
| suffix string | ||
| quitting bool | ||
| startTime time.Time // non-zero when elapsed time display is enabled |
There was a problem hiding this comment.
I recommend composing this as a "time spinner" that wraps this spinner and adds the time when View() is called. Then construct it with NewTimeSpinner.
There was a problem hiding this comment.
This suggestion is prob overkill.
Re: the feature, I think doing prefixing instead of suffixing makes more sense because it won't jump around as updates happen. Second, the time can be initialized at construction time instead of a separate method, and then the time prefix as an option to the spinner at construction time.
simonfaltum
left a comment
There was a problem hiding this comment.
[Agent Swarm Review] Verdict: Approved
- 0 Critical
- 0 Major
- 0 Gap
- 1 Nit
- 0 Suggestion
Clean addition of elapsed time tracking to spinners. The TrackElapsedTime() method is well-integrated into the Bubble Tea model. Minor note: the MM:SS format doesn't handle hours, but SSH connect operations shouldn't take that long.
Summary
TrackElapsedTime()method to the spinner that shows a runningMM:SSstopwatch next to the spinner messageExample output:
⣾ Starting SSH server... (task: PENDING) 00:15Stacked on #4694
Test plan
databricks ssh connect --cluster <id>and verify elapsed time appears and ticks next to each spinnerTrackElapsedTime()) are unaffected🤖 Generated with Claude Code