open-vault/ui/app/templates/components/pki-cert-show.hbs
claire bontempo 42ae96ed1c
UI/ PKI UI Redesign (#12541)
* installs node-forge

* correctly displays and formats cert metadata

* removes labels

* uses helper in hbs file

* adds named arg to helper

* pki-ca-cert displays common name, issue & expiry date

* alphabetizes some attrs

* adds test for date helper
2021-10-04 14:31:36 -07:00

68 lines
2.5 KiB
Handlebars

<PageHeader as |p|>
<p.top>
<KeyValueHeader @baseKey={{hash display=model.id id=model.idForNav}} @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">
PKI Certificate
</h1>
</p.levelLeft>
</PageHeader>
<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
<MessageError @model={{model}} />
{{#each model.attrs as |attr|}}
{{#if (eq attr.type "object")}}
<InfoTableRow data-test-table-row
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{stringify (get model attr.name)}} />
{{else}}
{{#if attr.options.masked}}
<InfoTableRow data-test-table-row
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{get model attr.name}}>
<MaskedInput
@value={{get model attr.name}}
@displayOnly={{true}}
@allowCopy={{true}}
/>
</InfoTableRow>
{{else if (and (get model attr.name) (or (eq attr.name "issueDate") (eq attr.name "expiryDate")))}}
<InfoTableRow data-test-table-row
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{date-format (get model attr.name) 'MMM dd, yyyy hh:mm:ss a' isFormatted=true}} />
{{else}}
<InfoTableRow data-test-table-row
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
@value={{get model attr.name}} />
{{/if}}
{{/if}}
{{/each}}
</div>
<div class="field is-grouped is-grouped-split box is-fullwidth is-bottomless">
<div class="field is-grouped">
<div class="control">
<CopyButton @clipboardText={{model.toCreds}} @class="button is-primary" @buttonType="button" @success={{action (set-flash-message "Credentials copied!")}}>
Copy credentials
</CopyButton>
</div>
<div class="control">
<LinkTo @route="vault.cluster.secrets.backend.list-root" @query={{hash tab="certs"}} class="button">
Back
</LinkTo>
</div>
</div>
{{#if (and (not model.revocationTime) model.canRevoke)}}
<ConfirmAction
@buttonClasses="button"
@onConfirmAction={{action "delete"}}
@confirmTitle="Revoke this cert?"
@confirmMessage="Any services using this cert may be affected."
@confirmButtonText="Revoke"
>
Revoke
</ConfirmAction>
{{/if}}
</div>