@@ -261,6 +261,10 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
261
261
title : "Compute" ,
262
262
name : "The computational aspects of this computer" ,
263
263
} ,
264
+ Storage : {
265
+ title : "Storage" ,
266
+ name : "The storage aspects of this computer" ,
267
+ } ,
264
268
}
265
269
266
270
private readonly meta : Record < string , Metadata > = {
@@ -276,6 +280,14 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
276
280
title : "Resources" ,
277
281
group : this . groups . Compute ,
278
282
} ,
283
+ ".*constraints/compute/workers" : {
284
+ title : "Resources" ,
285
+ group : this . groups . Compute ,
286
+ } ,
287
+ ".*constraints/compute/accelerators/gpu" : {
288
+ title : "GPU Class" ,
289
+ group : this . groups . Compute ,
290
+ } ,
279
291
"kubernetes/context" : {
280
292
title : "Cluster" ,
281
293
group : this . groups . Compute ,
@@ -284,6 +296,14 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
284
296
title : "Namespace" ,
285
297
group : this . groups . Compute ,
286
298
} ,
299
+ "aws/choose/profile" : {
300
+ title : "AWS Profile" ,
301
+ group : this . groups . Storage ,
302
+ } ,
303
+ ".*constraints/workload/type" : {
304
+ title : "Workload Type" ,
305
+ group : this . groups . Application ,
306
+ } ,
287
307
}
288
308
289
309
private form ( form : Record < string , string > ) {
@@ -352,18 +372,21 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
352
372
. filter ( ( _ ) => ! / e x p a n d \( | # # # # / . test ( _ [ 0 ] ) ) // filter out old style of choices
353
373
. filter ( ( _ ) => ! / t e s t \/ i n p u t s / . test ( _ [ 0 ] ) ) // filter out test residuals
354
374
. reduce ( ( groups , [ title , value ] ) => {
355
- const meta = this . meta [ title ]
356
- if ( meta ) {
357
- if ( ! groups [ meta . group . title ] ) {
358
- groups [ meta . group . title ] = {
359
- title : meta . group . title ,
360
- name : meta . group . name ,
361
- children : [ ] ,
375
+ const metaKey = this . meta [ title ] ? title : Object . keys ( this . meta ) . find ( ( _ ) => new RegExp ( _ ) . test ( title ) )
376
+ if ( metaKey ) {
377
+ const meta = this . meta [ metaKey ]
378
+ if ( meta ) {
379
+ if ( ! groups [ meta . group . title ] ) {
380
+ groups [ meta . group . title ] = {
381
+ title : meta . group . title ,
382
+ name : meta . group . name ,
383
+ children : [ ] ,
384
+ }
362
385
}
363
- }
364
- const { children } = groups [ meta . group . title ]
386
+ const { children } = groups [ meta . group . title ]
365
387
366
- children . push ( this . editable ( title , this . treeNode ( meta , value ) ) )
388
+ children . push ( this . editable ( title , this . treeNode ( meta , value ) ) )
389
+ }
367
390
}
368
391
369
392
return groups
@@ -373,15 +396,28 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
373
396
if ( data . length === 0 ) {
374
397
// oops, this profile has no "shape", no choices have been
375
398
// made for us to visualize
376
- data . push ( { name : "Empty" , children : [ ] } )
399
+ data . push ( { title : "Empty" , name : "So far, this profile has no constraints ", children : [ ] } )
377
400
}
401
+ this . sort ( data )
378
402
379
403
return < TreeView hasGuides defaultAllExpanded data = { data } variant = "compactNoBackground" />
380
404
}
381
405
382
406
return "Internal Error"
383
407
}
384
408
409
+ private sort ( data : TreeViewDataItem [ ] ) {
410
+ data . sort ( ( a , b ) => ( a . title || "" ) . toString ( ) . localeCompare ( ( b . title || "" ) . toString ( ) ) )
411
+
412
+ data . forEach ( ( _ ) => {
413
+ if ( Array . isArray ( _ . children ) ) {
414
+ _ . children = this . sort ( _ . children )
415
+ }
416
+ } )
417
+
418
+ return data
419
+ }
420
+
385
421
private footer ( ) {
386
422
return (
387
423
< Flex >
0 commit comments