open-vault/ui/app/templates/components/role-pki-edit.hbs
Joshua Ogle 7eff7b51aa
UI: Confirm Action as a popover
* Refactors ConfirmAction implementation as a popover
* Improves copy surrounding consequences of destructive actions
* Moves 'Delete' buttons to Toolbar
2019-05-17 11:29:21 -06:00

78 lines
1.9 KiB
Handlebars

<PageHeader as |p|>
<p.top>
{{key-value-header
baseKey=model
path="vault.cluster.secrets.backend.list"
mode=mode
root=root
showCurrent=true
}}
</p.top>
<p.levelLeft>
<h1 class="title is-3" data-test-secret-header="true">
{{#if (eq mode "create") }}
Create a PKI Role
{{else if (eq mode 'edit')}}
Edit PKI Role
{{else}}
PKI Role <code>{{model.id}}</code>
{{/if}}
</h1>
</p.levelLeft>
</PageHeader>
{{#if (eq mode "show") }}
<Toolbar>
<ToolbarActions>
{{#if model.canGenerate}}
<ToolbarSecretLink
@secret={{model.id}}
@mode="credentials"
@queryParams={{query-params action="issue"}}
@data-test-credentials-link=true
>
Generate Certificate
</ToolbarSecretLink>
{{/if}}
{{#if model.canSign}}
<ToolbarSecretLink
@secret={{model.id}}
@mode="credentials"
@queryParams={{query-params action="sign"}}
@data-test-sign-link=true
>
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}}
@mode="edit"
@data-test-edit-link=true
@replace=true
>
Edit role
</ToolbarSecretLink>
{{/if}}
</ToolbarActions>
</Toolbar>
{{/if}}
{{#if (or (eq mode 'edit') (eq mode 'create'))}}
{{partial 'partials/role-pki/form'}}
{{else}}
{{partial 'partials/role-pki/show'}}
{{/if}}