55 calculateSummaryTotalCellCount ,
66 getSummaryCount ,
77} from "./utils" ;
8+ import { formatCountSize } from "@databiosphere/findable-ui/lib/utils/formatCountSize" ;
9+ import { formatFileSize } from "@databiosphere/findable-ui/lib/utils/formatFileSize" ;
810
911// Template constants
1012const {
@@ -53,24 +55,29 @@ const {
5355 FILES ,
5456 SPECIES ,
5557 SPECIMENS ,
58+ TOTAL_FILE_SIZE ,
5659} = SUMMARY ;
5760
5861/**
5962 * Functions binding summary response API to summary count.
6063 */
6164export const BIND_SUMMARY_RESPONSE = {
62- [ BIOSAMPLES ] : ( r : AzulSummaryResponse ) : number =>
63- getSummaryCount ( r , SUMMARY_KEY . BIOSAMPLES ) ,
64- [ DONORS ] : ( r : AzulSummaryResponse ) : number =>
65- getSummaryCount ( r , SUMMARY_KEY . DONORS ) ,
66- [ ESTIMATED_CELLS ] : calculateSummaryTotalCellCount ,
67- [ FILES ] : ( r : AzulSummaryResponse ) : number =>
68- getSummaryCount ( r , SUMMARY_KEY . FILES ) ,
69- [ FILE_FORMATS ] : calculateSummaryFileFormatsCount ,
70- [ SPECIES ] : ( r : AzulSummaryResponse ) : number =>
71- getSummaryCount ( r , SUMMARY_KEY . SPECIES ) ,
72- [ SPECIMENS ] : ( r : AzulSummaryResponse ) : number =>
73- getSummaryCount ( r , SUMMARY_KEY . SPECIMENS ) ,
65+ [ BIOSAMPLES ] : ( r : AzulSummaryResponse ) : string =>
66+ formatCountSize ( getSummaryCount ( r , SUMMARY_KEY . BIOSAMPLES ) ) ,
67+ [ DONORS ] : ( r : AzulSummaryResponse ) : string =>
68+ formatCountSize ( getSummaryCount ( r , SUMMARY_KEY . DONORS ) ) ,
69+ [ ESTIMATED_CELLS ] : ( r : AzulSummaryResponse ) : string =>
70+ formatCountSize ( calculateSummaryTotalCellCount ( r ) ) ,
71+ [ FILES ] : ( r : AzulSummaryResponse ) : string =>
72+ formatCountSize ( getSummaryCount ( r , SUMMARY_KEY . FILES ) ) ,
73+ [ FILE_FORMATS ] : ( r : AzulSummaryResponse ) : string =>
74+ formatCountSize ( calculateSummaryFileFormatsCount ( r ) ) ,
75+ [ SPECIES ] : ( r : AzulSummaryResponse ) : string =>
76+ formatCountSize ( getSummaryCount ( r , SUMMARY_KEY . SPECIES ) ) ,
77+ [ SPECIMENS ] : ( r : AzulSummaryResponse ) : string =>
78+ formatCountSize ( getSummaryCount ( r , SUMMARY_KEY . SPECIMENS ) ) ,
79+ [ TOTAL_FILE_SIZE ] : ( r : AzulSummaryResponse ) : string =>
80+ formatFileSize ( getSummaryCount ( r , SUMMARY_KEY . TOTAL_FILE_SIZE ) ) ,
7481} ;
7582
7683export const NETWORK_KEYS = [
@@ -162,13 +169,14 @@ export const PLURALIZED_METADATA_LABEL = {
162169/**
163170 * Set of possible summary keys.
164171 */
165- export const SUMMARY_KEY = {
172+ export const SUMMARY_KEY : Record < string , keyof AzulSummaryResponse > = {
166173 [ BIOSAMPLES ] : "biosampleCount" ,
167174 [ DONORS ] : "donorCount" ,
168175 [ FILES ] : "fileCount" ,
169176 [ FILE_FORMATS ] : "fileFormats" ,
170177 [ SPECIES ] : "speciesCount" ,
171178 [ SPECIMENS ] : "specimenCount" ,
179+ [ TOTAL_FILE_SIZE ] : "totalFileSize" ,
172180} as const ;
173181
174182/**
@@ -182,4 +190,5 @@ export const SUMMARY_LABEL = {
182190 [ FILE_FORMATS ] : "Files" ,
183191 [ SPECIES ] : "Species" ,
184192 [ SPECIMENS ] : "Specimens" ,
193+ [ TOTAL_FILE_SIZE ] : "" ,
185194} ;
0 commit comments