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

[dashboard] Add alert when user deleting root level tab #5771

Merged

Conversation

graceguo-supercat
Copy link

@graceguo-supercat graceguo-supercat commented Aug 29, 2018

one user reported that while she was editing dashboard, she accidentally deleted a root-level tab, but she didn't notice the action. She saved all the changes, but later she found the loss is big.
So we want to add a alert when user deleting a root level tab. The tab will be removed after user confirm. The removed tab can still be recovered from undo.

Step 1
screen shot 2018-08-29 at 11 08 05 am

Step 2
before: tab is deleted.
after:
screen shot 2018-09-04 at 10 57 50 am

@graceguo-supercat graceguo-supercat changed the title [dashboard] Add alert on user delete root level tab [dashboard] Add alert when user deleting root level tab Aug 29, 2018
@williaster
Copy link
Contributor

@graceguo-supercat great change!

A couple of aesthetic comments:

  • there looks like there's double padding between the buttons, could we cut it in half?
  • could we update the messaging to the following (minor tweaks, I don't think the warning/note keywords are needed since we're using a modal):

"""
Delete dashboard tab?

Deleting a tab will remove all content within it. You may still reverse this action with the undo button (...+ z) until you save your changes.
"""

@codecov-io
Copy link

codecov-io commented Aug 29, 2018

Codecov Report

Merging #5771 into master will increase coverage by 0.01%.
The diff coverage is 76.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5771      +/-   ##
==========================================
+ Coverage   63.78%   63.79%   +0.01%     
==========================================
  Files         364      365       +1     
  Lines       23111    23138      +27     
  Branches     2587     2591       +4     
==========================================
+ Hits        14741    14762      +21     
- Misses       8355     8361       +6     
  Partials       15       15
Impacted Files Coverage Δ
...ts/src/dashboard/components/gridComponents/Tab.jsx 82.43% <100%> (-3.87%) ⬇️
superset/assets/src/components/ModalTrigger.jsx 97.22% <100%> (+0.16%) ⬆️
.../src/dashboard/components/menu/WithPopoverMenu.jsx 82.45% <50%> (+0.31%) ⬆️
.../src/dashboard/components/DeleteComponentModal.jsx 86.95% <86.95%> (ø)

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 8a4b1b7...3cf7f60. Read the comment docs.

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

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

This looks great to me with the exception of the messaging/aesthetic tweaks I suggested!

<div className="delete-component-modal">
<div>
<p />
<b>Warning:</b> If you delete this dashboard tab all content
Copy link
Contributor

Choose a reason for hiding this comment

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

see my comments about updated messaging

className: PropTypes.string,
label: PropTypes.string,
};

const defaultProps = {
className: null,
label: null,
onClick: () => true,
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm this is a little strange, but I guess is okay. Is this preferred so you don't have to set styles on a simple <div className="fa fa-trash" />?

Copy link
Author

@graceguo-supercat graceguo-supercat Aug 31, 2018

Choose a reason for hiding this comment

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

i wanted to re-use IconButton component to save some styling work. I only need that icon as a trigger to show modal, and ModalTrigger will bind onClick event listener.

but right now i feel should not change IconButton original behavior, which always required a callback. So i just use regular <div> as trigger component.

@@ -36,19 +37,19 @@ class WithPopoverMenu extends React.PureComponent {

componentWillReceiveProps(nextProps) {
if (nextProps.editMode && nextProps.isFocused && !this.state.isFocused) {
document.addEventListener('click', this.handleClick, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah still can't remember why I added these 🤷‍♀️

margin: 40px 0 12px 0;

.btn {
margin-right: 24px;
Copy link
Contributor

Choose a reason for hiding this comment

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

could we cut this in half?

Copy link
Author

Choose a reason for hiding this comment

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

i fixed padding, message text, and a few modal CSS. please see the updated attachment.

@williaster
Copy link
Contributor

@graceguo-supercat here's more details about my margin suggestions, let me know if it doesn't make sense. basically I think we should have consistent "pink" sized padding everywhere.

screen shot 2018-08-29 at 12 23 29 pm

@elibrumbaugh
Copy link

Thanks for your aestheic suggestions @williaster!

@graceguo-supercat could we remove the command symbol and instead write cmd? After thinking it over I'm worried that this will be confusing for Windows users.

The command cmd key on Mac is widely understood to be control on Windows. However the symbol for command is not widely understood.

@graceguo-supercat
Copy link
Author

i updated code per comments, and attached new screenshot. please take a look. Thanks @elibrumbaugh @williaster

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

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

looks great, thanks @graceguo-supercat 🙌 🚢

@graceguo-supercat graceguo-supercat merged commit 0c98ecb into apache:master Sep 6, 2018
@graceguo-supercat graceguo-supercat deleted the gg-DeleteTabAlert branch September 6, 2018 17:24
graceguo-supercat pushed a commit to graceguo-supercat/superset that referenced this pull request Sep 13, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Oct 29, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Nov 2, 2018
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Nov 2, 2018
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 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 🚢 0.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants