@@ -6,29 +6,35 @@ import DialogContent from '@mui/material/DialogContent';
66import DialogTitle from '@mui/material/DialogTitle' ;
77import DialogActions from '@mui/material/DialogActions' ;
88import FormControlLabel from '@mui/material/FormControlLabel' ;
9+ import FormControl from '@mui/material/FormControl' ;
910import Checkbox from '@mui/material/Checkbox' ;
1011import FormHelperText from '@mui/material/FormHelperText' ;
1112import Button from '@mui/material/Button' ;
13+ import RadioGroup from '@mui/material/RadioGroup' ;
14+ import Radio from '@mui/material/Radio' ;
15+ import FormLabel from '@mui/material/FormLabel' ;
16+
1217import DoubleArrowIcon from '@mui/icons-material/DoubleArrow' ;
1318
1419import CloseIconButton from '../common/CloseIconButton'
20+ import RepoChip from '../repos/RepoVersionChip'
1521import AIAssistantButton from './AIAssistantButton'
1622
1723
18- const AutoMatchDialog = ( { open, onClose, autoMatchUnmappedOnly, setAutoMatchUnmappedOnly, rowStatuses, autoRunAIAnalysis, setAutoRunAIAnalysis, AIModels, AIModel, setAIModel, repo , onSubmit, inAIAssistantGroup} ) => {
24+ const AutoMatchDialog = ( { open, onClose, autoMatchUnmappedOnly, setAutoMatchUnmappedOnly, rowStatuses, autoRunAIAnalysis, setAutoRunAIAnalysis, AIModels, AIModel, setAIModel, repoVersion , onSubmit, inAIAssistantGroup} ) => {
1925 const { t } = useTranslation ( )
2026
2127 const getHelperTextForAutoMatchUnmapped = ( ) => {
2228 if ( autoMatchUnmappedOnly ) {
23- const count = rowStatuses . readyForReview . length ;
29+ const count = rowStatuses . unmapped . length ;
2430 if ( count > 0 ) {
2531 return t ( 'map_project.auto_match_unmapped_only_note' , { count : count . toLocaleString ( ) } ) ;
2632 }
2733 return t ( 'map_project.auto_match_unmapped_only_note_no_count' ) ;
2834 }
2935 const approvedCount = rowStatuses . reviewed . length ;
3036 const proposedCount = rowStatuses . readyForReview . length ;
31- if ( approvedCount > 0 && proposedCount > 0 ) {
37+ if ( approvedCount > 0 || proposedCount > 0 ) {
3238 return t ( 'map_project.auto_match_note' , {
3339 approvedCount : approvedCount . toLocaleString ( ) ,
3440 proposedCount : proposedCount . toLocaleString ( )
@@ -37,6 +43,8 @@ const AutoMatchDialog = ({open, onClose, autoMatchUnmappedOnly, setAutoMatchUnma
3743 return t ( 'map_project.auto_match_note_no_counts' ) ;
3844 } ;
3945
46+ const isDisabled = ! repoVersion ?. version_url
47+
4048 return (
4149 < Dialog
4250 open = { open }
@@ -55,8 +63,34 @@ const AutoMatchDialog = ({open, onClose, autoMatchUnmappedOnly, setAutoMatchUnma
5563 < span > { t ( 'map_project.auto_match' ) } </ span >
5664 < CloseIconButton onClick = { onClose } />
5765 </ DialogTitle >
58- < DialogContent sx = { { paddingTop : '12px !important' } } >
59- < FormControlLabel sx = { { marginTop : '12px' , width : '100%' } } control = { < Checkbox checked = { autoMatchUnmappedOnly } onChange = { event => setAutoMatchUnmappedOnly ( event . target . checked ) } /> } label = { t ( 'map_project.unmapped_only' ) } />
66+ < DialogContent >
67+ < div className = 'col-xs-12 padding-0' style = { { display : 'flex' , alignItems : 'center' , fontSize : '1rem' } } >
68+ { t ( 'map_project.target_repository' ) }
69+ {
70+ repoVersion ?. id &&
71+ < RepoChip repo = { repoVersion } hideType sx = { { marginLeft : '16px' } } />
72+ }
73+ </ div >
74+ < FormControl sx = { { marginTop : '12px' } } >
75+ < FormLabel id = "automatch-rows" > { t ( 'map_project.input_dataset' ) } </ FormLabel >
76+ < RadioGroup
77+ row
78+ aria-labelledby = "automatch-rows"
79+ name = "automatch-rows"
80+ onChange = { ( ) => setAutoMatchUnmappedOnly ( ! autoMatchUnmappedOnly ) }
81+ >
82+ < FormControlLabel
83+ value = "unmapped"
84+ control = { < Radio checked = { autoMatchUnmappedOnly } /> }
85+ label = { t ( 'map_project.unmapped_only' ) + ` (${ rowStatuses . unmapped . length . toLocaleString ( ) } )` }
86+ />
87+ < FormControlLabel
88+ value = "all"
89+ control = { < Radio checked = { ! autoMatchUnmappedOnly } /> }
90+ label = { t ( 'map_project.all_rows' ) + ` (${ ( rowStatuses . unmapped . length + rowStatuses . readyForReview . length ) . toLocaleString ( ) } )` }
91+ />
92+ </ RadioGroup >
93+ </ FormControl >
6094 < FormHelperText sx = { { marginTop : '-4px' } } >
6195 {
6296 getHelperTextForAutoMatchUnmapped ( )
@@ -66,7 +100,7 @@ const AutoMatchDialog = ({open, onClose, autoMatchUnmappedOnly, setAutoMatchUnma
66100 inAIAssistantGroup &&
67101 < >
68102 < FormControlLabel
69- sx = { { marginTop : '0px ' , width : '100%' } }
103+ sx = { { marginTop : '12px ' , width : '100%' } }
70104 control = {
71105 < Checkbox
72106 checked = { autoRunAIAnalysis }
@@ -102,7 +136,7 @@ const AutoMatchDialog = ({open, onClose, autoMatchUnmappedOnly, setAutoMatchUnma
102136 size = 'small'
103137 sx = { { textTransform : 'none' , marginLeft : '12px' } }
104138 endIcon = { < DoubleArrowIcon /> }
105- disabled = { ! repo ?. url }
139+ disabled = { isDisabled }
106140 onClick = { onSubmit }
107141 >
108142 { t ( 'common.submit' ) }
0 commit comments