open-vault/ui/app/templates/components/role-ssh-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

76 lines
1.8 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 an SSH role
{{else if (eq mode 'edit')}}
Edit SSH role
{{else}}
SSH role <code>{{model.id}}</code>
{{/if}}
</h1>
</p.levelLeft>
</PageHeader>
{{#if (eq mode "show")}}
<Toolbar>
<ToolbarActions>
{{#if (eq model.keyType "otp")}}
<ToolbarSecretLink
@secret={{model.id}}
@mode="credentials"
@data-test-backend-credentials=true
@replace=true
>
Generate Credential
</ToolbarSecretLink>
{{else}}
<ToolbarSecretLink
@secret={{model.id}}
@mode="sign"
@data-test-backend-credentials=true
@replace=true
>
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}}
@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-ssh/form'}}
{{else}}
{{partial 'partials/role-ssh/show'}}
{{/if}}