From 26a77edbc7d00f37460c72dcd907fd89dbe0a1e3 Mon Sep 17 00:00:00 2001 From: Devon Anderson Date: Tue, 27 Feb 2024 13:52:50 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Migrate=20`form.inpu`?= =?UTF-8?q?=20to=20use=20Hds::TextInput::Field`=20(#2145)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- ui/admin/app/components/form/group/index.hbs | 29 +++-- .../form/host-catalog/aws/index.hbs | 100 ++++++++------ .../form/host-catalog/azure/index.hbs | 123 ++++++++++-------- .../form/host-catalog/static/index.hbs | 30 ++--- .../app/components/form/host/static/index.hbs | 64 ++++----- .../tests/acceptance/groups/create-test.js | 2 +- .../tests/acceptance/groups/update-test.js | 2 +- .../acceptance/host-catalogs/create-test.js | 2 +- .../host-catalogs/hosts/create-test.js | 2 +- .../host-catalogs/hosts/update-test.js | 2 +- .../acceptance/host-catalogs/update-test.js | 2 +- 11 files changed, 198 insertions(+), 160 deletions(-) diff --git a/ui/admin/app/components/form/group/index.hbs b/ui/admin/app/components/form/group/index.hbs index 9dda5c39d..c0d84d690 100644 --- a/ui/admin/app/components/form/group/index.hbs +++ b/ui/admin/app/components/form/group/index.hbs @@ -11,30 +11,31 @@ as |form| > - + {{t 'form.name.label'}} + {{t 'form.name.help'}} {{#if @model.errors.name}} - + {{#each @model.errors.name as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + diff --git a/ui/admin/app/components/form/host-catalog/aws/index.hbs b/ui/admin/app/components/form/host-catalog/aws/index.hbs index a6ab6c7d1..3a72e5b23 100644 --- a/ui/admin/app/components/form/host-catalog/aws/index.hbs +++ b/ui/admin/app/components/form/host-catalog/aws/index.hbs @@ -10,30 +10,31 @@ @showEditToggle={{if @model.isNew false true}} as |form| > - + {{t 'form.name.label'}} + {{t 'form.name.help'}} {{#if @model.errors.name}} - + {{#each @model.errors.name as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + @@ -94,7 +95,7 @@ {{t 'titles.provider'}} @@ -103,38 +104,53 @@ {{/if}} - + disabled={{form.disabled}} + {{on 'input' (set-from-event @model 'region')}} + as |F| + > + {{t 'resources.host-catalog.form.aws_region.label'}} + + {{t 'resources.host-catalog.form.aws_region.help'}} + + {{t 'actions.learn-more'}} + + + - + disabled={{form.disabled}} + {{on 'input' (set-from-event @model 'access_key_id')}} + as |F| + > + {{t 'form.access_key_id.label'}} + + {{t 'form.access_key_id.help'}} + + {{t 'actions.learn-more'}} + + + - + disabled={{form.disabled}} + {{on 'input' (set-from-event @model 'secret_access_key')}} + as |F| + > + {{t 'form.secret_access_key.label'}} + + {{t 'form.secret_access_key.help'}} + + {{t 'actions.learn-more'}} + + + - + {{t 'form.name.label'}} + {{t 'form.name.help'}} {{#if @model.errors.name}} - + {{#each @model.errors.name as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + @@ -94,7 +95,7 @@ {{t 'titles.provider'}} @@ -103,49 +104,69 @@ {{/if}} - + disabled={{form.disabled}} + {{on 'input' (set-from-event @model 'tenant_id')}} + as |F| + > + {{t 'form.tenant_id.label'}} + + {{t 'form.tenant_id.help'}} + + {{t 'actions.learn-more'}} + + + - + disabled={{form.disabled}} + {{on 'input' (set-from-event @model 'subscription_id')}} + as |F| + > + {{t 'form.subscription_id.label'}} + + {{t 'form.subscription_id.help'}} + + {{t 'actions.learn-more'}} + + + - + disabled={{form.disabled}} + {{on 'input' (set-from-event @model 'client_id')}} + as |F| + > + {{t 'resources.host-catalog.form.azure_client_id.label'}} + + {{t 'resources.host-catalog.form.azure_client_id.help'}} + + {{t 'actions.learn-more'}} + + + - + disabled={{form.disabled}} + {{on 'input' (set-from-event @model 'secret_value')}} + as |F| + > + {{t 'form.secret.label'}} + + {{t 'form.secret.help'}} + + {{t 'actions.learn-more'}} + + + - + {{t 'form.name.label'}} + {{t 'form.name.help'}} {{#if @model.errors.name}} - + {{#each @model.errors.name as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + diff --git a/ui/admin/app/components/form/host/static/index.hbs b/ui/admin/app/components/form/host/static/index.hbs index 5f28e163d..2c0074262 100644 --- a/ui/admin/app/components/form/host/static/index.hbs +++ b/ui/admin/app/components/form/host/static/index.hbs @@ -11,37 +11,35 @@ as |form| > - + + {{t 'form.type.label'}} + - + {{t 'form.name.label'}} + {{t 'form.name.help'}} {{#if @model.errors.name}} - + {{#each @model.errors.name as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + @@ -56,24 +54,26 @@ {{/if}} - + {{t 'form.address.label'}} + {{t 'form.address.help'}} {{#if @model.errors.address}} - + {{#each @model.errors.address as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + + {{#if (can 'save model' @model)}}