Skip to content

Conversation

@jeronimoalbi
Copy link
Member

@jeronimoalbi jeronimoalbi commented Oct 19, 2022

This PR adds spinner progress update to events for proper spinner interactions.

A spinner has a text next to the spinning animation which communicates the current status or progress. Once the spinner is started it can be updated to display a new text or stopped by using event options when sending the events though the event bus. There are three status update options:

  • events.ProgressStart()
  • events.ProgressUpdate()
  • events.ProgressFinish()

The spinner and its current text are removed when a finish event is received thought the event bus and replaced by the finished event text.

Text that should not be removed must be printed directly using the Session instance, sent thought the event bus without the ProgressStart or ProgressUpdate options, or sent using a finish event.

The PR also adds the new session option StartSpinnerWithText to start the spinner with a custom text to avoid an extra call to session.StartSpinner() right after the session is created.

jeronimoalbi added 4 commits October 19, 2022 14:04
This change allows to print event texts that will be removed when the
spinner stops or when another event status update text is printed.
This is required so the event updates are cleared once another event
update is received or when the spinner stops.
@jeronimoalbi jeronimoalbi added the type:new To implement new feature. label Oct 19, 2022
@jeronimoalbi jeronimoalbi self-assigned this Oct 19, 2022
@jeronimoalbi jeronimoalbi added the skip-changelog Don't check changelog for new entries label Oct 19, 2022
@jeronimoalbi jeronimoalbi removed the skip-changelog Don't check changelog for new entries label Oct 20, 2022
@jeronimoalbi jeronimoalbi marked this pull request as ready for review October 23, 2022 14:37
Co-authored-by: Alex Johnson <[email protected]>
Co-authored-by: Lucas Bertrand <[email protected]>
lumtis
lumtis previously approved these changes Oct 24, 2022
aljo242
aljo242 previously approved these changes Oct 28, 2022
Copy link
Contributor

@aljo242 aljo242 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just fix changelog and we can merge

@aljo242 aljo242 merged commit d942df8 into develop Oct 28, 2022
@aljo242 aljo242 deleted the feat/improve-spinner-events branch October 28, 2022 14:12
Jchicode pushed a commit to Jchicode/cli that referenced this pull request Aug 9, 2023
…2944)

* refactor: change `StartSpinner` option to receive an optional text

* feat: add progress update support for events and session print loop

This change allows to print event texts that will be removed when the
spinner stops or when another event status update text is printed.

* refactor: add `ProgressUpdate` to some of the events

This is required so the event updates are cleared once another event
update is received or when the spinner stops.

* refactor: rename event progress options

* feat: add `cliui.StartSpinnerWithText` option to session

* test: add test for event update

* chore: update changelog

* chore: updated some network commands to use progress update

* chore: review corrections

Co-authored-by: Alex Johnson <[email protected]>
Co-authored-by: Lucas Bertrand <[email protected]>

* chore: update changelog

Co-authored-by: Alex Johnson <[email protected]>
Co-authored-by: Lucas Bertrand <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:new To implement new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants