99 ProductsKnowledge ,
1010 RegionKnowledge ,
1111 useComponents ,
12+ useParamGroups ,
1213 useProducts ,
1314 useVendorsAndRegions ,
1415} from '@/components/CreateClusterPanel/helpers'
@@ -76,6 +77,9 @@ export function SimpleForm({
7677 arch
7778 )
7879
80+ // Get parameter groups with productId, productVersion
81+ const { paramGroups } = useParamGroups ( productId , productVersion )
82+
7983 const setVendor = useCallback (
8084 ( vendorId ?: string ) => {
8185 if ( ! vendorAndRegions ) return
@@ -131,6 +135,15 @@ export function SimpleForm({
131135 setProduct ( )
132136 } , [ products ] )
133137
138+ // set a default value of the parameterGroupID item
139+ useEffect ( ( ) => {
140+ if ( paramGroups ?. length ) {
141+ form . setFieldsValue ( {
142+ parameterGroupID : paramGroups [ 0 ] . id ,
143+ } )
144+ }
145+ } , [ paramGroups , form ] )
146+
134147 const { t, i18n } = useI18n ( )
135148
136149 const vendorSelector = useMemo (
@@ -173,9 +186,10 @@ export function SimpleForm({
173186 type = { productId }
174187 arch = { arch }
175188 products = { products }
189+ paramGroups = { paramGroups }
176190 />
177191 ) ,
178- [ productId , arch , vendorId , region , products , i18n . language ]
192+ [ productId , arch , vendorId , region , products , paramGroups , i18n . language ]
179193 )
180194
181195 const nodeOptions = useMemo (
@@ -210,6 +224,7 @@ export function SimpleForm({
210224 < Form
211225 layout = "horizontal"
212226 hideRequiredMark
227+ scrollToFirstError
213228 colon = { false }
214229 form = { form }
215230 name = "create"
@@ -243,6 +258,7 @@ function BasicOptions({
243258 type,
244259 arch,
245260 products,
261+ paramGroups,
246262} : {
247263 t : TFunction < '' >
248264 onSelectProduct : ( type : string ) => void
@@ -252,6 +268,7 @@ function BasicOptions({
252268 type : string
253269 arch : string
254270 products : ProductsKnowledge
271+ paramGroups : { id : string ; name : string } [ ]
255272} ) {
256273 return (
257274 < Card title = { t ( 'basic.title' ) } >
@@ -269,6 +286,21 @@ function BasicOptions({
269286 ) ) }
270287 </ Select >
271288 </ Form . Item >
289+ < Form . Item
290+ name = "cpuArchitecture"
291+ label = { t ( 'basic.fields.arch' ) }
292+ rules = { [ { required : true } ] }
293+ initialValue = { arch }
294+ >
295+ < Radio . Group onChange = { ( e ) => onSelectArch ( e . target . value ) } >
296+ { ! ! type &&
297+ products . products [ type ] ?. _archs . map ( ( a ) => (
298+ < Radio . Button value = { a } key = { a } >
299+ { a }
300+ </ Radio . Button >
301+ ) ) }
302+ </ Radio . Group >
303+ </ Form . Item >
272304 < Form . Item
273305 label = { t ( 'basic.fields.version' ) }
274306 name = "clusterVersion"
@@ -285,19 +317,19 @@ function BasicOptions({
285317 </ Select >
286318 </ Form . Item >
287319 < Form . Item
288- name = "cpuArchitecture"
289- label = { t ( 'basic.fields.arch' ) }
290- rules = { [ { required : true } ] }
291- initialValue = { arch }
320+ label = { t ( 'basic.fields.paramGroup' ) }
321+ name = "parameterGroupID"
322+ rules = { [
323+ { required : true , message : t ( 'basic.rules.paramGroup.require' ) } ,
324+ ] }
292325 >
293- < Radio . Group onChange = { ( e ) => onSelectArch ( e . target . value ) } >
294- { ! ! type &&
295- products . products [ type ] ?. _archs . map ( ( a ) => (
296- < Radio . Button value = { a } key = { a } >
297- { a }
298- </ Radio . Button >
299- ) ) }
300- </ Radio . Group >
326+ < Select >
327+ { paramGroups . map ( ( item ) => (
328+ < Select . Option value = { item . id } key = { item . id } >
329+ { item . name }
330+ </ Select . Option >
331+ ) ) }
332+ </ Select >
301333 </ Form . Item >
302334 </ Card >
303335 )
@@ -354,7 +386,7 @@ function ComponentOptions({
354386 label = { t ( 'component.fields.copies' ) }
355387 >
356388 < Select >
357- { [ 1 , 2 , 3 , 4 , 5 ] . map ( ( count ) => (
389+ { [ 1 , 3 , 5 , 7 ] . map ( ( count ) => (
358390 < Select . Option key = { count } value = { count } >
359391 { count }
360392 </ Select . Option >
@@ -365,15 +397,14 @@ function ComponentOptions({
365397 < Row
366398 gutter = { 20 }
367399 style = { {
368- lineHeight : '12px' ,
369400 fontSize : 16 ,
370401 } }
371402 >
372403 < Col span = { 8 } > { t ( 'component.fields.zone' ) } </ Col >
373404 < Col span = { 8 } > { t ( 'component.fields.spec' ) } </ Col >
374405 < Col span = { 8 } > { t ( 'component.fields.amount' ) } </ Col >
375406 </ Row >
376- < Divider style = { { margin : '16px 0' } } />
407+ < Divider style = { { margin : '12px 0' } } />
377408 { component . zones . map ( ( zone , i ) => {
378409 if ( ! zone ) return undefined
379410 return (
@@ -475,6 +506,9 @@ function ClusterOptions() {
475506 dropdownStyle = { { display : 'none' } }
476507 />
477508 </ Form . Item >
509+ < Form . Item label = { t ( 'cluster.fields.user' ) } >
510+ < span > root</ span >
511+ </ Form . Item >
478512 < Form . Item
479513 name = "dbPassword"
480514 label = { t ( 'cluster.fields.password' ) }
0 commit comments