* chore: 🤖 Migrate `form.inpu` to use Hds::TextInput::Field` Migrate `form/group`, `form/host-static`, `form/host-catalog/aws` and `form/host-catalog/azure` forms to use `Hds::TextInputField instead of `form.input` ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12466 * refactor: 💡 use `data-test` attributes for testing use `data-test` attributes for testing error messaging. ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12466 * refactor: 💡 field argument cleanup field argument cleanup ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12466 * refactor: 💡 switch `disabled` argument to `readonly` switch `disabled` argument to `readonly` ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12466
84 lines
2.3 KiB
Handlebars
84 lines
2.3 KiB
Handlebars
{{!
|
|
Copyright (c) HashiCorp, Inc.
|
|
SPDX-License-Identifier: MPL-2.0
|
|
}}
|
|
|
|
<Rose::Form
|
|
@onSubmit={{@submit}}
|
|
@cancel={{@cancel}}
|
|
@disabled={{@model.isSaving}}
|
|
@showEditToggle={{if @model.isNew false true}}
|
|
as |form|
|
|
>
|
|
|
|
<Hds::Form::TextInput::Field @value={{@model.type}} disabled={{true}} as |F|>
|
|
<F.Label>{{t 'form.type.label'}}</F.Label>
|
|
</Hds::Form::TextInput::Field>
|
|
|
|
<Hds::Form::TextInput::Field
|
|
name='name'
|
|
@value={{@model.name}}
|
|
@isInvalid={{@model.errors.name}}
|
|
@isOptional={{true}}
|
|
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 data-test-error-message-name>{{error.message}}</E.Message>
|
|
{{/each}}
|
|
</F.Error>
|
|
{{/if}}
|
|
</Hds::Form::TextInput::Field>
|
|
|
|
<Hds::Form::Textarea::Field
|
|
name='description'
|
|
@value={{@model.description}}
|
|
@isInvalid={{@model.errors.description}}
|
|
@isOptional={{true}}
|
|
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>
|
|
|
|
<Hds::Form::TextInput::Field
|
|
name='address'
|
|
@value={{@model.address}}
|
|
@isInvalid={{@model.errors.address}}
|
|
@isRequired={{true}}
|
|
disabled={{form.disabled}}
|
|
{{on 'input' (set-from-event @model 'address')}}
|
|
as |F|
|
|
>
|
|
<F.Label>{{t 'form.address.label'}}</F.Label>
|
|
<F.HelperText>{{t 'form.address.help'}}</F.HelperText>
|
|
{{#if @model.errors.address}}
|
|
<F.Error as |E|>
|
|
{{#each @model.errors.address as |error|}}
|
|
<E.Message>{{error.message}}</E.Message>
|
|
{{/each}}
|
|
</F.Error>
|
|
{{/if}}
|
|
</Hds::Form::TextInput::Field>
|
|
|
|
{{#if (can 'save model' @model)}}
|
|
<form.actions
|
|
@enableEditText={{t 'actions.edit-form'}}
|
|
@submitText={{t 'actions.save'}}
|
|
@cancelText={{t 'actions.cancel'}}
|
|
/>
|
|
{{/if}}
|
|
</Rose::Form> |