Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support to change spinner text using event updates #2944

Merged
merged 17 commits into from
Oct 28, 2022

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.

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
changelog.md Outdated Show resolved Hide resolved
ignite/pkg/cliui/cliui.go Outdated Show resolved Hide resolved
ignite/pkg/events/events.go Outdated Show resolved Hide resolved
ignite/services/chain/build.go Show resolved Hide resolved
ignite/services/chain/init.go Outdated Show resolved Hide resolved
ignite/cmd/generate_go.go Outdated Show resolved Hide resolved
Co-authored-by: Alex Johnson <[email protected]>
Co-authored-by: Lucas Bertrand <[email protected]>
lumtis
lumtis previously approved these changes Oct 24, 2022
changelog.md Outdated Show resolved Hide resolved
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.

3 participants