open-vault/ui/app/templates/partials/secret-form-edit.hbs

97 lines
2.6 KiB
Handlebars
Raw Normal View History

2018-04-03 14:16:57 +00:00
{{#if key.isError}}
{{#each key.adapterError.errors as |error|}}
<div class="connected vault-error">
{{error}}
</div>
{{/each}}
{{/if}}
<form class="" onsubmit={{action "createOrUpdateKey" "update"}} onchange={{action "handleChange"}}>
{{#if key.didError}}
<div class="kv-save-error">
<p>
We were unable to save your changes because the key has changed since the page loaded. Reload the page or click the button below to try again.
</p>
<button type="button" onclick={{action "refresh"}}>
Reload {{key.id}}
</button>
</div>
{{/if}}
{{#unless showAdvancedMode}}
<div class="table info-table-row-header">
<div class="info-table-row thead">
<div class="th column is-one-quarter">
Key
</div>
<div class="th column">
Value
</div>
</div>
</div>
{{/unless}}
{{#if capabilities.canUpdate}}
{{partial "partials/secret-edit-display"}}
{{else}}
<div class="field is-horizontal box is-sideless is-marginless">
<div class="content">
<p>Your current token does not have capabilities to update this secret.</p>
<p>
{{#secret-link
mode=(if key.isFolder "list" "show")
secret=key.id
class="button"
}}
Back to <code>{{key.id}}</code>
{{/secret-link}}
</p>
</div>
</div>
{{/if}}
<div class="field is-grouped is-grouped-split is-fullwidth box is-bottomless">
<div class="field is-grouped">
{{#unless key.isFolder}}
{{#if capabilities.canUpdate}}
<div class="control">
<button
type="submit"
disabled={{buttonDisabled}}
class="button is-primary"
>
Save
</button>
</div>
{{/if}}
{{/unless}}
<div class="control">
{{#secret-link
mode=(if key.isFolder "list" "show")
secret=key.id
class="button"
}}
Cancel
{{/secret-link}}
</div>
</div>
{{#if capabilities.canDelete}}
{{#confirm-action
buttonClasses="button"
onConfirmAction=(action "deleteKey")
confirmMessage=(if key.isFolder
(concat "Are you sure you want to delete " key.id " and all its contents?")
(concat "Are you sure you want to delete " key.id "?")
)
cancelButtonText="Cancel"
data-test-secret-delete="true"
}}
{{#if key.isFolder}}
Delete folder
{{else}}
Delete secret
{{/if}}
{{/confirm-action}}
{{/if}}
</div>
</form>