diff --git a/apps/portals/src/configurations/nf/synapseConfigs/datasets.ts b/apps/portals/src/configurations/nf/synapseConfigs/datasets.ts index 3e0c455715..2d2be59993 100644 --- a/apps/portals/src/configurations/nf/synapseConfigs/datasets.ts +++ b/apps/portals/src/configurations/nf/synapseConfigs/datasets.ts @@ -15,13 +15,15 @@ export const datasetCardConfiguration: CardConfiguration = { title: 'title', description: 'description', secondaryLabels: [ + // 'assay', + 'doi', + 'datasetSizeInBytes', 'diseaseFocus', 'fundingAgency', 'datasetItemCount', 'dataType', 'series', 'yearProcessed', - 'datasetSizeInBytes', ], }, titleLinkConfig: { diff --git a/packages/synapse-react-client/src/components/GenericCard/GenericCard.tsx b/packages/synapse-react-client/src/components/GenericCard/GenericCard.tsx index c480db34e1..c60c5f3dee 100644 --- a/packages/synapse-react-client/src/components/GenericCard/GenericCard.tsx +++ b/packages/synapse-react-client/src/components/GenericCard/GenericCard.tsx @@ -1,7 +1,10 @@ import { isEmpty } from 'lodash-es' import React from 'react' import { SynapseConstants } from '../../utils' -import { isTableEntity } from '../../utils/functions/EntityTypeUtils' +import { + isDatasetCollection, + isTableEntity, +} from '../../utils/functions/EntityTypeUtils' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { DOI_REGEX, @@ -40,6 +43,7 @@ import { FileHandleLink } from '../widgets/FileHandleLink' import { ImageFileHandle } from '../widgets/ImageFileHandle' import { QueryVisualizationContextType } from '../QueryVisualizationWrapper' import { IconOptions } from '../Icon/Icon' +import { calculateFriendlyFileSize } from '../../utils/functions/calculateFriendlyFileSize' export type KeyToAlias = { key: string @@ -688,8 +692,15 @@ export default class GenericCard extends React.Component< let value: any = data[schema[columnName]] let columnDisplayName if (value) { - // SWC-6115: special rendering of the version column (for Views) - if (isView && columnName === 'currentVersion') { + // PORTALS-2750: special rendering of the datasetSizeInBytes (for Dataset Collections) + if ( + isDatasetCollection(table as Entity) && + columnName === 'datasetSizeInBytes' + ) { + columnDisplayName = 'Size' + value = calculateFriendlyFileSize(parseInt(value)) + } // SWC-6115: special rendering of the version column (for Views) + else if (isView && columnName === 'currentVersion') { const synapseId = data[schema.id] const version = value value = VersionLabel({ synapseId, version })