open-vault/ui/app/templates/components/secret-form-show.hbs

88 lines
3.2 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="/vault/docs/secrets/kv/kv-v2">
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="/vault/docs/secrets/kv/kv-v2">
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."
}}
/>
{{else}}
{{#if @showAdvancedMode}}
<div class="has-top-margin-s">
<JsonEditor
@title={{if @isV2 "Version Data" "Secret Data"}}
@value={{@modelForData.dataAsJSONString}}
@readOnly={{true}}
/>
</div>
{{else}}
<div class="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 class="th column justify-right" data-test-created-time>
{{#if @modelForData.createdTime}}
<ToolTip @verticalPosition="above" @horizontalPosition="center" as |T|>
<T.Trigger data-test-tooltip-trigger tabindex="-1">
Version created
{{date-format @modelForData.createdTime "MMM dd, yyyy hh:mm a"}}
</T.Trigger>
<T.Content @defaultClass="tool-tip smaller-font">
<div class="box" data-test-hover-copy-tooltip-text>
{{@modelForData.createdTime}}
</div>
</T.Content>
</ToolTip>
{{/if}}
</div>
</div>
</div>
{{#if @modelForData.secretKeyAndValue}}
{{#each @modelForData.secretKeyAndValue as |secret|}}
<InfoTableRow @label={{secret.key}} @value={{secret.value}} @alwaysRender={{true}}>
{{#if secret.value}}
<MaskedInput
@name={{secret.key}}
@value={{secret.value}}
@displayOnly={{true}}
@allowCopy={{true}}
@allowDownload={{@isV2}}
/>
{{else}}
<Icon @name="minus" />
{{/if}}
</InfoTableRow>
{{/each}}
{{else}}
{{! In the case of no key or value <InfoTableRow> will still render }}
<InfoTableRow @label="" @value="" @alwaysRender={{true}}>
<Icon @name="minus" />
</InfoTableRow>
{{/if}}
{{/if}}
{{/if}}