Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1459 | hierarchy view filters | added omit …
Browse files Browse the repository at this point in the history
…if exists in and equivalency map type
  • Loading branch information
snyaggarwal committed Jan 16, 2023
1 parent c01117f commit 09e8771
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/components/concepts/HierarchyTreeFilters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ const HierarchyTreeFilters = ({filters, onChange, onMapTypesFilterChange, size})
const [mapTypes, setMapTypes] = React.useState(filters.mapTypes || '')
const [excludeMapTypes, setExcludeMapTypes] = React.useState(filters.excludeMapTypes || '')
const [returnMapTypes, setReturnMapTypes] = React.useState(filters.returnMapTypes || '')
const [omitIfExistsIn, setOmitIfExistsIn] = React.useState(filters.omitIfExistsIn || '')
const [equivalencyMapType, setEquivalencyMapType] = React.useState(filters.equivalencyMapType || '')
const [levelAnchorEl, setLevelAnchorEl] = React.useState(null);
const [mapTypeAnchorEl, setMapTypeAnchorEl] = React.useState(null);
const [omitIfExistsInAnchorEl, setOmitIfExistsInAnchorEl] = React.useState(null);
const cascadeLevelText = filters.cascadeLevels === '*' ? 'Levels: All' : `Levels: ${filters.cascadeLevels}`
const toggleLevelAnchor = event => setLevelAnchorEl(levelAnchorEl ? null : event.currentTarget)
const toggleMapTypeAnchor = event => setMapTypeAnchorEl(mapTypeAnchorEl ? null : event.currentTarget)
const toggleOmitIfExistsInAnchor = event => setOmitIfExistsInAnchorEl(omitIfExistsInAnchorEl ? null : event.currentTarget)
const onLevelChange = newLevel => {
toggleLevelAnchor()
onChange('cascadeLevels', newLevel)
Expand All @@ -37,6 +41,10 @@ const HierarchyTreeFilters = ({filters, onChange, onMapTypesFilterChange, size})
toggleMapTypeAnchor()
onMapTypesFilterChange({...filters, mapTypes: mapTypes, excludeMapTypes: excludeMapTypes, returnMapTypes: returnMapTypes})
}
const onOmitIfExistsInChange = () => {
toggleOmitIfExistsInAnchor()
onMapTypesFilterChange({...filters, omitIfExistsIn: omitIfExistsIn, equivalencyMapType: equivalencyMapType})
}
const _size = size || 'small'

return (
Expand Down Expand Up @@ -94,6 +102,19 @@ const HierarchyTreeFilters = ({filters, onChange, onMapTypesFilterChange, size})
/>
</Tooltip>
}
<Tooltip title="Omit If Exists In Repo Version" arrow placement='top'>
<Chip
color={filters.omitIfExistsIn ? "primary" : "secondary"}
variant="outlined"
label="OmitIfExistsIn"
size={_size}
clickable
deleteIcon={<FilterIcon />}
onDelete={toggleOmitIfExistsInAnchor}
onClick={toggleOmitIfExistsInAnchor}
style={{marginLeft: '2px'}}
/>
</Tooltip>
<Tooltip title={filters.includeRetired ? 'Exclude Retired' : 'Include Retired'} arrow placement='top'>
<Chip
color="primary"
Expand Down Expand Up @@ -185,6 +206,47 @@ const HierarchyTreeFilters = ({filters, onChange, onMapTypesFilterChange, size})
</Button>
</DialogActions>
</Dialog>
<Dialog open={Boolean(omitIfExistsInAnchorEl)} onClose={toggleOmitIfExistsInAnchor}>
<DialogTitle>
Omit If Exists In Repo Version
</DialogTitle>
<DialogContent style={{minWidth: '400px'}}>
<div className='col-xs-12 no-side-padding'>
<div className='col-xs-12 no-side-padding' style={{fontWeight: 'bold', marginBottom: '5px'}}>
OmitIfExistsIn
</div>
<div className='col-xs-12 no-side-padding'>
<TextField
fullWidth
value={omitIfExistsIn}
onChange={event => setOmitIfExistsIn(event.target.value)}
placeholder='e.g. /orgs/MyOrg/collections/MyCollection/'
/>
</div>
</div>
<div className='col-xs-12 no-side-padding' style={{marginTop: '15px'}}>
<div className='col-xs-12 no-side-padding' style={{fontWeight: 'bold', marginBottom: '5px'}}>
EquivalencyMapType
</div>
<div className='col-xs-12 no-side-padding'>
<TextField
fullWidth
value={equivalencyMapType}
onChange={event => setEquivalencyMapType(event.target.value)}
placeholder='e.g. SAME-AS,CONCEPT-SET'
/>
</div>
</div>
</DialogContent>
<DialogActions>
<Button onClick={toggleOmitIfExistsInAnchor} variant='outlined' color='secondary'>
Close
</Button>
<Button onClick={onOmitIfExistsInChange} color="primary" variant='outlined'>
Apply
</Button>
</DialogActions>
</Dialog>
</span>
);
}
Expand Down

0 comments on commit 09e8771

Please sign in to comment.