open-vault/ui/lib/pki/addon/components/pki-key-parameters.hbs
claire bontempo a959d2d908
ui: generate pki key (#18268)
* create generate key form

* disable key bits unless key type selected

* add create method to adapter, update serializer to remove type

* refactor key parameters component

* convert to typescript

* refactor routes to add controller breadcrumbs

* remove unnecessary attr

* revert typescript changes

* add validations to key type

* fix tests

* cleanup breadcrumbs

* update tests, change all bit types to strings

* add form test
2022-12-08 14:22:33 -08:00

49 lines
1.6 KiB
Handlebars

{{#each @fields as |attr|}}
{{#if (eq attr.name "keyBits")}}
<div class="field">
<FormFieldLabel for={{attr.name}} @label={{attr.options.label}} @subText={{attr.options.subText}} />
<div class="control is-expanded">
<ToolTip @verticalPosition="above" @horizontalPosition="center" as |T|>
<T.Trigger tabindex="-1">
<div class="select is-fullwidth">
<select
id={{attr.name}}
name={{attr.name}}
data-test-input={{attr.name}}
disabled={{unless @model.keyType true}}
{{on "change" this.onKeyBitsChange}}
>
{{#if (and attr.options.noDefault (not @model.keyType))}}
<option value="">
Select one
</option>
{{/if}}
{{#each this.keyBitOptions as |val|}}
<option selected={{eq (get @model "keyBits") val}} value={{val}}>
{{val}}
</option>
{{/each}}
</select>
</div>
</T.Trigger>
{{#unless @model.keyType}}
<T.Content @defaultClass="tool-tip smaller-font">
<div class="box">
Choose a key type before specifying bit length.
</div>
</T.Content>
{{/unless}}
</ToolTip>
</div>
</div>
{{else}}
<FormField
data-test-field={{attr}}
@attr={{attr}}
@model={{@model}}
@modelValidations={{@modelValidations}}
@showHelpText={{false}}
@onChange={{this.handleSelection}}
/>
{{/if}}
{{/each}}