@@ -16,6 +16,8 @@ import { useFeatures } from '../../context/feature_context/feature_hook';
16
16
import { APP_FEATURES } from '../../common/app_features' ;
17
17
import { useSubdomainUniqueness } from '../../hooks/subdomain_checker' ;
18
18
import { hasRequiredFields } from '../../common/validate_hosting_environment' ;
19
+ import { AvailabilityZoneTooltip } from '../engagement_data_cards/hosting_environment_card/availability_zone_tooltip' ;
20
+
19
21
export interface OpenShiftClusterEditModalProps {
20
22
hostingEnvironment : Partial < HostingEnvironment > ;
21
23
isOpen : boolean ;
@@ -59,7 +61,14 @@ export function OpenShiftClusterEditModal({
59
61
hostingEnvironment
60
62
) ;
61
63
62
- const onSave = ( ) => {
64
+ const onSave = async ( ) => {
65
+ if ( hostingEnvironment . ocp_cloud_provider_availability_zone === undefined ) {
66
+ await setHostingEnvironment ( {
67
+ ...hostingEnvironment ,
68
+ ocp_cloud_provider_availability_zone : engagementFormConfig ?. cloud_options ?. availability_zones ?. options ?. find ( element => element . default ) . value ,
69
+ } as HostingEnvironment ) ;
70
+ hostingEnvironment . ocp_cloud_provider_availability_zone = engagementFormConfig ?. cloud_options ?. availability_zones ?. options ?. find ( element => element . default ) . value ;
71
+ }
63
72
propsOnSave ( hostingEnvironment ) ;
64
73
onClose ( ) ;
65
74
} ;
@@ -127,6 +136,7 @@ export function OpenShiftClusterEditModal({
127
136
hostingEnvironment = { hostingEnvironment }
128
137
/>
129
138
< SelectFormField
139
+ arial-label = "Provider Region"
130
140
label = "Provider Region"
131
141
isDisabled = {
132
142
availableProviderRegionOptions ?. length === 0 ||
@@ -144,7 +154,29 @@ export function OpenShiftClusterEditModal({
144
154
onChange = { value => onChange ( 'ocp_cloud_provider_region' , value ) }
145
155
value = { hostingEnvironment ?. ocp_cloud_provider_region }
146
156
/>
157
+ { hasFeature ( APP_FEATURES . availabilityZone ) ?
158
+ < SelectFormField
159
+ aria-label = 'Availability Zone'
160
+ label = { < > Availability Zone
161
+ < AvailabilityZoneTooltip /> </ > }
162
+ isDisabled = {
163
+ engagementFormConfig ?. cloud_options ?. availability_zones ?. options ?. length === 0 ||
164
+ ! hasFeature ( APP_FEATURES . writer )
165
+ }
166
+ testId = "provider-availability-zone-select"
167
+ emptyValue = { {
168
+ label : "Select an availability zone configuration"
169
+ } }
170
+ options = { engagementFormConfig ?. cloud_options ?. availability_zones ?. options ?. map ?.(
171
+ v => ( { label : v . label , disabled : v . disabled , value : v . value } )
172
+ ) }
173
+ onChange = { value => onChange ( 'ocp_cloud_provider_availability_zone' , value ) }
174
+ value = { hostingEnvironment ?. ocp_cloud_provider_availability_zone ?? engagementFormConfig ?. cloud_options ?. availability_zones ?. options ?. find ( element => element . default ) . value }
175
+ />
176
+
177
+ : '' }
147
178
< SelectFormField
179
+ aria-label = 'OpenShift version'
148
180
value = { hostingEnvironment ?. ocp_version || '' }
149
181
testId = "oc_version_select"
150
182
emptyValue = { { label : 'Select a version' } }
@@ -170,6 +202,7 @@ export function OpenShiftClusterEditModal({
170
202
< SelectFormField
171
203
value = { hostingEnvironment ?. ocp_persistent_storage_size }
172
204
testId = "persistent-storage-select"
205
+ aria-label = 'Persistent Storage Needs'
173
206
label = "Persistent Storage Needs"
174
207
options = { engagementFormConfig ?. openshift_options ?. persistent_storage ?. options ?. map ?.(
175
208
v => ( { label : v . label , disabled : v . disabled , value : v . value } )
@@ -189,6 +222,7 @@ export function OpenShiftClusterEditModal({
189
222
value = { hostingEnvironment ?. ocp_cluster_size || '' }
190
223
emptyValue = { { label : 'Select cluster size' } }
191
224
label = "Cluster Size"
225
+ aria-label = "Cluster Size"
192
226
isDisabled = { ! hasFeature ( APP_FEATURES . writer ) }
193
227
onChange = { value => onChange ( 'ocp_cluster_size' , value ) }
194
228
/>
0 commit comments