diff --git a/src/components/references/ReferenceSourceGroupedResults.jsx b/src/components/references/ReferenceSourceGroupedResults.jsx index 8c7b195f..656925b1 100644 --- a/src/components/references/ReferenceSourceGroupedResults.jsx +++ b/src/components/references/ReferenceSourceGroupedResults.jsx @@ -17,29 +17,56 @@ import TableCell from '@mui/material/TableCell' import TableContainer from '@mui/material/TableContainer' import TableHead from '@mui/material/TableHead' import TableRow from '@mui/material/TableRow' +import Tooltip from '@mui/material/Tooltip' import Typography from '@mui/material/Typography' import CollapseIcon from '@mui/icons-material/KeyboardArrowDown' import ExpandIcon from '@mui/icons-material/KeyboardArrowRight' import MoreVertIcon from '@mui/icons-material/MoreVert' import { SOURCE_COLORS } from '../../common/colors' import { hashString, URIToParentParams } from '../../common/utils' +import ConceptIcon from '../concepts/ConceptIcon' +import MappingIcon from '../mappings/MappingIcon' import RepoChip from '../repos/RepoChip' const getReferenceId = reference => reference.version_url || reference.url || reference.id -const getReferenceSummary = reference => { - let label = '' +const ReferenceResultCount = ({ count, icon, label }) => ( + isNumber(count) && count > 0 ? + + + {icon} + + {count.toLocaleString()} + + + : + null +) + +const ReferenceResultsCell = ({ reference, t }) => { if(reference.last_resolved_at && reference.concepts === 0 && reference.mappings === 0) return '-' - if(isNumber(reference.concepts) && reference.concepts > 0) - label += `${reference.concepts.toLocaleString()} concepts` - if(isNumber(reference.mappings) && reference.mappings > 0) { - if(label?.length) - label += ', ' - label += `${reference.mappings.toLocaleString()} mappings` - } - return label || '-' + const hasConcepts = isNumber(reference.concepts) && reference.concepts > 0 + const hasMappings = isNumber(reference.mappings) && reference.mappings > 0 + + if(!hasConcepts && !hasMappings) + return '-' + + return ( + + } + label={t(reference.concepts === 1 ? 'concept.concept' : 'concept.concepts').toLowerCase()} + /> + } + label={t(reference.mappings === 1 ? 'mapping.mapping' : 'mapping.mappings').toLowerCase()} + /> + + ) } const getSourceColorKey = source => [source?.owner, source?.id || source?.short_code].filter(Boolean).join('/') @@ -143,6 +170,11 @@ const SourceGroup = ({ group, selected, onSelectedChange, onReferenceClick, isIt return ( + + setExpanded(!expanded)}> + {expanded ? : } + + - - setExpanded(!expanded)}> - {expanded ? : } - - + onRowSelect(event, id)}> - { @@ -212,7 +239,7 @@ const SourceGroup = ({ group, selected, onSelectedChange, onReferenceClick, isIt {getConceptLabel(reference)} - {reference.last_resolved_at ? getReferenceSummary(reference) : '-'} + {reference.last_resolved_at ? : '-'} onReferenceClick(event, id)}> diff --git a/src/components/repos/CollectionVersionsTab.jsx b/src/components/repos/CollectionVersionsTab.jsx index 9656f0c3..c45658d4 100644 --- a/src/components/repos/CollectionVersionsTab.jsx +++ b/src/components/repos/CollectionVersionsTab.jsx @@ -168,6 +168,38 @@ const bodyCellSx = { py: 1.25 }; +const countHeaderCellSx = { + ...headerCellSx, + width: "16%" +}; + +const countBodyCellSx = { + ...bodyCellSx, + width: "16%" +}; + +const actionHeaderCellSx = { + ...headerCellSx, + width: "1%", + whiteSpace: "nowrap" +}; + +const resolvedHeaderCellSx = { + ...headerCellSx, + width: "16%" +}; + +const actionBodyCellSx = { + ...bodyCellSx, + width: "1%", + whiteSpace: "nowrap" +}; + +const resolvedBodyCellSx = { + ...bodyCellSx, + width: "16%" +}; + const compactButtonSx = { minWidth: 0, px: 0, @@ -697,20 +729,20 @@ const CollectionVersionsTab = ({ - + - + - + {versionLoading ? ( ) : ( )} - + {hasAccess && ( - + {t("repo.expansions")} - + {t("search.concepts")} - + {t("search.mappings")} - + {t("repo.resolved_repo_versions")} - + @@ -911,13 +943,13 @@ const CollectionVersionsTab = ({ )} - + - + - + - + {hasAccess && (