Refactor cred type radio field (#3046)
* refactor: 💡 credential type radio field to be select field * refactor: 💡 radio component to be select component * test: 💍 fix e2e test page * test: 💍 add correct selector to e2e test * test: 💍 fix
This commit is contained in:
1 parent
f39961bbf5
commit
905a8f1951
16 files changed
+143
-61
No files matched your search
@@ -53,7 +53,7 @@
|
||||
</Hds::Form::Textarea::Field>
|
||||
|
||||
{{#if @model.isNew}}
|
||||
<Form::Credential::Radio
|
||||
<Form::Credential::Select
|
||||
@model={{@model}}
|
||||
@types={{@types}}
|
||||
@changeType={{@changeType}}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
{{!
|
||||
Copyright (c) HashiCorp, Inc.
|
||||
SPDX-License-Identifier: BUSL-1.1
|
||||
}}
|
||||
|
||||
<Hds::Form::Radio::Group
|
||||
class='credential-selection'
|
||||
@name={{t 'form.type.label'}}
|
||||
as |G|
|
||||
>
|
||||
<G.Legend>{{t 'form.type.label'}}</G.Legend>
|
||||
{{#each @types as |credentialType|}}
|
||||
<G.RadioField
|
||||
@value={{credentialType}}
|
||||
checked={{eq credentialType @model.type}}
|
||||
{{on 'input' (fn @changeType credentialType)}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t
|
||||
(concat 'resources.credential.types.' credentialType)
|
||||
}}</F.Label>
|
||||
<F.HelperText>{{t
|
||||
(concat 'resources.credential.help.' credentialType)
|
||||
}}</F.HelperText>
|
||||
</G.RadioField>
|
||||
{{/each}}
|
||||
</Hds::Form::Radio::Group>
|
||||
@@ -0,0 +1,24 @@
|
||||
{{!
|
||||
Copyright (c) HashiCorp, Inc.
|
||||
SPDX-License-Identifier: BUSL-1.1
|
||||
}}
|
||||
|
||||
<Hds::Form::SuperSelect::Single::Field
|
||||
name={{t 'form.type.label'}}
|
||||
@onChange={{@changeType}}
|
||||
@selected={{@model.type}}
|
||||
@options={{@types}}
|
||||
as |F|
|
||||
>
|
||||
<F.Label>{{t 'form.type.label'}}</F.Label>
|
||||
<F.Options>
|
||||
{{#let F.options as |credentialType|}}
|
||||
<Hds::Text::Body @tag='p' @weight='semibold'>{{t
|
||||
(concat 'resources.credential.types.' credentialType)
|
||||
}}</Hds::Text::Body>
|
||||
<Hds::Text::Body @tag='p' @color='faint' @size='100'>{{t
|
||||
(concat 'resources.credential.help.' credentialType)
|
||||
}}</Hds::Text::Body>
|
||||
{{/let}}
|
||||
</F.Options>
|
||||
</Hds::Form::SuperSelect::Single::Field>
|
||||
@@ -53,7 +53,7 @@
|
||||
</Hds::Form::Textarea::Field>
|
||||
|
||||
{{#if @model.isNew}}
|
||||
<Form::Credential::Radio
|
||||
<Form::Credential::Select
|
||||
@model={{@model}}
|
||||
@types={{@types}}
|
||||
@changeType={{@changeType}}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</Hds::Form::Textarea::Field>
|
||||
|
||||
{{#if @model.isNew}}
|
||||
<Form::Credential::Radio
|
||||
<Form::Credential::Select
|
||||
@model={{@model}}
|
||||
@types={{@types}}
|
||||
@changeType={{@changeType}}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</Hds::Form::Textarea::Field>
|
||||
|
||||
{{#if @model.isNew}}
|
||||
<Form::Credential::Radio
|
||||
<Form::Credential::Select
|
||||
@model={{@model}}
|
||||
@types={{@types}}
|
||||
@changeType={{@changeType}}
|
||||
|
||||
Reference in new issue
Block a user