@@ -123,27 +123,27 @@ const AssayDomainForm: FC<AssayDomainFormProps> = memo(props => {
123
123
] ) ;
124
124
return (
125
125
< DomainForm
126
- key = { domain . domainId || index }
127
126
api = { api }
128
- index = { domain . domainId || index }
129
- domainIndex = { index }
127
+ appDomainHeaderRenderer = { appDomainHeaderRenderer }
128
+ appPropertiesOnly = { hideAdvancedProperties }
129
+ controlledCollapse
130
130
domain = { domain }
131
+ domainFormDisplayOptions = { displayOptions }
132
+ domainIndex = { index }
131
133
headerPrefix = { headerPrefix }
132
- controlledCollapse
134
+ helpTopic = { null } // null so that we don't show the "learn more about this tool" link for these domains
135
+ index = { domain . domainId || index }
133
136
initCollapsed = { currentPanelIndex !== index + DOMAIN_PANEL_INDEX }
134
- validate = { validatePanel === index + DOMAIN_PANEL_INDEX }
137
+ key = { domain . domainId || index }
138
+ modelDomains = { protocolModel . domains }
139
+ onChange = { onChange }
140
+ onToggle = { onToggle }
135
141
panelStatus = {
136
142
protocolModel . isNew ( )
137
143
? getDomainPanelStatus ( index + DOMAIN_PANEL_INDEX , currentPanelIndex , visitedPanels , firstState )
138
144
: 'COMPLETE'
139
145
}
140
- helpTopic = { null } // null so that we don't show the "learn more about this tool" link for these domains
141
- onChange = { onChange }
142
- onToggle = { onToggle }
143
- appDomainHeaderRenderer = { appDomainHeaderRenderer }
144
- modelDomains = { protocolModel . domains }
145
- appPropertiesOnly = { hideAdvancedProperties }
146
- domainFormDisplayOptions = { displayOptions }
146
+ validate = { validatePanel === index + DOMAIN_PANEL_INDEX }
147
147
>
148
148
< div > { domain . description } </ div >
149
149
</ DomainForm >
@@ -336,40 +336,43 @@ export class AssayDesignerPanelsImpl extends React.PureComponent<Props, State> {
336
336
} ;
337
337
338
338
saveFilterCriteria = ( filterCriteria : FilterCriteriaMap ) => {
339
- this . setState ( current => {
340
- const protocolModel = current . protocolModel ;
341
- const resultsIndex = current . protocolModel . domains . findIndex ( ( domain : DomainDesign ) : boolean =>
342
- domain . isNameSuffixMatch ( 'Data' )
343
- ) ;
344
- const domains = current . protocolModel . domains ;
345
- let resultsDomain = domains . get ( resultsIndex ) ;
346
- // Clear the existing values first
347
- let fields = resultsDomain . fields . map ( f => f . set ( 'filterCriteria' , [ ] ) as DomainField ) . toList ( ) ;
348
-
349
- filterCriteria . forEach ( ( fieldCriteria , propertyId ) => {
350
- const domainFieldIdx = fields . findIndex ( d => d . propertyId === propertyId ) ;
351
-
352
- if ( domainFieldIdx < 0 ) {
353
- console . warn ( `Unable to find domain field with property id ${ propertyId } ` ) ;
354
- return ;
355
- }
339
+ this . setState (
340
+ current => {
341
+ const protocolModel = current . protocolModel ;
342
+ const resultsIndex = current . protocolModel . domains . findIndex ( ( domain : DomainDesign ) : boolean =>
343
+ domain . isNameSuffixMatch ( 'Data' )
344
+ ) ;
345
+ const domains = current . protocolModel . domains ;
346
+ let resultsDomain = domains . get ( resultsIndex ) ;
347
+ // Clear the existing values first
348
+ let fields = resultsDomain . fields . map ( f => f . set ( 'filterCriteria' , [ ] ) as DomainField ) . toList ( ) ;
356
349
357
- let domainField = fields . get ( domainFieldIdx ) ;
358
- domainField = domainField . set ( 'filterCriteria' , fieldCriteria ) as DomainField ;
359
- fields = fields . set ( domainFieldIdx , domainField ) ;
360
- } ) ;
350
+ filterCriteria . forEach ( ( fieldCriteria , propertyId ) => {
351
+ const domainFieldIdx = fields . findIndex ( d => d . propertyId === propertyId ) ;
361
352
362
- resultsDomain = resultsDomain . set ( 'fields' , fields ) as DomainDesign ;
353
+ if ( domainFieldIdx < 0 ) {
354
+ console . warn ( `Unable to find domain field with property id ${ propertyId } ` ) ;
355
+ return ;
356
+ }
363
357
364
- return {
365
- modalOpen : false ,
366
- openTo : undefined ,
367
- protocolModel : protocolModel . set (
368
- 'domains' ,
369
- protocolModel . domains . set ( resultsIndex , resultsDomain )
370
- ) as AssayProtocolModel ,
371
- } ;
372
- } ) ;
358
+ let domainField = fields . get ( domainFieldIdx ) ;
359
+ domainField = domainField . set ( 'filterCriteria' , fieldCriteria ) as DomainField ;
360
+ fields = fields . set ( domainFieldIdx , domainField ) ;
361
+ } ) ;
362
+
363
+ resultsDomain = resultsDomain . set ( 'fields' , fields ) as DomainDesign ;
364
+
365
+ return {
366
+ modalOpen : false ,
367
+ openTo : undefined ,
368
+ protocolModel : protocolModel . set (
369
+ 'domains' ,
370
+ protocolModel . domains . set ( resultsIndex , resultsDomain )
371
+ ) as AssayProtocolModel ,
372
+ } ;
373
+ } ,
374
+ ( ) => this . props . onChange ?.( this . state . protocolModel )
375
+ ) ;
373
376
} ;
374
377
375
378
togglePropertiesPanel = ( collapsed , callback ) : void => {
@@ -409,32 +412,32 @@ export class AssayDesignerPanelsImpl extends React.PureComponent<Props, State> {
409
412
410
413
return (
411
414
< BaseDomainDesigner
412
- name = { protocolModel . name }
413
- exception = { protocolModel . exception }
414
415
domains = { protocolModel . domains }
416
+ exception = { protocolModel . exception }
415
417
hasValidProperties = { protocolModel . hasValidProperties ( ) }
416
- visitedPanels = { visitedPanels }
417
- submitting = { submitting }
418
+ name = { protocolModel . name }
418
419
onCancel = { onCancel }
419
420
onFinish = { this . onFinish }
420
421
saveBtnText = { saveBtnText }
421
422
showUserComment = { ! initModel . isNew ( ) && appPropertiesOnly }
423
+ submitting = { submitting }
424
+ visitedPanels = { visitedPanels }
422
425
>
423
426
< FilterCriteriaContext . Provider value = { filterCriteriaState } >
424
427
< AssayPropertiesPanel
425
- model = { protocolModel }
426
- onChange = { this . onAssayPropertiesChange }
427
- controlledCollapse
428
- initCollapsed = { currentPanelIndex !== PROPERTIES_PANEL_INDEX }
429
- panelStatus = { panelStatus }
430
- validate = { validatePanel === PROPERTIES_PANEL_INDEX }
431
428
appPropertiesOnly = { appPropertiesOnly }
429
+ canRename = { isGpat }
430
+ controlledCollapse
432
431
hideAdvancedProperties = { hideAdvancedProperties }
433
432
hideStudyProperties = {
434
433
! ! domainFormDisplayOptions && domainFormDisplayOptions . hideStudyPropertyTypes
435
434
}
435
+ initCollapsed = { currentPanelIndex !== PROPERTIES_PANEL_INDEX }
436
+ model = { protocolModel }
437
+ onChange = { this . onAssayPropertiesChange }
436
438
onToggle = { this . togglePropertiesPanel }
437
- canRename = { isGpat }
439
+ panelStatus = { panelStatus }
440
+ validate = { validatePanel === PROPERTIES_PANEL_INDEX }
438
441
/>
439
442
{ /* Note: We cannot filter this array because onChange needs the correct index for each domain */ }
440
443
{ protocolModel . domains . toArray ( ) . map ( ( domain , i ) => {
@@ -445,16 +448,16 @@ export class AssayDesignerPanelsImpl extends React.PureComponent<Props, State> {
445
448
< AssayDomainForm
446
449
api = { api }
447
450
appDomainHeaders = { appDomainHeaders }
451
+ currentPanelIndex = { currentPanelIndex }
448
452
domain = { domain }
449
453
domainFormDisplayOptions = { domainFormDisplayOptions }
454
+ firstState = { firstState }
450
455
headerPrefix = { initModel ?. name }
451
456
index = { i }
452
457
key = { domain . name }
453
458
onDomainChange = { this . onDomainChange }
454
- protocolModel = { protocolModel }
455
- currentPanelIndex = { currentPanelIndex }
456
- firstState = { firstState }
457
459
onTogglePanel = { onTogglePanel }
460
+ protocolModel = { protocolModel }
458
461
validatePanel = { validatePanel }
459
462
visitedPanels = { visitedPanels }
460
463
/>
@@ -463,17 +466,17 @@ export class AssayDesignerPanelsImpl extends React.PureComponent<Props, State> {
463
466
{ modalOpen && (
464
467
< FilterCriteriaModal
465
468
onClose = { this . closeModal }
466
- openTo = { openTo }
467
469
onSave = { this . saveFilterCriteria }
470
+ openTo = { openTo }
468
471
protocolModel = { protocolModel }
469
472
/>
470
473
) }
471
474
</ FilterCriteriaContext . Provider >
472
475
{ appPropertiesOnly && allowFolderExclusion && (
473
476
< DataTypeFoldersPanel
474
477
controlledCollapse
475
- dataTypeRowId = { protocolModel ?. protocolId }
476
478
dataTypeName = { protocolModel ?. name }
479
+ dataTypeRowId = { protocolModel ?. protocolId }
477
480
entityDataType = { AssayRunDataType }
478
481
initCollapsed = { currentPanelIndex !== protocolModel . domains . size + 1 }
479
482
onToggle = { this . toggleFoldersPanel }
0 commit comments