Files
threshold-ui/ui/admin/app/components/form/credential-library/vault-generic/index.hbs
T

208 lines
5.7 KiB
Handlebars
Raw Normal View History

{{!
2026-02-03 12:08:35 -05:00
Copyright IBM Corp. 2021, 2026
SPDX-License-Identifier: BUSL-1.1
}}
2023-02-01 13:46:23 -05:00
<Rose::Form
@onSubmit={{@submit}}
@cancel={{@cancel}}
@disabled={{@model.isSaving}}
@showEditToggle={{if @model.isNew false true}}
as |form|
>
<Hds::Form::TextInput::Field
name='name'
2023-02-01 13:46:23 -05:00
@value={{@model.name}}
@isInvalid={{@model.errors.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>
2023-02-01 13:46:23 -05:00
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::TextInput::Field>
<Hds::Form::Textarea::Field
name='description'
2023-02-01 13:46:23 -05:00
@value={{@model.description}}
@isInvalid={{@model.errors.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>
2025-08-04 15:34:18 -05:00
{{#if @model.isNew}}
<Form::CredentialLibrary::Radio
@model={{@model}}
@changeType={{@changeType}}
/>
2023-02-01 13:46:23 -05:00
{{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}}
@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
data-test-error-message-vault-path
>{{error.message}}</E.Message>
2023-02-01 13:46:23 -05:00
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::TextInput::Field>
2025-06-17 11:24:19 -07:00
{{#if @model.isNew}}
<Hds::Form::Select::Field
@width='100%'
name='credential_type'
disabled={{form.disabled}}
{{on 'input' this.selectCredentialType}}
as |F|
>
<F.Label>
{{t 'resources.credential-library.form.credential_type.label'}}
</F.Label>
<F.HelperText>
{{t 'resources.credential-library.form.credential_type.help'}}
</F.HelperText>
<F.Options>
<option value='' />
2024-02-16 15:57:14 -08:00
2025-06-17 11:24:19 -07:00
{{#each this.credentialTypes as |type|}}
<option value={{type}} selected={{eq type @model.credential_type}}>
{{t (concat 'resources.credential-library.titles.' type)}}
</option>
2024-02-16 15:57:14 -08:00
{{/each}}
2025-06-17 11:24:19 -07:00
</F.Options>
{{#if @model.errors.credential_type}}
<F.Error as |E|>
{{#each @model.errors.credential_type as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::Select::Field>
{{else if @model.credential_type}}
2025-06-17 11:24:19 -07:00
<InfoField
@value={{t
(concat 'resources.credential-library.titles.' @model.credential_type)
}}
as |F|
>
<F.Label>{{t
'resources.credential-library.form.credential_type.label'
}}</F.Label>
<F.HelperText>
{{t 'resources.credential-library.form.credential_type.description'}}
</F.HelperText>
</InfoField>
{{/if}}
2024-02-16 15:57:14 -08:00
{{#if @model.credential_type}}
2025-08-04 15:34:18 -05:00
<Form::CredentialLibrary::MappingOverrides
@model={{@model}}
@disabled={{form.disabled}}
2025-08-04 15:34:18 -05:00
/>
{{/if}}
2023-02-01 13:46:23 -05:00
<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|}}
2024-06-17 14:31:33 -07:00
<G.RadioField
2023-02-01 13:46:23 -05:00
checked={{eq @model.http_method httpMethod}}
@value={{httpMethod}}
as |F|
>
<F.Label>{{httpMethod}}</F.Label>
2024-06-17 14:31:33 -07:00
</G.RadioField>
2023-02-01 13:46:23 -05:00
{{/each}}
</Hds::Form::Radio::Group>
{{#if this.isHttpRequestBodyAllowed}}
<Hds::Form::Textarea::Field
@isRequired={{true}}
@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>