From 20181c978fc8b5e5509d084f2b211b5891be254d Mon Sep 17 00:00:00 2001 From: Devon Anderson Date: Thu, 22 Feb 2024 13:22:18 -0500 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20Migrate=20`form.inpu?= =?UTF-8?q?t`=20to=20`Hds::TextInput::Field`=20(#2142)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 💡 Migrate `form.input` to `Hds::TextInput::Field` Migrate the use of `form.input` to `Hds::TextInput::Field` for OIDC and Password auth-method form ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12459 * Update index.hbs move `name` attribute to top of attribute list for readers * refactor: 💡 fix `step` and `min` arguments fix `step` and `min` arguments ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12459 * refactor: 💡 clean up order of arguments and add `data-test` att clean up order of arguments and add `data-test` attributes ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12459 * refactor: 💡 Add `@isOptional` attribute to all needed fields Add `@isOptiona` attributes to all needed fields ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12459 * Update index.hbs add `@hasVisibilityToggle` * refactor: 💡 fix lint fix lint ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12459 * refactor: 💡 quick attribute refactor quick attribute refactor ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12459 --- .../form/auth-method/oidc/index.hbs | 188 +++++++++--------- .../form/auth-method/password/index.hbs | 43 ++-- .../acceptance/auth-methods/update-test.js | 3 +- 3 files changed, 114 insertions(+), 120 deletions(-) diff --git a/ui/admin/app/components/form/auth-method/oidc/index.hbs b/ui/admin/app/components/form/auth-method/oidc/index.hbs index cec2c67eb..3f080377e 100644 --- a/ui/admin/app/components/form/auth-method/oidc/index.hbs +++ b/ui/admin/app/components/form/auth-method/oidc/index.hbs @@ -12,37 +12,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}} - + @@ -57,24 +55,25 @@ {{/if}} - + {{t 'form.issuer.label'}} + {{t 'form.issuer.help'}} {{#if @model.errors.issuer}} - + {{#each @model.errors.issuer as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + - + {{t 'form.client_id.label'}} + {{t 'form.client_id.help'}} {{#if @model.errors.client_id}} - + {{#each @model.errors.client_id as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + - + {{t 'form.client_secret.label'}} + {{t 'form.client_secret.help'}} {{#if @model.errors.client_secret}} - + {{#each @model.errors.client_secret as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + {{#unless @model.isNew}} - + disabled={{true}} + as |F| + > + {{t 'form.client_secret_hmac.label'}} + {{/unless}} {{! Signing Algorithms }} @@ -406,45 +409,43 @@ - + {{t 'form.max_age.label'}} + {{t 'form.max_age.help'}} {{#if @model.errors.max_age}} - + {{#each @model.errors.max_age as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + - + {{t 'form.api_url_prefix.label'}} + {{t 'form.api_url_prefix.help'}} {{#if @model.errors.api_url_prefix}} - + {{#each @model.errors.api_url_prefix as |error|}} - {{error.message}} + {{error.message}} {{/each}} - + {{/if}} - + {{t 'form.prompts.label'}} @@ -499,13 +500,14 @@ {{#unless @model.isNew}} - + disabled={{true}} + as |F| + > + {{t 'form.callback_url.label'}} + {{t 'form.callback_url.help'}} + {{/unless}} {{#if (can 'save model' @model)}} diff --git a/ui/admin/app/components/form/auth-method/password/index.hbs b/ui/admin/app/components/form/auth-method/password/index.hbs index 8970d3541..eb7af17e1 100644 --- a/ui/admin/app/components/form/auth-method/password/index.hbs +++ b/ui/admin/app/components/form/auth-method/password/index.hbs @@ -10,49 +10,40 @@ @showEditToggle={{if @model.isNew false true}} 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}} - + {{t 'form.description.label'}} {{t 'form.description.help'}} - {{#if @model.errors.description}} - - {{#each @model.errors.description as |error|}} - {{error.message}} - {{/each}} - - {{/if}} {{#if (can 'save model' @model)}} diff --git a/ui/admin/tests/acceptance/auth-methods/update-test.js b/ui/admin/tests/acceptance/auth-methods/update-test.js index 7ff7e80f2..a75a96f88 100644 --- a/ui/admin/tests/acceptance/auth-methods/update-test.js +++ b/ui/admin/tests/acceptance/auth-methods/update-test.js @@ -355,8 +355,9 @@ module('Acceptance | auth-methods | update', function (hooks) { await fillIn(NAME_INPUT_SELECTOR, 'existing auth method'); await click(SAVE_BTN_SELECTOR); await a11yAudit(); + assert.dom(ERROR_MSG_SELECTOR).hasText('The request was invalid.'); - assert.dom('.rose-form-error-message').hasText('Name is required.'); + assert.dom('.hds-form-error__message').hasText('Name is required.'); }); test('saving an existing ldap auth method with invalid fields displays error messages', async function (assert) {