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

fix: clear 'delete' confirmation #17345

Merged
merged 2 commits into from
Nov 4, 2021
Merged

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Nov 4, 2021

SUMMARY

Currently <DeleteModal/> does not clear the "delete" confirmation after a deletion. This means that:

  1. User selects charts using "bulk select"
  2. User clicks "DELETE"
  3. User types "delete" to confirm
  4. Charts are deleted
  5. User selects more charts using "bulk select"
  6. User clicks "DELETE"
  7. The modal shows up with the "delete" confirmation is already populated!

I changed the component so that the text in the <Input/> component is managed, clearing it when the modal is hidden or after a delete.

I also changed it so that users can press "return" to delete, once they've confirmed, instead of forcing users to click the button.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

bulk_delete_before.mov

After:

bulk_delete_after.mov

TESTING INSTRUCTIONS

Adding tests.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Nov 4, 2021

Codecov Report

Merging #17345 (17d6aab) into master (1fbce88) will increase coverage by 0.00%.
The diff coverage is 85.71%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #17345   +/-   ##
=======================================
  Coverage   77.13%   77.14%           
=======================================
  Files        1036     1036           
  Lines       55729    55740   +11     
  Branches     7627     7628    +1     
=======================================
+ Hits        42989    42998    +9     
- Misses      12484    12486    +2     
  Partials      256      256           
Flag Coverage Δ
javascript 71.42% <85.71%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rset-frontend/src/components/DeleteModal/index.tsx 92.00% <85.71%> (-8.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fbce88...17d6aab. Read the comment docs.


const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const targetValue = event.target.value ?? '';
setDisableChange(targetValue.toUpperCase() !== t('DELETE'));
Copy link
Member

@eschutho eschutho Nov 4, 2021

Choose a reason for hiding this comment

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

this is a tricky thing.. so we would need to have a translation for the capitalized text and the lowercase?
I wonder if t('delete').toUpperCase() would work. (I see that this isn't new code, so it's prob fine to leave as is. It just got me thinking.)

Copy link
Member Author

Choose a reason for hiding this comment

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

@eschutho this used to be much worse... before it didn't have the t() call, so we'd ask people in a different language, Por favor digite "apagar" para confirmar, but expected "delete" to unblock the dialog...

Copy link
Member

Choose a reason for hiding this comment

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

Ha, yeah I remember when you noticed that. :)

@betodealmeida betodealmeida merged commit 43f4ab8 into apache:master Nov 4, 2021
@eschutho eschutho added the v1.4 label Nov 22, 2021
eschutho pushed a commit that referenced this pull request Nov 22, 2021
* fix: clear 'delete' confirmation

* Add tests

(cherry picked from commit 43f4ab8)
AAfghahi pushed a commit that referenced this pull request Jan 10, 2022
* fix: clear 'delete' confirmation

* Add tests
@mistercrunch mistercrunch added 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M v1.4 🍒 1.4.0 🍒 1.4.1 🍒 1.4.2 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants