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

adds divider to toolbars with destructive actions #12895

Merged
merged 2 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/12895.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: Standardizes toolbar presentation of destructive actions
```
1 change: 1 addition & 0 deletions ui/app/templates/components/alphabet-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
>
Delete alphabet
</button>
<div class="toolbar-separator" />
{{/if}}
{{#if capabilities.canUpdate }}
<ToolbarSecretLink
Expand Down
56 changes: 28 additions & 28 deletions ui/app/templates/components/database-role-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,38 @@
<Toolbar>
<ToolbarActions>
{{#if @model.canDelete}}
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action 'delete'}}
@confirmTitle="Delete role?"
@confirmMessage="This role will be permanently deleted. You will need to recreate it to use it again."
@confirmButtonText="Delete"
data-test-database-role-delete
>
Delete role
</ConfirmAction>
<div class="toolbar-separator" />
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action 'delete'}}
@confirmTitle="Delete role?"
@confirmMessage="This role will be permanently deleted. You will need to recreate it to use it again."
@confirmButtonText="Delete"
data-test-database-role-delete
>
Delete role
</ConfirmAction>
<div class="toolbar-separator" />
{{/if}}
{{#if @model.canGenerateCredentials}}
<button
type="button"
class="toolbar-link"
{{on 'click' (fn this.generateCreds @model.id @model.type)}}
data-test-database-role-generate-creds
>
{{if (eq @model.type "static") "Get credentials" "Generate credentials"}}
</button>
<button
type="button"
class="toolbar-link"
{{on 'click' (fn this.generateCreds @model.id @model.type)}}
data-test-database-role-generate-creds
>
{{if (eq @model.type "static") "Get credentials" "Generate credentials"}}
</button>
{{/if}}
{{#if @model.canEditRole}}
<ToolbarSecretLink
@secret={{concat 'role/' @model.id}}
@mode="edit"
@replace=true
@queryParams={{query-params itemType="role"}}
@data-test-edit-link=true
>
Edit role
</ToolbarSecretLink>
<ToolbarSecretLink
@secret={{concat 'role/' @model.id}}
@mode="edit"
@replace=true
@queryParams={{query-params itemType="role"}}
@data-test-edit-link=true
>
Edit role
</ToolbarSecretLink>
{{/if}}
</ToolbarActions>
</Toolbar>
Expand Down
17 changes: 12 additions & 5 deletions ui/app/templates/components/generated-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,21 @@
{{#if (eq mode "show")}}
<Toolbar>
<ToolbarActions>
<ConfirmAction @buttonClasses="toolbar-link" @onConfirmAction={{action "deleteItem"}}
@confirmMessage={{concat "Are you sure you want to delete " itemType " " model.id "?"}} @cancelButtonText="Cancel"
data-test-secret-delete="true">
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "deleteItem"}}
@confirmMessage={{concat "Are you sure you want to delete " itemType " " model.id "?"}}
@cancelButtonText="Cancel"
data-test-secret-delete="true"
>
Delete
{{itemType}}
</ConfirmAction>
<ToolbarLink @params={{array "vault.cluster.access.method.item.edit" itemType model.id}}
@data-test-configure-link="true">
<div class="toolbar-separator" />
<ToolbarLink
@params={{array "vault.cluster.access.method.item.edit" itemType model.id}}
@data-test-configure-link="true"
>
Edit {{singularize itemType}}
</ToolbarLink>
</ToolbarActions>
Expand Down
20 changes: 9 additions & 11 deletions ui/app/templates/components/role-aws-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
{{#if (eq mode "show")}}
<Toolbar>
<ToolbarActions>
{{#if model.canDelete}}
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "delete"}}
>
Delete role
</ConfirmAction>
<div class="toolbar-separator" />
{{/if}}
{{#if model.canGenerate}}
<ToolbarSecretLink
@secret={{model.id}}
Expand All @@ -27,17 +36,6 @@
Generate credentials
</ToolbarSecretLink>
{{/if}}
{{#if (and model.canGenerate (or model.canDelete model.canEdit))}}
<div class="toolbar-separator" />
{{/if}}
{{#if model.canDelete}}
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "delete"}}
>
Delete role
</ConfirmAction>
{{/if}}
{{#if model.canEdit}}
<ToolbarSecretLink
@secret={{model.id}}
Expand Down
22 changes: 10 additions & 12 deletions ui/app/templates/components/role-pki-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@
{{#if (eq mode "show") }}
<Toolbar>
<ToolbarActions>
{{#if model.canDelete}}
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "delete"}}
data-test-role-delete="true"
>
Delete role
</ConfirmAction>
<div class="toolbar-separator" />
{{/if}}
{{#if model.canGenerate}}
<ToolbarSecretLink
@secret={{model.id}}
Expand All @@ -38,18 +48,6 @@
Sign Certificate
</ToolbarSecretLink>
{{/if}}
{{#if (and (or model.canGenerate model.canSign) (or model.canDelete model.canEdit))}}
<div class="toolbar-separator" />
{{/if}}
{{#if model.canDelete}}
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "delete"}}
data-test-role-delete="true"
>
Delete role
</ConfirmAction>
{{/if}}
{{#if model.canEdit}}
<ToolbarSecretLink
@secret={{model.id}}
Expand Down
20 changes: 9 additions & 11 deletions ui/app/templates/components/role-ssh-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
{{#if (eq mode "show")}}
<Toolbar>
<ToolbarActions>
{{#if model.canDelete}}
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "delete"}}
>
Delete role
</ConfirmAction>
<div class="toolbar-separator" />
{{/if}}
{{#if (eq model.keyType "otp")}}
<ToolbarSecretLink
@secret={{model.id}}
Expand All @@ -37,17 +46,6 @@
Sign Keys
</ToolbarSecretLink>
{{/if}}
{{#if (or model.canUpdate model.canDelete)}}
<div class="toolbar-separator" />
{{/if}}
{{#if model.canDelete}}
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "delete"}}
>
Delete role
</ConfirmAction>
{{/if}}
{{#if (or model.canUpdate model.canDelete)}}
<ToolbarSecretLink
@secret={{model.id}}
Expand Down
3 changes: 2 additions & 1 deletion ui/app/templates/components/secret-delete-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
>
Delete
</ConfirmAction>
<div class="toolbar-separator" />
{{/if}}
{{else}}
{{#if (and this.canUndeleteVersion @modelForData.deleted)}}
Expand All @@ -26,7 +27,7 @@
<button
type="button"
class="toolbar-link"
{{on "click" (fn (mut this.showDeleteModal false))}}
{{on "click" (fn (mut this.showDeleteModal) false)}}
data-test-delete-open-modal
>
{{if (and (not @modelForData.deleted) (not @modelForData.destroyed)) "Delete" "Destroy"}}
Expand Down
1 change: 1 addition & 0 deletions ui/app/templates/components/transform-role-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
>
Delete role
</ConfirmAction>
<div class="toolbar-separator" />
{{/if}}
{{#if capabilities.canUpdate }}
<ToolbarSecretLink
Expand Down
1 change: 1 addition & 0 deletions ui/app/templates/components/transform-template-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
>
Delete template
</button>
<div class="toolbar-separator" />
{{/if}}
{{#if capabilities.canUpdate }}
<ToolbarSecretLink
Expand Down
4 changes: 1 addition & 3 deletions ui/app/templates/components/transformation-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
{{#if (eq mode "show")}}
<Toolbar>
<ToolbarActions>
{{#if (or capabilities.canUpdate capabilities.canDelete)}}
<div class="toolbar-separator" />
{{/if}}
{{#if capabilities.canDelete}}
{{#if (gt model.allowed_roles.length 0)}}
<ToolTip
Expand Down Expand Up @@ -52,6 +49,7 @@
Delete transformation
</button>
{{/if}}
<div class="toolbar-separator" />
{{/if}}
{{#if capabilities.canUpdate }}
{{#if (gt model.allowed_roles.length 0)}}
Expand Down
14 changes: 7 additions & 7 deletions ui/app/templates/vault/cluster/policy/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@
{{#if (and (not-eq model.id "root") (or capabilities.canUpdate capabilities.canDelete))}}
<Toolbar>
<ToolbarActions>
<ToolbarLink
@params={{array 'vault.cluster.policy.show' model.id}}
@data-test-policy-edit-toggle=true
>
Back to policy
</ToolbarLink>
<div class="toolbar-separator" />
{{#if (and (not-eq model.id "default") capabilities.canDelete)}}
<ConfirmAction
@buttonClasses="toolbar-link"
Expand All @@ -39,7 +32,14 @@
>
Delete
</ConfirmAction>
<div class="toolbar-separator" />
{{/if}}
<ToolbarLink
@params={{array 'vault.cluster.policy.show' model.id}}
@data-test-policy-edit-toggle=true
>
Back to policy
</ToolbarLink>
</ToolbarActions>
</Toolbar>
{{/if}}
Expand Down
13 changes: 7 additions & 6 deletions ui/lib/kmip/addon/templates/credentials/show.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
</PageHeader>
<Toolbar>
<ToolbarActions>
<ToolbarLink
@params={{array "credentials.index" this.scope this.role}}
data-test-kmip-link-back-to-role
>
Back to role
</ToolbarLink>
{{#if model.deletePath.canDelete}}
<ModelWrap as |m|>
<ConfirmAction
Expand All @@ -38,7 +32,14 @@
Revoke credentials
</ConfirmAction>
</ModelWrap>
<div class="toolbar-separator" />
{{/if}}
<ToolbarLink
@params={{array "credentials.index" this.scope this.role}}
data-test-kmip-link-back-to-role
>
Back to role
</ToolbarLink>
<CopyButton
class="toolbar-link"
@clipboardText={{model.certificate}}
Expand Down
1 change: 1 addition & 0 deletions ui/lib/kmip/addon/templates/role.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Delete role
</ConfirmAction>
</ModelWrap>
<div class="toolbar-separator" />
{{/if}}
{{#if model.updatePath.canUpdate}}
<ToolbarLink
Expand Down