Skip to content

Commit e3b2e9c

Browse files
committed
Handle new data object aggregation on front end
Update the type definition for the response from `data_object/workflow_summary` and update the display strings in the bulk download component.
1 parent f6b0ec5 commit e3b2e9c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

web/src/components/BulkDownload.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@ export default defineComponent({
3535
download,
3636
} = useBulkDownload(stateRefs.conditions, dataObjectFilter);
3737
38+
function createLabelString(label: string, count: number, size: number): string {
39+
const labelString = `${label} (${count}`;
40+
if (size > 0) {
41+
return `${labelString}, ${humanFileSize(size)})`;
42+
}
43+
return `${labelString})`;
44+
}
45+
3846
const options = computed(() => Object.entries(downloadOptions.value)
3947
.map(([key, val]) => ({
4048
id: key,
41-
label: `${key} (${val.count})`,
42-
children: Object.entries(val.file_types).map(([filetype, count]) => ({
49+
label: createLabelString(key, val.count, val.size),
50+
children: Object.entries(val.file_types).map(([filetype, fileTypeStats]) => ({
4351
id: `${key}::${filetype}`,
44-
label: `${filetype} (${count})`,
52+
label: createLabelString(filetype, fileTypeStats.count, fileTypeStats.size),
4553
})),
4654
})));
4755

web/src/data/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ export const opMap: Record<opType, string> = {
294294
// See https://github.com/microbiomedata/nmdc-server/pull/403 for documentation
295295
export type BulkDownloadSummary = Record<string, {
296296
count: number;
297-
file_types: Record<string, number>,
297+
size: number;
298+
file_types: Record<string, { count: number, size: number }>,
298299
}>;
299300

300301
export type BulkDownloadAggregateSummary = {

0 commit comments

Comments
 (0)