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

UI: Confirm Action as a popover #6741

Merged
merged 10 commits into from
May 17, 2019
Merged

UI: Confirm Action as a popover #6741

merged 10 commits into from
May 17, 2019

Conversation

joshuaogle
Copy link
Contributor

Background

Vault stores a lot of sensitive data, so it is generally good to warn a user when an action that they take might have serious consequences. We do this in the UI by giving the user some context around this action and having them confirm that they are sure.

Prior to Vault v1.2, this design was extremely simple, and appeared when the user clicks on a "Delete" button (or "Revoke", or anything similar) on a list row or anywhere else, such as a "show" page

Along come Toolbars

In Vault v1.2, we are introducing the concept of Toolbars to the UI. The Toolbar gives us a consistent way to present page-level actions, including ones that may require confirmation. Unfortunately, the old design for these confirmations doesn't work well with the limited space, so in the HashiCorp Design System we have created a more consistent and clear way to confirm these actions with users, called "Confirm Popovers".

This PR includes the new design for this component, which also gave us an opportunity to write new copy making the actions even clearer to the user. The default popover and copy looks like this:

confirmdelete

Wherever we have clearer context we can provide the user, they would be more customized, like this:
image

Note: We plan to utilize a "sliding menu" similar to the Namespace Picker for use in dropdown menus, but because the default solution in this PR is still very usable, we will tackle that later.

min-width: 0;
padding: 0;
width: 2.5rem;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it might be good to introduce an "Icon button" style rather than do it this way, but this is an easy reset for now

<CopyButton @clipboardText={{auth.currentToken}} class="link" @buttonType="button" @success={{action (set-flash-message 'Token copied!')}}>
Copy token
</CopyButton>
</li>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gathering the "destructive actions" at the bottom of the list, so moving these up

@joshuaogle joshuaogle requested a review from a team May 15, 2019 19:32
Delete role
</ConfirmAction>
{{/if}}
{{#if (or model.canUpdate model.canDelete)}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any idea why the Edit button isn't showing up with just {{#if model.canUpdate}}?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm it should - I think previously it had this because delete was on the edit page. I can take a look.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, it's because the model it's a capabilities object, and the actual attribute is canEdit, so just #if model.canEdit should work here - looks like that's true of other secret models too.

canEdit: alias('updatePath.canUpdate'),

@joshuaogle joshuaogle force-pushed the ui-confirm-action-popover branch from 4383495 to c28d76b Compare May 16, 2019 18:08
@buttonClasses="link is-destroy"
@onConfirmAction={{action "delete" item}}
@confirmTitle="Revoke this cert?"
@confirmMessage="This may affect access to Vault data."
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be true, but we really don't have a way to tell what they're using the certs for (whether it's vault authentication or something else).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about something more generic like "Any services using this cert may be affected."?

I'm trying to give them an idea of the consequences, but certs are a tricky one

Copy link
Contributor

Choose a reason for hiding this comment

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

👌

@buttonClasses="button"
@onConfirmAction={{action "delete"}}
@confirmTitle="Revoke this cert?"
@confirmMessage="This may affect access to Vault data."
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, we don't know how they're using the certs.

<ConfirmAction
@buttonClasses="toolbar-link"
@confirmTitle="Rotate this key?"
@confirmMessage="After rotation, new plaintext requests will be encrypted with the new version of the key."
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we want to mention encryption here because the key may not support encrypt / decrypt. Maybe "After rotation, all key actions will default to using the newest version of the key." ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is the only one I copied word for word from the docs (https://www.vaultproject.io/api/secret/transit/index.html#rotate-key), but I do like the change better. I wonder if we should add that detail there then

buttonClasses="link is-destroy"
onConfirmAction=(action "delete" item)
confirmMessage=(concat "Are you sure you want to delete " item.id "?")
showConfirm=(get this (concat "shouldDelete-" (dot-to-dash item.id)))
Copy link
Contributor

Choose a reason for hiding this comment

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

👏 nice cleanup here!

@@ -26,16 +26,5 @@
Cancel
{{/secret-link}}
</div>
{{#if (and (eq mode 'edit') model.canDelete)}}
Copy link
Contributor

Choose a reason for hiding this comment

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

So no deletes currently happen on the edit page anymore, is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that's right. If there is a "show" page we should have it as a link there instead. We do still have a couple places that still need to be moved I think.

ui/app/templates/partials/transit-form-edit.hbs Outdated Show resolved Hide resolved
assert.equal(currentRouteName(), 'vault.cluster.secrets.backend.edit', 'navs to the edit page');

await editPage.deleteRole();
await showPage.visit({ backend: path, id: 'role' });
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should end up on the show page already here (but it probably doesn't hurt to explicitly nav there).

* @property {String} [disabledMessage=Complete the form to complete this action] - The message to display when the button is disabled.
*
*/

export default Component.extend({
tagName: 'span',
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about doing tagName: '' and then moving all class and wrapping HTML to the template?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd have to pass in the data-attributes explicitly like I did for ToolbarLink (until we can use ...attributes), right? Is that worth it?

Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able to use ...attributes with this one because it's not one of the built-in template helpers (link-to was the problem with the other one iirc). But up to you if you want to change it - when we move to glimmer components that will be the default way things work so more just trying to shift to that where we can.

@joshuaogle joshuaogle force-pushed the ui-confirm-action-popover branch from ff880d0 to 9ed84e7 Compare May 16, 2019 21:07
Copy link
Contributor

@meirish meirish 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 and I know it was no small amount of work - thanks for tackling it!

@joshuaogle joshuaogle merged commit 6603a86 into master May 17, 2019
@joshuaogle joshuaogle deleted the ui-confirm-action-popover branch May 17, 2019 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants