open-vault/ui/app/templates/partials/secret-form-show.hbs
Matthew Irish d56f0ccb72
UI - write without read for kv (#6570)
* wait for all hash promises to be settled

* skeleton tests with policies for write without read

* adjust what gets returned from the model hook

* refactor secret-edit model hook to use async/await

* return a stub version if we can't read secret data

* return a stub model for v1 kv

* tweak tests to make re-runs friendlier

* allow write without CAS if both v2 models cannot be read

* show warnings on edit pages for different write without read scenarios

* add no read empty states on secret show pages

* review feedback

* make message language consistent

* use version models from metadata if we can read it

* refresh route on delete / undelete / destroy

* hide controls in the toolbar when you can't read the secret data

* show deleted / destroyed messaging over cannot read messaging on the show page

* fix test with model stub

* refactor large model hook into several functions

* comment clarifications
2019-04-16 15:27:23 -05:00

56 lines
1.9 KiB
Handlebars

{{#if (and isV2 modelForData.destroyed)}}
<EmptyState
@title="Version {{modelForData.version}} of this secret has been permanently destroyed"
@message="A version that has been permanently deleted cannot be restored. You can see other versions of this secret in the History menu."
>
<DocLink @path="/docs/secrets/kv/kv-v2.html">
Learn more
</DocLink>
</EmptyState>
{{else if (and isV2 modelForData.deleted)}}
<EmptyState
@title="Version {{modelForData.version}} of this secret has been deleted"
@message="A version that has been deleted but can be undeleted using the Version {{modelForData.version}} menu above.
You can also see other versions of this secret in the History menu."
>
<DocLink @path="/docs/secrets/kv/kv-v2.html">
Learn more
</DocLink>
</EmptyState>
{{else if isWriteWithoutRead}}
<EmptyState
data-test-write-without-read-empty-message
@title="You do not have permission to read this secret."
@message={{if isV2
"Your policies permit you to write a new version of this secret, but do not allow you to read its current contents."
"Your policies permit you to overwrite this secret, but do not allow you to read it."
}}
>
</EmptyState>
{{else}}
{{#if showAdvancedMode}}
{{json-editor
value=modelForData.dataAsJSONString
options=(hash
readOnly=true
)
}}
{{else}}
<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>
{{#each-in modelForData.secretData as |key value|}}
{{#info-table-row label=key value=value alwaysRender=true}}
{{masked-input value=value displayOnly=true allowCopy=true}}
{{/info-table-row}}
{{/each-in}}
{{/if}}
{{/if}}