Skip to content

Commit 7213b96

Browse files
committed
OpenConceptLab/ocl_issues#2190 | fixing column map width | fixing decision result name and other attributes
1 parent dfed6fe commit 7213b96

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/components/map-projects/ColumnMapTable.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const ColumnMapTable = ({validColumns, columns, isValid, onUpdate, sx, setColumn
8585
const isHidden = columnVisibilityModel[column.dataKey] === false
8686
return (
8787
<TableRow key={column.original}>
88-
<TableCell>
88+
<TableCell sx={{width: '50%'}}>
8989
<span style={{display: 'flex', alignItems: 'center'}}>
9090
{
9191
isValidColumn ?

src/components/map-projects/MapProject.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,7 @@ const MapProject = () => {
14011401
allMapTypes={allMapTypes}
14021402
onMap={onMap}
14031403
proposed={proposed[rowIndex]}
1404+
columns={columns}
14041405
/>
14051406
<Divider sx={{width: '100%'}} />
14061407
<DecisionSelector

src/components/map-projects/MappingDecisionResult.jsx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,46 @@ import has from 'lodash/has'
55
import values from 'lodash/values'
66
import isEmpty from 'lodash/isEmpty'
77
import find from 'lodash/find'
8+
import get from 'lodash/get'
89
import compact from 'lodash/compact'
910
import MapButton from './MapButton'
1011
import { URIToParentParams } from '../../common/utils'
1112
import Score from './Score'
1213

13-
const MappingDecisionResult = ({targetConcept, row, rowIndex, mapTypes, allMapTypes, onMap, proposed}) => {
14+
const MappingDecisionResult = ({targetConcept, row, rowIndex, mapTypes, allMapTypes, onMap, proposed, columns}) => {
1415
const parentParams = targetConcept?.url ? URIToParentParams(targetConcept.url) : {}
1516
const hasClass = has(row, 'Class') || has(row, 'Concept Class')
1617
const hasDatatype = has(row, 'Datatype') || has(row, 'datatype')
1718
const getFieldFromProposed = field => {
1819
return find(proposed?.attributes, attr => attr?.name?.toLowerCase()?.includes(field))?.value || ''
1920
}
2021

22+
const getValue = field => {
23+
const col = find(columns, col => col?.label?.toLowerCase() == field.toLowerCase())
24+
let val
25+
if(col?.dataKey)
26+
val = row[col.dataKey]
27+
if(!val)
28+
val = get(row, field) || get(row, field.toLowerCase())
29+
return val
30+
}
2131

2232
return (
2333
<div className='col-xs-12 padding-0' style={{display: 'flex', margin: '8px 0', justifyContent: 'space-between'}}>
2434
<div style={{maxWidth: '45%'}}>
2535
<Typography component='span' sx={{color: 'rgba(0, 0, 0, 0.6)', fontSize: '12px'}}>Source Code</Typography>
2636
<div className='col-xs-12 padding-0'>
2737
<ListItemText
28-
primary={row?.Name || row?.name || '-'}
38+
primary={getValue('Name')}
2939
secondary={
3040
<span style={{fontSize: '12px'}}>
3141
{
3242
hasClass &&
33-
<>Class: <i>{row.Class || row['Concept Class']}</i>,</>
43+
<>Class: <i>{getValue('Property: Class') || getValue('Class') || getValue('concept_class')}</i>,</>
3444
}
3545
{
3646
hasDatatype &&
37-
<>Datatype: <i>{row.Datatype}</i></>
47+
<>Datatype: <i>{getValue('Property: Datatype') || getValue('datatype')}</i></>
3848
}
3949
</span>
4050
}

0 commit comments

Comments
 (0)