Skip to content

feat: Add visual feedback on Remove and Discard changes dialogs - #7029

Merged
iAmWillShepherd merged 4 commits into
desktop:developmentfrom
vhashimotoo:happy-little-spinners
Mar 18, 2019
Merged

iAmWillShepherd merged 4 commits into
desktop:developmentfrom
vhashimotoo:happy-little-spinners

Conversation

@vhashimotoo

@vhashimotoo vhashimotoo commented Mar 7, 2019 •

Copy link
Copy Markdown
Contributor

Overview

Closes #7015

Description

  • Added spinners and disables button when "Remove Repository" and "Discard changes" dialogs have a action.

Discarding:
discarding

Removing:
removing repo

Release notes

Notes: [Improved?] "Remove" and "Discard changes" dialogs show visual effects on action

@billygriffin

Copy link
Copy Markdown
Contributor

@HashimotoYT Thanks for the PR! Is this ready for review?

@billygriffin

Copy link
Copy Markdown
Contributor

@HashimotoYT Also, quick question on the discard changes: does this also trigger the spinner when you're just discarding a selection of changes. In other words, if I have 10 changes and I've selected 5 of them to discard, does the spinner show up?

@vhashimotoo

vhashimotoo commented Mar 7, 2019 •

Copy link
Copy Markdown
Contributor Author

@billygriffin Spinner shows anyways, discarding selected files shows same Dialog component, and yes this is ready for review 🍿.

@billygriffin billygriffin added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Mar 7, 2019
@shiftkey

shiftkey commented Mar 7, 2019

Copy link
Copy Markdown
Member

@HashimotoYT another example to test out as part of this would be discarding thousands of files (renaming node_modules to something that isn't covered by .gitignore would be a good way to get that). How does discarding that many files look within the app?

@tierninho

Copy link
Copy Markdown
Contributor

Tested and LGTM 👍

@vhashimotoo

Copy link
Copy Markdown
Contributor Author

It works as planned (tested on e/electronjs.org node_modules, 53k), spinner spinning, discard button doesn't work, Cancel works as well. But on canceling, app starts hanging. GIF:

1

@tierninho

Copy link
Copy Markdown
Contributor

@HashimotoYT Thanks for surfacing this. The Cancel button should be disabled if the user clicks the Discard button.

@iAmWillShepherd iAmWillShepherd self-assigned this Mar 8, 2019
@vhashimotoo

Copy link
Copy Markdown
Contributor Author

The Cancel button should be disabled if the user clicks the Discard button.

@tierninho Hm... 🤔 Disabling Cancel button does not make dialog impossible to exit, the user can use x mark or click somewhere on free space behind dialog for close. Can please give some cause why dialog should be not dismissable manually?

@iAmWillShepherd iAmWillShepherd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a few tweaks needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we need to add the following attribute to the Cancel button: disabled={this.state.isDiscardingChanges}.

@njbmartin

Copy link
Copy Markdown

So this is where it gets a bit complicated. Cancelling the dialog doesn't actually cancel the action (yet?), but as a user I would expect it to.

@vhashimotoo

Copy link
Copy Markdown
Contributor Author

@iAmWillShepherd changes made

@iAmWillShepherd

Copy link
Copy Markdown
Contributor

You are right, cancelling the dialog won't cancel the action. Cancelling an in-progress discard is a non-trivial thing to do with how the discard logic works in the application right now and we’d prefer to focus on getting this change in which will at least provide some feedback while the discard is running and since we’re not going to be able to cancel the operation, we feel like it would be confusing if the cancel button remains enabled after discarding has begun. That's why our opinion is that we should disable the Cancel button to ensure it's clear what's happening.

If we did cancel an operation while it's running, doing so would put your repository in an unclear state depending on what percentage of the operation was completed. In this case, especially since you're already in a confirm dialog, our assumption is that once a user has clicked confirm to begin the operation, that's it.

The Cancel button here is really about whether you want to start the operation in the first place. Note that the Cancel button is enabled and displayed before confirming, but sticks around after confirmation is made. I can see how that button remaining visible after confirming changes the semantics behind it.

The dialog component actually has a prop to make it not-dismissible:

readonly dismissable?: boolean

And a prop to disable all buttons within it:

readonly disabled?: boolean

Using ☝️ means we don't have to modify that ourselves, instead relying on the component to do it.

@iAmWillShepherd iAmWillShepherd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use the built-in functionality of the Dialog component.

@iAmWillShepherd
iAmWillShepherd merged commit fa27067 into desktop:development Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

confirmation dialog shows no visual feedback when performing an action

6 participants