Skip to content

Commit

Permalink
Mapping exists in OCL icon
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Mar 24, 2023
1 parent 66a358c commit defa572
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 49 deletions.
1 change: 0 additions & 1 deletion src/components/collections/CollectionHomeChildrenList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ class CollectionHomeChildrenList extends React.Component {
<div className='col-xs-12' style={{marginBottom: '5px', borderRadius: '5px', border: '1px solid rgba(0, 0, 0, 0.1)', padding: '5px 10px'}}>
<div className='col-xs-12 no-side-padding'>
<ResourceLabel
noExistsIcon
resource='concept'
owner={resource.owner}
parent={resource.source}
Expand Down
13 changes: 1 addition & 12 deletions src/components/common/ResourceLabel.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import React from 'react';
import { includes } from 'lodash';
import {
ChevronRight as SeparatorIcon,
} from '@mui/icons-material';
import ExistsInOCLIcon from '../common/ExistsInOCLIcon';
import DoesnotExistsInOCLIcon from '../common/DoesnotExistsInOCLIcon';

const SEPARATOR = (<SeparatorIcon />)
const ResourceLabel = props => {
const { resource, existsInOCL, noSeparator, noExistsIcon } = props;
const isSourceChild = includes(['concept', 'mapping'], resource);
const { noSeparator } = props;

return (
<div className='col-xs-12 no-side-padding flex-vertical-center' style={{flexWrap: 'wrap'}}>
Expand Down Expand Up @@ -40,13 +36,6 @@ const ResourceLabel = props => {
<span className={'resource-label resource-id ' + (props.colorClass || '')} style={{maxWidth: '100%'}}>
<span className='ellipsis-text'>{props.name}</span>
</span>
{
!noExistsIcon && isSourceChild && (
existsInOCL ?
<ExistsInOCLIcon containerStyles={{marginLeft: '5px'}} /> :
<DoesnotExistsInOCLIcon containerStyles={{marginLeft: '5px'}} />
)
}
</div>
)
}
Expand Down
15 changes: 2 additions & 13 deletions src/components/common/ResourceLabelVertical.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ import { includes } from 'lodash';
import {
ChevronRight as SeparatorIcon,
} from '@mui/icons-material';
import ExistsInOCLIcon from '../common/ExistsInOCLIcon';
import DoesnotExistsInOCLIcon from '../common/DoesnotExistsInOCLIcon';

const SEPARATOR = (<SeparatorIcon />)
const ResourceLabelVertical = props => {
const { resource, existsInOCL } = props;
const { resource } = props;
const isSourceChild = includes(['concept', 'mapping'], resource);
const parentTextStyles = {
width: '100%',
fontSize: '10px',
background: '#eee',
padding: '0 5px',
padding: '2px 5px',
textAlign: 'center',
borderRadius: '2px',
overflowX: 'auto',
Expand Down Expand Up @@ -56,15 +54,6 @@ const ResourceLabelVertical = props => {
<span>{props.name}</span>
</div>
</div>
<div className='no-left-padding flex-vertical-center' style={{width: '5%', justifyContent: 'flex-end'}}>
{
isSourceChild && (
existsInOCL ?
<ExistsInOCLIcon containerStyles={{marginLeft: '5px'}} /> :
<DoesnotExistsInOCLIcon containerStyles={{marginLeft: '5px'}} />
)
}
</div>
</div>
)
}
Expand Down
15 changes: 12 additions & 3 deletions src/components/concepts/ConceptHierarchyRow.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import React from 'react';
import {
TableRow, TableCell, Chip
TableRow, TableCell, Chip, Tooltip
} from '@mui/material';
import {LocalOffer as LocalOfferIcon} from '@mui/icons-material'
import { map, get, orderBy } from 'lodash';
import ExistsInOCLIcon from '../common/ExistsInOCLIcon';
import { getSiteTitle } from '../../common/utils';

const SITE_TITLE = getSiteTitle()

const ConceptHierarchyRow = ({ mapType, concepts, source }) => {
const onDefaultClick = (event, concept) => {
Expand Down Expand Up @@ -39,7 +42,13 @@ const ConceptHierarchyRow = ({ mapType, concepts, source }) => {
<TableCell align='left' className='ellipsis-text' style={{width: '30%', paddingLeft: '5px'}}>
<span className='flex-vertical-center'>
<span className='flex-vertical-center' style={{marginRight: '4px'}}>
<ExistsInOCLIcon />
<Tooltip title={`Defined in ${SITE_TITLE}`}>
<LocalOfferIcon
color='primary'
fontSize='small'
style={{width: '12pt'}}
/>
</Tooltip>
</span>
<span className={concept.retired ? 'retired' : ''}>
{get(concept, 'id')}
Expand Down
18 changes: 10 additions & 8 deletions src/components/mappings/ConceptHomeMappingsTableRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import {
ImportExport as SortIcon,
ArrowUpward as UpIcon,
ArrowDownward as DownIcon,
WarningAmber as WarningIcon
WarningAmber as WarningIcon,
LocalOffer as LocalOfferIcon
} from '@mui/icons-material';
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
import { map, get, forEach, orderBy, filter, find, isNumber, has, isEmpty, some, maxBy } from 'lodash';
import ExistsInOCLIcon from '../common/ExistsInOCLIcon';
import DoesnotExistsInOCLIcon from '../common/DoesnotExistsInOCLIcon';
import MappingOptions from './MappingOptions';
import { getSiteTitle, toParentURI, getSiblings } from '../../common/utils';
import MappingInlineForm from './MappingInlineForm';
Expand Down Expand Up @@ -257,11 +256,14 @@ const ConceptHomeMappingsTableRows = ({ concept, mappings, mapType, isIndirect,
</span>
}
<span className='flex-vertical-center' style={{marginRight: '4px'}}>
{
targetURL ?
<ExistsInOCLIcon title={title} /> :
<DoesnotExistsInOCLIcon title={title} />
}
<Tooltip title={title}>
<LocalOfferIcon
color={targetURL ? 'primary': 'warning'}
fontSize='small'
style={{width: '12pt'}}
/>

</Tooltip>
</span>
<span className={mapping.retired ? 'retired' : ''}>
{ mapping[conceptCodeAttr] }
Expand Down
12 changes: 9 additions & 3 deletions src/components/mappings/FromConceptLabel.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Tooltip } from '@mui/material'
import {LocalOffer as LocalOfferIcon} from '@mui/icons-material'
import { get } from 'lodash';
import ResourceLabel from '../common/ResourceLabel';
import { DARKGRAY } from '../../common/constants';
import { getSiteTitle } from '../../common/utils';

const SITE_TITLE = getSiteTitle()

const FromConceptLabel = props => {
const conceptName = props.from_concept_name || props.from_concept_name_resolved || get(props, 'from_concept.display_name')
const existsInOCL = Boolean(props.from_concept_url)
const labelComponent = <ResourceLabel
resource='concept'
existsInOCL={Boolean(props.from_concept_url)}
owner={props.from_source_owner}
parent={props.from_source_name}
id={props.from_concept_code}
parentURL={props.from_source_url}
name={conceptName}
icon={
<Tooltip title={existsInOCL ? `Defined in ${SITE_TITLE}` : `Not defined in ${SITE_TITLE}`}>
<LocalOfferIcon
color={existsInOCL ? 'primary': 'warning'}
fontSize='small'
style={{width: '10pt', color: DARKGRAY}}
style={{width: '12pt'}}
/>
</Tooltip>
} />;
return (
<React.Fragment>
Expand Down
11 changes: 8 additions & 3 deletions src/components/mappings/FromConceptLabelVertical.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Tooltip } from '@mui/material'
import {LocalOffer as LocalOfferIcon} from '@mui/icons-material'
import { get } from 'lodash';
import ResourceLabelVertical from '../common/ResourceLabelVertical';
import { DARKGRAY } from '../../common/constants';
import { getSiteTitle } from '../../common/utils';

const SITE_TITLE = getSiteTitle()
const FromConceptLabelVertical = props => {
const conceptName = props.from_concept_name || props.from_concept_name_resolved || get(props, 'from_concept.display_name')
const existsInOCL = Boolean(props.from_concept_url)
const labelComponent = <ResourceLabelVertical
resource='concept'
existsInOCL={Boolean(props.from_concept_url)}
owner={props.from_source_owner}
parent={props.from_source_name}
id={props.from_concept_code}
parentURL={props.from_source_url}
name={conceptName}
icon={
<Tooltip title={existsInOCL ? `Defined in ${SITE_TITLE}` : `Not defined in ${SITE_TITLE}`}>
<LocalOfferIcon
color={existsInOCL ? 'primary': 'warning'}
fontSize='small'
style={{width: '12pt', color: DARKGRAY}}
style={{width: '14pt'}}
/>
</Tooltip>
} />;
return (
<React.Fragment>
Expand Down
12 changes: 9 additions & 3 deletions src/components/mappings/ToConceptLabel.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Tooltip } from '@mui/material'
import {LocalOffer as LocalOfferIcon} from '@mui/icons-material'
import { get } from 'lodash';
import ResourceLabel from '../common/ResourceLabel';
import { DARKGRAY } from '../../common/constants';
import { getSiteTitle } from '../../common/utils';

const SITE_TITLE = getSiteTitle()

const ToConceptLabel = props => {
const conceptName = props.to_concept_name || props.to_concept_name_resolved || get(props, 'to_concept.display_name')
const hasLink = props.to_concept_url && !props.noRedirect;
const existsInOCL = Boolean(props.to_concept_url)
const labelComponent = <ResourceLabel
resource='concept'
existsInOCL={Boolean(props.to_concept_url)}
owner={props.to_source_owner}
parent={props.to_source_name}
id={props.to_concept_code}
parentURL={props.to_source_url}
name={conceptName}
icon={
<Tooltip title={existsInOCL ? `Defined in ${SITE_TITLE}` : `Not defined in ${SITE_TITLE}`}>
<LocalOfferIcon
color={existsInOCL ? 'primary': 'warning'}
fontSize='small'
style={{width: '10pt', color: DARKGRAY}}
style={{width: '12pt'}}
/>
</Tooltip>
} />;
return (
<React.Fragment>
Expand Down
11 changes: 8 additions & 3 deletions src/components/mappings/ToConceptLabelVertical.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Tooltip } from '@mui/material'
import {LocalOffer as LocalOfferIcon} from '@mui/icons-material'
import { get } from 'lodash';
import ResourceLabelVertical from '../common/ResourceLabelVertical';
import { DARKGRAY } from '../../common/constants';
import { getSiteTitle } from '../../common/utils';

const SITE_TITLE = getSiteTitle()
const ToConceptLabelVertical = props => {
const conceptName = props.to_concept_name || props.to_concept_name_resolved || get(props, 'to_concept.display_name')
const hasLink = props.to_concept_url && !props.noRedirect;
const existsInOCL = Boolean(props.to_concept_url)
const labelComponent = <ResourceLabelVertical
resource='concept'
existsInOCL={Boolean(props.to_concept_url)}
owner={props.to_source_owner}
parent={props.to_source_name}
id={props.to_concept_code}
parentURL={props.to_source_url}
name={conceptName}
icon={
<Tooltip title={existsInOCL ? `Defined in ${SITE_TITLE}` : `Not defined in ${SITE_TITLE}`}>
<LocalOfferIcon
color={existsInOCL ? 'primary': 'warning'}
fontSize='small'
style={{width: '12pt', color: DARKGRAY}}
style={{width: '14pt'}}
/>
</Tooltip>
} />;
return (
<React.Fragment>
Expand Down

0 comments on commit defa572

Please sign in to comment.