open-vault/ui/lib/pki/addon/components/pki-role-generate.hbs
2022-12-15 22:42:18 +00:00

89 lines
2.9 KiB
Handlebars

{{#if @model.serialNumber}}
<Toolbar>
<ToolbarActions>
<button type="button" class="toolbar-link" {{on "click" this.downloadCert}} data-test-pki-cert-download-button>
Download
<Chevron @direction="down" @isButton={{true}} />
</button>
{{#if @model.canRevoke}}
<button
type="button"
class="toolbar-link"
{{on "click" (perform this.revoke)}}
disabled={{this.revoke.isRunning}}
data-test-pki-cert-revoke-button
>
Revoke certificate
<Chevron @direction="right" @isButton={{true}} />
</button>
{{/if}}
</ToolbarActions>
</Toolbar>
{{#each @model.formFields as |attr|}}
{{#if (eq attr.name "certificate")}}
<InfoTableRow @label="Certificate" @value={{@model.certificate}}>
<MaskedInput @value={{@model.certificate}} @name="Certificate" @displayOnly={{true}} @allowCopy={{true}} />
</InfoTableRow>
{{else}}
<InfoTableRow
@label={{or attr.options.label (humanize (dasherize attr.name))}}
@value={{get @model attr.name}}
@formatDate={{if (eq attr.type "date") "MMM d yyyy HH:mm:ss a zzzz"}}
/>
{{/if}}
{{/each}}
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<button
type="button"
class="button has-left-margin-s"
disabled={{this.save.isRunning}}
{{on "click" this.cancel}}
data-test-pki-generate-back
>
Back
</button>
</div>
</div>
{{else}}
<form {{on "submit" (perform this.save)}} data-test-pki-generate-cert-form>
<div class="box is-bottomless is-fullwidth is-marginless">
<MessageError @errorMessage={{this.errorBanner}} />
<NamespaceReminder @mode="create" @noun="certificate" />
{{#let (get @model.formFieldGroups "0") as |defaultGroup|}}
{{#each defaultGroup.default as |attr|}}
<FormField @model={{@model}} @attr={{attr}}>
<PkiNotValidAfterForm @attr={{attr}} @model={{@model}} />
</FormField>
{{/each}}
{{/let}}
<FormFieldGroups
@model={{@model}}
@mode="create"
@renderGroup="Subject Alternative Name (SAN) Options"
@groupName="formFieldGroups"
/>
</div>
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<button
type="submit"
class="button is-primary {{if this.save.isRunning 'is-loading'}}"
disabled={{this.save.isRunning}}
data-test-pki-generate-button
>
{{capitalize this.verb}}
</button>
<button
type="button"
class="button has-left-margin-s"
disabled={{this.save.isRunning}}
{{on "click" this.cancel}}
data-test-pki-generate-cancel
>
Cancel
</button>
</div>
</div>
</form>
{{/if}}