File tree Expand file tree Collapse file tree 5 files changed +244
-59
lines changed
credential-library/vault-ssh-certificate
tests/integration/components/form/field Expand file tree Collapse file tree 5 files changed +244
-59
lines changed Original file line number Diff line number Diff line change 257257 @disabled ={{ form.disabled }}
258258 @isOptional ={{ true }}
259259 @keyFieldType =' text'
260- @showValueField ={{ true }}
261260 @valueFieldType =' select'
262261 @valueFieldOptions ={{ this.toClaims }}
263262 @keyLabel ={{ t ' form.from_claim.label' }}
Original file line number Diff line number Diff line change 234234 @errors ={{ @model.errors.critical_options }}
235235 @disabled ={{ form.disabled }}
236236 @isOptional ={{ true }}
237- @showValueField ={{ true }}
238237 @keyFieldType =' text'
239238 @valueFieldType =' text'
240239 />
Original file line number Diff line number Diff line change 1515 {{ #if @helperText }}
1616 <H .HelperText data-test-helper-text>{{ @helperText }} </H .HelperText>
1717 {{ /if }}
18- {{ #if @errors }}
19- <H .Error data-test-error as |E|>
20- {{ #each @errors as |error |}}
21- <E .Message data-test-error-message>{{ error.message }} </E .Message>
22- {{ /each }}
23- </H .Error>
24- {{ /if }}
2518 </:header >
2619 <:row as |R|>
2720 <R .Field as |F|>
3124 name ={{ @name }}
3225 disabled ={{ @disabled }}
3326 data-test-key-input
27+ @isInvalid ={{ @errors }}
3428 {{ on ' change' (fn this.updateKey R.rowData )}}
3529 >
3630 <option disabled hidden selected value =' ' >
5145 @value ={{ R.rowData.key }}
5246 disabled ={{ @disabled }}
5347 data-test-key-input
48+ @isInvalid ={{ @errors }}
5449 {{ on ' input' (fn this.updateKey R.rowData )}}
5550 />
5651 {{ else }}
6055 @value ={{ R.rowData.key }}
6156 disabled ={{ @disabled }}
6257 data-test-key-input
58+ @isInvalid ={{ @errors }}
6359 {{ on ' input' (fn this.updateKey R.rowData )}}
6460 />
6561 {{ /if }}
6662 </R .Field>
6763
68- {{ #if this.showValueField }}
64+ {{ #unless this.hideValueField }}
6965 <R .Field as |F|>
7066 <F .Label>{{ or @valueLabel (t ' form.value.label' )}} </F .Label>
7167 {{ #if (eq @valueFieldType ' select' )}}
7268 <F .Select
7369 name ={{ @name }}
7470 disabled ={{ @disabled }}
7571 data-test-value-input
72+ @isInvalid ={{ @errors }}
7673 {{ on ' change' (fn this.updateValue R.rowData )}}
7774 >
7875 <option disabled hidden selected value =' ' >
8986 </F .Select>
9087 {{ else if (eq @valueFieldType 'textarea')}}
9188 <F .Textarea
89+ name ={{ @name }}
9290 @value ={{ R.rowData.value }}
9391 disabled ={{ @disabled }}
9492 data-test-value-input
93+ @isInvalid ={{ @errors }}
9594 {{ on ' input' (fn this.updateValue R.rowData )}}
9695 />
9796 {{ else }}
101100 @value ={{ R.rowData.value }}
102101 disabled ={{ @disabled }}
103102 data-test-value-input
103+ @isInvalid ={{ @errors }}
104104 {{ on ' input' (fn this.updateValue R.rowData )}}
105105 />
106106 {{ /if }}
107107 </R .Field>
108- {{ /if }}
108+ {{ /unless }}
109109
110110 <R .DeleteRowButton
111111 data-test-delete-button
112112 onclick ={{ fn this.removeRow R.rowData }}
113113 />
114114 </:row >
115115 <:footer as |F|>
116+
117+ {{ #if @errors }}
118+ <F .Error as |E|>
119+ {{ #each @errors as |error |}}
120+ <E .Message data-test-error-message>{{ error.message }} </E .Message>
121+ {{ /each }}
122+ </F .Error>
123+ {{ /if }}
116124 <F .AddRowButton
117125 @text ={{ t ' actions.add' }}
118126 data-test-add-button
Original file line number Diff line number Diff line change @@ -14,14 +14,18 @@ export default class FormFieldKeyValueComponent extends Component {
1414 ? [ ...this . args . data ]
1515 : [ this . createEmptyRow ( ) ] ;
1616
17- // Determine if the value field should be shown
18- get showValueField ( ) {
19- return this . args . showValueField !== false ;
17+ /**
18+ * Determine if the value field should be shown
19+ * Defaults to false (show the value field by default)
20+ * @type {boolean }
21+ */
22+ get hideValueField ( ) {
23+ return this . args . hideValueField ?? false ;
2024 }
2125
2226 createEmptyRow ( ) {
2327 const row = { key : '' } ;
24- if ( this . showValueField ) {
28+ if ( ! this . hideValueField ) {
2529 row . value = '' ;
2630 }
2731 return row ;
You can’t perform that action at this time.
0 commit comments