@@ -89,7 +89,7 @@ const createSchema = (fields, edit, ems, loadSchema, emptySchema) => {
8989 component : componentTypes . SUB_FORM ,
9090 name : 'resource_type_selection' ,
9191 id : 'resource_type_selection' ,
92- condition : { when : 'required_capabilities ' , isNotEmpty : true } ,
92+ condition : { when : 'compression ' , isNotEmpty : true } ,
9393 fields : [
9494 {
9595 component : 'enhanced-select' ,
@@ -101,12 +101,18 @@ const createSchema = (fields, edit, ems, loadSchema, emptySchema) => {
101101 isRequired : true ,
102102 validate : [
103103 { type : validatorTypes . REQUIRED } ,
104- { type : validatorTypes . PATTERN , pattern : '^(?!-)' , message : 'Required ' } ,
104+ { type : validatorTypes . PATTERN , pattern : '^(?!-)' , message : 'No storage service supports all selected capabilities ' } ,
105105 async ( value ) => validateServiceHasResources ( value ) ,
106106 ] ,
107107 resolveProps : ( _props , _field , { getState } ) => {
108- const capabilityValues = getState ( ) . values . required_capabilities . map ( ( { value } ) => value ) ;
109- const emsId = getState ( ) . values . ems_id ;
108+ const stateValues = getState ( ) . values ;
109+ const emsId = stateValues . ems_id ;
110+ const capabilityValues = [ ] ;
111+
112+ const capabilityNames = fields . find ( ( object ) => object . id === 'required_capabilities' )
113+ . fields . map ( ( capability ) => capability . id ) ;
114+ capabilityNames . forEach ( ( capabilityName ) => capabilityValues . push ( stateValues [ capabilityName ] ) ) ;
115+
110116 return {
111117 key : JSON . stringify ( capabilityValues ) ,
112118 loadOptions : async ( ) => {
@@ -120,19 +126,25 @@ const createSchema = (fields, edit, ems, loadSchema, emptySchema) => {
120126 component : 'enhanced-select' ,
121127 name : 'storage_resource_id' ,
122128 id : 'storage_resource_id' ,
123- label : __ ( 'Storage Resources (if no option appears then no storage resource with selected capabilities was found )' ) ,
129+ label : __ ( 'Storage Resource(s )' ) ,
124130 condition : { when : 'mode' , is : 'Advanced' } ,
125131 onInputChange : ( ) => null ,
126132 isRequired : true ,
127- helperText : __ ( 'Select storage resources to attach to the new service. The new Volume(s) will be created on these resources.' ) ,
133+ helperText : __ ( 'Select storage resources to attach to the service. The new Volume(s) will be created on these resources.' ) ,
128134 validate : [
129135 { type : validatorTypes . REQUIRED } ,
130136 { type : validatorTypes . PATTERN , pattern : '^(?!-)' , message : 'Required' } ,
131137 ] ,
132138 isMulti : true ,
133139 resolveProps : ( _props , _field , { getState } ) => {
134- const capabilityValues = getState ( ) . values . required_capabilities . map ( ( { value } ) => value ) ;
135- const emsId = getState ( ) . values . ems_id ;
140+ const stateValues = getState ( ) . values ;
141+ const emsId = stateValues . ems_id ;
142+ const capabilityValues = [ ] ;
143+
144+ const capabilityNames = fields . find ( ( object ) => object . id === 'required_capabilities' )
145+ . fields . map ( ( capability ) => capability . id ) ;
146+ capabilityNames . forEach ( ( capabilityName ) => capabilityValues . push ( stateValues [ capabilityName ] ) ) ;
147+
136148 return {
137149 key : JSON . stringify ( capabilityValues ) ,
138150 loadOptions : async ( ) => {
0 commit comments