Files
threshold-ui/ui/admin/app/components/form/credential-library/vault-generic/index.hbs
T
Zhihe Li f0530e1f8f Vault SSH Cert Feature (#1596)
* feat: 🎸 Update models for vault ssh cert feature (#1591)

✅ Closes: ICU-7546

* feat: 🎸 Setup types in cred library forms and use HDS component (#1597)

* feat: 🎸 Setup types in cred library forms and use HDS component

✅ Closes: ICU-7673

* feat: 🎸 Add vault ssh cert type for credential library (#1608)

* feat: 🎸 Add vault ssh cert type for credential library

✅ Closes: ICU-7678

* feat: 🎸 Enable feature flag for vault ssh cert work (#1614)

* fix: 🐛 Change fields to optional as they get default by backend (#1615)

* Chore/cleanup vault ssh cert (#1616)
2023-02-01 13:46:23 -05:00

169 lines
4.8 KiB
Handlebars

<Rose::Form
@onSubmit={{@submit}}
@cancel={{@cancel}}
@disabled={{@model.isSaving}}
@showEditToggle={{if @model.isNew false true}}
as |form|
>
<Hds::Form::TextInput::Field
@isRequired={{false}}
@isOptional={{true}}
@value={{@model.name}}
@isInvalid={{@model.errors.name}}
@type='text'
name='name'
disabled={{form.disabled}}
{{on 'input' (set-from-event @model 'name')}}
as |F|
>
<F.Label>{{t 'form.name.label'}}</F.Label>
<F.HelperText>{{t 'form.name.help'}}</F.HelperText>
{{#if @model.errors.name}}
<F.Error as |E|>
{{#each @model.errors.name as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::TextInput::Field>
<Hds::Form::Textarea::Field
@isRequired={{false}}
@isOptional={{true}}
@value={{@model.description}}
@isInvalid={{@model.errors.description}}
name='description'
disabled={{form.disabled}}
as |F|
>
<F.Label>{{t 'form.description.label'}}</F.Label>
<F.HelperText>{{t 'form.description.help'}}</F.HelperText>
{{#if @model.errors.description}}
<F.Error as |E|>
{{#each @model.errors.description as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::Textarea::Field>
{{#if
(and @model.isNew (feature-flag 'credential-library-vault-ssh-certificate'))
}}
<Hds::Form::RadioCard::Group @name='type' @alignment='center' as |G|>
<G.Legend>{{t 'form.type.label'}}</G.Legend>
{{#each this.types as |type|}}
<G.RadioCard
@value={{type}}
@maxWidth='20rem'
@checked={{eq type @model.type}}
{{on 'input' (fn @changeType type)}}
as |R|
>
<R.Label>{{t
(concat 'resources.credential-library.types.' type)
}}</R.Label>
<R.Description>{{t
(concat 'resources.credential-library.help.' type)
}}</R.Description>
</G.RadioCard>
{{/each}}
</Hds::Form::RadioCard::Group>
{{else}}
<InfoField
@value={{t (concat 'resources.credential-library.types.' @model.type)}}
as |F|
>
<F.Label>{{t 'form.type.label'}}</F.Label>
<F.HelperText>
{{t (concat 'resources.credential-library.help.' @model.type)}}
</F.HelperText>
</InfoField>
{{/if}}
<Hds::Form::TextInput::Field
@isRequired={{true}}
@isOptional={{false}}
@value={{@model.path}}
@isInvalid={{@model.errors.path}}
@type='text'
name='vault_path'
disabled={{form.disabled}}
{{on 'input' (set-from-event @model 'path')}}
as |F|
>
<F.Label>{{t
'resources.credential-library.form.vault_path.label'
}}</F.Label>
<F.HelperText>{{t
'resources.credential-library.form.vault_path.help'
}}</F.HelperText>
{{#if @model.errors.path}}
<F.Error as |E|>
{{#each @model.errors.path as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::TextInput::Field>
<Hds::Form::Radio::Group
disabled={{form.disabled}}
{{on 'input' (set-from-event @model 'http_method')}}
@isRequired={{true}}
@layout='horizontal'
@name='http_method'
as |G|
>
<G.Legend>
{{t 'resources.credential-library.form.http_method.label'}}
</G.Legend>
<G.HelperText>
{{t 'resources.credential-library.form.http_method.help'}}
</G.HelperText>
{{#each this.httpMethodOptions as |httpMethod|}}
<G.Radio::Field
checked={{eq @model.http_method httpMethod}}
@value={{httpMethod}}
as |F|
>
<F.Label>{{httpMethod}}</F.Label>
</G.Radio::Field>
{{/each}}
</Hds::Form::Radio::Group>
{{#if this.isHttpRequestBodyAllowed}}
<Hds::Form::Textarea::Field
@isRequired={{true}}
@isOptional={{false}}
@value={{@model.http_request_body}}
@isInvalid={{@model.errors.http_request_body}}
name='http_request_body'
disabled={{form.disabled}}
as |F|
>
<F.Label>{{t
'resources.credential-library.form.http_request_body.label'
}}</F.Label>
<F.HelperText>{{t
'resources.credential-library.form.http_request_body.help'
}}</F.HelperText>
{{#if @model.errors.http_request_body}}
<F.Error as |E|>
{{#each @model.errors.http_request_body as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::Textarea::Field>
{{/if}}
{{#if (can 'save model' @model)}}
<form.actions
@enableEditText={{t 'actions.edit-form'}}
@submitText={{t 'actions.save'}}
@cancelText={{t 'actions.cancel'}}
/>
{{/if}}
</Rose::Form>