adds divider to toolbars with destructive actions (#12895)

* adds divider to toolbars with destructive actions

* adds changelog
This commit is contained in:
Jordan Reimer 2021-10-22 08:11:14 -06:00 committed by GitHub
parent de0a56bd44
commit 702a275ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 92 additions and 84 deletions

3
changelog/12895.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
ui: Standardizes toolbar presentation of destructive actions
```

View File

@ -33,6 +33,7 @@
> >
Delete alphabet Delete alphabet
</button> </button>
<div class="toolbar-separator" />
{{/if}} {{/if}}
{{#if capabilities.canUpdate }} {{#if capabilities.canUpdate }}
<ToolbarSecretLink <ToolbarSecretLink

View File

@ -19,38 +19,38 @@
<Toolbar> <Toolbar>
<ToolbarActions> <ToolbarActions>
{{#if @model.canDelete}} {{#if @model.canDelete}}
<ConfirmAction <ConfirmAction
@buttonClasses="toolbar-link" @buttonClasses="toolbar-link"
@onConfirmAction={{action 'delete'}} @onConfirmAction={{action 'delete'}}
@confirmTitle="Delete role?" @confirmTitle="Delete role?"
@confirmMessage="This role will be permanently deleted. You will need to recreate it to use it again." @confirmMessage="This role will be permanently deleted. You will need to recreate it to use it again."
@confirmButtonText="Delete" @confirmButtonText="Delete"
data-test-database-role-delete data-test-database-role-delete
> >
Delete role Delete role
</ConfirmAction> </ConfirmAction>
<div class="toolbar-separator" /> <div class="toolbar-separator" />
{{/if}} {{/if}}
{{#if @model.canGenerateCredentials}} {{#if @model.canGenerateCredentials}}
<button <button
type="button" type="button"
class="toolbar-link" class="toolbar-link"
{{on 'click' (fn this.generateCreds @model.id @model.type)}} {{on 'click' (fn this.generateCreds @model.id @model.type)}}
data-test-database-role-generate-creds data-test-database-role-generate-creds
> >
{{if (eq @model.type "static") "Get credentials" "Generate credentials"}} {{if (eq @model.type "static") "Get credentials" "Generate credentials"}}
</button> </button>
{{/if}} {{/if}}
{{#if @model.canEditRole}} {{#if @model.canEditRole}}
<ToolbarSecretLink <ToolbarSecretLink
@secret={{concat 'role/' @model.id}} @secret={{concat 'role/' @model.id}}
@mode="edit" @mode="edit"
@replace=true @replace=true
@queryParams={{query-params itemType="role"}} @queryParams={{query-params itemType="role"}}
@data-test-edit-link=true @data-test-edit-link=true
> >
Edit role Edit role
</ToolbarSecretLink> </ToolbarSecretLink>
{{/if}} {{/if}}
</ToolbarActions> </ToolbarActions>
</Toolbar> </Toolbar>

View File

@ -32,14 +32,21 @@
{{#if (eq mode "show")}} {{#if (eq mode "show")}}
<Toolbar> <Toolbar>
<ToolbarActions> <ToolbarActions>
<ConfirmAction @buttonClasses="toolbar-link" @onConfirmAction={{action "deleteItem"}} <ConfirmAction
@confirmMessage={{concat "Are you sure you want to delete " itemType " " model.id "?"}} @cancelButtonText="Cancel" @buttonClasses="toolbar-link"
data-test-secret-delete="true"> @onConfirmAction={{action "deleteItem"}}
@confirmMessage={{concat "Are you sure you want to delete " itemType " " model.id "?"}}
@cancelButtonText="Cancel"
data-test-secret-delete="true"
>
Delete Delete
{{itemType}} {{itemType}}
</ConfirmAction> </ConfirmAction>
<ToolbarLink @params={{array "vault.cluster.access.method.item.edit" itemType model.id}} <div class="toolbar-separator" />
@data-test-configure-link="true"> <ToolbarLink
@params={{array "vault.cluster.access.method.item.edit" itemType model.id}}
@data-test-configure-link="true"
>
Edit {{singularize itemType}} Edit {{singularize itemType}}
</ToolbarLink> </ToolbarLink>
</ToolbarActions> </ToolbarActions>

View File

@ -18,6 +18,15 @@
{{#if (eq mode "show")}} {{#if (eq mode "show")}}
<Toolbar> <Toolbar>
<ToolbarActions> <ToolbarActions>
{{#if model.canDelete}}
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "delete"}}
>
Delete role
</ConfirmAction>
<div class="toolbar-separator" />
{{/if}}
{{#if model.canGenerate}} {{#if model.canGenerate}}
<ToolbarSecretLink <ToolbarSecretLink
@secret={{model.id}} @secret={{model.id}}
@ -27,17 +36,6 @@
Generate credentials Generate credentials
</ToolbarSecretLink> </ToolbarSecretLink>
{{/if}} {{/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}} {{#if model.canEdit}}
<ToolbarSecretLink <ToolbarSecretLink
@secret={{model.id}} @secret={{model.id}}

View File

@ -18,6 +18,16 @@
{{#if (eq mode "show") }} {{#if (eq mode "show") }}
<Toolbar> <Toolbar>
<ToolbarActions> <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}} {{#if model.canGenerate}}
<ToolbarSecretLink <ToolbarSecretLink
@secret={{model.id}} @secret={{model.id}}
@ -38,18 +48,6 @@
Sign Certificate Sign Certificate
</ToolbarSecretLink> </ToolbarSecretLink>
{{/if}} {{/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}} {{#if model.canEdit}}
<ToolbarSecretLink <ToolbarSecretLink
@secret={{model.id}} @secret={{model.id}}

View File

@ -18,6 +18,15 @@
{{#if (eq mode "show")}} {{#if (eq mode "show")}}
<Toolbar> <Toolbar>
<ToolbarActions> <ToolbarActions>
{{#if model.canDelete}}
<ConfirmAction
@buttonClasses="toolbar-link"
@onConfirmAction={{action "delete"}}
>
Delete role
</ConfirmAction>
<div class="toolbar-separator" />
{{/if}}
{{#if (eq model.keyType "otp")}} {{#if (eq model.keyType "otp")}}
<ToolbarSecretLink <ToolbarSecretLink
@secret={{model.id}} @secret={{model.id}}
@ -37,17 +46,6 @@
Sign Keys Sign Keys
</ToolbarSecretLink> </ToolbarSecretLink>
{{/if}} {{/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)}} {{#if (or model.canUpdate model.canDelete)}}
<ToolbarSecretLink <ToolbarSecretLink
@secret={{model.id}} @secret={{model.id}}

View File

@ -9,6 +9,7 @@
> >
Delete Delete
</ConfirmAction> </ConfirmAction>
<div class="toolbar-separator" />
{{/if}} {{/if}}
{{else}} {{else}}
{{#if (and this.canUndeleteVersion @modelForData.deleted)}} {{#if (and this.canUndeleteVersion @modelForData.deleted)}}
@ -26,7 +27,7 @@
<button <button
type="button" type="button"
class="toolbar-link" class="toolbar-link"
{{on "click" (fn (mut this.showDeleteModal false))}} {{on "click" (fn (mut this.showDeleteModal) false)}}
data-test-delete-open-modal data-test-delete-open-modal
> >
{{if (and (not @modelForData.deleted) (not @modelForData.destroyed)) "Delete" "Destroy"}} {{if (and (not @modelForData.deleted) (not @modelForData.destroyed)) "Delete" "Destroy"}}

View File

@ -29,6 +29,7 @@
> >
Delete role Delete role
</ConfirmAction> </ConfirmAction>
<div class="toolbar-separator" />
{{/if}} {{/if}}
{{#if capabilities.canUpdate }} {{#if capabilities.canUpdate }}
<ToolbarSecretLink <ToolbarSecretLink

View File

@ -33,6 +33,7 @@
> >
Delete template Delete template
</button> </button>
<div class="toolbar-separator" />
{{/if}} {{/if}}
{{#if capabilities.canUpdate }} {{#if capabilities.canUpdate }}
<ToolbarSecretLink <ToolbarSecretLink

View File

@ -18,9 +18,6 @@
{{#if (eq mode "show")}} {{#if (eq mode "show")}}
<Toolbar> <Toolbar>
<ToolbarActions> <ToolbarActions>
{{#if (or capabilities.canUpdate capabilities.canDelete)}}
<div class="toolbar-separator" />
{{/if}}
{{#if capabilities.canDelete}} {{#if capabilities.canDelete}}
{{#if (gt model.allowed_roles.length 0)}} {{#if (gt model.allowed_roles.length 0)}}
<ToolTip <ToolTip
@ -52,6 +49,7 @@
Delete transformation Delete transformation
</button> </button>
{{/if}} {{/if}}
<div class="toolbar-separator" />
{{/if}} {{/if}}
{{#if capabilities.canUpdate }} {{#if capabilities.canUpdate }}
{{#if (gt model.allowed_roles.length 0)}} {{#if (gt model.allowed_roles.length 0)}}

View File

@ -23,13 +23,6 @@
{{#if (and (not-eq model.id "root") (or capabilities.canUpdate capabilities.canDelete))}} {{#if (and (not-eq model.id "root") (or capabilities.canUpdate capabilities.canDelete))}}
<Toolbar> <Toolbar>
<ToolbarActions> <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)}} {{#if (and (not-eq model.id "default") capabilities.canDelete)}}
<ConfirmAction <ConfirmAction
@buttonClasses="toolbar-link" @buttonClasses="toolbar-link"
@ -39,7 +32,14 @@
> >
Delete Delete
</ConfirmAction> </ConfirmAction>
<div class="toolbar-separator" />
{{/if}} {{/if}}
<ToolbarLink
@params={{array 'vault.cluster.policy.show' model.id}}
@data-test-policy-edit-toggle=true
>
Back to policy
</ToolbarLink>
</ToolbarActions> </ToolbarActions>
</Toolbar> </Toolbar>
{{/if}} {{/if}}

View File

@ -10,12 +10,6 @@
</PageHeader> </PageHeader>
<Toolbar> <Toolbar>
<ToolbarActions> <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}} {{#if model.deletePath.canDelete}}
<ModelWrap as |m|> <ModelWrap as |m|>
<ConfirmAction <ConfirmAction
@ -38,7 +32,14 @@
Revoke credentials Revoke credentials
</ConfirmAction> </ConfirmAction>
</ModelWrap> </ModelWrap>
<div class="toolbar-separator" />
{{/if}} {{/if}}
<ToolbarLink
@params={{array "credentials.index" this.scope this.role}}
data-test-kmip-link-back-to-role
>
Back to role
</ToolbarLink>
<CopyButton <CopyButton
class="toolbar-link" class="toolbar-link"
@clipboardText={{model.certificate}} @clipboardText={{model.certificate}}

View File

@ -21,6 +21,7 @@
Delete role Delete role
</ConfirmAction> </ConfirmAction>
</ModelWrap> </ModelWrap>
<div class="toolbar-separator" />
{{/if}} {{/if}}
{{#if model.updatePath.canUpdate}} {{#if model.updatePath.canUpdate}}
<ToolbarLink <ToolbarLink